Skip to content

Commit 19be9e8

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
Pull powerpc updates from Michael Ellerman: "There's some bug fixes or cleanups to facilitate fixes, a MAINTAINERS update, and a new syscall (bpf)" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: powerpc/numa: ensure per-cpu NUMA mappings are correct on topology update powerpc/numa: use cached value of update->cpu in update_cpu_topology cxl: Fix PSL error due to duplicate segment table entries powerpc/mm: Use appropriate ESID mask in copro_calculate_slb() cxl: Refactor cxl_load_segment() and find_free_sste() cxl: Disable secondary hash in segment table Revert "powerpc/powernv: Fix endian bug in LPC bus debugfs accessors" powernv: Use _GLOBAL_TOC for opal wrappers powerpc: Wire up sys_bpf() syscall MAINTAINERS: nx-842 driver maintainer change powerpc/mm: Remove redundant #if case powerpc/mm: Fix build error with hugetlfs disabled
2 parents 9f76628 + 2c0a33f commit 19be9e8

File tree

12 files changed

+56
-49
lines changed

12 files changed

+56
-49
lines changed

MAINTAINERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -4608,7 +4608,7 @@ S: Supported
46084608
F: drivers/crypto/nx/
46094609

46104610
IBM Power 842 compression accelerator
4611-
M: Nathan Fontenot <[email protected].ibm.com>
4611+
M: Dan Streetman <ddstreet@us.ibm.com>
46124612
S: Supported
46134613
F: drivers/crypto/nx/nx-842.c
46144614
F: include/linux/nx842.h

arch/powerpc/include/asm/hugetlb.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
7171

7272
void flush_dcache_icache_hugepage(struct page *page);
7373

74-
#if defined(CONFIG_PPC_MM_SLICES) || defined(CONFIG_PPC_SUBPAGE_PROT)
74+
#if defined(CONFIG_PPC_MM_SLICES)
7575
int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
7676
unsigned long len);
7777
#else

arch/powerpc/include/asm/systbl.h

+1
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,4 @@ SYSCALL_SPU(renameat2)
365365
SYSCALL_SPU(seccomp)
366366
SYSCALL_SPU(getrandom)
367367
SYSCALL_SPU(memfd_create)
368+
SYSCALL_SPU(bpf)

arch/powerpc/include/asm/unistd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <uapi/asm/unistd.h>
1313

1414

15-
#define __NR_syscalls 361
15+
#define __NR_syscalls 362
1616

1717
#define __NR__exit __NR_exit
1818
#define NR_syscalls __NR_syscalls

arch/powerpc/include/uapi/asm/unistd.h

+1
Original file line numberDiff line numberDiff line change
@@ -383,5 +383,6 @@
383383
#define __NR_seccomp 358
384384
#define __NR_getrandom 359
385385
#define __NR_memfd_create 360
386+
#define __NR_bpf 361
386387

387388
#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */

arch/powerpc/mm/copro_fault.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
9999
u64 vsid;
100100
int psize, ssize;
101101

102-
slb->esid = (ea & ESID_MASK) | SLB_ESID_V;
103-
104102
switch (REGION_ID(ea)) {
105103
case USER_REGION_ID:
106104
pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea);
@@ -133,6 +131,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
133131
vsid |= mmu_psize_defs[psize].sllp |
134132
((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0);
135133

134+
slb->esid = (ea & (ssize == MMU_SEGSIZE_1T ? ESID_MASK_1T : ESID_MASK)) | SLB_ESID_V;
136135
slb->vsid = vsid;
137136

138137
return 0;

arch/powerpc/mm/numa.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -1509,11 +1509,14 @@ static int update_cpu_topology(void *data)
15091509
cpu = smp_processor_id();
15101510

15111511
for (update = data; update; update = update->next) {
1512+
int new_nid = update->new_nid;
15121513
if (cpu != update->cpu)
15131514
continue;
15141515

1515-
unmap_cpu_from_node(update->cpu);
1516-
map_cpu_to_node(update->cpu, update->new_nid);
1516+
unmap_cpu_from_node(cpu);
1517+
map_cpu_to_node(cpu, new_nid);
1518+
set_cpu_numa_node(cpu, new_nid);
1519+
set_cpu_numa_mem(cpu, local_memory_node(new_nid));
15171520
vdso_getcpu_init();
15181521
}
15191522

arch/powerpc/mm/slice.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
682682
slice_convert(mm, mask, psize);
683683
}
684684

685+
#ifdef CONFIG_HUGETLB_PAGE
685686
/*
686687
* is_hugepage_only_range() is used by generic code to verify whether
687688
* a normal mmap mapping (non hugetlbfs) is valid on a given area.
@@ -726,4 +727,4 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
726727
#endif
727728
return !slice_check_fit(mask, available);
728729
}
729-
730+
#endif

arch/powerpc/platforms/powernv/opal-lpc.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
191191
{
192192
struct lpc_debugfs_entry *lpc = filp->private_data;
193193
u32 data, pos, len, todo;
194-
__be32 bedata;
195194
int rc;
196195

197196
if (!access_ok(VERIFY_WRITE, ubuf, count))
@@ -214,10 +213,9 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
214213
len = 2;
215214
}
216215
rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos,
217-
&bedata, len);
216+
&data, len);
218217
if (rc)
219218
return -ENXIO;
220-
data = be32_to_cpu(bedata);
221219
switch(len) {
222220
case 4:
223221
rc = __put_user((u32)data, (u32 __user *)ubuf);

arch/powerpc/platforms/powernv/opal-wrappers.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1); \
5858
*/
5959

