Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc1ea1df authored by Fabiano Rosas's avatar Fabiano Rosas Committed by Greg Kroah-Hartman
Browse files

KVM: PPC: Fix vmx/vsx mixup in mmio emulation



[ Upstream commit b99234b918c6e36b9aa0a5b2981e86b6bd11f8e2 ]

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: acc9eb93 ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction ...")
Signed-off-by: default avatarFabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220125215655.1026224-3-farosas@linux.ibm.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ee422205
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1479,7 +1479,7 @@ int kvmppc_handle_vmx_load(struct kvm_run *run, 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) {
@@ -1576,7 +1576,7 @@ int kvmppc_handle_vmx_store(struct kvm_run *run, 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;