[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZzPTHD2D5ATBsoGV@Asurada-Nvidia>
Date: Tue, 12 Nov 2024 14:13:48 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Marc Zyngier <maz@...nel.org>
CC: Robin Murphy <robin.murphy@....com>, <tglx@...utronix.de>,
<bhelgaas@...gle.com>, <alex.williamson@...hat.com>, <jgg@...dia.com>,
<leonro@...dia.com>, <shameerali.kolothum.thodi@...wei.com>,
<dlemoal@...nel.org>, <kevin.tian@...el.com>, <smostafa@...gle.com>,
<andriy.shevchenko@...ux.intel.com>, <reinette.chatre@...el.com>,
<eric.auger@...hat.com>, <ddutile@...hat.com>, <yebin10@...wei.com>,
<brauner@...nel.org>, <apatel@...tanamicro.com>,
<shivamurthy.shastri@...utronix.de>, <anna-maria@...utronix.de>,
<nipun.gupta@....com>, <marek.vasut+renesas@...lbox.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<linux-pci@...r.kernel.org>, <kvm@...r.kernel.org>
Subject: Re: [PATCH RFCv1 0/7] vfio: Allow userspace to specify the address
for each MSI vector
On Mon, Nov 11, 2024 at 02:14:15PM +0000, Marc Zyngier wrote:
> On Mon, 11 Nov 2024 13:09:20 +0000,
> Robin Murphy <robin.murphy@....com> wrote:
> > On 2024-11-09 5:48 am, Nicolin Chen wrote:
> > > To solve this problem the VMM should capture the MSI IOVA allocated by the
> > > guest kernel and relay it to the GIC driver in the host kernel, to program
> > > the correct MSI IOVA. And this requires a new ioctl via VFIO.
> >
> > Once VFIO has that information from userspace, though, do we really
> > need the whole complicated dance to push it right down into the
> > irqchip layer just so it can be passed back up again? AFAICS
> > vfio_msi_set_vector_signal() via VFIO_DEVICE_SET_IRQS already
> > explicitly rewrites MSI-X vectors, so it seems like it should be
> > pretty straightforward to override the message address in general at
> > that level, without the lower layers having to be aware at all, no?
>
> +1.
>
> I would like to avoid polluting each and every interrupt controller
> with usage-specific knowledge (they usually are brain-damaged enough).
> We already have an indirection into the IOMMU subsystem and it
> shouldn't be a big deal to intercept the message for all
> implementations at this level.
>
> I also wonder how to handle the case of braindead^Wwonderful platforms
> where ITS transactions are not translated by the SMMU. Somehow, VFIO
> should be made aware of this situation.
Perhaps we should do iommu_get_domain_for_dev(&vdev->pdev->dev) and
check the returned domain->type:
* if (domain->type & __IOMMU_DOMAIN_PAGING): 1-stage translation
* if (domain->type == IOMMU_DOMAIN_NESTED): 2-stage translation
And for this particular topic/series, we should do something like:
if (vdev->msi_iovas && domain->type == IOMMU_DOMAIN_NESTED) {
msg.address_lo = lower_32_bits(vdev->msi_iovas[vector]);
msg.address_hi = upper_32_bits(vdev->msi_iovas[vector]);
}
?
Thanks
Nicolin
Powered by blists - more mailing lists