Re: [PATCHv8 1/5] powerpc/setup : Enable boot_cpu_hwid for PPC32

2023-10-15 Thread Sourabh Jain

Hello Pingfan,


With this patch series applied, the kdump kernel fails to boot on
powerpc with nr_cpus=1.

Console logs:
---
[root]# echo c > /proc/sysrq-trigger
[   74.783235] sysrq: Trigger a crash
[   74.783244] Kernel panic - not syncing: sysrq triggered crash
[   74.783252] CPU: 58 PID: 3838 Comm: bash Kdump: loaded Not tainted
6.6.0-rc5pf-nr-cpus+ #3
[   74.783259] Hardware name: POWER10 (raw) phyp pSeries
[   74.783275] Call Trace:
[   74.783280] [c0020f4ebac0] [c0ed9f38]
dump_stack_lvl+0x6c/0x9c (unreliable)
[   74.783291] [c0020f4ebaf0] [c0150300] panic+0x178/0x438
[   74.783298] [c0020f4ebb90] [c0936d48]
sysrq_handle_crash+0x28/0x30
[   74.783304] [c0020f4ebbf0] [c093773c]
__handle_sysrq+0x10c/0x250
[   74.783309] [c0020f4ebc90] [c0937fa8]
write_sysrq_trigger+0xc8/0x168
[   74.783314] [c0020f4ebcd0] [c0665d8c]
proc_reg_write+0x10c/0x1b0
[   74.783321] [c0020f4ebd00] [c058da54]
vfs_write+0x104/0x4b0
[   74.783326] [c0020f4ebdc0] [c058dfdc]
ksys_write+0x7c/0x140
[   74.783331] [c0020f4ebe10] [c0033a64]
system_call_exception+0x144/0x3a0
[   74.783337] [c0020f4ebe50] [c000c554]
system_call_common+0xf4/0x258
[   74.783343] --- interrupt: c00 at 0x7fffa0721594
[   74.783352] NIP:  7fffa0721594 LR: 7fffa0697bf4 CTR:

[   74.783364] REGS: c0020f4ebe80 TRAP: 0c00   Not tainted
(6.6.0-rc5pf-nr-cpus+)
[   74.783376] MSR:  8280f033
  CR: 2802  XER: 
[   74.783394] IRQMASK: 0
[   74.783394] GPR00: 0004 7c4b6800 7fffa0807300
0001
[   74.783394] GPR04: 00013549ea60 0002 0010

[   74.783394] GPR08:   

