]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86: Move MMIO write tracing into vcpu_mmio_write()
authorSean Christopherson <seanjc@google.com>
Wed, 25 Feb 2026 01:20:41 +0000 (17:20 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 3 Mar 2026 00:02:52 +0000 (16:02 -0800)
Move the invocation of MMIO write tracepoint into vcpu_mmio_write() and
drop its largely-useless wrapper to cull pointless code and to make the
code symmetrical with respect to vcpu_mmio_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-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c

index fa2eb4fdc4b42e4406cc3a24202b1bf741f3bacb..0f4cfc3374a68ec5d88c8b6b4013b3252ed576b7 100644 (file)
@@ -7768,11 +7768,14 @@ static void kvm_init_msr_lists(void)
 }
 
 static int vcpu_mmio_write(struct kvm_vcpu *vcpu, gpa_t addr, int len,
-                          const void *v)
+                          void *__v)
 {
+       const void *v = __v;
        int handled = 0;
        int n;
 
+       trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, addr, __v);
+
        do {
                n = min(len, 8);
                if (!(lapic_in_kernel(vcpu) &&
@@ -8130,12 +8133,6 @@ static int write_emulate(struct kvm_vcpu *vcpu, gpa_t gpa,
        return emulator_write_phys(vcpu, gpa, val, bytes);
 }
 
-static int write_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes, void *val)
-{
-       trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, val);
-       return vcpu_mmio_write(vcpu, gpa, bytes, val);
-}
-
 static const struct read_write_emulator_ops read_emultor = {
        .read_write_emulate = read_emulate,
        .read_write_mmio = vcpu_mmio_read,
@@ -8143,7 +8140,7 @@ static const struct read_write_emulator_ops read_emultor = {
 
 static const struct read_write_emulator_ops write_emultor = {
        .read_write_emulate = write_emulate,
-       .read_write_mmio = write_mmio,
+       .read_write_mmio = vcpu_mmio_write,
        .write = true,
 };