Re: [PATCH 14/14] KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exit

From: Edgecombe, Rick P

Date: Wed Feb 25 2026 - 12:33:45 EST


On Tue, 2026-02-24 at 17:20 -0800, Sean Christopherson wrote:
> +static inline void __kvm_prepare_emulated_mmio_exit(struct kvm_vcpu *vcpu,
> +     gpa_t gpa, unsigned int len,
> +     const void *data,
> +     bool is_write)
> +{
> + struct kvm_run *run = vcpu->run;
> +
> + run->mmio.len = min(8u, len);

I would think to extract this to a local var so it can be used twice.

> + run->mmio.is_write = is_write;
> + run->exit_reason = KVM_EXIT_MMIO;
> + run->mmio.phys_addr = gpa;
> + if (is_write)
> + memcpy(run->mmio.data, data, min(8u, len));
> +}
> +