[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617154524-mutt-send-email-mst@kernel.org>
Date: Tue, 17 Jun 2025 15:46:12 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Demi Marie Obenour <demiobenour@...il.com>
Cc: Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Alyssa Ross <hi@...ssa.is>, virtualization@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
iommu@...ts.linux.dev, x86@...nel.org,
Spectrum OS Development <devel@...ctrum-os.org>
Subject: Re: Virtio-IOMMU interrupt remapping design
On Sun, Jun 15, 2025 at 02:47:15PM -0400, Demi Marie Obenour wrote:
> Virtio-IOMMU interrupt remapping turned out to be much harder than I
> realized. The main problem is that interrupt remapping is set up
> very early in boot. In fact, Linux calls the interrupt remapping probe
> function from the APIC initialization code: x86_64_probe_apic ->
> enable_IR_x2apic -> irq_remapping_prepare(). This is almost certainly
> much before PCI has been initialized. Also, the order in which devices
> will be initialized is not something Linux guarantees at all, which is a
> problem because interrupt remapping must be initialized before drivers
> start setting up interrupts. Otherwise, the interrupt remapping table
> won't include entries for already-existing interrupts, and things will
> either break badly, not get the benefit of interrupt remapping
> security-wise, or both.
>
> The reason I expect this doesn't cause problems for address translation
> is that the IOMMU probably starts in bypass mode by default, meaning
> that all DMA is permitted. If the IOMMU is only used by VFIO or
> IOMMUFD, it will not be needed until userspace starts up, which is after
> the IOMMU has been initialized. This isn't ideal, though, as it means
> that kernel drivers operate without DMA protection.
>
> Is a paravirtualized IOMMU with interrupt remapping something that makes
> sense? Absolutely! However, the IOMMU should be considered a platform
> device that must be initialized very early in boot. Using virtio-IOMMU
> with MMIO transport as the interface might be a reasonable option, but
> the IOMMU needs to be enumerated via ACPI, device tree, or kernel
> command line argument. This allows it to be brought up before anything
> capable of DMA is initialized.
>
> Is this the right path to go down? What do others think about this?
> --
> Sincerely,
> Demi Marie Obenour (she/her/hers)
The project for this discussion is also virtio-comment,
this ML is for driver work.
Powered by blists - more mailing lists