Re: [RFC PATCH v3 16/59] KVM: x86: Add per-VM flag to disable direct IRQ injection

From: Lai Jiangshan
Date: Sun Nov 28 2021 - 21:52:51 EST


On Fri, Nov 26, 2021 at 3:44 PM <isaku.yamahata@xxxxxxxxx> wrote:

> static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu)
> {
> return vcpu->run->request_interrupt_window &&
> + !vcpu->kvm->arch.irq_injection_disallowed &&
> likely(!pic_in_kernel(vcpu->kvm));
> }


Just judged superficially by the function names, it seems that the
logic is better to be put in kvm_cpu_accept_dm_intr() or some deeper
function nested in kvm_cpu_accept_dm_intr().

The function name will tell us that the interrupt is not injected
because the CPU doesn't accept it. And it will also have an effect
that vcpu->run->ready_for_interrupt_injection will always be false
which I think is better to have for TDX.

>
> --
> 2.25.1
>