mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
KVM: x86: Use local MMIO fragment variable to clean up emulator_read_write()
Grab the MMIO fragment used by emulator_read_write() to initiate an exit to userspace in a local variable to make the code easier to read. No functional change intended. Tested-by: Tom Lendacky <thomas.lendacky@gmail.com> Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Link: https://patch.msgid.link/20260225012049.920665-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
4f11fded53
commit
523b6269f7
|
|
@ -8230,7 +8230,7 @@ static int emulator_read_write(struct x86_emulate_ctxt *ctxt,
|
|||
const struct read_write_emulator_ops *ops)
|
||||
{
|
||||
struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
|
||||
gpa_t gpa;
|
||||
struct kvm_mmio_fragment *frag;
|
||||
int rc;
|
||||
|
||||
if (WARN_ON_ONCE((bytes > 8u || !ops->write) && object_is_on_stack(val)))
|
||||
|
|
@ -8286,17 +8286,16 @@ static int emulator_read_write(struct x86_emulate_ctxt *ctxt,
|
|||
if (!vcpu->mmio_nr_fragments)
|
||||
return X86EMUL_CONTINUE;
|
||||
|
||||
gpa = vcpu->mmio_fragments[0].gpa;
|
||||
|
||||
vcpu->mmio_needed = 1;
|
||||
vcpu->mmio_cur_fragment = 0;
|
||||
|
||||
vcpu->run->mmio.len = min(8u, vcpu->mmio_fragments[0].len);
|
||||
frag = &vcpu->mmio_fragments[0];
|
||||
vcpu->run->mmio.len = min(8u, frag->len);
|
||||
vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write;
|
||||
vcpu->run->exit_reason = KVM_EXIT_MMIO;
|
||||
vcpu->run->mmio.phys_addr = gpa;
|
||||
vcpu->run->mmio.phys_addr = frag->gpa;
|
||||
|
||||
return ops->read_write_exit_mmio(vcpu, gpa, val, bytes);
|
||||
return ops->read_write_exit_mmio(vcpu, frag->gpa, val, bytes);
|
||||
}
|
||||
|
||||
static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user