]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Decouple device assignment from IRQ bypass
authorSean Christopherson <seanjc@google.com>
Wed, 11 Jun 2025 22:45:56 +0000 (15:45 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 23 Jun 2025 16:50:46 +0000 (09:50 -0700)
commit77e1b8332d1d7aa786f7515e9bd4055def6a1e06
tree1296fa23ff28f561dd85603ab46fce84a01173d4
parent99836eb9c5dcae1f0e64da2cb6f7e0bb9151f95d
KVM: x86: Decouple device assignment from IRQ bypass

Use a dedicated counter to track the number of IRQs that can utilize IRQ
bypass instead of piggybacking the assigned device count.  As evidenced by
commit 2edd9cb79fb3 ("kvm: detect assigned device via irqbypass manager"),
it's possible for a device to be able to post IRQs to a vCPU without said
device being assigned to a VM.

Leave the calls to kvm_arch_{start,end}_assignment() alone for the moment
to avoid regressing the MMIO stale data mitigation.  KVM is abusing the
assigned device count when applying mmio_stale_data_clear, and it's not at
all clear if vDPA devices rely on this behavior.  This will hopefully be
cleaned up in the future, as the number of assigned devices is a terrible
heuristic for detecting if a VM has access to host MMIO.

Link: https://lore.kernel.org/r/20250611224604.313496-55-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm-x86-ops.h
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/irq.c
arch/x86/kvm/vmx/main.c
arch/x86/kvm/vmx/posted_intr.c
arch/x86/kvm/vmx/posted_intr.h
arch/x86/kvm/x86.c