drivers/iommu/iommufd/Kconfig | 2 +- drivers/iommu/dma-iommu.h | 14 ++ drivers/iommu/iommu-priv.h | 13 ++ drivers/iommu/iommufd/iommufd_private.h | 7 +- include/linux/iommu.h | 35 ++-- drivers/iommu/dma-iommu.c | 208 ++++++++++++------------ drivers/iommu/iommu-sva.c | 1 + drivers/iommu/iommu.c | 36 +++- drivers/iommu/iommufd/device.c | 131 +-------------- drivers/iommu/iommufd/driver.c | 126 ++++++++++++++ drivers/iommu/iommufd/hw_pagetable.c | 6 +- 11 files changed, 323 insertions(+), 256 deletions(-)
A few things in iommu_domain structure (such as iova_cookie, iommufd_hwpt, fault handler, and etc) are exclusive to certain types of iommu_domains. So, all of them can be seen as domain cookies in different cookie types. Furthermore, iova_cookie is shared with the msi_cookie use case. It could be cleaner by decoupling these too. Define an enum iommu_domain_cookie_type to fit all those cookies in. Since there are only two sw_msi implementations, check domain->cookie_type in iommu_dma_prepare_msi() to call the corresponding sw_msi function. This is a clean-up series for the previous sw_msi Part-1 core series. It's on github: https://github.com/nicolinc/iommufd/commits/iommufd_msi_cleanup-v5 Changelog v5 * Add IMPORT line for IOMMUFD_INTERNAL and change IOMMUFD_DRIVER_CORE to a "bool" module, fixing build module errors reported by Arnd: https://lore.kernel.org/all/20250324210329.2809869-1-arnd@kernel.org/ * In iommu_dma_prepare_msi(), let all IDENTITY DOMAINs pass through, fixing the regression with IDENTITY domains reported by Nathan: https://lore.kernel.org/linux-iommu/20250324162558.GA198799@ax162/ v4 https://lore.kernel.org/all/cover.1741294235.git.nicolinc@nvidia.com/ * Rebase on top of a bug fix for hwpt_iommufd cookie https://lore.kernel.org/all/20250305211800.229465-1-nicolinc@nvidia.com/ * Add Reviewed-by from Robin and Kevin * Add missing "break;" in iommu_domain_free() * Drop "linux/msi.h" header from the iommufd/device code * Set iommufd_sw_msi_install's SYMBOL to "IOMMUFD_INTERNAL" * Update commit messages for typo fixing and size comparison * Add a local msi_page_list to cache cookie_msi_pages(domain) return * Add an inline iommufd_group_setup_msi() for !CONFIG_IRQ_MSI_IOMMU v3 https://lore.kernel.org/all/cover.1741034885.git.nicolinc@nvidia.com/ * Integrate Robin's patch https://lore.kernel.org/linux-iommu/4e68d5820be06adc1b34fc0d1c9399481151daee.1740742271.git.robin.murphy@arm.com/ replacing private_data_owner with the new cookie_type * Move iommu_sw_msi stub from the public header to iommu-priv.h v2 https://lore.kernel.org/all/cover.1740705776.git.nicolinc@nvidia.com/ * Drop sw_msi function pointer * Add a new private_data_owner tag in iommu_domain * Let iommu core call the two sw_msi implementations directly v1 https://lore.kernel.org/all/cover.1740600272.git.nicolinc@nvidia.com/ Thanks Nicolin Nicolin Chen (2): iommufd: Move iommufd_sw_msi and related functions to driver.c iommu: Drop sw_msi from iommu_domain Robin Murphy (1): iommu: Sort out domain user data drivers/iommu/iommufd/Kconfig | 2 +- drivers/iommu/dma-iommu.h | 14 ++ drivers/iommu/iommu-priv.h | 13 ++ drivers/iommu/iommufd/iommufd_private.h | 7 +- include/linux/iommu.h | 35 ++-- drivers/iommu/dma-iommu.c | 208 ++++++++++++------------ drivers/iommu/iommu-sva.c | 1 + drivers/iommu/iommu.c | 36 +++- drivers/iommu/iommufd/device.c | 131 +-------------- drivers/iommu/iommufd/driver.c | 126 ++++++++++++++ drivers/iommu/iommufd/hw_pagetable.c | 6 +- 11 files changed, 323 insertions(+), 256 deletions(-) base-commit: da0c56520e880441d0503d0cf0d6853dcfb5f1a4 -- 2.43.0
On Mon, Mar 24, 2025 at 09:05:14PM -0700, Nicolin Chen wrote: > Nicolin Chen (2): > iommufd: Move iommufd_sw_msi and related functions to driver.c > iommu: Drop sw_msi from iommu_domain > > Robin Murphy (1): > iommu: Sort out domain user data Refreshed, thanks Jason
On Mon, Mar 24, 2025 at 09:05:14PM -0700, Nicolin Chen wrote:
> This is a clean-up series for the previous sw_msi Part-1 core series. It's
> on github:
> https://github.com/nicolinc/iommufd/commits/iommufd_msi_cleanup-v5
>
> Changelog
> v5
> * Add IMPORT line for IOMMUFD_INTERNAL and change IOMMUFD_DRIVER_CORE
> to a "bool" module, fixing build module errors reported by Arnd:
> https://lore.kernel.org/all/20250324210329.2809869-1-arnd@kernel.org/
> * In iommu_dma_prepare_msi(), let all IDENTITY DOMAINs pass through,
> fixing the regression with IDENTITY domains reported by Nathan:
> https://lore.kernel.org/linux-iommu/20250324162558.GA198799@ax162/
> base-commit: da0c56520e880441d0503d0cf0d6853dcfb5f1a4
Hi Jason,
Assuming that you want to replace the commits in your for-next
tree with these patches, I rebased them on this commit:
da0c56520e88 iommu/arm-smmu-v3: Set MEV bit in nested STE for DoS mitigations
Again, sorry for the trouble.
Nicolin
P.S. Attaching git-diff against the current commit in your tree
"git diff -U1 e009e088d88e8..nicolinc/iommufd_msi_cleanup-v5":
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 0f4cc15ded1c..d96e6fabb4da 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3653,3 +3653,4 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)
mutex_lock(&group->mutex);
- if (group->domain) {
+ /* An IDENTITY domain must pass through */
+ if (group->domain && group->domain->type != IOMMU_DOMAIN_IDENTITY) {
switch (group->domain->cookie_type) {
diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index 0a07f9449fd9..2beeb4f60ee5 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -2,3 +2,3 @@
config IOMMUFD_DRIVER_CORE
- tristate
+ bool
default (IOMMUFD_DRIVER || IOMMUFD) if IOMMUFD!=n
diff --git a/drivers/iommu/iommufd/driver.c b/drivers/iommu/iommufd/driver.c
index 352513974154..a08ff0f37fc6 100644
--- a/drivers/iommu/iommufd/driver.c
+++ b/drivers/iommu/iommufd/driver.c
@@ -249,2 +249,3 @@ EXPORT_SYMBOL_NS_GPL(iommufd_sw_msi, "IOMMUFD");
MODULE_DESCRIPTION("iommufd code shared with builtin modules");
+MODULE_IMPORT_NS("IOMMUFD_INTERNAL");
MODULE_LICENSE("GPL");
On Mon, Mar 24, 2025 at 09:14:23PM -0700, Nicolin Chen wrote: > On Mon, Mar 24, 2025 at 09:05:14PM -0700, Nicolin Chen wrote: > > This is a clean-up series for the previous sw_msi Part-1 core series. It's > > on github: > > https://github.com/nicolinc/iommufd/commits/iommufd_msi_cleanup-v5 > > > > Changelog > > v5 > > * Add IMPORT line for IOMMUFD_INTERNAL and change IOMMUFD_DRIVER_CORE > > to a "bool" module, fixing build module errors reported by Arnd: > > https://lore.kernel.org/all/20250324210329.2809869-1-arnd@kernel.org/ > > * In iommu_dma_prepare_msi(), let all IDENTITY DOMAINs pass through, > > fixing the regression with IDENTITY domains reported by Nathan: > > https://lore.kernel.org/linux-iommu/20250324162558.GA198799@ax162/ > > > base-commit: da0c56520e880441d0503d0cf0d6853dcfb5f1a4 > > Hi Jason, > > Assuming that you want to replace the commits in your for-next > tree with these patches, I rebased them on this commit: > da0c56520e88 iommu/arm-smmu-v3: Set MEV bit in nested STE for DoS mitigations > > Again, sorry for the trouble. Can you post a v6 please? That is a bit easier Thanks, Jason
© 2016 - 2025 Red Hat, Inc.