Hi Gaurav, kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next] [also build test WARNING on powerpc/fixes linus/master v6.7-rc5 next-20231214] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Gaurav-Batra/powerpc-pseries-iommu-IOMMU-table-is-not-initialized-for-kdump-over-SR-IOV/20231214-035436 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next patch link: https://lore.kernel.org/r/20231213195233.10329-1-gbatra%40linux.vnet.ibm.com patch subject: [PATCH] powerpc/pseries/iommu: IOMMU table is not initialized for kdump over SR-IOV config: powerpc64-randconfig-r113-20231214 (https://download.01.org/0day-ci/archive/20231214/202312141941.qraw6p8l-...@intel.com/config) compiler: powerpc64-linux-gcc (GCC) 13.2.0 reproduce: (https://download.01.org/0day-ci/archive/20231214/202312141941.qraw6p8l-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <l...@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202312141941.qraw6p8l-...@intel.com/ sparse warnings: (new ones prefixed by >>) >> arch/powerpc/platforms/pseries/iommu.c:753:29: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] liobn @@ got unsigned int [usertype] @@ arch/powerpc/platforms/pseries/iommu.c:753:29: sparse: expected restricted __be32 [usertype] liobn arch/powerpc/platforms/pseries/iommu.c:753:29: sparse: got unsigned int [usertype] >> arch/powerpc/platforms/pseries/iommu.c:754:32: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be64 >> [usertype] dma_base @@ got unsigned long long [usertype] @@ arch/powerpc/platforms/pseries/iommu.c:754:32: sparse: expected restricted __be64 [usertype] dma_base arch/powerpc/platforms/pseries/iommu.c:754:32: sparse: got unsigned long long [usertype] >> arch/powerpc/platforms/pseries/iommu.c:755:33: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] tce_shift @@ got unsigned int [usertype] @@ arch/powerpc/platforms/pseries/iommu.c:755:33: sparse: expected restricted __be32 [usertype] tce_shift arch/powerpc/platforms/pseries/iommu.c:755:33: sparse: got unsigned int [usertype] >> arch/powerpc/platforms/pseries/iommu.c:756:36: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] window_shift @@ got unsigned int [usertype] @@ arch/powerpc/platforms/pseries/iommu.c:756:36: sparse: expected restricted __be32 [usertype] window_shift arch/powerpc/platforms/pseries/iommu.c:756:36: sparse: got unsigned int [usertype] >> arch/powerpc/platforms/pseries/iommu.c:762:29: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] liobn @@ got unsigned long [addressable] liobn @@ arch/powerpc/platforms/pseries/iommu.c:762:29: sparse: expected restricted __be32 [usertype] liobn arch/powerpc/platforms/pseries/iommu.c:762:29: sparse: got unsigned long [addressable] liobn >> arch/powerpc/platforms/pseries/iommu.c:763:32: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be64 >> [usertype] dma_base @@ got unsigned long [addressable] offset @@ arch/powerpc/platforms/pseries/iommu.c:763:32: sparse: expected restricted __be64 [usertype] dma_base arch/powerpc/platforms/pseries/iommu.c:763:32: sparse: got unsigned long [addressable] offset >> arch/powerpc/platforms/pseries/iommu.c:764:33: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] tce_shift @@ got int @@ arch/powerpc/platforms/pseries/iommu.c:764:33: sparse: expected restricted __be32 [usertype] tce_shift arch/powerpc/platforms/pseries/iommu.c:764:33: sparse: got int >> arch/powerpc/platforms/pseries/iommu.c:765:36: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected restricted __be32 >> [usertype] window_shift @@ got int @@ arch/powerpc/platforms/pseries/iommu.c:765:36: sparse: expected restricted __be32 [usertype] window_shift arch/powerpc/platforms/pseries/iommu.c:765:36: sparse: got int >> arch/powerpc/platforms/pseries/iommu.c:800:78: sparse: sparse: incorrect >> type in argument 3 (different base types) @@ expected unsigned long >> liobn @@ got restricted __be32 [addressable] [usertype] liobn @@ arch/powerpc/platforms/pseries/iommu.c:800:78: sparse: expected unsigned long liobn arch/powerpc/platforms/pseries/iommu.c:800:78: sparse: got restricted __be32 [addressable] [usertype] liobn >> arch/powerpc/platforms/pseries/iommu.c:801:37: sparse: sparse: incorrect >> type in argument 4 (different base types) @@ expected unsigned long >> win_addr @@ got restricted __be64 [addressable] [usertype] dma_base @@ arch/powerpc/platforms/pseries/iommu.c:801:37: sparse: expected unsigned long win_addr arch/powerpc/platforms/pseries/iommu.c:801:37: sparse: got restricted __be64 [addressable] [usertype] dma_base >> arch/powerpc/platforms/pseries/iommu.c:801:60: sparse: sparse: restricted >> __be32 degrades to integer >> arch/powerpc/platforms/pseries/iommu.c:802:37: sparse: sparse: incorrect >> type in argument 6 (different base types) @@ expected unsigned long >> page_shift @@ got restricted __be32 [addressable] [usertype] tce_shift @@ arch/powerpc/platforms/pseries/iommu.c:802:37: sparse: expected unsigned long page_shift arch/powerpc/platforms/pseries/iommu.c:802:37: sparse: got restricted __be32 [addressable] [usertype] tce_shift >> arch/powerpc/platforms/pseries/iommu.c:808:48: sparse: sparse: incorrect >> type in assignment (different base types) @@ expected unsigned int >> [usertype] tce32_start @@ got restricted __be64 [addressable] [usertype] >> dma_base @@ arch/powerpc/platforms/pseries/iommu.c:808:48: sparse: expected unsigned int [usertype] tce32_start arch/powerpc/platforms/pseries/iommu.c:808:48: sparse: got restricted __be64 [addressable] [usertype] dma_base arch/powerpc/platforms/pseries/iommu.c:809:61: sparse: sparse: restricted __be32 degrades to integer arch/powerpc/platforms/pseries/iommu.c:1594:77: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long liobn @@ got restricted __be32 [addressable] [usertype] liobn @@ arch/powerpc/platforms/pseries/iommu.c:1594:77: sparse: expected unsigned long liobn arch/powerpc/platforms/pseries/iommu.c:1594:77: sparse: got restricted __be32 [addressable] [usertype] liobn arch/powerpc/platforms/pseries/iommu.c:1595:37: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected unsigned long win_addr @@ got restricted __be64 [addressable] [usertype] dma_base @@ arch/powerpc/platforms/pseries/iommu.c:1595:37: sparse: expected unsigned long win_addr arch/powerpc/platforms/pseries/iommu.c:1595:37: sparse: got restricted __be64 [addressable] [usertype] dma_base arch/powerpc/platforms/pseries/iommu.c:1595:60: sparse: sparse: restricted __be32 degrades to integer arch/powerpc/platforms/pseries/iommu.c:1596:37: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected unsigned long page_shift @@ got restricted __be32 [addressable] [usertype] tce_shift @@ arch/powerpc/platforms/pseries/iommu.c:1596:37: sparse: expected unsigned long page_shift arch/powerpc/platforms/pseries/iommu.c:1596:37: sparse: got restricted __be32 [addressable] [usertype] tce_shift arch/powerpc/platforms/pseries/iommu.c:1602:47: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] tce32_start @@ got restricted __be64 [addressable] [usertype] dma_base @@ arch/powerpc/platforms/pseries/iommu.c:1602:47: sparse: expected unsigned int [usertype] tce32_start arch/powerpc/platforms/pseries/iommu.c:1602:47: sparse: got restricted __be64 [addressable] [usertype] dma_base arch/powerpc/platforms/pseries/iommu.c:1603:60: sparse: sparse: restricted __be32 degrades to integer arch/powerpc/platforms/pseries/iommu.c: note: in included file (through include/linux/preempt.h, include/linux/spinlock.h, include/linux/mmzone.h, ...): include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true vim +753 arch/powerpc/platforms/pseries/iommu.c 698 699 /* 700 * Find nearest ibm,dma-window (default DMA window) or direct DMA window or 701 * dynamic 64bit DMA window, walking up the device tree. 702 */ 703 static struct device_node *pci_dma_find(struct device_node *dn, 704 struct dynamic_dma_window_prop *prop) 705 { 706 const __be32 *default_prop = NULL; 707 const __be32 *ddw_prop = NULL; 708 struct device_node *rdn = NULL; 709 bool default_win = false, ddw_win = false; 710 711 for ( ; dn && PCI_DN(dn); dn = dn->parent) { 712 default_prop = of_get_property(dn, "ibm,dma-window", NULL); 713 if (default_prop) { 714 rdn = dn; 715 default_win = true; 716 } 717 ddw_prop = of_get_property(dn, DIRECT64_PROPNAME, NULL); 718 if (ddw_prop) { 719 rdn = dn; 720 ddw_win = true; 721 break; 722 } 723 ddw_prop = of_get_property(dn, DMA64_PROPNAME, NULL); 724 if (ddw_prop) { 725 rdn = dn; 726 ddw_win = true; 727 break; 728 } 729 730 /* At least found default window, which is the case for normal boot */ 731 if (default_win) 732 break; 733 } 734 735 /* For PCI devices there will always be a DMA window, either on the device 736 * or parent bus 737 */ 738 WARN_ON(!(default_win | ddw_win)); 739 740 /* caller doesn't want to get DMA window property */ 741 if (!prop) 742 return rdn; 743 744 /* parse DMA window property. During normal system boot, only default 745 * DMA window is passed in OF. But, for kdump, a dedicated adapter might 746 * have both default and DDW in FDT. In this scenario, DDW takes precedence 747 * over default window. 748 */ 749 if (ddw_win) { 750 struct dynamic_dma_window_prop *p; 751 752 p = (struct dynamic_dma_window_prop *)ddw_prop; > 753 prop->liobn = be32_to_cpu(p->liobn); > 754 prop->dma_base = be64_to_cpu(p->dma_base); > 755 prop->tce_shift = be32_to_cpu(p->tce_shift); > 756 prop->window_shift = be32_to_cpu(p->window_shift); 757 } else if (default_win) { 758 unsigned long offset, size, liobn; 759 760 of_parse_dma_window(rdn, default_prop, &liobn, &offset, &size); 761 > 762 prop->liobn = liobn; > 763 prop->dma_base = offset; > 764 prop->tce_shift = IOMMU_PAGE_SHIFT_4K; > 765 prop->window_shift = order_base_2(size); 766 } 767 768 return rdn; 769 } 770 771 static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) 772 { 773 struct iommu_table *tbl; 774 struct device_node *dn, *pdn; 775 struct pci_dn *ppci; 776 struct dynamic_dma_window_prop prop; 777 778 dn = pci_bus_to_OF_node(bus); 779 780 pr_debug("pci_dma_bus_setup_pSeriesLP: setting up bus %pOF\n", 781 dn); 782 783 pdn = pci_dma_find(dn, &prop); 784 785 /* In PPC architecture, there will always be DMA window on bus or one of the 786 * parent bus. During reboot, there will be ibm,dma-window property to 787 * define DMA window. For kdump, there will at least be default window or DDW 788 * or both. 789 */ 790 791 ppci = PCI_DN(pdn); 792 793 pr_debug(" parent is %pOF, iommu_table: 0x%p\n", 794 pdn, ppci->table_group); 795 796 if (!ppci->table_group) { 797 ppci->table_group = iommu_pseries_alloc_group(ppci->phb->node); 798 tbl = ppci->table_group->tables[0]; 799 > 800 iommu_table_setparms_common(tbl, > ppci->phb->bus->number, prop.liobn, > 801 prop.dma_base, 1ULL << > prop.window_shift, > 802 prop.tce_shift, NULL, > &iommu_table_lpar_multi_ops); 803 804 /* Only for normal boot with default window. Doesn't matter even 805 * if we set these with DDW which is 64bit during kdump, since 806 * these will not be used during kdump. 807 */ > 808 ppci->table_group->tce32_start = prop.dma_base; 809 ppci->table_group->tce32_size = 1ULL << prop.window_shift; 810 811 if (!iommu_init_table(tbl, ppci->phb->node, 0, 0)) 812 panic("Failed to initialize iommu table"); 813 814 iommu_register_group(ppci->table_group, 815 pci_domain_nr(bus), 0); 816 pr_debug(" created table: %p\n", ppci->table_group); 817 } 818 } 819 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki