[RFC PATCH 2/2] KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled

2022-01-17 Thread Nicholas Piggin
emulation code was subtly broken and removed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 4 arch/powerpc/kernel/setup_64.c | 15 +++ arch/powerpc/kvm/book3s_pr.c | 20 ++-- 3 files changed, 33 insertions(+), 6

[RFC PATCH 0/2] 2nd attempt at PR KVM + SCV and syscall

2022-01-17 Thread Nicholas Piggin
(thanks) but any mistakes are mine, Naveen are we on the right track here? Thanks, Nick Nicholas Piggin (2): powerpc/64: remove system call instruction emulation KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled arch/powerpc/kernel/exceptions-64s.S | 4 arch/powerpc/kernel

[RFC PATCH 1/2] powerpc/64: remove system call instruction emulation

2022-01-17 Thread Nicholas Piggin
ation should not be a significant problem. Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/sstep.c | 36 1 file changed, 36 deletions(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index a94b0cd0bdc5..ee3bc45fb23b 100644 --- a/arch/powerpc/lib/sstep.

Re: [PATCH v2 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior

2022-01-17 Thread Nicholas Piggin
Excerpts from Kefeng Wang's message of December 28, 2021 12:59 am: > Introduce HUGE_VMALLOC_DEFAULT_ENABLED and make it default y, this > let user to choose whether or not enable huge vmalloc mappings by > default. > > Meanwhile, add new hugevmalloc=on/off parameter to enable or disable > this

Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings

2022-01-17 Thread Nicholas Piggin
Excerpts from Dave Hansen's message of December 29, 2021 2:14 am: > On 12/28/21 2:26 AM, Kefeng Wang wrote: There are some disadvantages about this feature[2], one of the main concerns is the possible memory fragmentation/waste in some scenarios, also archs must ensure that any arch

[RFC PATCH 3/3] KVM: PPC: Book3S PR: Disable SCV when running AIL is disabled

2022-01-17 Thread Nicholas Piggin
PR KVM does not support running with AIL enabled, and SCV does is not supported with AIL disabled. When PR KVM disables AIL on a system that has SCV enabled, the guest can crash the host if it executes scv, or the host can crash itself if another CPU executes scv while AIL is disabled (e.g., in

[RFC PATCH 2/3] powerpc/64s: Emulate scv syscalls if facility unavailable and PR KVM is possible

2022-01-17 Thread Nicholas Piggin
The SCV facility will be disabled at runtime in the host by PR KVM by the next change, emulate it in the facility unavailable handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 45 + 1 file changed, 45 insertions(+) diff --git a/arch

[RFC PATCH 1/3] powerpc/64s: Fix system call emulation

2022-01-17 Thread Nicholas Piggin
Interrupt return code expects the returned-to irq state to be reconciled with the returned-to MSR[EE] state. That is, if local irqs are enabled then MSR[EE] must be set, and if MSR[EE] is not set then local irqs must be disabled. System call emulation (both sc and scv 0) does not get this right,

[RFC PATCH 1/3] powerpc/64s: Fix system call emulation

2022-01-17 Thread Nicholas Piggin
Interrupt return code expects the returned-to irq state to be reconciled with the returned-to MSR[EE] state. That is, if local irqs are enabled then MSR[EE] must be set, and if MSR[EE] is not set then local irqs must be disabled. System call emulation (both sc and scv 0) does not get this right,

[PATCH] powerpc/64s: Mask SRR0 before checking against the masked NIP

2022-01-17 Thread Nicholas Piggin
ng against SRR0") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/interrupt_64.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index 92088f848266..7bab2d7de372 100644 --- a/arch/powerpc/kernel/interrupt_64.

Re: [PATCH v2 1/2] powerpc: Fix virt_addr_valid() check

2022-01-10 Thread Nicholas Piggin
Excerpts from Kefeng Wang's message of January 8, 2022 9:58 pm: > Hi PPC maintainers, ping.. Hmm. I might have confused myself about this. I'm going back and trying to work out what I was thinking when I suggested it. This works on 64e because vmalloc space is below the kernel linear map, right?

Re: [PATCH v3 5/6] KVM: PPC: mmio: Return to guest after emulation failure

2022-01-10 Thread Nicholas Piggin
Excerpts from Alexey Kardashevskiy's message of January 11, 2022 9:51 am: > > > On 1/10/22 18:36, Nicholas Piggin wrote: >> Excerpts from Fabiano Rosas's message of January 8, 2022 7:00 am: >>> If MMIO emulation fails we don't want to crash the whole guest by &g

Re: [PATCH] powerpc/time: Fix build failure due to do_hard_irq_enable() on PPC32

2022-01-10 Thread Nicholas Piggin
should_hard_irq_enable() returns false on PPC32 so this BUILD_BUG() shouldn't > trigger. > > Force inlining of should_hard_irq_enable() > > Signed-off-by: Christophe Leroy > Fixes: 0faf20a1ad16 ("powerpc/64s/interrupt: Don't enable MSR[EE] in irq > handlers unless perf is in use&quo

Re: [PATCH v3 6/6] KVM: PPC: mmio: Reject instructions that access more than mmio.data size

2022-01-09 Thread Nicholas Piggin
; > (While here, fix the error message to check against 'bytes' and not > 'run->mmio.len' which at this point has an old value.) This looks good to me Reviewed-by: Nicholas Piggin > > Signed-off-by: Fabiano Rosas > Reviewed-by: Alexey Kardashevskiy > --- > arch/powerpc/kvm/

Re: [PATCH v3 5/6] KVM: PPC: mmio: Return to guest after emulation failure

2022-01-09 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 8, 2022 7:00 am: > If MMIO emulation fails we don't want to crash the whole guest by > returning to userspace. > > The original commit bbf45ba57eae ("KVM: ppc: PowerPC 440 KVM > implementation") added a todo: > > /* XXX Deliver Program interrupt

Re: [PATCH v3 4/6] KVM: PPC: mmio: Queue interrupt at kvmppc_emulate_mmio

2022-01-09 Thread Nicholas Piggin
> No functional change, just separation of responsibilities. Looks cleaner. Reviewed-by: Nicholas Piggin > > Signed-off-by: Fabiano Rosas > --- > arch/powerpc/kvm/emulate_loadstore.c | 8 +--- > arch/powerpc/kvm/powerpc.c | 2 +- > 2 files changed, 2 insertion

Re: [PATCH v3 3/6] KVM: PPC: Don't use pr_emerg when mmio emulation fails

2022-01-09 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of January 8, 2022 7:00 am: > If MMIO emulation fails we deliver a Program interrupt to the > guest. This is a normal event for the host, so use pr_info. > > Signed-off-by: Fabiano Rosas > --- Should it be rate limited to prevent guest spamming host log? In

Re: [PATCH] Revert "mm/usercopy: Drop extra is_vmalloc_or_module() check"

2021-12-25 Thread Nicholas Piggin
>> CONFIG_FSL_EMB_PERFMON=y >>> CONFIG_FSL_EMB_PERF_EVENT=y >>> CONFIG_FSL_EMB_PERF_EVENT_E500=y >>> CONFIG_BOOKE=y >>> CONFIG_PPC_FSL_BOOK3E=y >>> CONFIG_PTE_64BIT=y >>> CONFIG_PHYS_64BIT=y >>> CONFIG_PPC_MMU_NOHASH=y >>>

Re: [BISECTED] power8: watchdog: CPU 3 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x154/0x2d0

2021-12-25 Thread Nicholas Piggin
Excerpts from Stijn Tintel's message of December 22, 2021 11:20 am: > Hi, > > After upgrading my Power8 server from 5.10 LTS to 5.15 LTS, I started > experiencing CPU hard lockups, usually rather quickly after boot: > > > watchdog: CPU 3 self-detected hard LOCKUP @ >

Re: [PATCH 3/3] KVM: PPC: Book3S HV: Free allocated memory if module init fails

2021-12-25 Thread Nicholas Piggin
r = kvmppc_uvmem_init(); > @@ -6111,6 +6112,12 @@ static int kvmppc_book3s_init_hv(void) > kvmppc_hv_ops = _ops_hv; > > return 0; > + > +err: > + kvmhv_nested_exit(); > + kvmppc_radix_exit(); These should both be callable without init functions succeeding so this looks right to me. Reviewed-by: Nicholas Piggin Thanks, Nick > + > + return r; > } > > static void kvmppc_book3s_exit_hv(void) > -- > 2.33.1 > >

Re: [PATCH 2/3] KVM: PPC: Book3S HV: Delay setting of kvm ops

2021-12-25 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of December 24, 2021 7:19 am: > Delay the setting of kvm_hv_ops until after all init code has > completed. This avoids leaving the ops still accessible if the init > fails. > > Signed-off-by: Fabiano Rosas Also looks okay to me but KVM init has lots of

Re: [PATCH 1/3] KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init

2021-12-25 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of December 24, 2021 7:19 am: > The return of the function is being shadowed by the call to > kvmppc_uvmem_init. > Reviewed-by: Nicholas Piggin > Fixes: ca9f4942670c ("KVM: PPC: Book3S HV: Support for running secure guests") > Sig

Re: [PATCH 3/3] KVM: PPC: Fix mmio length message

2021-12-25 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of December 24, 2021 7:15 am: > We check against 'bytes' but print 'run->mmio.len' which at that point > has an old value. > > e.g. 16-byte load: > > before: > __kvmppc_handle_load: bad MMIO length: 8 > > now: > __kvmppc_handle_load: bad MMIO length: 16 >

Re: [PATCH 2/3] KVM: PPC: Fix vmx/vsx mixup in mmio emulation

2021-12-25 Thread Nicholas Piggin
Reimplement LOAD_VMX/STORE_VMX instruction > ...") > Signed-off-by: Fabiano Rosas Good catch. AFAIKS handle_vmx_store needs the same treatment? If you agree then Reviewed-by: Nicholas Piggin > --- > arch/powerpc/kvm/powerpc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deleti

Re: [PATCH 1/3] KVM: PPC: Book3S HV: Stop returning internal values to userspace

2021-12-25 Thread Nicholas Piggin
oticed while enabling the kvm selftests for powerpc. There's > an assert at the _vcpu_run function when we return a value different > from the expected. That's nasty. Looks like qemu never touches the return value except if it was < 0, so hopefully should be okay. Reviewed-by: Nicholas Pigg

Re: [PATCH 4/5] powerpc/64: Add VIRTUAL_BUG_ON checks for __va and __pa addresses

2021-12-25 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 24, 2021 11:24 pm: > Hi Nic, > > Le 24/07/2019 à 10:46, Nicholas Piggin a écrit : >> Ensure __va is given a physical address below PAGE_OFFSET, and __pa is >> given a virtual address above PAGE_OFFSET. >> >&g

Re: [RFC PATCH] powerpc/signal: sanitise PT_NIP and sa_handler low bits

2021-12-19 Thread Nicholas Piggin
Excerpts from Sachin Sant's message of December 15, 2021 8:49 pm: > >> Reported-by: Sachin Sant >> Signed-off-by: Nicholas Piggin >> --- >> I'm not entirely sure about the 32-bit / compat part. Or the 64-bit for >> that matter except that it does seem

[PATCH v2] powerpc/64s/radix: Fix huge vmap false positive

2021-12-16 Thread Nicholas Piggin
lpers for page table walk"), while implementing a similar fix for other page table walking functions. Fixes: d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP") Signed-off-by: Nicholas Piggin --- Since v1: - Also fix some false positive warnings spotted by Daniel. - Renam

Re: [PATCH v4 09/10] powerpc/mm: Convert to default topdown mmap layout

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 9, 2021 8:22 pm: > > > Le 09/12/2021 à 11:15, Nicholas Piggin a écrit : >> Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: >>> Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and >>&

Re: [PATCH v4 09/10] powerpc/mm: Convert to default topdown mmap layout

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: > Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and > remove arch/powerpc/mm/mmap.c > > This change provides standard randomisation of mmaps. > > See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 >

Re: [PATCH v4 07/10] powerpc/mm: Use generic_hugetlb_get_unmapped_area()

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: > Use the generic version of arch_hugetlb_get_unmapped_area() > which is now available at all time. > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/book3s/64/hugetlb.h | 4 -- >

Re: [PATCH v4 06/10] powerpc/mm: Use generic_get_unmapped_area() and call it from arch_get_unmapped_area()

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: > Use the generic version of arch_get_unmapped_area() which > is now available at all time instead of its copy > radix__arch_get_unmapped_area() > > Instead of setting mm->get_unmapped_area() to either >

Re: [PATCH v4 02/10] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions

2021-12-09 Thread Nicholas Piggin
APPED_AREA_TOPDOWN. > > Do the same for hugetlb_get_unmapped_area() versus > HAVE_ARCH_HUGETLB_UNMAPPED_AREA. > Reviewed-by: Nicholas Piggin > Signed-off-by: Christophe Leroy > --- > fs/hugetlbfs/inode.c | 17 + > include/linux/hugetlb.h | 5 +

Re: [PATCH v4 03/10] powerpc/mm: Move vma_mmu_pagesize()

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 9, 2021 3:18 am: > vma_mmu_pagesize() is only required for slices, > otherwise there is a generic weak version doing the > exact same thing. > > Move it to slice.c > Reviewed-by: Nicholas Piggin > Signed-off

Re: [PATCH v6 15/18] powerpc/64s: Always define arch unmapped area calls

2021-12-09 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of December 9, 2021 6:25 pm: > Excerpts from Christophe Leroy's message of December 8, 2021 7:38 pm: >> >> >> Le 01/12/2021 à 15:41, Nicholas Piggin a écrit : >>> To avoid any functional changes to radix paths when buil

Re: [PATCH v6 17/18] powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU

2021-12-09 Thread Nicholas Piggin
Excerpts from Michael Ellerman's message of December 7, 2021 11:00 pm: > Nicholas Piggin writes: >> 34 files changed, 173 insertions(+), 52 deletions(-) > > > I was able to clean up some of the ifdefs a little with the changes > below. I'll run these through some test b

Re: [PATCH v6 15/18] powerpc/64s: Always define arch unmapped area calls

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 8, 2021 8:00 pm: > > > Le 01/12/2021 à 15:41, Nicholas Piggin a écrit : >> To avoid any functional changes to radix paths when building with hash >> MMU support disabled (and CONFIG_PPC_MM_SLICES=n), always define the >

Re: [PATCH v6 15/18] powerpc/64s: Always define arch unmapped area calls

2021-12-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of December 8, 2021 7:38 pm: > > > Le 01/12/2021 à 15:41, Nicholas Piggin a écrit : >> To avoid any functional changes to radix paths when building with hash >> MMU support disabled (and CONFIG_PPC_MM_SLICES=n), always define the >

[PATCH v6 18/18] powerpc/microwatt: add POWER9_CPU, clear PPC_64S_HASH_MMU

2021-12-01 Thread Nicholas Piggin
Microwatt implements a subset of ISA v3.0 (which is equivalent to the POWER9_CPU option). It is radix-only, so does not require hash MMU support. This saves 20kB compressed dtbImage and 56kB vmlinux size. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 3 ++- arch

[PATCH v6 17/18] powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU

2021-12-01 Thread Nicholas Piggin
Compiling out hash support code when CONFIG_PPC_64S_HASH_MMU=n saves 128kB kernel image size (90kB text) on powernv_defconfig minus KVM, 350kB on pseries_defconfig minus KVM, 40kB on a tiny config. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch

[PATCH v6 16/18] powerpc/64s: Make hash MMU support configurable

2021-12-01 Thread Nicholas Piggin
This adds Kconfig selection which allows 64s hash MMU support to be disabled. It can be disabled if radix support is enabled, the minimum supported CPU type is POWER9 (or higher), and KVM is not selected. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 3 ++- arch

[PATCH v6 15/18] powerpc/64s: Always define arch unmapped area calls

2021-12-01 Thread Nicholas Piggin
To avoid any functional changes to radix paths when building with hash MMU support disabled (and CONFIG_PPC_MM_SLICES=n), always define the arch get_unmapped_area calls on 64s platforms. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/hash.h | 4 --- arch/powerpc/include

[PATCH v6 14/18] powerpc/64s: Fix radix MMU when MMU_FTR_HPTE_TABLE is clear

2021-12-01 Thread Nicholas Piggin
There are a few places that require MMU_FTR_HPTE_TABLE to be set even when running in radix mode. Fix those up. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/pgtable.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm

[PATCH v6 13/18] powerpc/64e: remove mmu_linear_psize

2021-12-01 Thread Nicholas Piggin
mmu_linear_psize is only set at boot once on 64e, is not necessarily the correct size of the linear map pages, and is never used anywhere. Remove it. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/nohash/mmu-book3e.h | 1 - arch/powerpc/mm/nohash/tlb.c | 9

[PATCH v6 12/18] powerpc: make memremap_compat_align 64s-only

2021-12-01 Thread Nicholas Piggin
memremap_compat_align is only relevant when ZONE_DEVICE is selected. ZONE_DEVICE depends on ARCH_HAS_PTE_DEVMAP, which is only selected by PPC_BOOK3S_64. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch/powerpc/mm/book3s64/pgtable.c | 20

[PATCH v6 11/18] powerpc/64: pcpu setup avoid reading mmu_linear_psize on 64e or radix

2021-12-01 Thread Nicholas Piggin
Radix never sets mmu_linear_psize so it's always 4K, which causes pcpu atom_size to always be PAGE_SIZE. 64e sets it to 1GB always. Make paths for these platforms to be explicit about what value they set atom_size to. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/setup_64.c | 21

[PATCH v6 10/18] powerpc/64s: Rename hash_hugetlbpage.c to hugetlbpage.c

2021-12-01 Thread Nicholas Piggin
This file contains functions and data common to radix, so rename it to remove the hash_ prefix. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/{hash_hugetlbpage.c => hugetlbpage.c} | 0 2 files changed

[PATCH v6 09/18] powerpc/64s: move page size definitions from hash specific file

2021-12-01 Thread Nicholas Piggin
The radix code uses some of the psize variables. Move the common ones from hash_utils.c to pgtable.c. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_utils.c | 5 - arch/powerpc/mm/book3s64/pgtable.c| 7 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff

[PATCH v6 08/18] powerpc/64s: Make flush_and_reload_slb a no-op when radix is enabled

2021-12-01 Thread Nicholas Piggin
to not introduce runtime changes to radix mode behaviour. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/mce_power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index c2f55fe7092d..cf5263b648fc 100644

[PATCH v6 07/18] powerpc/64s: move THP trace point creation out of hash specific file

2021-12-01 Thread Nicholas Piggin
In preparation for making hash MMU support configurable, move THP trace point function definitions out of an otherwise hash-specific file. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 1 - arch/powerpc/mm/book3s64

[PATCH v6 06/18] powerpc/pseries: lparcfg don't include slb_size line in radix mode

2021-12-01 Thread Nicholas Piggin
This avoids a change in behaviour in the later patch making hash support configurable. This is possibly a user interface change, so the alternative would be a hard-coded slb_size=0 here. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lparcfg.c | 3 ++- 1 file changed, 2

[PATCH v6 05/18] powerpc/pseries: move process table registration away from hash-specific code

2021-12-01 Thread Nicholas Piggin
This reduces ifdefs in a later change which makes hash support configurable. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lpar.c | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch

[PATCH v6 04/18] powerpc/64s: Move and rename do_bad_slb_fault as it is not hash specific

2021-12-01 Thread Nicholas Piggin
slb.c is hash-specific SLB management, but do_bad_slb_fault deals with segment interrupts that occur with radix MMU as well. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 2 +- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- arch/powerpc/mm/book3s64/slb.c | 16

[PATCH v6 03/18] powerpc/pseries: Stop selecting PPC_HASH_MMU_NATIVE

2021-12-01 Thread Nicholas Piggin
The pseries platform does not use the native hash code but the PAPR virtualised hash interfaces, so remove PPC_HASH_MMU_NATIVE. This requires moving tlbiel code from hash_native.c to hash_utils.c. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/tlbflush.h | 4 - arch

[PATCH v6 02/18] powerpc: Rename PPC_NATIVE to PPC_HASH_MMU_NATIVE

2021-12-01 Thread Nicholas Piggin
PPC_NATIVE now only controls the native HPT code, so rename it to be more descriptive. Restrict it to Book3S only. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 +- arch/powerpc/platforms/52xx/Kconfig

[PATCH v6 01/18] powerpc: Remove unused FW_FEATURE_NATIVE references

2021-12-01 Thread Nicholas Piggin
FW_FEATURE_NATIVE_ALWAYS and FW_FEATURE_NATIVE_POSSIBLE are always zero and never do anything. Remove them. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/firmware.h | 8 1 file changed, 8 deletions(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc

[PATCH v6 00/18] powerpc: Make hash MMU code build configurable

2021-12-01 Thread Nicholas Piggin
point that had to be commented out in the previous. - Avoid minor (probably unreachable) behaviour change in machine check handler when hash was not compiled. - Fix microwatt updates so !HASH is not enforced. - Rebase, build fixes. Thanks, Nick Nicholas Piggin (18): powerpc: Remove unused

Re: [PATCH v2 rebased 7/9] powerpc/mm: Convert to default topdown mmap layout

2021-11-30 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:52 am: > Select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT and > remove arch/powerpc/mm/mmap.c > > This change provides standard randomisation of mmaps. > > See commit 8b8addf891de ("x86/mm/32: Enable full randomization on i386 >

Re: [PATCH v2 rebased 5/9] powerpc/mm: Call radix__arch_get_unmapped_area() from arch_get_unmapped_area()

2021-11-30 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:52 am: > Instead of setting mm->get_unmapped_area() to either > arch_get_unmapped_area() or radix__arch_get_unmapped_area(), > always set it to arch_get_unmapped_area() and call > radix__arch_get_unmapped_area() from there when radix

Re: [PATCH v2 rebased 4/9] powerpc/mm: Remove asm/slice.h

2021-11-30 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:52 am: > Move necessary stuff in asm/book3s/64/slice.h and > remove asm/slice.h Any reason to make this separate from patch 1? Thanks, Nick

Re: [PATCH v2 rebased 3/9] powerpc/mm: Remove CONFIG_PPC_MM_SLICES

2021-11-30 Thread Nicholas Piggin
lices. Maybe without any huge page support? I guess it's probably broken if it never =n, and not worth maintaining anyway? Reviewed-by: Nicholas Piggin > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/book3s/64/hash.h | 4 ++-- > arch/powerpc/include/asm/huget

Re: [PATCH v2 rebased 2/9] powerpc/mm: Move vma_mmu_pagesize() and hugetlb_get_unmapped_area() to slice.c

2021-11-30 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:52 am: > vma_mmu_pagesize() is only required for slices, > otherwise there is a generic weak version. Fine. > hugetlb_get_unmapped_area() is dedicated to slices. > radix__hugetlb_get_unmapped_area() as well. Hmm, that's

Re: [PATCH v2 rebased 1/9] powerpc/mm: Make slice specific to book3s/64

2021-11-30 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:52 am: > Since commit 555904d07eef ("powerpc/8xx: MM_SLICE is not needed > anymore") only book3s/64 selects CONFIG_PPC_MM_SLICES. > > Move slice.c into mm/book3s64/ > > Signed-off-by: Christophe Leroy

[PATCH] KVM: PPC: Book3S HV P9: Remove unused ri_set local variable

2021-11-30 Thread Nicholas Piggin
ri_set is set and never used. Signed-off-by: Nicholas Piggin --- This patch is against powerpc next. It's causing warnings with new gcc now. Thanks, Nick arch/powerpc/kvm/book3s_hv_p9_entry.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kvm

Re: [PATCH v5 15/17] powerpc/64s: Make hash MMU support configurable

2021-11-30 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of November 29, 2021 11:46 pm: > Nicholas Piggin writes: > >> This adds Kconfig selection which allows 64s hash MMU support to be >> disabled. It can be disabled if radix support is enabled, the minimum >> supported CPU type is POW

[PATCH] powerpc: unrecoverable system reset crash fix

2021-11-30 Thread Nicholas Piggin
the exit/panic, which the main 0x100 die() call can use. The unrecoverable die() calls then exit and don't return, as expected. Fixes: d40b6768e45b ("powerpc/64s: sreset panic if there is no debugger or crash dump handlers") Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/tr

[RFC PATCH] powerpc/signal: sanitise PT_NIP and sa_handler low bits

2021-11-29 Thread Nicholas Piggin
t.gp_regs[PT_NIP] |= 3; } int main(void) { struct sigaction trap_sa; trap_sa.sa_flags = SA_SIGINFO; trap_sa.sa_sigaction = trap_signal_handler; sigaction(SIGUSR1, _sa, NULL); raise(SIGUSR1); exit(EXIT_SUCCESS); } Reported-by: Sachin Sant Signed-off-by:

[PATCH v3] powerpc/64s: Get LPID bit width from device tree

2021-11-28 Thread Nicholas Piggin
but it will not allocate > 4096 LPIDs). OPAL firmware provides this property for POWER10 CPUs since skiboot commit 9b85f7d961f2 ("hdata: add mmu-pid-bits and mmu-lpid-bits for POWER10 CPUs"). Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- Since v2: fixed compile bug, added skiboo

[PATCH v5 17/17] powerpc/microwatt: add POWER9_CPU, clear PPC_64S_HASH_MMU

2021-11-28 Thread Nicholas Piggin
Microwatt implements a subset of ISA v3.0 (which is equivalent to the POWER9_CPU option). It is radix-only, so does not require hash MMU support. This saves 20kB compressed dtbImage and 56kB vmlinux size. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 3 ++- arch

[PATCH v5 16/17] powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU

2021-11-28 Thread Nicholas Piggin
Compiling out hash support code when CONFIG_PPC_64S_HASH_MMU=n saves 128kB kernel image size (90kB text) on powernv_defconfig minus KVM, 350kB on pseries_defconfig minus KVM, 40kB on a tiny config. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch

[PATCH v5 15/17] powerpc/64s: Make hash MMU support configurable

2021-11-28 Thread Nicholas Piggin
This adds Kconfig selection which allows 64s hash MMU support to be disabled. It can be disabled if radix support is enabled, the minimum supported CPU type is POWER9 (or higher), and KVM is not selected. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 3 ++- arch

[PATCH v5 14/17] powerpc/64s: Fix radix MMU when MMU_FTR_HPTE_TABLE is clear

2021-11-28 Thread Nicholas Piggin
There are a few places that require MMU_FTR_HPTE_TABLE to be set even when running in radix mode. Fix those up. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/pgtable.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm

[PATCH v5 13/17] powerpc/64e: remove mmu_linear_psize

2021-11-28 Thread Nicholas Piggin
mmu_linear_psize is only set at boot once on 64e, is not necessarily the correct size of the linear map pages, and is never used anywhere. Remove it. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/nohash/mmu-book3e.h | 1 - arch/powerpc/mm/nohash/tlb.c | 9

[PATCH v5 12/17] powerpc: make memremap_compat_align 64s-only

2021-11-28 Thread Nicholas Piggin
memremap_compat_align is only relevant when ZONE_DEVICE is selected. ZONE_DEVICE depends on ARCH_HAS_PTE_DEVMAP, which is only selected by PPC_BOOK3S_64. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch/powerpc/mm/book3s64/pgtable.c | 20

[PATCH v5 11/17] powerpc/64: pcpu setup avoid reading mmu_linear_psize on 64e or radix

2021-11-28 Thread Nicholas Piggin
Radix never sets mmu_linear_psize so it's always 4K, which causes pcpu atom_size to always be PAGE_SIZE. 64e sets it to 1GB always. Make paths for these platforms to be explicit about what value they set atom_size to. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/setup_64.c | 21

[PATCH v5 10/17] powerpc/64s: Rename hash_hugetlbpage.c to hugetlbpage.c

2021-11-28 Thread Nicholas Piggin
This file contains functions and data common to radix, so rename it to remove the hash_ prefix. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/{hash_hugetlbpage.c => hugetlbpage.c} | 0 2 files changed

[PATCH v5 09/17] powerpc/64s: move page size definitions from hash specific file

2021-11-28 Thread Nicholas Piggin
The radix code uses some of the psize variables. Move the common ones from hash_utils.c to pgtable.c. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/hash_utils.c | 5 - arch/powerpc/mm/book3s64/pgtable.c| 7 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff

[PATCH v5 08/17] powerpc/64s: Make flush_and_reload_slb a no-op when radix is enabled

2021-11-28 Thread Nicholas Piggin
to not introduce runtime changes to radix mode behaviour. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/mce_power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index c2f55fe7092d..cf5263b648fc 100644

[PATCH v5 07/17] powerpc/64s: move THP trace point creation out of hash specific file

2021-11-28 Thread Nicholas Piggin
In preparation for making hash MMU support configurable, move THP trace point function definitions out of an otherwise hash-specific file. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 1 - arch/powerpc/mm/book3s64

[PATCH v5 06/17] powerpc/pseries: lparcfg don't include slb_size line in radix mode

2021-11-28 Thread Nicholas Piggin
This avoids a change in behaviour in the later patch making hash support configurable. This is possibly a user interface change, so the alternative would be a hard-coded slb_size=0 here. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lparcfg.c | 3 ++- 1 file changed, 2

[PATCH v5 05/17] powerpc/pseries: move process table registration away from hash-specific code

2021-11-28 Thread Nicholas Piggin
This reduces ifdefs in a later change which makes hash support configurable. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lpar.c | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch

[PATCH v5 04/17] powerpc/64s: Move and rename do_bad_slb_fault as it is not hash specific

2021-11-28 Thread Nicholas Piggin
slb.c is hash-specific SLB management, but do_bad_slb_fault deals with segment interrupts that occur with radix MMU as well. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 2 +- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- arch/powerpc/mm/book3s64/slb.c | 16

[PATCH v5 03/17] powerpc/pseries: Stop selecting PPC_HASH_MMU_NATIVE

2021-11-28 Thread Nicholas Piggin
The pseries platform does not use the native hash code but the PAPR virtualised hash interfaces, so remove PPC_HASH_MMU_NATIVE. This requires moving tlbiel code from hash_native.c to hash_utils.c. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/tlbflush.h | 4 - arch

[PATCH v5 02/17] powerpc: Rename PPC_NATIVE to PPC_HASH_MMU_NATIVE

2021-11-28 Thread Nicholas Piggin
PPC_NATIVE now only controls the native HPT code, so rename it to be more descriptive. Restrict it to Book3S only. Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/Makefile | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 +- arch/powerpc/platforms/52xx/Kconfig

[PATCH v5 00/17] powerpc: Make hash MMU code build configurable

2021-11-28 Thread Nicholas Piggin
Nicholas Piggin (17): powerpc: Remove unused FW_FEATURE_NATIVE references powerpc: Rename PPC_NATIVE to PPC_HASH_MMU_NATIVE powerpc/pseries: Stop selecting PPC_HASH_MMU_NATIVE powerpc/64s: Move and rename do_bad_slb_fault as it is not hash specific powerpc/pseries: move process table

[PATCH v5 01/17] powerpc: Remove unused FW_FEATURE_NATIVE references

2021-11-28 Thread Nicholas Piggin
FW_FEATURE_NATIVE_ALWAYS and FW_FEATURE_NATIVE_POSSIBLE are always zero and never do anything. Remove them. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/firmware.h | 8 1 file changed, 8 deletions(-) diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc

Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

2021-11-28 Thread Nicholas Piggin
Excerpts from Yury Norov's message of November 28, 2021 1:56 pm: > In many cases people use bitmap_weight()-based functions like this: > > if (num_present_cpus() > 1) > do_something(); > > This may take considerable amount of time on many-cpus machines because >

Re: [PATCH] powerpc/64s/radix: Fix unmapping huge vmaps when CONFIG_HUGETLB_PAGE=n

2021-11-26 Thread Nicholas Piggin
Excerpts from Daniel Axtens's message of November 26, 2021 4:09 pm: > Hi, > >> pmd_huge is defined out to false when HUGETLB_PAGE is not configured, >> but the vmap code still installs huge PMDs. This leads to errors >> encountering bad PMDs when vunmapping because it is not seen as a >> huge

Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable

2021-11-26 Thread Nicholas Piggin
Excerpts from Cédric Le Goater's message of November 26, 2021 5:13 pm: > On 11/26/21 06:21, Nicholas Piggin wrote: >> KVM does not support VAS so guests always print a useless error on boot >> >> vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000 >> &

Re: [PATCH 1/3] powerpc/code-patching: work around code patching verification in patching tests

2021-11-26 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 4:34 pm: > > > Le 26/11/2021 à 04:22, Nicholas Piggin a écrit : >> Code patching tests patch the stack and (non-module) vmalloc space now, >> which falls afoul of the new address check. >> >> The s

[PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable

2021-11-25 Thread Nicholas Piggin
KVM does not support VAS so guests always print a useless error on boot vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000 Change this to only print the message if the error is not H_FUNCTION. Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/vas.c | 11

[PATCH 3/3] powerpc/code-patching: don't use the stack for code patching tests

2021-11-25 Thread Nicholas Piggin
Use the existing test function for code patching tests instead of writing to the stack. This means the address verification does not have to be bypassed for these tests. Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/code-patching.c | 24 1 file changed, 16

[PATCH 2/3] powerpc/code-patching: warn on code patching failure

2021-11-25 Thread Nicholas Piggin
Callers are supposed to handle this, but it is possible that they don't or they do but don't make much noise about it. A failure is probably an indication of a bigger problem somewhere so it is good to warn once about it. Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/code-patching.c | 5

[PATCH 1/3] powerpc/code-patching: work around code patching verification in patching tests

2021-11-25 Thread Nicholas Piggin
: 8b8a8f0ab3f55 ("powerpc/code-patching: Improve verification of patchability") Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/code-patching.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patchi

[PATCH] powerpc/64s/radix: Fix unmapping huge vmaps when CONFIG_HUGETLB_PAGE=n

2021-11-25 Thread Nicholas Piggin
can improve much in arch/powerpc code. Fixes: d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP") Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix

Re: [PATCH v4 00/17] powerpc: Make hash MMU code build configurable

2021-11-25 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of November 26, 2021 3:35 am: > > > Le 25/11/2021 à 17:35, Christophe Leroy a écrit : >> >> >> Le 25/11/2021 à 13:50, Nicholas Piggin a écrit : >>> Now that there's a platform that can make good use of it, here's &g

Re: [PATCH] powerpc/watchdog: Fix wd_smp_last_reset_tb reporting

2021-11-25 Thread Nicholas Piggin
Excerpts from Laurent Dufour's message of November 26, 2021 3:21 am: > On 25/11/2021, 11:33:46, Nicholas Piggin wrote: >> wd_smp_last_reset_tb now gets reset by watchdog_smp_panic() as part of >> marking CPUs stuck and removing them from the pending mask before it >>

[PATCH v4 17/17] powerpc/microwatt: add POWER9_CPU, clear PPC_64S_HASH_MMU

2021-11-25 Thread Nicholas Piggin
Microwatt implements a subset of ISA v3.0 (which is equivalent to the POWER9_CPU option). It is radix-only, so does not require hash MMU support. This saves 20kB compressed dtbImage and 56kB vmlinux size. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 3 ++- arch

[PATCH v4 16/17] powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU

2021-11-25 Thread Nicholas Piggin
Compiling out hash support code when CONFIG_PPC_64S_HASH_MMU=n saves 128kB kernel image size (90kB text) on powernv_defconfig minus KVM, 350kB on pseries_defconfig minus KVM, 40kB on a tiny config. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 2 +- arch

[PATCH v4 15/17] powerpc/64s: Make hash MMU support configurable

2021-11-25 Thread Nicholas Piggin
This adds Kconfig selection which allows 64s hash MMU support to be disabled. It can be disabled if radix support is enabled, the minimum supported CPU type is POWER9 (or higher), and KVM is not selected. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 3 ++- arch

  1   2   3   4   5   6   7   8   9   10   >