Skip to content

Commit 75603b1

Browse files
committed
Merge tag 'powerpc-5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull more powerpc fixes from Michael Ellerman: - Fix a bug in copying of sigset_t for 32-bit systems, which caused X to not start. - Fix handling of shared LSIs (rare) with the xive interrupt controller (Power9/10). - Fix missing TOC setup in some KVM code, which could result in oopses depending on kernel data layout. - Fix DMA mapping when we have persistent memory and only one DMA window available. - Fix further problems with STRICT_KERNEL_RWX on 8xx, exposed by a recent fix. - A couple of other minor fixes. Thanks to Alexey Kardashevskiy, Aneesh Kumar K.V, Cédric Le Goater, Christian Zigotzky, Christophe Leroy, Daniel Axtens, Finn Thain, Greg Kurz, Masahiro Yamada, Nicholas Piggin, and Uwe Kleine-König. * tag 'powerpc-5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/xive: Change IRQ domain to a tree domain powerpc/8xx: Fix pinned TLBs with CONFIG_STRICT_KERNEL_RWX powerpc/signal32: Fix sigset_t copy powerpc/book3e: Fix TLBCAM preset at boot powerpc/pseries/ddw: Do not try direct mapping with persistent memory and one window powerpc/pseries/ddw: simplify enable_ddw() powerpc/pseries/ddw: Revert "Extend upper limit for huge DMA window for persistent memory" powerpc/pseries: Fix numa FORM2 parsing fallback code powerpc/pseries: rename numa_dist_table to form2_distances powerpc: clean vdso32 and vdso64 directories powerpc/83xx/mpc8349emitx: Drop unused variable KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr()
2 parents 61eb495 + 8e80a73 commit 75603b1

File tree

11 files changed

+52
-59
lines changed

11 files changed

+52
-59
lines changed

arch/powerpc/kernel/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,6 @@ clean-files := vmlinux.lds
196196
# Force dependency (incbin is bad)
197197
$(obj)/vdso32_wrapper.o : $(obj)/vdso32/vdso32.so.dbg
198198
$(obj)/vdso64_wrapper.o : $(obj)/vdso64/vdso64.so.dbg
199+
200+
# for cleaning
201+
subdir- += vdso32 vdso64

arch/powerpc/kernel/head_8xx.S

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ _GLOBAL(mmu_pin_tlb)
733733
#ifdef CONFIG_PIN_TLB_DATA
734734
LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET)
735735
LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED)
736+
li r8, 0
736737
#ifdef CONFIG_PIN_TLB_IMMR
737738
li r0, 3
738739
#else
@@ -741,26 +742,26 @@ _GLOBAL(mmu_pin_tlb)
741742
mtctr r0
742743
cmpwi r4, 0
743744
beq 4f
744-
LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT)
745745
LOAD_REG_ADDR(r9, _sinittext)
746746

747747
2: ori r0, r6, MD_EVALID
748+
ori r12, r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT
748749
mtspr SPRN_MD_CTR, r5
749750
mtspr SPRN_MD_EPN, r0
750751
mtspr SPRN_MD_TWC, r7
751-
mtspr SPRN_MD_RPN, r8
752+
mtspr SPRN_MD_RPN, r12
752753
addi r5, r5, 0x100
753754
addis r6, r6, SZ_8M@h
754755
addis r8, r8, SZ_8M@h
755756
cmplw r6, r9
756757
bdnzt lt, 2b
757-
758-
4: LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT)
758+
4:
759759
2: ori r0, r6, MD_EVALID
760+
ori r12, r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT
760761
mtspr SPRN_MD_CTR, r5
761762
mtspr SPRN_MD_EPN, r0
762763
mtspr SPRN_MD_TWC, r7
763-
mtspr SPRN_MD_RPN, r8
764+
mtspr SPRN_MD_RPN, r12
764765
addi r5, r5, 0x100
765766
addis r6, r6, SZ_8M@h
766767
addis r8, r8, SZ_8M@h
@@ -781,7 +782,7 @@ _GLOBAL(mmu_pin_tlb)
781782
#endif
782783
#if defined(CONFIG_PIN_TLB_IMMR) || defined(CONFIG_PIN_TLB_DATA)
783784
lis r0, (MD_RSV4I | MD_TWAM)@h
784-
mtspr SPRN_MI_CTR, r0
785+
mtspr SPRN_MD_CTR, r0
785786
#endif
786787
mtspr SPRN_SRR1, r10
787788
mtspr SPRN_SRR0, r11

arch/powerpc/kernel/signal.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ static inline int __get_user_sigset(sigset_t *dst, const sigset_t __user *src)
2525

2626
return __get_user(dst->sig[0], (u64 __user *)&src->sig[0]);
2727
}
28-
#define unsafe_get_user_sigset(dst, src, label) \
29-
unsafe_get_user((dst)->sig[0], (u64 __user *)&(src)->sig[0], label)
28+
#define unsafe_get_user_sigset(dst, src, label) do { \
29+
sigset_t *__dst = dst; \
30+
const sigset_t __user *__src = src; \
31+
int i; \
32+
\
33+
for (i = 0; i < _NSIG_WORDS; i++) \
34+
unsafe_get_user(__dst->sig[i], &__src->sig[i], label); \
35+
} while (0)
3036

3137
#ifdef CONFIG_VSX
3238
extern unsigned long copy_vsx_to_user(void __user *to,

arch/powerpc/kvm/book3s_hv_rmhandlers.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ hcall_real_table:
20052005
.globl hcall_real_table_end
20062006
hcall_real_table_end:
20072007

2008-
_GLOBAL(kvmppc_h_set_xdabr)
2008+
_GLOBAL_TOC(kvmppc_h_set_xdabr)
20092009
EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
20102010
andi. r0, r5, DABRX_USER | DABRX_KERNEL
20112011
beq 6f
@@ -2015,7 +2015,7 @@ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
20152015
6: li r3, H_PARAMETER
20162016
blr
20172017

2018-
_GLOBAL(kvmppc_h_set_dabr)
2018+
_GLOBAL_TOC(kvmppc_h_set_dabr)
20192019
EXPORT_SYMBOL_GPL(kvmppc_h_set_dabr)
20202020
li r5, DABRX_USER | DABRX_KERNEL
20212021
3:

arch/powerpc/mm/nohash/kaslr_booke.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static unsigned long __init kaslr_choose_location(void *dt_ptr, phys_addr_t size
314314
pr_warn("KASLR: No safe seed for randomizing the kernel base.\n");
315315

316316
ram = min_t(phys_addr_t, __max_low_memory, size);
317-
ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true, false);
317+
ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true, true);
318318
linear_sz = min_t(unsigned long, ram, SZ_512M);
319319

320320
/* If the linear size is smaller than 64M, do not randmize */

arch/powerpc/mm/nohash/tlb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static void early_init_this_mmu(void)
645645

646646
if (map)
647647
linear_map_top = map_mem_in_cams(linear_map_top,
648-
num_cams, true, true);
648+
num_cams, false, true);
649649
}
650650
#endif
651651

@@ -766,7 +766,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
766766
num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
767767

768768
linear_sz = map_mem_in_cams(first_memblock_size, num_cams,
769-
false, true);
769+
true, true);
770770

771771
ppc64_rma_size = min_t(u64, linear_sz, 0x40000000);
772772
} else

arch/powerpc/mm/numa.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ static void initialize_form2_numa_distance_lookup_table(void)
376376
{
377377
int i, j;
378378
struct device_node *root;
379-
const __u8 *numa_dist_table;
379+
const __u8 *form2_distances;
380380
const __be32 *numa_lookup_index;
381-
int numa_dist_table_length;
381+
int form2_distances_length;
382382
int max_numa_index, distance_index;
383383

384384
if (firmware_has_feature(FW_FEATURE_OPAL))
@@ -392,45 +392,41 @@ static void initialize_form2_numa_distance_lookup_table(void)
392392
max_numa_index = of_read_number(&numa_lookup_index[0], 1);
393393

394394
/* first element of the array is the size and is encode-int */
395-
numa_dist_table = of_get_property(root, "ibm,numa-distance-table", NULL);
396-
numa_dist_table_length = of_read_number((const __be32 *)&numa_dist_table[0], 1);
395+
form2_distances = of_get_property(root, "ibm,numa-distance-table", NULL);
396+
form2_distances_length = of_read_number((const __be32 *)&form2_distances[0], 1);
397397
/* Skip the size which is encoded int */
398-
numa_dist_table += sizeof(__be32);
398+
form2_distances += sizeof(__be32);
399399

400-
pr_debug("numa_dist_table_len = %d, numa_dist_indexes_len = %d\n",
401-
numa_dist_table_length, max_numa_index);
400+
pr_debug("form2_distances_len = %d, numa_dist_indexes_len = %d\n",
401+
form2_distances_length, max_numa_index);
402402

403403
for (i = 0; i < max_numa_index; i++)
404404
/* +1 skip the max_numa_index in the property */
405405
numa_id_index_table[i] = of_read_number(&numa_lookup_index[i + 1], 1);
406406

407407

408-
if (numa_dist_table_length != max_numa_index * max_numa_index) {
408+
if (form2_distances_length != max_numa_index * max_numa_index) {
409409
WARN(1, "Wrong NUMA distance information\n");
410-
/* consider everybody else just remote. */
411-
for (i = 0; i < max_numa_index; i++) {
412-
for (j = 0; j < max_numa_index; j++) {
413-
int nodeA = numa_id_index_table[i];
414-
int nodeB = numa_id_index_table[j];
415-
416-
if (nodeA == nodeB)
417-
numa_distance_table[nodeA][nodeB] = LOCAL_DISTANCE;
418-
else
419-
numa_distance_table[nodeA][nodeB] = REMOTE_DISTANCE;
420-
}
421-
}
410+
form2_distances = NULL; // don't use it
422411
}
423-
424412
distance_index = 0;
425413
for (i = 0; i < max_numa_index; i++) {
426414
for (j = 0; j < max_numa_index; j++) {
427415
int nodeA = numa_id_index_table[i];
428416
int nodeB = numa_id_index_table[j];
429-
430-
numa_distance_table[nodeA][nodeB] = numa_dist_table[distance_index++];
431-
pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, numa_distance_table[nodeA][nodeB]);
417+
int dist;
418+
419+
if (form2_distances)
420+
dist = form2_distances[distance_index++];
421+
else if (nodeA == nodeB)
422+
dist = LOCAL_DISTANCE;
423+
else
424+
dist = REMOTE_DISTANCE;
425+
numa_distance_table[nodeA][nodeB] = dist;
426+
pr_debug("dist[%d][%d]=%d ", nodeA, nodeB, dist);
432427
}
433428
}
429+
434430
of_node_put(root);
435431
}
436432

arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ static int mcu_probe(struct i2c_client *client)
186186
static int mcu_remove(struct i2c_client *client)
187187
{
188188
struct mcu *mcu = i2c_get_clientdata(client);
189-
int ret;
190189

191190
kthread_stop(shutdown_thread);
192191

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,15 +1094,6 @@ static phys_addr_t ddw_memory_hotplug_max(void)
10941094
phys_addr_t max_addr = memory_hotplug_max();
10951095
struct device_node *memory;
10961096

1097-
/*
1098-
* The "ibm,pmemory" can appear anywhere in the address space.
1099-
* Assuming it is still backed by page structs, set the upper limit
1100-
* for the huge DMA window as MAX_PHYSMEM_BITS.
1101-
*/
1102-
if (of_find_node_by_type(NULL, "ibm,pmemory"))
1103-
return (sizeof(phys_addr_t) * 8 <= MAX_PHYSMEM_BITS) ?
1104-
(phys_addr_t) -1 : (1ULL << MAX_PHYSMEM_BITS);
1105-
11061097
for_each_node_by_type(memory, "memory") {
11071098
unsigned long start, size;
11081099
int n_mem_addr_cells, n_mem_size_cells, len;
@@ -1238,7 +1229,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
12381229
u32 ddw_avail[DDW_APPLICABLE_SIZE];
12391230
struct dma_win *window;
12401231
struct property *win64;
1241-
bool ddw_enabled = false;
12421232
struct failed_ddw_pdn *fpdn;
12431233
bool default_win_removed = false, direct_mapping = false;
12441234
bool pmem_present;
@@ -1253,7 +1243,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
12531243

12541244
if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) {
12551245
direct_mapping = (len >= max_ram_len);
1256-
ddw_enabled = true;
12571246
goto out_unlock;
12581247
}
12591248

@@ -1367,8 +1356,10 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
13671356
len = order_base_2(query.largest_available_block << page_shift);
13681357
win_name = DMA64_PROPNAME;
13691358
} else {
1370-
direct_mapping = true;
1371-
win_name = DIRECT64_PROPNAME;
1359+
direct_mapping = !default_win_removed ||
1360+
(len == MAX_PHYSMEM_BITS) ||
1361+
(!pmem_present && (len == max_ram_len));
1362+
win_name = direct_mapping ? DIRECT64_PROPNAME : DMA64_PROPNAME;
13721363
}
13731364

13741365
ret = create_ddw(dev, ddw_avail, &create, page_shift, len);
@@ -1406,8 +1397,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
14061397
dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n",
14071398
dn, ret);
14081399

1409-
/* Make sure to clean DDW if any TCE was set*/
1410-
clean_dma_window(pdn, win64->value);
1400+
/* Make sure to clean DDW if any TCE was set*/
1401+
clean_dma_window(pdn, win64->value);
14111402
goto out_del_list;
14121403
}
14131404
} else {
@@ -1454,7 +1445,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
14541445
spin_unlock(&dma_win_list_lock);
14551446

14561447
dev->dev.archdata.dma_offset = win_addr;
1457-
ddw_enabled = true;
14581448
goto out_unlock;
14591449

14601450
out_del_list:
@@ -1490,10 +1480,10 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
14901480
* as RAM, then we failed to create a window to cover persistent
14911481
* memory and need to set the DMA limit.
14921482
*/
1493-
if (pmem_present && ddw_enabled && direct_mapping && len == max_ram_len)
1483+
if (pmem_present && direct_mapping && len == max_ram_len)
14941484
dev->dev.bus_dma_limit = dev->dev.archdata.dma_offset + (1ULL << len);
14951485

1496-
return ddw_enabled && direct_mapping;
1486+
return direct_mapping;
14971487
}
14981488

14991489
static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)

arch/powerpc/sysdev/xive/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ config PPC_XIVE
33
bool
44
select PPC_SMP_MUXED_IPI
55
select HARDIRQS_SW_RESEND
6-
select IRQ_DOMAIN_NOMAP
76

87
config PPC_XIVE_NATIVE
98
bool

0 commit comments

Comments
 (0)