Skip to content

Commit

Permalink
KVM: PPC: Fix vmx/vsx mixup in mmio emulation
Browse files Browse the repository at this point in the history
[ Upstream commit b99234b ]

The MMIO emulation code for vector instructions is duplicated between
VSX and VMX. When emulating VMX we should check the VMX copy size
instead of the VSX one.

Fixes: acc9eb9 ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction ...")
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220125215655.1026224-3-farosas@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
farosas authored and gregkh committed Apr 8, 2022
1 parent 16ad5b3 commit ed45ce5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/kvm/powerpc.c
Expand Up @@ -1499,7 +1499,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu,
{
enum emulation_result emulated = EMULATE_DONE;

if (vcpu->arch.mmio_vsx_copy_nums > 2)
if (vcpu->arch.mmio_vmx_copy_nums > 2)
return EMULATE_FAIL;

while (vcpu->arch.mmio_vmx_copy_nums) {
Expand Down Expand Up @@ -1596,7 +1596,7 @@ int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu,
unsigned int index = rs & KVM_MMIO_REG_MASK;
enum emulation_result emulated = EMULATE_DONE;

if (vcpu->arch.mmio_vsx_copy_nums > 2)
if (vcpu->arch.mmio_vmx_copy_nums > 2)
return EMULATE_FAIL;

vcpu->arch.io_gpr = rs;
Expand Down

0 comments on commit ed45ce5

Please sign in to comment.