]> www.infradead.org Git - users/jedix/linux-maple.git/commit
genirq/msi: Refactor iommu_dma_compose_msi_msg()
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 20 Feb 2025 01:31:37 +0000 (17:31 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 21 Feb 2025 14:04:12 +0000 (10:04 -0400)
commit9349887e93009331e751854843f73a086bef4018
tree0d802a89aca9acf5670214f4bc57fe5446423e94
parent1f7df3a691740a7736bbc99dc4ed536120eb4746
genirq/msi: Refactor iommu_dma_compose_msi_msg()

The two-step process to translate the MSI address involves two functions,
iommu_dma_prepare_msi() and iommu_dma_compose_msi_msg().

Previously iommu_dma_compose_msi_msg() needed to be in the iommu layer as
it had to dereference the opaque cookie pointer. Now, the previous patch
changed the cookie pointer into an integer so there is no longer any need
for the iommu layer to be involved.

Further, the call sites of iommu_dma_compose_msi_msg() all follow the same
pattern of setting an MSI message address_hi/lo to non-translated and then
immediately calling iommu_dma_compose_msi_msg().

Refactor iommu_dma_compose_msi_msg() into msi_msg_set_addr() that directly
accepts the u64 version of the address and simplifies all the callers.

Move the new helper to linux/msi.h since it has nothing to do with iommu.

Aside from refactoring, this logically prepares for the next patch, which
allows multiple implementation options for iommu_dma_prepare_msi(). So, it
does not make sense to have the iommu_dma_compose_msi_msg() in dma-iommu.c
as it no longer provides the only iommu_dma_prepare_msi() implementation.

Link: https://patch.msgid.link/r/eda62a9bafa825e9cdabd7ddc61ad5a21c32af24.1740014950.git.nicolinc@nvidia.com
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/dma-iommu.c
drivers/irqchip/irq-gic-v2m.c
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3-mbi.c
drivers/irqchip/irq-ls-scfg-msi.c
include/linux/iommu.h
include/linux/msi.h