[   74.783394] GPR12:  7fffa0abaf70 4000
00011a0f9798
[   74.783394] GPR16: 00011a0f9724 00011a097688 00011a02ff70
00011a0fd568
[   74.783394] GPR20: 000135554bf0 0001 00011a0aa478
7c4b6a24
[   74.783394] GPR24: 7c4b6a20 00011a0faf94 0002
00013549ea60
[   74.783394] GPR28: 0002 7fffa08017a0 00013549ea60
0002
[   74.783440] NIP [7fffa0721594] 0x7fffa0721594
[   74.783443] LR [7fffa0697bf4] 0x7fffa0697bf4
[   74.783447] --- interrupt: c00
I'm in purgatory
[0.00] radix-mmu: Page sizes from device-tree:
[0.00] radix-mmu: Page size shift = 12 AP=0x0
[0.00] radix-mmu: Page size shift = 16 AP=0x5
[0.00] radix-mmu: Page size shift = 21 AP=0x1
[0.00] radix-mmu: Page size shift = 30 AP=0x2
[0.00] Activating Kernel Userspace Access Prevention
[0.00] Activating Kernel Userspace Execution Prevention
[0.00] radix-mmu: Mapped 0x-0x0001
with 64.0 KiB pages (exec)
[0.00] radix-mmu: Mapped 0x0001-0x0020
with 64.0 KiB pages
[0.00] radix-mmu: Mapped 0x0020-0x2000
with 2.00 MiB pages
[0.00] radix-mmu: Mapped 0x2000-0x2260
with 2.00 MiB pages (exec)
[0.00] radix-mmu: Mapped 0x2260-0x4000
with 2.00 MiB pages
[0.00] radix-mmu: Mapped 0x4000-0x00018000
with 1.00 GiB pages
[0.00] radix-mmu: Mapped 0x00018000-0x0001a000
with 2.00 MiB pages
[0.00] lpar: Using radix MMU under hypervisor
[0.00] Linux version 6.6.0-rc5pf-nr-cpus+
(r...@ltcever7x0-lp1.aus.stglabs.ibm.com) (gcc (GCC) 8.5.0 20210514 (Red
Hat 8.5.0-20), GNU ld version 2.30-123.el8) #3 SMP Mon Oct  9 11:07:
41 CDT 2023
[0.00] Found initrd at 0xc00022e6:0xc000248f08d8
[0.00] Hardware name: IBM,9043-MRX POWER10 (raw) 0x800200
0xf06 of:IBM,FW1060.00 (NM1060_016) hv:phyp pSeries
[0.00] printk: bootconsole [udbg0] enabled
[0.00] the round shift between dt seq and the cpu logic number:
56
[0.00] BUG: Unable to handle kernel data access on write at
0xc001a000
[0.00] Faulting instruction address: 0xc00022009c64
[0.00] Oops: Kernel access of bad area, sig: 11 [#1]
[0.00] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
[0.00] Modules linked in:
[0.00] CPU: 2 PID: 0 Comm: swapper Not tainted
6.6.0-rc5pf-nr-cpus+ #3
[0.00] Hardware name:  POWER10 (raw)  hv:phyp pSeries
[0.00] NIP:  c00022009c64 LR: c00022009c54 CTR:
c000201ff348
[0.00] REGS: c00022aebb00 TRAP: 0300   Not tainted
(6.6.0-rc5pf-nr-cpus+)
[0.00] MSR:  80001033  CR: 28222824
XER: 0001
[0.00] CFAR: c00020031574 DAR: c001a000 DSISR:
4200 IRQMASK: 1
[0.00] GPR00: c00022009ba0 c00022aebda0 c000213d1300
0004
[0.00] GPR04: 0001 c00022a

[PATCH v2 3/3] powerpc/32: Convert patch_instruction() to patch_uint()

2023-10-15 Thread Benjamin Gray
These changes are for patch_instruction() uses on data. Unlike ppc64
these should not be incorrect as-is, but using the patch_uint() alias
better reflects what kind of data being patched and allows for
benchmarking the effect of different patch_* implementations (e.g.,
skipping instruction flushing when patching data).

Signed-off-by: Benjamin Gray 
---
 arch/powerpc/kernel/static_call.c | 2 +-
 arch/powerpc/platforms/powermac/smp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/static_call.c 
b/arch/powerpc/kernel/static_call.c
index 863a7aa24650..1502b7e439ca 100644
--- a/arch/powerpc/kernel/static_call.c
+++ b/arch/powerpc/kernel/static_call.c
@@ -17,7 +17,7 @@ void arch_static_call_transform(void *site, void *tramp, void 
*func, bool tail)
mutex_lock(&text_mutex);
 
if (func && !is_short) {
-   err = patch_instruction(tramp + PPC_SCT_DATA, ppc_inst(target));
+   err = patch_ulong(tramp + PPC_SCT_DATA, target);
if (err)
goto out;
}
diff --git a/arch/powerpc/platforms/powermac/smp.c 
b/arch/powerpc/platforms/powermac/smp.c
index c83d1e14077e..cfc1cd10135d 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -827,7 +827,7 @@ static int smp_core99_kick_cpu(int nr)
mdelay(1);
 
/* Restore our exception vector */
-   patch_instruction(vector, ppc_inst(save_vector));
+   patch_uint(vector, save_vector);
 
local_irq_restore(flags);
if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
-- 
2.39.2



[PATCH v2 2/3] powerpc/64: Convert patch_instruction() to patch_u32()

2023-10-15 Thread Benjamin Gray
This use of patch_instruction() is working on 32 bit data, and can fail
if the data looks like a prefixed instruction and the extra write
crosses a page boundary. Use patch_u32() to fix the write size.

Fixes: 8734b41b3efe ("powerpc/module_64: Fix livepatching for RO modules")
Link: https://lore.kernel.org/all/20230203004649.1f59dbd4@yea/
Signed-off-by: Benjamin Gray 

---

v2: * Added the fixes tag, it seems appropriate even if the subject does
  mention a more robust solution being required.

patch_u64() should be more efficient, but judging from the bug report
it doesn't seem like the data is doubleword aligned.
---
 arch/powerpc/kernel/module_64.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 7112adc597a8..e9bab599d0c2 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -651,12 +651,11 @@ static inline int create_stub(const Elf64_Shdr *sechdrs,
// func_desc_t is 8 bytes if ABIv2, else 16 bytes
desc = func_desc(addr);
for (i = 0; i < sizeof(func_desc_t) / sizeof(u32); i++) {
-   if (patch_instruction(((u32 *)&entry->funcdata) + i,
- ppc_inst(((u32 *)(&desc))[i])))
+   if (patch_u32(((u32 *)&entry->funcdata) + i, ((u32 *)&desc)[i]))
return 0;
}
 
-   if (patch_instruction(&entry->magic, ppc_inst(STUB_MAGIC)))
+   if (patch_u32(&entry->magic, STUB_MAGIC))
return 0;
 
return 1;
-- 
2.39.2



[PATCH v2 1/3] powerpc/code-patching: Add generic memory patching

2023-10-15 Thread Benjamin Gray
patch_instruction() is designed for patching instructions in otherwise
readonly memory. Other consumers also sometimes need to patch readonly
memory, so have abused patch_instruction() for arbitrary data patches.

This is a problem on ppc64 as patch_instruction() decides on the patch
width using the 'instruction' opcode to see if it's a prefixed
instruction. Data that triggers this can lead to larger writes, possibly
crossing a page boundary and failing the write altogether.

Introduce patch_uint(), and patch_ulong(), with aliases patch_u32(), and
patch_u64() (on ppc64) designed for aligned data patches. The patch
size is now determined by the called function, and is passed as an
additional parameter to generic internals.

While the instruction flushing is not required for data patches, the
use cases for data patching (mainly module loading and static calls)
are less performance sensitive than for instruction patching
(ftrace activation). So the instruction flushing remains unconditional
in this patch.

ppc32 does not support prefixed instructions, so is unaffected by the
original issue. Care is taken in not exposing the size parameter in the
public (non-static) interface, so the compiler can const-propagate it
away.

Signed-off-by: Benjamin Gray 

---

v2: * Deduplicate patch_32() definition
* Use u32 for val32
* Remove noinline
---
 arch/powerpc/include/asm/code-patching.h | 33 
 arch/powerpc/lib/code-patching.c | 66 ++--
 2 files changed, 83 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/code-patching.h 
b/arch/powerpc/include/asm/code-patching.h
index 3f881548fb61..7c6056bb1706 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -75,6 +75,39 @@ int patch_branch(u32 *addr, unsigned long target, int flags);
 int patch_instruction(u32 *addr, ppc_inst_t instr);
 int raw_patch_instruction(u32 *addr, ppc_inst_t instr);
 
+/*
+ * patch_uint() and patch_ulong() should only be called on addresses where the
+ * patch does not cross a cacheline, otherwise it may not be flushed properly
+ * and mixes of new and stale data may be observed. It cannot cross a page
+ * boundary, as only the target page is mapped as writable.
+ *
+ * patch_instruction() and other instruction patchers automatically satisfy 
this
+ * requirement due to instruction alignment requirements.
+ */
+
+#ifdef CONFIG_PPC64
+
+int patch_uint(void *addr, unsigned int val);
+int patch_ulong(void *addr, unsigned long val);
+
+#define patch_u64 patch_ulong
+
+#else
+
+static inline int patch_uint(u32 *addr, unsigned int val)
+{
+   return patch_instruction(addr, ppc_inst(val));
+}
+
+static inline int patch_ulong(void *addr, unsigned long val)
+{
+   return patch_instruction(addr, ppc_inst(val));
+}
+
+#endif
+
+#define patch_u32 patch_uint
+
 static inline unsigned long patch_site_addr(s32 *site)
 {
return (unsigned long)site + *site;
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index b00112d7ad46..60289332412f 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -20,15 +20,14 @@
 #include 
 #include 
 
-static int __patch_instruction(u32 *exec_addr, ppc_inst_t instr, u32 
*patch_addr)
+static int __patch_memory(void *exec_addr, unsigned long val, void *patch_addr,
+ bool is_dword)
 {
-   if (!ppc_inst_prefixed(instr)) {
-   u32 val = ppc_inst_val(instr);
+   if (!IS_ENABLED(CONFIG_PPC64) || likely(!is_dword)) {
+   u32 val32 = val;
 
-   __put_kernel_nofault(patch_addr, &val, u32, failed);
+   __put_kernel_nofault(patch_addr, &val32, u32, failed);
} else {
-   u64 val = ppc_inst_as_ulong(instr);
-
__put_kernel_nofault(patch_addr, &val, u64, failed);
}
 
@@ -43,7 +42,10 @@ static int __patch_instruction(u32 *exec_addr, ppc_inst_t 
instr, u32 *patch_addr
 
 int raw_patch_instruction(u32 *addr, ppc_inst_t instr)
 {
-   return __patch_instruction(addr, instr, addr);
+   if (ppc_inst_prefixed(instr))
+   return __patch_memory(addr, ppc_inst_as_ulong(instr), addr, 
true);
+   else
+   return __patch_memory(addr, ppc_inst_val(instr), addr, false);
 }
 
 struct patch_context {
@@ -278,7 +280,7 @@ static void unmap_patch_area(unsigned long addr)
flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
 }
 
-static int __do_patch_instruction_mm(u32 *addr, ppc_inst_t instr)
+static int __do_patch_memory_mm(void *addr, unsigned long val, bool is_dword)
 {
int err;
u32 *patch_addr;
@@ -307,7 +309,7 @@ static int __do_patch_instruction_mm(u32 *addr, ppc_inst_t 
instr)
 
orig_mm = start_using_temp_mm(patching_mm);
 
-   err = __patch_instruction(addr, instr, patch_addr);
+   err = __patch_memory(addr, val, patch_addr, is_dword);
 
/* hwsync performed by __patch_

[PATCH v2 0/3] Add generic data patching functions

2023-10-15 Thread Benjamin Gray
Currently patch_instruction() bases the write length on the value being
written. If the value looks like a prefixed instruction it writes 8 bytes,
otherwise it writes 4 bytes. This makes it potentially buggy to use for
writing arbitrary data, as if you want to write 4 bytes but it decides to
write 8 bytes it may clobber the following memory or be unaligned and
trigger an oops if it tries to cross a page boundary.

To solve this, this series pulls out the size parameter to the 'top' of
the text patching logic, and propagates it through the various functions.

The two sizes supported are int and long; this allows for patching
instructions and pointers on both ppc32 and ppc64. On ppc32 these are the
same size, so care is taken to only use the size parameter on static
functions, so the compiler can optimise it out entirely. Unfortunately
GCC trips over its own feet here and won't optimise in a way that is
optimal for strict RWX (mpc85xx_smp_defconfig) and no RWX
(pmac32_defconfig).

In the first case, patch_memory() is very large and can only be inlined
if a single function calls it. While the source only calls it in
patch_instruction(), an earlier optimisation pass inlined
patch_instruction() into patch_branch(), so now there are 'two' references
to patch_memory() and it cannot be inlined into patch_instruction().
Instead patch_instruction() becomes a single branch directly to
patch_memory().

We can fix this by marking patch_instruction() as noinline, but this
prevents patch_memory() from being directly inlined into patch_branch()
when RWX is disabled and patch_memory() is very small.

It may be possible to avoid this by merging together patch_instruction()
and patch_memory() on ppc32, but the only way I can think to do this
without duplicating the implementation involves using the preprocessor
to change if is_dword is a parameter or a local variable, which is gross.

For now I've removed the noinline, because at least the compiler might
get smarter in future and do the inlines correctly. If noinline remains
then there is no chance of it working.

Changes from v1:
  * Addressed the v1 review actions
  * Removed noinline (for now)

v1: 
https://patchwork.ozlabs.org/project/linuxppc-dev/cover/20230207015643.590684-1-bg...@linux.ibm.com/

Benjamin Gray (3):
  powerpc/code-patching: Add generic memory patching
  powerpc/64: Convert patch_instruction() to patch_u32()
  powerpc/32: Convert patch_instruction() to patch_uint()

 arch/powerpc/include/asm/code-patching.h | 33 
 arch/powerpc/kernel/module_64.c  |  5 +-
 arch/powerpc/kernel/static_call.c|  2 +-
 arch/powerpc/lib/code-patching.c | 66 ++--
 arch/powerpc/platforms/powermac/smp.c|  2 +-
 5 files changed, 87 insertions(+), 21 deletions(-)

-- 
2.39.2


[powerpc:merge] BUILD SUCCESS 16cbbabfa2a7d32f7d4eae046dda0ece2f157a70

2023-10-15 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
merge
branch HEAD: 16cbbabfa2a7d32f7d4eae046dda0ece2f157a70  Automatic merge of 
'next' into merge (2023-10-15 20:56)

elapsed time: 740m

configs tested: 104
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

tested configs:
alpha allnoconfig   gcc  
alphaallyesconfig   gcc  
alpha   defconfig   gcc  
arc  allmodconfig   gcc  
arc   allnoconfig   gcc  
arc  allyesconfig   gcc  
arc defconfig   gcc  
arc   randconfig-001-20231015   gcc  
arm  allmodconfig   gcc  
arm   allnoconfig   gcc  
arm  allyesconfig   gcc  
arm defconfig   gcc  
arm   randconfig-001-20231015   gcc  
arm64allmodconfig   gcc  
arm64 allnoconfig   gcc  
arm64allyesconfig   gcc  
arm64   defconfig   gcc  
csky allmodconfig   gcc  
csky  allnoconfig   gcc  
csky allyesconfig   gcc  
cskydefconfig   gcc  
i386 allmodconfig   gcc  
i386  allnoconfig   gcc  
i386 allyesconfig   gcc  
i386  debian-10.3   gcc  
i386defconfig   gcc  
i386  randconfig-001-20231015   gcc  
i386  randconfig-002-20231015   gcc  
i386  randconfig-003-20231015   gcc  
i386  randconfig-004-20231015   gcc  
i386  randconfig-005-20231015   gcc  
i386  randconfig-006-20231015   gcc  
loongarchallmodconfig   gcc  
loongarch allnoconfig   gcc  
loongarchallyesconfig   gcc  
loongarch   defconfig   gcc  
loongarch randconfig-001-20231015   gcc  
m68k allmodconfig   gcc  
m68k  allnoconfig   gcc  
m68k allyesconfig   gcc  
m68kdefconfig   gcc  
microblaze   allmodconfig   gcc  
microblazeallnoconfig   gcc  
microblaze   allyesconfig   gcc  
microblaze  defconfig   gcc  
mips allmodconfig   gcc  
mips  allnoconfig   gcc  
mips allyesconfig   gcc  
nios2allmodconfig   gcc  
nios2 allnoconfig   gcc  
nios2allyesconfig   gcc  
nios2   defconfig   gcc  
openrisc allmodconfig   gcc  
openrisc  allnoconfig   gcc  
openrisc allyesconfig   gcc  
openriscdefconfig   gcc  
parisc   allmodconfig   gcc  
pariscallnoconfig   gcc  
parisc   allyesconfig   gcc  
parisc  defconfig   gcc  
parisc64defconfig   gcc  
powerpc  allmodconfig   gcc  
powerpc   allnoconfig   gcc  
powerpc  allyesconfig   gcc  
riscvallmodconfig   gcc  
riscv allnoconfig   gcc  
riscvallyesconfig   gcc  
riscv   defconfig   gcc  
riscv randconfig-001-20231015   gcc  
riscv  rv32_defconfig   gcc  
s390 allmodconfig   gcc  
s390  allnoconfig   gcc  
s390 allyesconfig   gcc  
s390defconfig   gcc  
s390  randconfig-001-20231015   gcc  
sh   allmodconfig   gcc  
shallnoconfig   gcc  
sh   allyesconfig   gcc  
sh  defconfig   gcc  
sparcallmodconfig   gcc  
sparc allnoconfig   gcc  
sparcallyesconfig   gcc  
sparc   defconfig   gcc  
sparc randconfig-001-20231015   gcc  
sparc64  allmodconfig   gcc

[powerpc:fixes-test] BUILD SUCCESS ff9e8f41513669e290f6e1904e1bc75950584491

2023-10-15 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
fixes-test
branch HEAD: ff9e8f41513669e290f6e1904e1bc75950584491  powerpc/mm: Allow 
ARCH_FORCE_MAX_ORDER up to 12

elapsed time: 727m

configs tested: 104
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

tested configs:
alpha allnoconfig   gcc  
alphaallyesconfig   gcc  
alpha   defconfig   gcc  
arc  allmodconfig   gcc  
arc   allnoconfig   gcc  
arc  allyesconfig   gcc  
arc defconfig   gcc  
arc   randconfig-001-20231015   gcc  
arm  allmodconfig   gcc  
arm   allnoconfig   gcc  
arm  allyesconfig   gcc  
arm defconfig   gcc  
arm   randconfig-001-20231015   gcc  
arm64allmodconfig   gcc  
arm64 allnoconfig   gcc  
arm64allyesconfig   gcc  
arm64   defconfig   gcc  
csky allmodconfig   gcc  
csky  allnoconfig   gcc  
csky allyesconfig   gcc  
cskydefconfig   gcc  
i386 allmodconfig   gcc  
i386  allnoconfig   gcc  
i386 allyesconfig   gcc  
i386  debian-10.3   gcc  
i386defconfig   gcc  
i386  randconfig-001-20231015   gcc  
i386  randconfig-002-20231015   gcc  
i386  randconfig-003-20231015   gcc  
i386  randconfig-004-20231015   gcc  
i386  randconfig-005-20231015   gcc  
i386  randconfig-006-20231015   gcc  
loongarchallmodconfig   gcc  
loongarch allnoconfig   gcc  
loongarchallyesconfig   gcc  
loongarch   defconfig   gcc  
loongarch randconfig-001-20231015   gcc  
m68k allmodconfig   gcc  
m68k  allnoconfig   gcc  
m68k allyesconfig   gcc  
m68kdefconfig   gcc  
microblaze   allmodconfig   gcc  
microblazeallnoconfig   gcc  
microblaze   allyesconfig   gcc  
microblaze  defconfig   gcc  
mips allmodconfig   gcc  
mips  allnoconfig   gcc  
mips allyesconfig   gcc  
nios2allmodconfig   gcc  
nios2 allnoconfig   gcc  
nios2allyesconfig   gcc  
nios2   defconfig   gcc  
openrisc allmodconfig   gcc  
openrisc  allnoconfig   gcc  
openrisc allyesconfig   gcc  
openriscdefconfig   gcc  
parisc   allmodconfig   gcc  
pariscallnoconfig   gcc  
parisc   allyesconfig   gcc  
parisc  defconfig   gcc  
parisc64defconfig   gcc  
powerpc  allmodconfig   gcc  
powerpc   allnoconfig   gcc  
powerpc  allyesconfig   gcc  
riscvallmodconfig   gcc  
riscv allnoconfig   gcc  
riscvallyesconfig   gcc  
riscv   defconfig   gcc  
riscv randconfig-001-20231015   gcc  
riscv  rv32_defconfig   gcc  
s390 allmodconfig   gcc  
s390  allnoconfig   gcc  
s390 allyesconfig   gcc  
s390defconfig   gcc  
s390  randconfig-001-20231015   gcc  
sh   allmodconfig   gcc  
shallnoconfig   gcc  
sh   allyesconfig   gcc  
sh  defconfig   gcc  
sparcallmodconfig   gcc  
sparc allnoconfig   gcc  
sparcallyesconfig   gcc  
sparc   defconfig   gcc  
sparc randconfig-001-20231015   gcc  
sparc64  allmodconfig   gcc  
sparc64

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-6.6-4 tag

2023-10-15 Thread pr-tracker-bot
The pull request you sent on Sun, 15 Oct 2023 21:31:39 +1100:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
> tags/powerpc-6.6-4

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/f8bf101b3b1171923a011a47923a93f4b22e6cb0

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


[GIT PULL] Please pull powerpc/linux.git powerpc-6.6-4 tag

2023-10-15 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Linus,

Please pull some more powerpc fixes for 6.6:

The following changes since commit 58b33e78a31782ffe25d404d5eba9a45fe636e27:

  selftests/powerpc: Fix emit_tests to work with run_kselftest.sh (2023-09-22 
20:29:48 +1000)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
tags/powerpc-6.6-4

for you to fetch changes up to f0eee815babed70a749d2496a7678be5b45b4c14:

  powerpc/47x: Fix 47x syscall return crash (2023-10-11 09:31:26 +1100)

- --
powerpc fixes for 6.6 #4

 - Fix softlockup/crash when using hcall tracing.

 - Fix pte_access_permitted() for PAGE_NONE on 8xx.

 - Fix inverted pte_young() test in __ptep_test_and_clear_young() on 64-bit 
BookE.

 - Fix unhandled math emulation exception on 85xx.

 - Fix kernel crash on syscall return on 476.

Thanks to: Athira Rajeev, Christophe Leroy, Eddie James, Naveen N Rao.

- --
Athira Rajeev (2):
  powerpc/pseries: Fix STK_PARAM access in the hcall tracing code
  powerpc/pseries: Remove unused r0 in the hcall tracing code

Christophe Leroy (3):
  powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
  powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
  powerpc/85xx: Fix math emulation exception

Michael Ellerman (1):
  powerpc/47x: Fix 47x syscall return crash


 arch/powerpc/include/asm/nohash/32/pte-8xx.h | 7 +++
 arch/powerpc/include/asm/nohash/64/pgtable.h | 2 +-
 arch/powerpc/include/asm/nohash/pgtable.h| 2 ++
 arch/powerpc/kernel/entry_32.S   | 8 +---
 arch/powerpc/kernel/head_85xx.S  | 2 +-
 arch/powerpc/platforms/pseries/hvCall.S  | 8 +---
 6 files changed, 17 insertions(+), 12 deletions(-)
-BEGIN PGP SIGNATURE-

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmUrvzYACgkQUevqPMjh
pYCKAQ/+MjIJYV6DQPPoopfl1mFgPTKEGZh4xSj0VAuRHcvZGJT3UgJGu/ngnQw/
IWjcdDuHg1eYayWLhQBYBzTZVN8nNxSF/eAxdYyV2CFHBDk3iED1rpFO8nlrM+wL
rBfY+4U37Lx7HJDHPC6pzn+5hzIVBqwCh7cdS4z/VYW/7Nz1hPr5oD1MAYYTCBdV
Yuan4v5VqfMmXPCn/kBgGWjE2kNIDBfPqyi3VC3uJu9Z/pVpkBT8GFSqbZ6pxIHw
pOC8mkimWNkY3VZqqcrb649NeDHvZUjctzZTy45f3euC+x+UQ7kkI2Bc56DzcK4F
6M+aI6t9WO0N4XVZxrHCC5j90/RZDccwTK/KBbtAPGhOjZTWSY5oZF+F3v/ga+/2
IbcHSKHtFw3jf9JHpqe3VF9l4LbwsnYfh99ZaHZcfiY6007sJwzp8M+xbHOKLVVm
4Q+J2qoTqdXSHXkO7ldCcBz7dcp3CI8EGs3Nvk+EBjRkMjlsShhsFq8yGgzAOS3Y
AWg1br+w9udkvI4t7TWT8JhXy5jitSuB+Cxpe3wZ1PPRB9mVqICdIPcJ7XsAqMH1
fbaa7wOXbAXPSIN1o70WmrENB1qn5HLoDPBpbSJc+EW2efCPhDN+IsRsqEkWjKD6
hkD+z9B2WppLl79nE5Xso2/MwtxhlINVBpPyVLPvnVzYQ7An+1U=
=p0qH
-END PGP SIGNATURE-


Re: (subset) [PATCH 0/7] arch/*: config: Remove ReiserFS from defconfig

2023-10-15 Thread Michael Ellerman
On Mon, 18 Sep 2023 17:56:09 +, Peter Lafreniere wrote:
> ReiserFS has been considered deprecated for 19 months since commit
> eb103a51640e ("reiserfs: Deprecate reiserfs"). However, there are
> several architectures that still build it into their defconfig kernels.
> 
> As ReiserFS will be removed in 2025, delete all ReiserFS-related options
> from defconfig files before the filesystem's removal.
> 
> [...]

Applied to powerpc/next.

[2/7] arch: powerpc: remove ReiserFS from defconfig
  https://git.kernel.org/powerpc/c/c945e6f453a361b0e9daddd2be9c099d1b80d6f8

cheers


Re: [PATCH v4] powerpc: Use shared font data

2023-10-15 Thread Michael Ellerman
On Fri, 25 Aug 2023 15:27:54 +0100, li...@treblig.org wrote:
> PowerPC has a 'btext' font used for the console which is almost identical
> to the shared font_sun8x16, so use it rather than duplicating the data.
> 
> They were actually identical until about a decade ago when
>commit bcfbeecea11c ("drivers: console: font_: Change a glyph from
> "broken bar" to "vertical line"")
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc: Use shared font data
  https://git.kernel.org/powerpc/c/0ebc7feae79ac07772a20382eebd8c3503313714

cheers


Re: (subset) [PATCH v2 0/2] m68k/powerpc: Kill references to non-existent README.legal

2023-10-15 Thread Michael Ellerman
On Mon, 18 Sep 2023 12:14:42 +0200, Geert Uytterhoeven wrote:
> Note that the "COPYING" file at that time corresponded to the version
> from upstream Linux v0.99.11 until v2.1.104, and thus predated the
> addition of the "only valid GPL version is v2" clause in v2.4.0-test8.
> 
> This patch series gets rid of the references to README.legal by
> replacing the boilerplate with SPDX license identifiers.
> 
> [...]

Applied to powerpc/next.

[2/2] powerpc: Replace GPL 2.0+ README.legal boilerplate with SPDX
  https://git.kernel.org/powerpc/c/6fcb13972bc2b41211e1dddb02f5e73199addc75

cheers


Re: [PATCH] powerpc: Only define __parse_fpscr() when required

2023-10-15 Thread Michael Ellerman
On Fri, 22 Sep 2023 14:33:13 +0200, Christophe Leroy wrote:
> Clang 17 reports:
> 
> arch/powerpc/kernel/traps.c:1167:19: error: unused function '__parse_fpscr' 
> [-Werror,-Wunused-function]
> 
> __parse_fpscr() is called from two sites. First call is guarded
> by #ifdef CONFIG_PPC_FPU_REGS
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc: Only define __parse_fpscr() when required
  https://git.kernel.org/powerpc/c/c7e0d9bb9154c6e6b2ac8746faba27b53393f25e

cheers


Re: [PATCH] selftests/powerpc: Fix emit_tests to work with run_kselftest.sh

2023-10-15 Thread Michael Ellerman
On Thu, 21 Sep 2023 17:26:10 +1000, Michael Ellerman wrote:
> In order to use run_kselftest.sh the list of tests must be emitted to
> populate kselftest-list.txt.
> 
> The powerpc Makefile is written to use EMIT_TESTS. But support for
> EMIT_TESTS was dropped in commit d4e59a536f50 ("selftests: Use runner.sh
> for emit targets"). Although prior to that commit a548de0fe8e1
> ("selftests: lib.mk: add test execute bit check to EMIT_TESTS") had
> already broken run_kselftest.sh for powerpc due to the executable check
> using the wrong path.
> 
> [...]

Applied to powerpc/fixes.

[1/1] selftests/powerpc: Fix emit_tests to work with run_kselftest.sh
  https://git.kernel.org/powerpc/c/58b33e78a31782ffe25d404d5eba9a45fe636e27

cheers


Re: [PATCH] powerpc/mm: Allow ARCH_FORCE_MAX_ORDER up to 12

2023-10-15 Thread Michael Ellerman
On Thu, 24 Aug 2023 22:28:49 +1000, Michael Ellerman wrote:
> Christophe reported that the change to ARCH_FORCE_MAX_ORDER to limit the
> range to 10 had broken his ability to configure hugepages:
> 
>   # echo 1 > /sys/kernel/mm/hugepages/hugepages-8192kB/nr_hugepages
>   sh: write error: Invalid argument
> 
> Several of the powerpc defconfigs previously set the
> ARCH_FORCE_MAX_ORDER value to 12, via the definition in
> arch/powerpc/configs/fsl-emb-nonhw.config, used by:
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/mm: Allow ARCH_FORCE_MAX_ORDER up to 12
  https://git.kernel.org/powerpc/c/ff9e8f41513669e290f6e1904e1bc75950584491

cheers


Re: [PATCH] powerpc/47x: Fix 47x syscall return crash

2023-10-15 Thread Michael Ellerman
On Tue, 10 Oct 2023 22:47:50 +1100, Michael Ellerman wrote:
> Eddie reported that newer kernels were crashing during boot on his 476
> FSP2 system:
> 
>   kernel tried to execute user page (b7ee2000) - exploit attempt? (uid: 0)
>   BUG: Unable to handle kernel instruction fetch
>   Faulting instruction address: 0xb7ee2000
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   BE PAGE_SIZE=4K FSP-2
>   Modules linked in:
>   CPU: 0 PID: 61 Comm: mount Not tainted 6.1.55-d23900f.ppcnf-fsp2 #1
>   Hardware name: ibm,fsp2 476fpe 0x7ff520c0 FSP-2
>   NIP:  b7ee2000 LR: 8c008000 CTR: 
>   REGS: bffebd83 TRAP: 0400   Not tainted (6.1.55-d23900f.ppcnf-fs p2)
>   MSR:  0030   CR: 1000  XER: 2000
>   GPR00: c00110ac bffebe63 bffebe7e bffebe88 8c008000 1000 0d12 
> b7ee2000
>   GPR08: 0033   c139df10 48224824 1016c314 1016 
> 
>   GPR16: 1016 1016 0008  1016  1016 
> 1017f5b0
>   GPR24: 1017fa50 1017f4f0 1017fa50 1017f740 1017f630   
> 1017f4f0
>   NIP [b7ee2000] 0xb7ee2000
>   LR [8c008000] 0x8c008000
>   Call Trace:
>   Instruction dump:
>          
>          
>   ---[ end trace  ]---
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/47x: Fix 47x syscall return crash
  https://git.kernel.org/powerpc/c/f0eee815babed70a749d2496a7678be5b45b4c14

cheers


Re: (subset) [PATCH v2 00/37] Implement execute-only protection on powerpc

2023-10-15 Thread Michael Ellerman
On Mon, 25 Sep 2023 20:31:14 +0200, Christophe Leroy wrote:
> This series reworks _PAGE_FLAGS on all platforms in order
> to implement execute-only protection on all powerpc.
> 
> For all targets except 40x and 604 it will be a real execute-only
> protection as the hardware and/or software allows a distinct protection.
> 
> For 40x and 604 that's a poor's man execute-only protection in the
> way that once the page is in the TLB it can be executed. But it's
> better than nothing and allows to have a similar implementation for
> all sorts of powerpc.
> 
> [...]

Patches 1 and 2 applied to powerpc/fixes.

[01/37] powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE

https://git.kernel.org/powerpc/c/5d9cea8a552ee122e21fbd5a3c5d4eb85f648e06
[02/37] powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()

https://git.kernel.org/powerpc/c/5ea0bbaa32e8f54e9a57cfee4a3b8769b80be0d2

cheers


Re: [PATCH 1/2] powerpc/platforms/pseries: Fix STK_PARAM access in the hcall tracing code

2023-10-15 Thread Michael Ellerman
On Fri, 29 Sep 2023 22:53:36 +0530, Athira Rajeev wrote:
> In powerpc pseries system, below behaviour is observed while
> enabling tracing on hcall:
>   # cd /sys/kernel/debug/tracing/
>   # cat events/powerpc/hcall_exit/enable
>   0
>   # echo 1 > events/powerpc/hcall_exit/enable
> 
> [...]

Applied to powerpc/fixes.

[1/2] powerpc/platforms/pseries: Fix STK_PARAM access in the hcall tracing code
  https://git.kernel.org/powerpc/c/3b678768c0458e6d8d45fadf61423e44effed4cb
[2/2] powerpc/platforms/pseries: Remove unused r0 in the hcall tracing code
  https://git.kernel.org/powerpc/c/dfb5f8cbd5992d5769edfd3e059fad9e0b8bdafb

cheers


Re: [PATCH] powerpc/85xx: Fix math emulation exception

2023-10-15 Thread Michael Ellerman
On Mon, 25 Sep 2023 17:55:51 +0200, Christophe Leroy wrote:
> Booting mpc85xx_defconfig kernel on QEMU leads to:
> 
> Bad trap at PC: fe9bab0, SR: 2d000, vector=800
> awk[82]: unhandled trap (5) at 0 nip fe9bab0 lr fe9e01c code 5 in 
> libc-2.27.so[fe5a000+17a000]
> awk[82]: code: 3aa0 3a800010 4bffe03c 9421fff0 7ca62b78 38a0 93c10008 
> 83c10008
> awk[82]: code: 38210010 4bffdec8 9421ffc0 7c0802a6  d8010008 
> 4815190d 93810030
> Trace/breakpoint trap
> WARNING: no useful console
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/85xx: Fix math emulation exception
  https://git.kernel.org/powerpc/c/8e8a12ecbc86700b5e1a3596ce2b3c43dafad336

cheers


Re: [PATCH] powerpc/stacktrace: Fix arch_stack_walk_reliable()

2023-10-15 Thread Michael Ellerman
On Fri, 22 Sep 2023 09:24:41 +1000, Michael Ellerman wrote:
> The changes to copy_thread() made in commit eed7c420aac7 ("powerpc:
> copy_thread differentiate kthreads and user mode threads") inadvertently
> broke arch_stack_walk_reliable() because it has knowledge of the stack
> layout.
> 
> Fix it by changing the condition to match the new logic in
> copy_thread(). The changes make the comments about the stack layout
> incorrect, rather than rephrasing them just refer the reader to
> copy_thread().
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/stacktrace: Fix arch_stack_walk_reliable()
  https://git.kernel.org/powerpc/c/c5cc3ca707bc916a3f326364751a41f25040aef3

cheers