Skip to content

Commit 4927cb9

Browse files
committed
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
2 parents 90af47e + 1f7aacc commit 4927cb9

File tree

11 files changed

+32
-88
lines changed

11 files changed

+32
-88
lines changed

arch/powerpc/boot/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ endif
3434

3535
BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
3636
-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) \
3937
$(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \
4038
-pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
4139
$(LINUXINCLUDE)
@@ -71,6 +69,10 @@ BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
7169

7270
BOOTARFLAGS := -crD
7371

72+
BOOTCFLAGS += $(call cc-option,-mno-prefixed) \
73+
$(call cc-option,-mno-pcrel) \
74+
$(call cc-option,-mno-mma)
75+
7476
ifdef CONFIG_CC_IS_CLANG
7577
BOOTCFLAGS += $(CLANG_FLAGS)
7678
BOOTAFLAGS += $(CLANG_FLAGS)

arch/powerpc/crypto/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ config CRYPTO_AES_PPC_SPE
9696

9797
config CRYPTO_AES_GCM_P10
9898
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
100100
select CRYPTO_LIB_AES
101101
select CRYPTO_ALGAPI
102102
select CRYPTO_AEAD

arch/powerpc/include/asm/iommu.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ extern void iommu_register_group(struct iommu_table_group *table_group,
205205
int pci_domain_number, unsigned long pe_num);
206206
extern int iommu_add_device(struct iommu_table_group *table_group,
207207
struct device *dev);
208-
extern void iommu_del_device(struct device *dev);
209208
extern long iommu_tce_xchg(struct mm_struct *mm, struct iommu_table *tbl,
210209
unsigned long entry, unsigned long *hpa,
211210
enum dma_data_direction *direction);
@@ -229,10 +228,6 @@ static inline int iommu_add_device(struct iommu_table_group *table_group,
229228
{
230229
return 0;
231230
}
232-
233-
static inline void iommu_del_device(struct device *dev)
234-
{
235-
}
236231
#endif /* !CONFIG_IOMMU_API */
237232

238233
u64 dma_iommu_get_required_mask(struct device *dev);

arch/powerpc/kernel/dma-iommu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static bool dma_iommu_bypass_supported(struct device *dev, u64 mask)
144144
/* We support DMA to/from any memory page via the iommu */
145145
int dma_iommu_dma_supported(struct device *dev, u64 mask)
146146
{
147-
struct iommu_table *tbl = get_iommu_table_base(dev);
147+
struct iommu_table *tbl;
148148

149149
if (dev_is_pci(dev) && dma_iommu_bypass_supported(dev, mask)) {
150150
/*
@@ -162,6 +162,8 @@ int dma_iommu_dma_supported(struct device *dev, u64 mask)
162162
return 1;
163163
}
164164

165+
tbl = get_iommu_table_base(dev);
166+
165167
if (!tbl) {
166168
dev_err(dev, "Warning: IOMMU dma not supported: mask 0x%08llx, table unavailable\n", mask);
167169
return 0;

arch/powerpc/kernel/iommu.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
518518
/* Convert entry to a dma_addr_t */
519519
entry += tbl->it_offset;
520520
dma_addr = entry << tbl->it_page_shift;
521-
dma_addr |= (s->offset & ~IOMMU_PAGE_MASK(tbl));
521+
dma_addr |= (vaddr & ~IOMMU_PAGE_MASK(tbl));
522522

523523
DBG(" - %lu pages, entry: %lx, dma_addr: %lx\n",
524524
npages, entry, dma_addr);
@@ -905,6 +905,7 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
905905
unsigned int order;
906906
unsigned int nio_pages, io_order;
907907
struct page *page;
908+
int tcesize = (1 << tbl->it_page_shift);
908909

909910
size = PAGE_ALIGN(size);
910911
order = get_order(size);
@@ -931,15 +932,17 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
931932
memset(ret, 0, size);
932933

933934
/* Set up tces to cover the allocated range */
934-
nio_pages = size >> tbl->it_page_shift;
935+
nio_pages = IOMMU_PAGE_ALIGN(size, tbl) >> tbl->it_page_shift;
936+
935937
io_order = get_iommu_order(size, tbl);
936938
mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
937939
mask >> tbl->it_page_shift, io_order, 0);
938940
if (mapping == DMA_MAPPING_ERROR) {
939941
free_pages((unsigned long)ret, order);
940942
return NULL;
941943
}
942-
*dma_handle = mapping;
944+
945+
*dma_handle = mapping | ((u64)ret & (tcesize - 1));
943946
return ret;
944947
}
945948

@@ -950,7 +953,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size,
950953
unsigned int nio_pages;
951954

952955
size = PAGE_ALIGN(size);
953-
nio_pages = size >> tbl->it_page_shift;
956+
nio_pages = IOMMU_PAGE_ALIGN(size, tbl) >> tbl->it_page_shift;
954957
iommu_free(tbl, dma_handle, nio_pages);
955958
size = PAGE_ALIGN(size);
956959
free_pages((unsigned long)vaddr, get_order(size));
@@ -1168,23 +1171,6 @@ int iommu_add_device(struct iommu_table_group *table_group, struct device *dev)
11681171
}
11691172
EXPORT_SYMBOL_GPL(iommu_add_device);
11701173

1171-
void iommu_del_device(struct device *dev)
1172-
{
1173-
/*
1174-
* Some devices might not have IOMMU table and group
1175-
* and we needn't detach them from the associated
1176-
* IOMMU groups
1177-
*/
1178-
if (!device_iommu_mapped(dev)) {
1179-
pr_debug("iommu_tce: skipping device %s with no tbl\n",
1180-
dev_name(dev));
1181-
return;
1182-
}
1183-
1184-
iommu_group_remove_device(dev);
1185-
}
1186-
EXPORT_SYMBOL_GPL(iommu_del_device);
1187-
11881174
/*
11891175
* A simple iommu_table_group_ops which only allows reusing the existing
11901176
* iommu_table. This handles VFIO for POWER7 or the nested KVM.

arch/powerpc/kernel/isa-bridge.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ static int process_ISA_OF_ranges(struct device_node *isa_node,
9393
}
9494

9595
inval_range:
96-
if (!phb_io_base_phys) {
96+
if (phb_io_base_phys) {
9797
pr_err("no ISA IO ranges or unexpected isa range, mapping 64k\n");
9898
remap_isa_base(phb_io_base_phys, 0x10000);
99+
return 0;
99100
}
100-
return 0;
101+
return -EINVAL;
101102
}
102103

103104

arch/powerpc/mm/book3s64/radix_pgtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ void radix__ptep_set_access_flags(struct vm_area_struct *vma, pte_t *ptep,
10401040
pte_t entry, unsigned long address, int psize)
10411041
{
10421042
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);
10451045

10461046
unsigned long change = pte_val(entry) ^ pte_val(*ptep);
10471047
/*

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
101101
bpf_hdr = jit_data->header;
102102
proglen = jit_data->proglen;
103103
extra_pass = true;
104+
/* During extra pass, ensure index is reset before repopulating extable entries */
105+
cgctx.exentry_idx = 0;
104106
goto skip_init_ctx;
105107
}
106108

arch/powerpc/platforms/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ config CPM2
265265
config FSL_ULI1575
266266
bool "ULI1575 PCIe south bridge support"
267267
depends on FSL_SOC_BOOKE || PPC_86xx
268+
depends on PCI
268269
select FSL_PCI
269270
select GENERIC_ISA_DMA
270271
help

arch/powerpc/platforms/powernv/pci.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -865,28 +865,3 @@ void __init pnv_pci_init(void)
865865
/* Configure IOMMU DMA hooks */
866866
set_pci_dma_ops(&dma_iommu_ops);
867867
}
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);

0 commit comments

Comments
 (0)