Skip to content

Commit 96093fe

Browse files
committed
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by irqchips that need it
Currently, IRQ_MSI_IOMMU is selected if DMA_IOMMU is available to provide an implementation for iommu_dma_prepare/compose_msi_msg(). However, it'll make more sense for irqchips that call prepare/compose to select it, and that will trigger all the additional code and data to be compiled into the kernel. If IRQ_MSI_IOMMU is selected with no IOMMU side implementation, then the prepare/compose() will be NOP stubs. If IRQ_MSI_IOMMU is not selected by an irqchip, then the related code on the iommu side is compiled out. Link: https://patch.msgid.link/r/a2620f67002c5cdf974e89ca3bf905f5c0817be6.1740014950.git.nicolinc@nvidia.com Signed-off-by: Nicolin Chen <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 288683c commit 96093fe

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

drivers/iommu/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ config IOMMU_DMA
154154
select DMA_OPS_HELPERS
155155
select IOMMU_API
156156
select IOMMU_IOVA
157-
select IRQ_MSI_IOMMU
158157
select NEED_SG_DMA_LENGTH
159158
select NEED_SG_DMA_FLAGS if SWIOTLB
160159

drivers/iommu/dma-iommu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,10 @@ void iommu_put_dma_cookie(struct iommu_domain *domain)
449449
struct iommu_dma_cookie *cookie = domain->iova_cookie;
450450
struct iommu_dma_msi_page *msi, *tmp;
451451

452+
#if IS_ENABLED(CONFIG_IRQ_MSI_IOMMU)
452453
if (domain->sw_msi != iommu_dma_sw_msi)
453454
return;
455+
#endif
454456

455457
if (!cookie)
456458
return;

drivers/irqchip/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config ARM_GIC_V2M
2828
select ARM_GIC
2929
select IRQ_MSI_LIB
3030
select PCI_MSI
31+
select IRQ_MSI_IOMMU
3132

3233
config GIC_NON_BANKED
3334
bool
@@ -38,12 +39,14 @@ config ARM_GIC_V3
3839
select PARTITION_PERCPU
3940
select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
4041
select HAVE_ARM_SMCCC_DISCOVERY
42+
select IRQ_MSI_IOMMU
4143

4244
config ARM_GIC_V3_ITS
4345
bool
4446
select GENERIC_MSI_IRQ
4547
select IRQ_MSI_LIB
4648
default ARM_GIC_V3
49+
select IRQ_MSI_IOMMU
4750

4851
config ARM_GIC_V3_ITS_FSL_MC
4952
bool
@@ -408,6 +411,7 @@ config LS_EXTIRQ
408411

409412
config LS_SCFG_MSI
410413
def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE
414+
select IRQ_MSI_IOMMU
411415
depends on PCI_MSI
412416

413417
config PARTITION_PERCPU

kernel/irq/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ config GENERIC_MSI_IRQ
100100
bool
101101
select IRQ_DOMAIN_HIERARCHY
102102

103+
# irqchip drivers should select this if they call iommu_dma_prepare_msi()
103104
config IRQ_MSI_IOMMU
104105
bool
105106

0 commit comments

Comments
 (0)