From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Nicolin Chen <nicolinc@nvidia.com>,
kevin.tian@intel.com, tglx@linutronix.de, maz@kernel.org,
joro@8bytes.org, will@kernel.org, shuah@kernel.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org, eric.auger@redhat.com,
baolu.lu@linux.intel.com, yi.l.liu@intel.com,
yury.norov@gmail.com, jacob.pan@linux.microsoft.com,
patches@lists.linux.dev
Subject: Re: [PATCH v2 3/7] iommu: Make iommu_dma_prepare_msi() into a generic operation
Date: Thu, 27 Feb 2025 11:32:42 -0400 [thread overview]
Message-ID: <20250227153242.GG39591@nvidia.com> (raw)
In-Reply-To: <634c60ea-fec3-43ad-923a-cf9ba5e76065@arm.com>
On Thu, Feb 27, 2025 at 11:21:28AM +0000, Robin Murphy wrote:
> It wouldn't need a hard dependency, it's easy to have a trivial built-in
> stub function which becomes valid once the module loads - you literally have
> the iommufd_driver infrastructure for precisely that sort of thing already.
Yes, but I also kinda dislike using it because it bloats the built in
kernel for a narrow use case..
> All I'm saying is to hide the callback detail in the IOMMUFD code because
> being IOMMUFD modular is unique to IOMMUFD and not the rest of the core
> code's problem.
Maybe we could use a global function pointer set/cleared on iommufd
module load?
Regardless, we need to first find a way for the core code to tell if
the domain is iommufd owned or not.
We should also make it so we can tell if dma-iommu.c is linked to that
domain (eg vfio or the default_domain), then we can do the iova_cookie
move without changing the destruction flows. This would be the missing
union struct tag you mentioned in the other email.
What I've been thinking of is changing type into flags. I think we
have now removed type from all drivers so this should be a small
enough work.
Nicolin should be able to look into some followup here, it is not a
small change.
> And frankly otherwise, what even is the benefit of moving the iova_cookie
> pointer into the union if we have to replace it with another whole pointer
> to make it work?
It makes a lot more semantic sense that the domain owners all share a
single "private data" pointer.
> This is just adding more code and more complexity in in
> order to make struct iommu_domain... the same size it already is :/
That we get back the space we spent on sw_msi is a nice bonus.
Jason
next prev parent reply other threads:[~2025-02-27 19:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 1:31 [PATCH v2 0/7] iommu: Add MSI mapping support with nested SMMU (Part-1 core) Nicolin Chen
2025-02-20 1:31 ` [PATCH v2 1/7] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie Nicolin Chen
2025-02-21 9:28 ` Thomas Gleixner
2025-02-21 11:10 ` Joerg Roedel
2025-02-21 13:41 ` Jason Gunthorpe
2025-02-21 14:00 ` Joerg Roedel
2025-02-21 14:05 ` Jason Gunthorpe
2025-02-20 1:31 ` [PATCH v2 2/7] genirq/msi: Refactor iommu_dma_compose_msi_msg() Nicolin Chen
2025-02-21 9:28 ` Thomas Gleixner
2025-02-20 1:31 ` [PATCH v2 3/7] iommu: Make iommu_dma_prepare_msi() into a generic operation Nicolin Chen
2025-02-21 15:39 ` Robin Murphy
2025-02-21 16:44 ` Jason Gunthorpe
2025-02-27 11:21 ` Robin Murphy
2025-02-27 15:32 ` Jason Gunthorpe [this message]
2025-02-27 17:46 ` Nicolin Chen
2025-02-27 19:47 ` Jason Gunthorpe
2025-02-20 1:31 ` [PATCH v2 4/7] irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by irqchips that need it Nicolin Chen
2025-02-21 9:30 ` Thomas Gleixner
2025-02-21 14:48 ` Jason Gunthorpe
2025-02-20 1:31 ` [PATCH v2 5/7] iommu: Turn fault_data to iommufd private pointer Nicolin Chen
2025-02-20 17:50 ` Jason Gunthorpe
2025-02-20 1:31 ` [PATCH v2 6/7] iommufd: Implement sw_msi support natively Nicolin Chen
2025-02-21 14:51 ` Jason Gunthorpe
2025-02-27 19:33 ` Jason Gunthorpe
2025-02-20 1:31 ` [PATCH v2 7/7] iommu: Turn iova_cookie to dma-iommu private pointer Nicolin Chen
2025-02-20 17:50 ` Jason Gunthorpe
2025-02-21 14:39 ` Jason Gunthorpe
2025-02-21 15:23 ` Robin Murphy
2025-02-21 16:48 ` Jason Gunthorpe
2025-02-26 2:25 ` Nicolin Chen
2025-02-26 17:36 ` Jason Gunthorpe
2025-02-26 18:57 ` Nicolin Chen
2025-02-26 19:18 ` Jason Gunthorpe
2025-02-21 14:59 ` [PATCH v2 0/7] iommu: Add MSI mapping support with nested SMMU (Part-1 core) Jason Gunthorpe
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=20250227153242.GG39591@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.pan@linux.microsoft.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=nicolinc@nvidia.com \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
--cc=yury.norov@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).