Commit e8d57845 authored by Greg Kurz's avatar Greg Kurz Committed by Kamal Mostafa

KVM: PPC: Fix ONE_REG AltiVec support

commit b4d7f161 upstream.

The get and set operations got exchanged by mistake when moving the
code from book3s.c to powerpc.c.

Fixes: 3840edc8Signed-off-by: default avatarGreg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent c5d01184
...@@ -915,21 +915,17 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) ...@@ -915,21 +915,17 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
r = -ENXIO; r = -ENXIO;
break; break;
} }
vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval; val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0];
break; break;
case KVM_REG_PPC_VSCR: case KVM_REG_PPC_VSCR:
if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
r = -ENXIO; r = -ENXIO;
break; break;
} }
vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val); val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]);
break; break;
case KVM_REG_PPC_VRSAVE: case KVM_REG_PPC_VRSAVE:
if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { val = get_reg_val(reg->id, vcpu->arch.vrsave);
r = -ENXIO;
break;
}
vcpu->arch.vrsave = set_reg_val(reg->id, val);
break; break;
#endif /* CONFIG_ALTIVEC */ #endif /* CONFIG_ALTIVEC */
default: default:
...@@ -970,17 +966,21 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) ...@@ -970,17 +966,21 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
r = -ENXIO; r = -ENXIO;
break; break;
} }
val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0]; vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
break; break;
case KVM_REG_PPC_VSCR: case KVM_REG_PPC_VSCR:
if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
r = -ENXIO; r = -ENXIO;
break; break;
} }
val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]); vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val);
break; break;
case KVM_REG_PPC_VRSAVE: case KVM_REG_PPC_VRSAVE:
val = get_reg_val(reg->id, vcpu->arch.vrsave); if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
r = -ENXIO;
break;
}
vcpu->arch.vrsave = set_reg_val(reg->id, val);
break; break;
#endif /* CONFIG_ALTIVEC */ #endif /* CONFIG_ALTIVEC */
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment