Merge tag 'powerpc-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

- Fix broken soft dirty tracking when using the Radix MMU (>= P9)

- Fix ISA mapping when "ranges" property is not present, for PASemi
Nemo boards

- Fix a possible WARN_ON_ONCE hitting in BPF extable handling

- Fix incorrect DMA address handling when using 2MB TCEs

- Fix a bug in IOMMU table handling for SR-IOV devices

- Fix the recent rework of IOMMU handling which left arch code calling
clean up routines that are handled by the IOMMU core

- A few assorted build fixes

Thanks to Christian Zigotzky, Dan Horák, Gaurav Batra, Hari Bathini,
Jason Gunthorpe, Nathan Chancellor, Naveen N. Rao, Nicholas Piggin, Pali
Rohár, Randy Dunlap, and Rob Herring.

* tag 'powerpc-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/iommu: Incorrect DDW Table is referenced for SR-IOV device
powerpc/iommu: DMA address offset is incorrectly calculated with 2MB TCEs
powerpc/iommu: Remove iommu_del_device()
powerpc/crypto: Fix aes-gcm-p10 build when VSX=n
powerpc/bpf: populate extable entries only during the last pass
powerpc/boot: Disable power10 features after BOOTAFLAGS assignment
powerpc/64s/radix: Fix soft dirty tracking
powerpc/fsl_uli1575: fix kconfig warnings and build errors
powerpc/isa-bridge: Fix ISA mapping when "ranges" is not present

Changed files
+32 -88
arch
powerpc
boot
crypto
include
asm
kernel
mm
book3s64
net
platforms
powernv
pseries
+4 -2
arch/powerpc/boot/Makefile
··· 34 34 35 35 BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 36 36 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ 37 - $(call cc-option,-mno-prefixed) $(call cc-option,-mno-pcrel) \ 38 - $(call cc-option,-mno-mma) \ 39 37 $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ 40 38 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 41 39 $(LINUXINCLUDE) ··· 68 70 BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc 69 71 70 72 BOOTARFLAGS := -crD 73 + 74 + BOOTCFLAGS += $(call cc-option,-mno-prefixed) \ 75 + $(call cc-option,-mno-pcrel) \ 76 + $(call cc-option,-mno-mma) 71 77 72 78 ifdef CONFIG_CC_IS_CLANG 73 79 BOOTCFLAGS += $(CLANG_FLAGS)
+1 -1
arch/powerpc/crypto/Kconfig
··· 96 96 97 97 config CRYPTO_AES_GCM_P10 98 98 tristate "Stitched AES/GCM acceleration support on P10 or later CPU (PPC)" 99 - depends on PPC64 && CPU_LITTLE_ENDIAN 99 + depends on PPC64 && CPU_LITTLE_ENDIAN && VSX 100 100 select CRYPTO_LIB_AES 101 101 select CRYPTO_ALGAPI 102 102 select CRYPTO_AEAD
-5
arch/powerpc/include/asm/iommu.h
··· 205 205 int pci_domain_number, unsigned long pe_num); 206 206 extern int iommu_add_device(struct iommu_table_group *table_group, 207 207 struct device *dev); 208 - extern void iommu_del_device(struct device *dev); 209 208 extern long iommu_tce_xchg(struct mm_struct *mm, struct iommu_table *tbl, 210 209 unsigned long entry, unsigned long *hpa, 211 210 enum dma_data_direction *direction); ··· 227 228 struct device *dev) 228 229 { 229 230 return 0; 230 - } 231 - 232 - static inline void iommu_del_device(struct device *dev) 233 - { 234 231 } 235 232 #endif /* !CONFIG_IOMMU_API */ 236 233
+3 -1
arch/powerpc/kernel/dma-iommu.c
··· 144 144 /* We support DMA to/from any memory page via the iommu */ 145 145 int dma_iommu_dma_supported(struct device *dev, u64 mask) 146 146 { 147 - struct iommu_table *tbl = get_iommu_table_base(dev); 147 + struct iommu_table *tbl; 148 148 149 149 if (dev_is_pci(dev) && dma_iommu_bypass_supported(dev, mask)) { 150 150 /* ··· 161 161 dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n"); 162 162 return 1; 163 163 } 164 + 165 + tbl = get_iommu_table_base(dev); 164 166 165 167 if (!tbl) { 166 168 dev_err(dev, "Warning: IOMMU dma not supported: mask 0x%08llx, table unavailable\n", mask);
+7 -21
arch/powerpc/kernel/iommu.c
··· 518 518 /* Convert entry to a dma_addr_t */ 519 519 entry += tbl->it_offset; 520 520 dma_addr = entry << tbl->it_page_shift; 521 - dma_addr |= (s->offset & ~IOMMU_PAGE_MASK(tbl)); 521 + dma_addr |= (vaddr & ~IOMMU_PAGE_MASK(tbl)); 522 522 523 523 DBG(" - %lu pages, entry: %lx, dma_addr: %lx\n", 524 524 npages, entry, dma_addr); ··· 905 905 unsigned int order; 906 906 unsigned int nio_pages, io_order; 907 907 struct page *page; 908 + int tcesize = (1 << tbl->it_page_shift); 908 909 909 910 size = PAGE_ALIGN(size); 910 911 order = get_order(size); ··· 932 931 memset(ret, 0, size); 933 932 934 933 /* Set up tces to cover the allocated range */ 935 - nio_pages = size >> tbl->it_page_shift; 934 + nio_pages = IOMMU_PAGE_ALIGN(size, tbl) >> tbl->it_page_shift; 935 + 936 936 io_order = get_iommu_order(size, tbl); 937 937 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL, 938 938 mask >> tbl->it_page_shift, io_order, 0); ··· 941 939 free_pages((unsigned long)ret, order); 942 940 return NULL; 943 941 } 944 - *dma_handle = mapping; 942 + 943 + *dma_handle = mapping | ((u64)ret & (tcesize - 1)); 945 944 return ret; 946 945 } 947 946 ··· 953 950 unsigned int nio_pages; 954 951 955 952 size = PAGE_ALIGN(size); 956 - nio_pages = size >> tbl->it_page_shift; 953 + nio_pages = IOMMU_PAGE_ALIGN(size, tbl) >> tbl->it_page_shift; 957 954 iommu_free(tbl, dma_handle, nio_pages); 958 955 size = PAGE_ALIGN(size); 959 956 free_pages((unsigned long)vaddr, get_order(size)); ··· 1170 1167 return iommu_probe_device(dev); 1171 1168 } 1172 1169 EXPORT_SYMBOL_GPL(iommu_add_device); 1173 - 1174 - void iommu_del_device(struct device *dev) 1175 - { 1176 - /* 1177 - * Some devices might not have IOMMU table and group 1178 - * and we needn't detach them from the associated 1179 - * IOMMU groups 1180 - */ 1181 - if (!device_iommu_mapped(dev)) { 1182 - pr_debug("iommu_tce: skipping device %s with no tbl\n", 1183 - dev_name(dev)); 1184 - return; 1185 - } 1186 - 1187 - iommu_group_remove_device(dev); 1188 - } 1189 - EXPORT_SYMBOL_GPL(iommu_del_device); 1190 1170 1191 1171 /* 1192 1172 * A simple iommu_table_group_ops which only allows reusing the existing
+3 -2
arch/powerpc/kernel/isa-bridge.c
··· 93 93 } 94 94 95 95 inval_range: 96 - if (!phb_io_base_phys) { 96 + if (phb_io_base_phys) { 97 97 pr_err("no ISA IO ranges or unexpected isa range, mapping 64k\n"); 98 98 remap_isa_base(phb_io_base_phys, 0x10000); 99 + return 0; 99 100 } 100 - return 0; 101 + return -EINVAL; 101 102 } 102 103 103 104
+2 -2
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 1040 1040 pte_t entry, unsigned long address, int psize) 1041 1041 { 1042 1042 struct mm_struct *mm = vma->vm_mm; 1043 - unsigned long set = pte_val(entry) & (_PAGE_DIRTY | _PAGE_ACCESSED | 1044 - _PAGE_RW | _PAGE_EXEC); 1043 + unsigned long set = pte_val(entry) & (_PAGE_DIRTY | _PAGE_SOFT_DIRTY | 1044 + _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); 1045 1045 1046 1046 unsigned long change = pte_val(entry) ^ pte_val(*ptep); 1047 1047 /*
+2
arch/powerpc/net/bpf_jit_comp.c
··· 101 101 bpf_hdr = jit_data->header; 102 102 proglen = jit_data->proglen; 103 103 extra_pass = true; 104 + /* During extra pass, ensure index is reset before repopulating extable entries */ 105 + cgctx.exentry_idx = 0; 104 106 goto skip_init_ctx; 105 107 } 106 108
+1
arch/powerpc/platforms/Kconfig
··· 265 265 config FSL_ULI1575 266 266 bool "ULI1575 PCIe south bridge support" 267 267 depends on FSL_SOC_BOOKE || PPC_86xx 268 + depends on PCI 268 269 select FSL_PCI 269 270 select GENERIC_ISA_DMA 270 271 help
-25
arch/powerpc/platforms/powernv/pci.c
··· 865 865 /* Configure IOMMU DMA hooks */ 866 866 set_pci_dma_ops(&dma_iommu_ops); 867 867 } 868 - 869 - static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb, 870 - unsigned long action, void *data) 871 - { 872 - struct device *dev = data; 873 - 874 - switch (action) { 875 - case BUS_NOTIFY_DEL_DEVICE: 876 - iommu_del_device(dev); 877 - return 0; 878 - default: 879 - return 0; 880 - } 881 - } 882 - 883 - static struct notifier_block pnv_tce_iommu_bus_nb = { 884 - .notifier_call = pnv_tce_iommu_bus_notifier, 885 - }; 886 - 887 - static int __init pnv_tce_iommu_bus_notifier_init(void) 888 - { 889 - bus_register_notifier(&pci_bus_type, &pnv_tce_iommu_bus_nb); 890 - return 0; 891 - } 892 - machine_subsys_initcall_sync(powernv, pnv_tce_iommu_bus_notifier_init);
+9 -29
arch/powerpc/platforms/pseries/iommu.c
··· 91 91 static void iommu_pseries_free_group(struct iommu_table_group *table_group, 92 92 const char *node_name) 93 93 { 94 - struct iommu_table *tbl; 95 - 96 94 if (!table_group) 97 95 return; 98 96 99 - tbl = table_group->tables[0]; 100 97 #ifdef CONFIG_IOMMU_API 101 98 if (table_group->group) { 102 99 iommu_group_put(table_group->group); 103 100 BUG_ON(table_group->group); 104 101 } 105 102 #endif 106 - iommu_tce_table_put(tbl); 103 + 104 + /* Default DMA window table is at index 0, while DDW at 1. SR-IOV 105 + * adapters only have table on index 1. 106 + */ 107 + if (table_group->tables[0]) 108 + iommu_tce_table_put(table_group->tables[0]); 109 + 110 + if (table_group->tables[1]) 111 + iommu_tce_table_put(table_group->tables[1]); 107 112 108 113 kfree(table_group); 109 114 } ··· 1699 1694 } 1700 1695 1701 1696 __setup("multitce=", disable_multitce); 1702 - 1703 - static int tce_iommu_bus_notifier(struct notifier_block *nb, 1704 - unsigned long action, void *data) 1705 - { 1706 - struct device *dev = data; 1707 - 1708 - switch (action) { 1709 - case BUS_NOTIFY_DEL_DEVICE: 1710 - iommu_del_device(dev); 1711 - return 0; 1712 - default: 1713 - return 0; 1714 - } 1715 - } 1716 - 1717 - static struct notifier_block tce_iommu_bus_nb = { 1718 - .notifier_call = tce_iommu_bus_notifier, 1719 - }; 1720 - 1721 - static int __init tce_iommu_bus_notifier_init(void) 1722 - { 1723 - bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb); 1724 - return 0; 1725 - } 1726 - machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init); 1727 1697 1728 1698 #ifdef CONFIG_SPAPR_TCE_IOMMU 1729 1699 struct iommu_group *pSeries_pci_device_group(struct pci_controller *hose,