Hi,

The following iommu WARNING is observed on powerpc system during pci 
enumeration at boot up using recent
upstream kernel:

pci 0048:01:00.0: Adding to iommu group 0
------------[ cut here ]------------
WARNING: drivers/iommu/iommu.c:2252 at iommu_get_domain_for_dev+0x38/0x80, 
CPU#2: swapper/0/1
Modules linked in:
CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.0.0-rc2+ #35 PREEMPT
Hardware name: IBM,9105-22A Power11 (architected) 0x820200 0xf000007 
of:IBM,FW1120.00 (RB1120_115) hv:phyp pSeries
NIP:  c000000000c244c4 LR: c00000000005b5a4 CTR: c00000000005b578
REGS: c00000000a7bf280 TRAP: 0700   Not tainted  (7.0.0-rc2+)
MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 22004422  XER: 0000000a
CFAR: c000000000c24508 IRQMASK: 0
GPR00: c00000000005b5a4 c00000000a7bf520 c000000001dc8100 0000000000000001
GPR04: c00000000f972f10 0000000000000000 0000000000000000 0000000000000001
GPR08: 0000001ffbc60000 0000000000000001 0000000000000000 0000000000000000
GPR12: c00000000005b578 c000001fffffe480 c000000000011618 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: ffffffffffffefff 0000000000000000 c000000002d30eb0 0000000000000001
GPR24: c0000000017881f8 0000000000000000 0000000000000001 c00000000f972e00
GPR28: c00000000bbba0d0 0000000000000000 c00000000bbba0d0 c00000000f972e00
NIP [c000000000c244c4] iommu_get_domain_for_dev+0x38/0x80
LR [c00000000005b5a4] spapr_tce_platform_iommu_attach_dev+0x2c/0x98
Call Trace:
[c00000000a7bf520] [c000000000c244f4] iommu_get_domain_for_dev+0x68/0x80 
(unreliable)
[c00000000a7bf550] [c00000000005b5a4] 
spapr_tce_platform_iommu_attach_dev+0x2c/0x98
[c00000000a7bf580] [c000000000c27518] __iommu_attach_device+0x44/0x220
[c00000000a7bf610] [c000000000c277e8] __iommu_device_set_domain+0xf4/0x194
[c00000000a7bf6a0] [c000000000c27974] 
__iommu_group_set_domain_internal+0xec/0x228
[c00000000a7bf700] [c000000000c2a3a0] iommu_setup_default_domain+0x5f4/0x6a4
[c00000000a7bf7d0] [c000000000c2b09c] __iommu_probe_device+0x674/0x724
[c00000000a7bf890] [c000000000c2b228] iommu_probe_device+0x50/0xb4
[c00000000a7bf8d0] [c00000000005b3a0] iommu_add_device+0x48/0x198
[c00000000a7bf940] [c000000000102498] pci_dma_dev_setup_pSeriesLP+0x198/0x4f0
[c00000000a7bfa30] [c000000000078f30] pcibios_bus_add_device+0x80/0x464
[c00000000a7bfae0] [c000000000af3c90] pci_bus_add_device+0x40/0x100
[c00000000a7bfb20] [c000000000af3da4] pci_bus_add_devices+0x54/0xb0
[c00000000a7bfb60] [c00000000201b2c8] pcibios_init+0xd8/0x140
[c00000000a7bfbe0] [c000000000010f04] do_one_initcall+0x8c/0x598
[c00000000a7bfcd0] [c0000000020065ac] kernel_init_freeable+0x3ec/0x850
[c00000000a7bfde0] [c000000000011644] kernel_init+0x34/0x270
[c00000000a7bfe50] [c00000000000dd3c] ret_from_kernel_user_thread+0x14/0x1c
---- interrupt: 0 at 0x0
Code: 7c0802a6 60000000 fbe1fff8 f821ffd1 ebe30480 2c3f0000 41820020 3d2200f7 
39298db0 81290000 2c090000 40820020 <0b090000> ebff0170 38210030 7fe3fb78
irq event stamp: 422464
hardirqs last  enabled at (422463): [<c00000000024d838>] 
__up_console_sem+0xd4/0x110
hardirqs last disabled at (422464): [<c00000000002ab50>] 
interrupt_enter_prepare+0x88/0x260
softirqs last  enabled at (422062): [<c00000000016ad7c>] 
handle_softirqs+0x688/0x6a0
softirqs last disabled at (422007): [<c000000000018970>] 
do_softirq_own_stack+0x40/0x54
---[ end trace 0000000000000000 ]---
pci 0048:01:00.1: Adding to iommu group 0
------------[ cut here ]------------

Looking at the warning it seems that this is a regression caused due to
commit a75b2be249d6 ("iommu: Add iommu_driver_get_domain_for_dev() helper").

Any help from the iommu expert would be appreciated. Though I am not expert,
it seems the following patch help fix this warning (I encourage the iommu
developers to confirm and/or take this forward) :

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 0ce71310b7d9..d122e8447831 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1159,7 +1159,7 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain 
*platform_domain,
                                    struct device *dev,
                                    struct iommu_domain *old)
 {
-       struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
+       struct iommu_domain *domain = iommu_driver_get_domain_for_dev(dev);
        struct iommu_table_group *table_group;
        struct iommu_group *grp;


Please let me know if any further information is needed.

Thanks,
--Nilay


Reply via email to