public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Maximilian Dittgen <mdittgen@amazon.de>
Cc: <oliver.upton@linux.dev>, <pbonzini@redhat.com>,
	<shuah@kernel.org>, <linux-arm-kernel@lists.infradead.org>,
	<kvmarm@lists.linux.dev>, <linux-kselftest@vger.kernel.org>,
	<kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm, selftests: ioctl to handle MSIs injected from userspace as software-bypassing vLPIs
Date: Thu, 25 Sep 2025 10:25:13 +0100	[thread overview]
Message-ID: <868qi228au.wl-maz@kernel.org> (raw)
In-Reply-To: <20250925090116.27575-1-mdittgen@amazon.de>

On Thu, 25 Sep 2025 10:01:16 +0100,
Maximilian Dittgen <mdittgen@amazon.de> wrote:
> 
> From: Maximilian Dittgen <mdittgen@amazon.de>
> 
> At the moment, all MSIs injected from userspace using KVM_SIGNAL_MSI are
> processed as LPIs in software with a hypervisor trap and exit.

Not really. Injecting an interrupt preempts the guest injecting a host
IPI, but there is no trap.

> To
> properly test GICv4 direct vLPI injection from KVM selftests, we write a
> KVM_DEBUG_GIC_MSI_SETUP ioctl that manually creates an IRQ routing table
> entry for the specified MSI, and populates ITS structures (device,
> collection, and interrupt translation table entries) to map the MSI to a
> vLPI. We then call GICv4 kvm_vgic_v4_set_forwarding to let the vLPI bypass
> hypervisor traps and inject directly to the vCPU.

I think that's totally overkill, and there is at least two ways to
achieve the same thing without adding any additional code to the
kernel:

- your test can simulate the restore of a guest with pending
  interrupts in the in-memory tables, start it, see the expected
  interrupts in the guest. Additional benefit: you can now test LPI
  restore.

- you use the interrupt injection mechanism that has been in the core
  code since 536e2e34bd0022, and let the GIC inject the interrupt for
  you. In case you wonder why it is there: for the exact purpose you
  describe.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

      reply	other threads:[~2025-09-25  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25  9:01 [PATCH] kvm, selftests: ioctl to handle MSIs injected from userspace as software-bypassing vLPIs Maximilian Dittgen
2025-09-25  9:25 ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868qi228au.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mdittgen@amazon.de \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox