patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	virtualization@lists.linux.dev, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, devel@spectrum-os.org,
	Alyssa Ross <hi@alyssa.is>, Thomas Gleixner <tglx@linutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org
Subject: Re: Virtio interrupt remapping
Date: Fri, 13 Jun 2025 14:50:01 -0400	[thread overview]
Message-ID: <6b661c62-c322-4f2b-8e4a-da1d5c5e48a1@gmail.com> (raw)
In-Reply-To: <20250613181345.GA1350149@myrica>


[-- Attachment #1.1.1: Type: text/plain, Size: 2070 bytes --]

On 6/13/25 14:13, Jean-Philippe Brucker wrote:
> Hi,
> 
> On Fri, Jun 13, 2025 at 01:08:07PM -0400, Demi Marie Obenour wrote:
>> I’m working on virtio-IOMMU interrupt remapping for Spectrum OS [1],
>> and am running into a problem.  All of the current interrupt remapping
>> drivers use __init code during initialization, and I’m not sure how to
>> plumb the struct virtio_device * into the IOMMU initialization code.
>>
>> What is the proper way to do this, where “proper” means that it doesn’t
>> do something disgusting like “stuff the virtio device in a global
>> variable”?
> 
> I'm not familiar at all with interrupt remapping, but I suspect a major
> hurdle will be device probing order: the PCI subsystem probes the
> virtio-pci transport device relatively late during boot, and the virtio
> driver probes the virtio-iommu device afterwards, at which point we can
> call viommu_probe() and inspect the device features and config.  This can
> be quite late in userspace if virtio and virtio-iommu get loaded as
> modules (which distros tend to do).> 
> The way we know to hold off initializing dependent devices before the
> IOMMU is ready is by reading the firmware tables. In devicetree the
> "msi-parent" and "msi-map" properties point to the interrupt remapping
> device, so by reading those Linux knows to wait for the probe of the
> remapping device before setting up those endpoints. The ACPI VIOT
> describes this topology as well, although at the moment it does not have
> separate graphs for MMU and interrupts, like devicetree does (could
> probably be added to the spec if needed, but I'm guessing the topologies
> may be the same for a VM).  If the interrupt infrastructure supports
> probe deferral, then that's probably the way to go.

I don't see any examples of probe deferral in the codebase.  Would it
instead be possible to require virtio-iommu (and thus virtio) to be
built-in rather than modules?

CCing the IRQ and PCI maintainers as well.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-06-14  7:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 17:08 Virtio interrupt remapping Demi Marie Obenour
2025-06-13 18:13 ` Jean-Philippe Brucker
2025-06-13 18:50   ` Demi Marie Obenour [this message]
2025-06-14  8:11     ` Alyssa Ross
2025-06-16 16:07       ` Jean-Philippe Brucker

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=6b661c62-c322-4f2b-8e4a-da1d5c5e48a1@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux.dev \
    --cc=will@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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).