6060
#define OPAL_CALL(name, token) \
61-
_GLOBAL(name); \
61+
_GLOBAL_TOC(name); \
6262
mflr r0; \
6363
std r0,16(r1); \
6464
li r0,token; \

drivers/misc/cxl/fault.c

+39-35
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,64 @@
2121

2222
#include "cxl.h"
2323

24-
static struct cxl_sste* find_free_sste(struct cxl_sste *primary_group,
25-
bool sec_hash,
26-
struct cxl_sste *secondary_group,
27-
unsigned int *lru)
24+
static bool sste_matches(struct cxl_sste *sste, struct copro_slb *slb)
2825
{
29-
unsigned int i, entry;
30-
struct cxl_sste *sste, *group = primary_group;
31-
32-
for (i = 0; i < 2; i++) {
33-
for (entry = 0; entry < 8; entry++) {
34-
sste = group + entry;
35-
if (!(be64_to_cpu(sste->esid_data) & SLB_ESID_V))
36-
return sste;
37-
}
38-
if (!sec_hash)
39-
break;
40-
group = secondary_group;
26+
return ((sste->vsid_data == cpu_to_be64(slb->vsid)) &&
27+
(sste->esid_data == cpu_to_be64(slb->esid)));
28+
}
29+
30+
/*
31+
* This finds a free SSTE for the given SLB, or returns NULL if it's already in
32+
* the segment table.
33+
*/
34+
static struct cxl_sste* find_free_sste(struct cxl_context *ctx,
35+
struct copro_slb *slb)
36+
{
37+
struct cxl_sste *primary, *sste, *ret = NULL;
38+
unsigned int mask = (ctx->sst_size >> 7) - 1; /* SSTP0[SegTableSize] */
39+
unsigned int entry;
40+
unsigned int hash;
41+
42+
if (slb->vsid & SLB_VSID_B_1T)
43+
hash = (slb->esid >> SID_SHIFT_1T) & mask;
44+
else /* 256M */
45+
hash = (slb->esid >> SID_SHIFT) & mask;
46+
47+
primary = ctx->sstp + (hash << 3);
48+
49+
for (entry = 0, sste = primary; entry < 8; entry++, sste++) {
50+
if (!ret && !(be64_to_cpu(sste->esid_data) & SLB_ESID_V))
51+
ret = sste;
52+
if (sste_matches(sste, slb))
53+
return NULL;
4154
}
55+
if (ret)
56+
return ret;
57+
4258
/* Nothing free, select an entry to cast out */
43-
if (sec_hash && (*lru & 0x8))
44-
sste = secondary_group + (*lru & 0x7);
45-
else
46-
sste = primary_group + (*lru & 0x7);
47-
*lru = (*lru + 1) & 0xf;
59+
ret = primary + ctx->sst_lru;
60+
ctx->sst_lru = (ctx->sst_lru + 1) & 0x7;
4861

49-
return sste;
62+
return ret;
5063
}
5164

5265
static void cxl_load_segment(struct cxl_context *ctx, struct copro_slb *slb)
5366
{
5467
/* mask is the group index, we search primary and secondary here. */
55-
unsigned int mask = (ctx->sst_size >> 7)-1; /* SSTP0[SegTableSize] */
56-
bool sec_hash = 1;
5768
struct cxl_sste *sste;
58-
unsigned int hash;
5969
unsigned long flags;
6070

61-
62-
sec_hash = !!(cxl_p1n_read(ctx->afu, CXL_PSL_SR_An) & CXL_PSL_SR_An_SC);
63-
64-
if (slb->vsid & SLB_VSID_B_1T)
65-
hash = (slb->esid >> SID_SHIFT_1T) & mask;
66-
else /* 256M */
67-
hash = (slb->esid >> SID_SHIFT) & mask;
68-
6971
spin_lock_irqsave(&ctx->sste_lock, flags);
70-
sste = find_free_sste(ctx->sstp + (hash << 3), sec_hash,
71-
ctx->sstp + ((~hash & mask) << 3), &ctx->sst_lru);
72+
sste = find_free_sste(ctx, slb);
73+
if (!sste)
74+
goto out_unlock;
7275

7376
pr_devel("CXL Populating SST[%li]: %#llx %#llx\n",
7477
sste - ctx->sstp, slb->vsid, slb->esid);
7578

7679
sste->vsid_data = cpu_to_be64(slb->vsid);
7780
sste->esid_data = cpu_to_be64(slb->esid);
81+
out_unlock:
7882
spin_unlock_irqrestore(&ctx->sste_lock, flags);
7983
}
8084

drivers/misc/cxl/native.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr)
417417
ctx->elem->haurp = 0; /* disable */
418418
ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1));
419419

420-
sr = CXL_PSL_SR_An_SC;
420+
sr = 0;
421421
if (ctx->master)
422422
sr |= CXL_PSL_SR_An_MP;
423423
if (mfspr(SPRN_LPCR) & LPCR_TC)
@@ -508,7 +508,7 @@ static int attach_dedicated(struct cxl_context *ctx, u64 wed, u64 amr)
508508
u64 sr;
509509
int rc;
510510

511-
sr = CXL_PSL_SR_An_SC;
511+
sr = 0;
512512
set_endian(sr);
513513
if (ctx->master)
514514
sr |= CXL_PSL_SR_An_MP;

0 commit comments

Comments
 (0)