Re: [PATCH -next] powerpc: kernel/time.c - cleanup warnings

2021-03-22 Thread heying (H)
Dear Christophe, 在 2021/3/23 14:33, Christophe Leroy 写道: Le 23/03/2021 à 07:21, heying (H) a écrit : Dear Christophe, 在 2021/3/18 10:28, heying (H) 写道: 在 2021/3/17 19:16, Christophe Leroy 写道: Le 17/03/2021 à 11:34, He Ying a écrit : We found these warnings in arch/powerpc/kernel/time

Re: [PATCH -next] powerpc: kernel/time.c - cleanup warnings

2021-03-22 Thread Christophe Leroy
Le 23/03/2021 à 07:21, heying (H) a écrit : Dear Christophe, 在 2021/3/18 10:28, heying (H) 写道: 在 2021/3/17 19:16, Christophe Leroy 写道: Le 17/03/2021 à 11:34, He Ying a écrit : We found these warnings in arch/powerpc/kernel/time.c as follows: warning: symbol 'decrementer_max' was not de

[PATCH] [v2] arch: powerpc: Remove duplicate includes

2021-03-22 Thread Wan Jiabing
mmu-hash.h: asm/bug.h has been included at line 12, so remove the duplicate one at line 21. interrupt.c: asm/interrupt.h has been included at line 12, so remove the duplicate one at line 10. time.c: linux/sched/clock.h has been included at line 33,so remove the duplicate one at line 56 and move

Re: [PATCH -next] powerpc: kernel/time.c - cleanup warnings

2021-03-22 Thread heying (H)
Dear Christophe, 在 2021/3/18 10:28, heying (H) 写道: 在 2021/3/17 19:16, Christophe Leroy 写道: Le 17/03/2021 à 11:34, He Ying a écrit : We found these warnings in arch/powerpc/kernel/time.c as follows: warning: symbol 'decrementer_max' was not declared. Should it be static? warning: symbol '

[PATCH] [v2] tools: testing: Remove duplicate includes

2021-03-22 Thread Wan Jiabing
sched.h has been included at line 33, so remove the duplicate one at line 36. inttypes.h has been included at line 19, so remove the duplicate one at line 23. pthread.h has been included at line 17,so remove the duplicate one at line 20. Signed-off-by: Wan Jiabing --- tools/testing/selftests/

Re: [PATCH] tools: testing: Remove duplicate include of sched.h

2021-03-22 Thread Christophe Leroy
Le 23/03/2021 à 04:34, Wan Jiabing a écrit : sched.h has been included at line 33. So we remove the duplicate one at line 36. Can you please send a single patch for all files in tools/testing/selftests/powerpc/ Thanks Christophe Signed-off-by: Wan Jiabing --- tools/testing/selftests/

Re: [PATCH] arch: powerpc: Remove duplicate include of interrupt.h

2021-03-22 Thread Christophe Leroy
Le 23/03/2021 à 03:41, Wan Jiabing a écrit : asm/interrupt.h has been included at line 12. According to alphabetic order,we remove the duplicate one at line 10. Could you please cook a single patch for all files in arch/powerpc/ Thanks Christophe Signed-off-by: Wan Jiabing --- arch/po

[PATCH] tools: testing: inttypes.h is included twice

2021-03-22 Thread Wan Jiabing
inttypes.h has been included at line 19. So we remove the duplicate one at line 23. Signed-off-by: Wan Jiabing --- tools/testing/selftests/powerpc/tm/tm-poison.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/t

[PATCH] tools: testing: pthread.h is included twice

2021-03-22 Thread Wan Jiabing
pthread.h has been included at line 17. So we remove the duplicate one at line 20. Signed-off-by: Wan Jiabing --- tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c b/tools/testing/selftests/

[PATCH] tools: testing: Remove duplicate include of sched.h

2021-03-22 Thread Wan Jiabing
sched.h has been included at line 33. So we remove the duplicate one at line 36. Signed-off-by: Wan Jiabing --- tools/testing/selftests/powerpc/mm/tlbie_test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/mm/tlbie_test.c b/tools/testing/selftests/powerpc/mm

[PATCH] arch: powerpc: Remove duplicate include of clock.h

2021-03-22 Thread Wan Jiabing
linux/sched/clock.h has been included at line 33. So we remove the duplicate one at line 56. For better understanding, we also move sched/cputime.h under the sched including segment. Signed-off-by: Wan Jiabing --- arch/powerpc/kernel/time.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(

[PATCH] arch: powerpc: Remove duplicate include of interrupt.h

2021-03-22 Thread Wan Jiabing
asm/interrupt.h has been included at line 12. According to alphabetic order,we remove the duplicate one at line 10. Signed-off-by: Wan Jiabing --- arch/powerpc/kernel/interrupt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c

[PATCH] arch: powerpc: bug.h is included twice

2021-03-22 Thread Wan Jiabing
asm/bug.h has been included at line 12, so remove the duplicate one at line 21. Signed-off-by: Wan Jiabing --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu

[PATCH] arch/powerpc/kernel: Duplicate include asm/interrupt.h

2021-03-22 Thread zhouchuangao
asm/interrupt.h is repeatedly in the file interrupt.c. Signed-off-by: zhouchuangao --- arch/powerpc/kernel/interrupt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index c475a22..6deaccc 100644 --- a/arch/powerpc/kernel/inte

Re: [PATCH v6 3/6] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-22 Thread Bharata B Rao
On Tue, Mar 23, 2021 at 01:26:56PM +1100, David Gibson wrote: > On Thu, Mar 11, 2021 at 02:09:36PM +0530, Bharata B Rao wrote: > > H_RPT_INVALIDATE does two types of TLB invalidations: > > > > 1. Process-scoped invalidations for guests when LPCR[GTSE]=0. > >This is currently not used in KVM as

[PATCH 4/4] rust: Enable for ppc64le

2021-03-22 Thread Michael Ellerman
All the pieces are in place now for us to enable building rust support on ppc64le. Only works with clang for now. Signed-off-by: Michael Ellerman --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index d73ac9de186d..ddc2fda1a22c 100

[PATCH 3/4] powerpc/rust: Add target.json for ppc64le

2021-03-22 Thread Michael Ellerman
Based on the x86 and arm64 versions, as well as output from: $ rustc +nightly -Z unstable-options --target=powerpc64le-unknown-linux-gnu --print target-spec-json Notably disables altivec, vsx and hard-float. The very cryptic data-layout: "data-layout": "e-m:e-i64:64-n32:64-S128", Has the

[PATCH 2/4] rust: Add powerpc64 as a 64-bit target_arch in c_types.rs

2021-03-22 Thread Michael Ellerman
powerpc kernel code uses int-ll64.h. Signed-off-by: Michael Ellerman --- rust/kernel/c_types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/c_types.rs b/rust/kernel/c_types.rs index 423ac1108ddb..988fd84b0d66 100644 --- a/rust/kernel/c_types.rs +++ b/rust/kern

[PATCH 1/4] rust: Export symbols in initialized data section

2021-03-22 Thread Michael Ellerman
On powerpc some symbols end up in the initialized data section, which means they aren't detected by the logic in cmd_export, leading to errors such as: ERROR: modpost: "_RNvNtCsbDqzXfLQacH_6kernel12module_param15PARAM_OPS_USIZE" [drivers/char/rust_example_4.ko] undefined! nm represents the "in

[PATCH 0/4] Rust for Linux for ppc64le

2021-03-22 Thread Michael Ellerman
Hi all, Here's a first attempt at getting the kernel Rust support building on powerpc. It's powerpc64le only for now, as that's what I can easily test given the distros I have installed. Though powerpc and powerpc64 are also Tier 2 platforms so in theory should work. Supporting those would requir

Re: [PATCH v6 5/6] KVM: PPC: Book3S HV: Add KVM_CAP_PPC_RPT_INVALIDATE capability

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:38PM +0530, Bharata B Rao wrote: > Now that we have H_RPT_INVALIDATE fully implemented, enable > support for the same via KVM_CAP_PPC_RPT_INVALIDATE KVM capability > > Signed-off-by: Bharata B Rao Reviewed-by: David Gibson > --- > Documentation/virt/kvm/api.rst |

Re: [PATCH v6 3/6] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:36PM +0530, Bharata B Rao wrote: > H_RPT_INVALIDATE does two types of TLB invalidations: > > 1. Process-scoped invalidations for guests when LPCR[GTSE]=0. >This is currently not used in KVM as GTSE is not usually >disabled in KVM. > 2. Partition-scoped invalid

Re: [PATCH v6 4/6] KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:37PM +0530, Bharata B Rao wrote: > Enable support for process-scoped invalidations from nested > guests and partition-scoped invalidations for nested guests. > > Process-scoped invalidations for any level of nested guests > are handled by implementing H_RPT_INVALIDATE

Re: [PATCH v6 6/6] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:39PM +0530, Bharata B Rao wrote: > In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall > H_RPT_INVALIDATE if available. The availability of this hcall > is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions > DT property. > > Signed-

Re: [PATCH v6 2/6] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:35PM +0530, Bharata B Rao wrote: > Add a field to mmu_psize_def to store the page size encodings > of H_RPT_INVALIDATE hcall. Initialize this while scanning the radix > AP encodings. This will be used when invalidating with required > page size encoding in the hcall. >

Re: [PATCH v6 1/6] KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments

2021-03-22 Thread David Gibson
On Thu, Mar 11, 2021 at 02:09:34PM +0530, Bharata B Rao wrote: > From: "Aneesh Kumar K.V" > > The type values H_RPTI_TYPE_PRT and H_RPTI_TYPE_PAT indicate > invalidating the caching of process and partition scoped entries > respectively. > > Signed-off-by: Aneesh Kumar K.V > Signed-off-by: Bhar

Re: [PATCH v3 25/41] KVM: PPC: Book3S HV P9: Reduce irq_work vs guest decrementer races

2021-03-22 Thread Alexey Kardashevskiy
On 06/03/2021 02:06, Nicholas Piggin wrote: irq_work's use of the DEC SPR is racy with guest<->host switch and guest entry which flips the DEC interrupt to guest, which could lose a host work interrupt. This patch closes one race, and attempts to comment another class of races. Signed-off-by

Re: [PATCH v11 0/6] KASAN for powerpc64 radix

2021-03-22 Thread Daniel Axtens
Hi Christophe, > In the discussion we had long time ago, > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20190806233827.16454-5-...@axtens.net/#2321067 > > , I challenged you on why it was not possible to implement things the same > way as other > architectures, in extenso with an e

[PATCH v4 46/46] KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path

2021-03-22 Thread Nicholas Piggin
POWER9 and later processors always go via the P9 guest entry path now. Remove the remaining support from the P7/8 path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 62 ++-- arch/powerpc/kvm/book3s_hv_interrupts.S | 9 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S

[PATCH v4 45/46] KVM: PPC: Book3S HV P9: implement hash host / hash guest support

2021-03-22 Thread Nicholas Piggin
This additionally has to save and restore the host SLB, and also ensure that the MMU is off while switching into the guest SLB. P9 and later CPUs now always go via the P9 path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_entry.S | 6 + arch/powerpc/kvm/book3s_hv.c

[PATCH v4 44/46] KVM: PPC: Book3S HV P9: implement hash guest support

2021-03-22 Thread Nicholas Piggin
Guest entry/exit has to restore and save/clear the SLB, plus several other bits to accommodate hash guests in the P9 path. Radix host, hash guest support is removed from the P7/8 path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 20 ++- arch/powerpc/kvm/book3s_

[PATCH v4 43/46] KVM: PPC: Book3S HV: add virtual mode handlers for HPT hcalls and page faults

2021-03-22 Thread Nicholas Piggin
In order to support hash guests in the P9 path (which does not do real mode hcalls or page fault handling), these real-mode hash specific interrupts need to be implemented in virt mode. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 126 ++-- arc

[PATCH v4 42/46] KVM: PPC: Book3S HV: small pseries_do_hcall cleanup

2021-03-22 Thread Nicholas Piggin
Functionality should not be changed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 0f3c1792ab86..e6d113dbc076 10

[PATCH v4 41/46] KVM: PPC: Book3S HV P9: Allow all P9 processors to enable nested HV

2021-03-22 Thread Nicholas Piggin
All radix guests go via the P9 path now, so there is no need to limit nested HV to processors that support "mixed mode" MMU. Remove the restriction. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kv

[PATCH v4 40/46] KVM: PPC: Book3S HV: Remove unused nested HV tests in XICS emulation

2021-03-22 Thread Nicholas Piggin
Commit f3c18e9342a44 ("KVM: PPC: Book3S HV: Use XICS hypercalls when running as a nested hypervisor") added nested HV tests in XICS hypercalls, but not all are required. * icp_eoi is only called by kvmppc_deliver_irq_passthru which is only called by kvmppc_check_passthru which is only caled by

[PATCH v4 39/46] KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers

2021-03-22 Thread Nicholas Piggin
Now that the P7/8 path no longer supports radix, real-mode handlers do not need to deal with being called in virt mode. This change effectively reverts commit acde25726bc6 ("KVM: PPC: Book3S HV: Add radix checks in real-mode hypercall handlers"). It removes a few more real-mode tests in rm hcall

[PATCH v4 38/46] KVM: PPC: Book3S HV: Remove radix guest support from P7/8 path

2021-03-22 Thread Nicholas Piggin
The P9 path now runs all supported radix guest combinations, so remove radix guest support from the P7/8 path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 79 + 1 file changed, 3 insertions(+), 76 deletions(-) diff --git a/arch/powerpc/kv

[PATCH v4 37/46] KVM: PPC: Book3S HV: Remove support for dependent threads mode on P9

2021-03-22 Thread Nicholas Piggin
Radix guest support will be removed from the P7/8 path, so disallow dependent threads mode on P9. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_host.h | 1 - arch/powerpc/kvm/book3s_hv.c| 27 +-- 2 files changed, 5 insertions(+), 23 deletions(-)

[PATCH v4 36/46] KVM: PPC: Book3S HV: Implement radix prefetch workaround by disabling MMU

2021-03-22 Thread Nicholas Piggin
Rather than partition the guest PID space + flush a rogue guest PID to work around this problem, instead fix it by always disabling the MMU when switching in or out of guest MMU context in HV mode. This may be a bit less efficient, but it is a lot less complicated and allows the P9 path to trivall

[PATCH v4 35/46] KVM: PPC: Book3S HV P9: Switch to guest MMU context as late as possible

2021-03-22 Thread Nicholas Piggin
Move MMU context switch as late as reasonably possible to minimise code running with guest context switched in. This becomes more important when this code may run in real-mode, with later changes. Move WARN_ON as early as possible so program check interrupts are less likely to tangle everything up

[PATCH v4 34/46] KVM: PPC: Book3S HV P9: Add helpers for OS SPR handling

2021-03-22 Thread Nicholas Piggin
This is a first step to wrapping supervisor and user SPR saving and loading up into helpers, which will then be called independently in bare metal and nested HV cases in order to optimise SPR access. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 141 ++

[PATCH v4 33/46] KVM: PPC: Book3S HV P9: Move SPR loading after expiry time check

2021-03-22 Thread Nicholas Piggin
This is wasted work if the time limit is exceeded. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_interrupt.c | 36 -- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c b/arch/powerpc/kvm/book3s_hv_inter

[PATCH v4 32/46] KVM: PPC: Book3S HV P9: Improve exit timing accounting coverage

2021-03-22 Thread Nicholas Piggin
The C conversion caused exit timing to become a bit cramped. Expand it to cover more of the entry and exit code. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_interrupt.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_interr

[PATCH v4 31/46] KVM: PPC: Book3S HV P9: Read machine check registers while MSR[RI] is 0

2021-03-22 Thread Nicholas Piggin
SRR0/1, DAR, DSISR must all be protected from machine check which can clobber them. Ensure MSR[RI] is clear while they are live. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 11 +++-- arch/powerpc/kvm/book3s_hv_interrupt.c | 33 +++--- arch/

[PATCH v4 30/46] KVM: PPC: Book3S HV P9: inline kvmhv_load_hv_regs_and_go into __kvmhv_vcpu_entry_p9

2021-03-22 Thread Nicholas Piggin
Now the initial C implementation is done, inline more HV code to make rearranging things easier. And rename __kvmhv_vcpu_entry_p9 to drop the leading underscores as it's now C, and is now a more complete vcpu entry. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/inc

[PATCH v4 29/46] KVM: PPC: Book3S HV P9: Implement the rest of the P9 path in C

2021-03-22 Thread Nicholas Piggin
Almost all logic is moved to C, by introducing a new in_guest mode that selects and branches very early in the interrupt handler to the P9 exit code. The remaining assembly is only about 160 lines of low level stack setup, with VCPU vs host register save and restore, plus a small shim to the legac

[PATCH v4 28/46] KVM: PPC: Book3S HV P9: Reduce irq_work vs guest decrementer races

2021-03-22 Thread Nicholas Piggin
irq_work's use of the DEC SPR is racy with guest<->host switch and guest entry which flips the DEC interrupt to guest, which could lose a host work interrupt. This patch closes one race, and attempts to comment another class of races. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_h

[PATCH v4 27/46] powerpc: add set_dec_or_work API for safely updating decrementer

2021-03-22 Thread Nicholas Piggin
Decrementer updates must always check for new irq work to avoid an irq work decrementer interrupt being lost. Add an API for this in the timer code so callers don't have to care about details. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h

[PATCH v4 26/46] KVM: PPC: Book3S HV P9: Reduce mftb per guest entry/exit

2021-03-22 Thread Nicholas Piggin
mftb is serialising (dispatch next-to-complete) so it is heavy weight for a mfspr. Avoid reading it multiple times in the entry or exit paths. A small number of cycles delay to timers is tolerable. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 9 ++

[PATCH v4 25/46] KVM: PPC: Book3S HV P9: Use host timer accounting to avoid decrementer read

2021-03-22 Thread Nicholas Piggin
There is no need to save away the host DEC value, as it is derived from the host timer subsystem, which maintains the next timer time. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 5 + arch/powerpc/kernel/time.c | 1 + arch/powerpc/kvm/book3s_hv.c| 12 +

[PATCH v4 24/46] KVM: PPC: Book3S HV P9: Use large decrementer for HDEC

2021-03-22 Thread Nicholas Piggin
On processors that don't suppress the HDEC exceptions when LPCR[HDICE]=0, this could help reduce needless guest exits due to leftover exceptions on entering the guest. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 2 ++ arch/powerpc/kvm/b

[PATCH v4 23/46] KVM: PPC: Book3S HV P9: Move setting HDEC after switching to guest LPCR

2021-03-22 Thread Nicholas Piggin
LPCR[HDICE]=0 suppresses hypervisor decrementer exceptions on some processors, so it must be enabled before HDEC is set. Rather than set it in the host LPCR then setting HDEC, move the HDEC update to after the guest MMU context (including LPCR) is loaded. There shouldn't be much concern with delay

[PATCH v4 22/46] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path

2021-03-22 Thread Nicholas Piggin
In the interest of minimising the amount of code that is run in "real-mode", don't handle hcalls in real mode in the P9 path. POWER8 and earlier are much more expensive to exit from HV real mode and switch to host mode, because on those processors HV interrupts get to the hypervisor with the MMU o

[PATCH v4 21/46] KVM: PPC: Book3S HV P9: Move xive vcpu context management into kvmhv_p9_guest_entry

2021-03-22 Thread Nicholas Piggin
Move the xive management up so the low level register switching can be pushed further down in a later patch. XIVE MMIO CI operations can run in higher level code with machine checks, tracing, etc., available. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/

[PATCH v4 20/46] KVM: PPC: Book3S HV P9: implement kvmppc_xive_pull_vcpu in C

2021-03-22 Thread Nicholas Piggin
This is more symmetric with kvmppc_xive_push_vcpu. The extra test in the asm will go away in a later change. Reviewed-by: Cédric Le Goater Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_ppc.h | 2 ++ arch/powerpc/kvm/book3s_hv.c

[PATCH v4 19/46] KVM: PPC: Book3S HV P9: Move radix MMU switching instructions together

2021-03-22 Thread Nicholas Piggin
Switching the MMU from radix<->radix mode is tricky particularly as the MMU can remain enabled and requires a certain sequence of SPR updates. Move these together into their own functions. This also includes the radix TLB check / flush because it's tied in to MMU switching due to tlbiel getting LP

[PATCH v4 18/46] KVM: PPC: Book3S 64: Minimise hcall handler calling convention differences

2021-03-22 Thread Nicholas Piggin
This sets up the same calling convention from interrupt entry to KVM interrupt handler for system calls as exists for other interrupt types. This is a better API, it uses a save area rather than SPR, and it has more registers free to use. Using a single common API helps maintain it, and it becomes

[PATCH v4 17/46] KVM: PPC: Book3S 64: move bad_host_intr check to HV handler

2021-03-22 Thread Nicholas Piggin
This is not used by PR KVM. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_64_entry.S | 3 --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++- arch/powerpc/kvm/book3s_segment.S | 7 +++ 3 files changed, 10 insertions(+), 4 deletions

[PATCH v4 16/46] KVM: PPC: Book3S 64: Move interrupt early register setup to KVM

2021-03-22 Thread Nicholas Piggin
Like the earlier patch for hcalls, KVM interrupt entry requires a different calling convention than the Linux interrupt handlers set up. Move the code that converts from one to the other into KVM. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 131 +

[PATCH v4 15/46] KVM: PPC: Book3S 64: Move hcall early register setup to KVM

2021-03-22 Thread Nicholas Piggin
System calls / hcalls have a different calling convention than other interrupts, so there is code in the KVMTEST to massage these into the same form as other interrupt handlers. Move this work into the KVM hcall handler. This means teaching KVM a little more about the low level interrupt handler s

[PATCH v4 14/46] KVM: PPC: Book3S 64: add hcall interrupt handler

2021-03-22 Thread Nicholas Piggin
Add a separate hcall entry point. This can be used to deal with the different calling convention. Reviewed-by: Daniel Axtens Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- arch/powerpc/kvm/book3s_64_entry.S | 6 +- 2 files c

[PATCH v4 13/46] KVM: PPC: Book3S 64: Move GUEST_MODE_SKIP test into KVM

2021-03-22 Thread Nicholas Piggin
Move the GUEST_MODE_SKIP logic into KVM code. This is quite a KVM internal detail that has no real need to be in common handlers. Also add a comment explaining why this thing exists. Reviewed-by: Daniel Axtens Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/e

[PATCH v4 12/46] KVM: PPC: Book3S 64: move KVM interrupt entry to a common entry point

2021-03-22 Thread Nicholas Piggin
Rather than bifurcate the call depending on whether or not HV is possible, and have the HV entry test for PR, just make a single common point which does the demultiplexing. This makes it simpler to add another type of exit handler. Reviewed-by: Daniel Axtens Reviewed-by: Fabiano Rosas Signed-off

[PATCH v4 11/46] KVM: PPC: Book3S HV: Ensure MSR[HV] is always clear in guest MSR

2021-03-22 Thread Nicholas Piggin
Rather than clear the HV bit from the MSR at guest entry, make it clear that the hypervisor does not allow the guest to set the bit. The HV clear is kept in guest entry for now, but a future patch will warn if it's not present. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_built

[PATCH v4 10/46] KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR

2021-03-22 Thread Nicholas Piggin
Rather than add the ME bit to the MSR at guest entry, make it clear that the hypervisor does not allow the guest to clear the bit. The ME set is kept in guest entry for now, but a future patch will warn if it's not present. Reviewed-by: Daniel Axtens Reviewed-by: Fabiano Rosas Signed-off-by: Ni

[PATCH v4 09/46] powerpc/64s: remove KVM SKIP test from instruction breakpoint handler

2021-03-22 Thread Nicholas Piggin
The code being executed in KVM_GUEST_MODE_SKIP is hypervisor code with MSR[IR]=0, so the faults of concern are the d-side ones caused by access to guest context by the hypervisor. Instruction breakpoint interrupts are not a concern here. It's unlikely any good would come of causing breaks in this

[PATCH v4 08/46] powerpc/64s: Remove KVM handler support from CBE_RAS interrupts

2021-03-22 Thread Nicholas Piggin
Cell does not support KVM. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 8082b690e874..a0515cb829c2 10

[PATCH v4 07/46] KVM: PPC: Book3S HV: Fix CONFIG_SPAPR_TCE_IOMMU=n default hcalls

2021-03-22 Thread Nicholas Piggin
This config option causes the warning in init_default_hcalls to fire because the TCE handlers are in the default hcall list but not implemented. Reviewed-by: Daniel Axtens Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/

[PATCH v4 06/46] KVM: PPC: Book3S HV: remove unused kvmppc_h_protect argument

2021-03-22 Thread Nicholas Piggin
The va argument is not used in the function or set by its asm caller, so remove it to be safe. Reviewed-by: Daniel Axtens Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_ppc.h | 3 +-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)

[PATCH v4 05/46] KVM: PPC: Book3S HV: Remove redundant mtspr PSPB

2021-03-22 Thread Nicholas Piggin
This SPR is set to 0 twice when exiting the guest. Suggested-by: Fabiano Rosas Reviewed-by: Daniel Axtens Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 1ffb090

[PATCH v4 04/46] KVM: PPC: Book3S HV: Prevent radix guests from setting LPCR[TC]

2021-03-22 Thread Nicholas Piggin
This bit only applies to hash partitions. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 6 ++ arch/powerpc/kvm/book3s_hv_nested.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c ind

[PATCH v4 03/46] KVM: PPC: Book3S HV: Disallow LPCR[AIL] to be set to 1 or 2

2021-03-22 Thread Nicholas Piggin
These are already disallowed by H_SET_MODE from the guest, also disallow these by updating LPCR directly. AIL modes can affect the host interrupt behaviour while the guest LPCR value is set, so filter it here too. Suggested-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/

[PATCH v4 02/46] KVM: PPC: Book3S HV: Add a function to filter guest LPCR bits

2021-03-22 Thread Nicholas Piggin
Guest LPCR depends on hardware type, and future changes will add restrictions based on errata and guest MMU mode. Move this logic to a common function and use it for the cases where the guest wants to update its LPCR (or the LPCR of a nested guest). Signed-off-by: Nicholas Piggin --- arch/powerp

[PATCH v4 01/46] KVM: PPC: Book3S HV: Nested move LPCR sanitising to sanitise_hv_regs

2021-03-22 Thread Nicholas Piggin
This will get a bit more complicated in future patches. Move it into the helper function. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_nested.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/pow

[PATCH v4 00/46] KVM: PPC: Book3S: C-ify the P9 entry/exit code

2021-03-22 Thread Nicholas Piggin
I think enough changes and fixes have gone in since last round to repost. I put a git tree here to make things easier to get. https://github.com/npiggin/linux/tree/kvm-in-c-2 Main changes since v3: - Hopefully fixed LPCR sanising [from Fabiano review] - Added MSR[HV] clearing of guest MSR (like

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Cye Borg
PWS 500au: snow / # lspci -vvx -s 7.1 00:07.1 IDE interface: Contaq Microsystems 82c693 (prog-if 80 [ISA Compatibility mode-only controller, supports bus mastering]) Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR- FastB2B- DisINTx- Status: Cap- 6

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Cye Borg
I use pata_cypress on Alpha, and for the above mentioned problems, it always restricted me to use only one IDE channel out of the two available. Also, not forcing it to use PIO mode, it always failed to operate. I would love to test on Alpha, and give you feedback about a fix/finished implementatio

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Cye Borg
And lspci from Compaq PWS 500au: snow / # lspci 00:03.0 Ethernet controller: Digital Equipment Corporation DECchip 21142/43 (rev 30) 00:07.0 ISA bridge: Contaq Microsystems 82c693 00:07.1 IDE interface: Contaq Microsystems 82c693 00:07.2 IDE interface: Contaq Microsystems 82c693 00:07.3 USB control

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Cye Borg
I use pata_cypress on Alpha, and for the above mentioned problems, it always restricted me to use only one IDE channel out of the two available. Also, not forcing it to use PIO mode, it always failed to operate. I would love to test on Alpha, and give you feedback about a fix/finished implementatio

Re: [PATCH] xsysace: Remove SYSACE driver

2021-03-22 Thread Davidlohr Bueso
Hi, On Mon, 09 Nov 2020, Michal Simek wrote: Sysace IP is no longer used on Xilinx PowerPC 405/440 and Microblaze systems. The driver is not regularly tested and very likely not working for quite a long time that's why remove it. Is there a reason this patch was never merged? can the driver b

Re: [PATCH 3/3] powerpc/mm/hash: Avoid multiple HPT resize-downs on memory hotunplug

2021-03-22 Thread David Gibson
On Fri, Mar 12, 2021 at 04:29:41AM -0300, Leonardo Bras wrote: > During memory hotunplug, after each LMB is removed, the HPT may be > resized-down if it would map a max of 4 times the current amount of memory. > (2 shifts, due to introduced histeresis) > > It usually is not an issue, but it can ta

Re: [PATCH] powerpc/asm: Fix a typo

2021-03-22 Thread Michael Ellerman
Randy Dunlap writes: > On 3/22/21 4:32 AM, Bhaskar Chowdhury wrote: >> >> s/poiner/pointer/ >> >> Signed-off-by: Bhaskar Chowdhury > > Acked-by: Randy Dunlap > > However, it would be a GOOD THING to collect multiple similar > patches that are in e.g. arch/powerpc/ and send them as one patch >

Re: [PATCH 00/10] Move 64e to new interrupt return code

2021-03-22 Thread Daniel Axtens
Hi Nick, > Since RFC this is rebased on Christophe's v3 ppc32 conversion, and > has fixed up small details, and then adds some powerpc-wide > cleanups at the end. > > Tested on qemu only (QEMU e500), which is not ideal for interrupt > handling particularly the critical interrupts which I don't kno

Re: [PATCH 1/1] hotplug-cpu.c: show 'last online CPU' error in dlpar_cpu_remove()

2021-03-22 Thread Daniel Henrique Barboza
On 3/19/21 8:26 AM, Michael Ellerman wrote: Daniel Henrique Barboza writes: Ping On 3/5/21 2:38 PM, Daniel Henrique Barboza wrote: Of all the reasons that dlpar_cpu_remove() can fail, the 'last online CPU' is one that can be caused directly by the user offlining CPUs in a partition/virtual

Re: [PATCH next v1 2/3] printk: remove safe buffers

2021-03-22 Thread Petr Mladek
On Mon 2021-03-22 12:16:15, John Ogness wrote: > On 2021-03-21, Sergey Senozhatsky wrote: > >> @@ -369,7 +70,10 @@ __printf(1, 0) int vprintk_func(const char *fmt, > >> va_list args) > >> * Use the main logbuf even in NMI. But avoid calling console > >> * drivers that might have their own

Re: [PATCH next v1 2/3] printk: remove safe buffers

2021-03-22 Thread John Ogness
On 2021-03-22, Petr Mladek wrote: > On Mon 2021-03-22 12:16:15, John Ogness wrote: >> On 2021-03-21, Sergey Senozhatsky wrote: >> >> @@ -369,7 +70,10 @@ __printf(1, 0) int vprintk_func(const char *fmt, >> >> va_list args) >> >>* Use the main logbuf even in NMI. But avoid calling console >> >

[PATCH 1/1] powerpc/iommu: Enable remaining IOMMU Pagesizes present in LoPAR

2021-03-22 Thread Leonardo Bras
According to LoPAR, ibm,query-pe-dma-window output named "IO Page Sizes" will let the OS know all possible pagesizes that can be used for creating a new DDW. Currently Linux will only try using 3 of the 8 available options: 4K, 64K and 16M. According to LoPAR, Hypervisor may also offer 32M, 64M, 1

Re: [PATCH] powerpc: kernel: Trivial spelling fixes throughout the file head_fsl_booke.S

2021-03-22 Thread Randy Dunlap
On 3/14/21 8:37 PM, Bhaskar Chowdhury wrote: > s/virutal/virtual/ > s/mismach/mismatch/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap > --- > As Randy pointed out I was changing the predefined macro name,so, reverted > or leave it alone. > Michael,sorry to run down a cold weav

Re: [PATCH] docs: powerpc: Fix a typo

2021-03-22 Thread Randy Dunlap
On 3/21/21 11:22 PM, Bhaskar Chowdhury wrote: > > s/struture/structure/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap > --- > Documentation/powerpc/firmware-assisted-dump.rst | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Documentation/powerpc/firmwar

Re: [PATCH] powerpc/asm: Fix a typo

2021-03-22 Thread Randy Dunlap
On 3/22/21 4:32 AM, Bhaskar Chowdhury wrote: > > s/poiner/pointer/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap However, it would be a GOOD THING to collect multiple similar patches that are in e.g. arch/powerpc/ and send them as one patch instead of many little patches. > --

Re: [PATCH] powerpc/8xx: Fix a typo

2021-03-22 Thread Randy Dunlap
On 3/22/21 5:03 AM, Bhaskar Chowdhury wrote: > > s/poiners/pointers/ > > Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap > --- > arch/powerpc/kernel/head_8xx.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/ker

Re: [PATCH v3 19/41] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path

2021-03-22 Thread Nicholas Piggin
Excerpts from Cédric Le Goater's message of March 23, 2021 2:01 am: > On 3/22/21 2:15 PM, Nicholas Piggin wrote: >> Excerpts from Alexey Kardashevskiy's message of March 22, 2021 5:30 pm: >>> >>> >>> On 06/03/2021 02:06, Nicholas Piggin wrote: In the interest of minimising the amount of code t

Re: [PATCH v3 17/41] KVM: PPC: Book3S HV P9: implement kvmppc_xive_pull_vcpu in C

2021-03-22 Thread Nicholas Piggin
Excerpts from Cédric Le Goater's message of March 23, 2021 2:19 am: > On 3/5/21 4:06 PM, Nicholas Piggin wrote: >> This is more symmetric with kvmppc_xive_push_vcpu. The extra test in >> the asm will go away in a later change. >> >> Signed-off-by: Nicholas Piggin > > Reviewed-by: Cédric Le Goate

Re: [RFC PATCH 6/8] powerpc/mm/book3s64/hash: drop pre 2.06 tlbiel for clang

2021-03-22 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of March 23, 2021 2:49 am: > > > Le 19/03/2021 à 03:01, Nicholas Piggin a écrit : >> Excerpts from Daniel Axtens's message of February 25, 2021 1:10 pm: >>> The llvm integrated assembler does not recognise the ISA 2.05 tlbiel >>> version. Eventually do thi

Re: [PATCH v2 0/8] Implement EBPF on powerpc32

2021-03-22 Thread Andrii Nakryiko
On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy wrote: > > This series implements extended BPF on powerpc32. For the implementation > details, see the patch before the last. > > The following operations are not implemented: > > case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */ >

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

2021-03-22 Thread Alex Williamson
On Mon, 22 Mar 2021 16:01:54 +0100 Christoph Hellwig wrote: > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index 8ce36c1d53ca11..db7e782419d5d9 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -332,19 +332,6 @@ struct vfio_region_info_cap_type

Re: [PATCH] PCI: layerscape: Correct syntax by changing comma to semicolon

2021-03-22 Thread Lorenzo Pieralisi
On Thu, 11 Mar 2021 03:37:45 +, Krzysztof Wilczyński wrote: > Replace command with a semicolon to correct syntax and to prevent > potential unspecified behaviour and/or unintended side effects. > > Related: > > https://lore.kernel.org/linux-pci/20201216131944.14990-1-zhengyongj...@huawei.co

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Russell King - ARM Linux admin
On Mon, Mar 22, 2021 at 05:09:13PM +0100, John Paul Adrian Glaubitz wrote: > On 3/22/21 4:15 PM, Russell King - ARM Linux admin wrote: > > I'm quite surprised that the CY82C693 even works on Alpha - I've > > asked for a lspci for that last week but nothing has yet been > > forthcoming from whoever

Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig

2021-03-22 Thread Russell King - ARM Linux admin
On Mon, Mar 22, 2021 at 04:18:23PM +0100, Christoph Hellwig wrote: > On Mon, Mar 22, 2021 at 03:15:03PM +, Russell King - ARM Linux admin > wrote: > > It gets worse than that though - due to a change to remove > > pcibios_min_io from the generic code, moving it into the ARM > > architecture co

Re: [RFC PATCH 6/8] powerpc/mm/book3s64/hash: drop pre 2.06 tlbiel for clang

2021-03-22 Thread Christophe Leroy
Le 19/03/2021 à 03:01, Nicholas Piggin a écrit : Excerpts from Daniel Axtens's message of February 25, 2021 1:10 pm: The llvm integrated assembler does not recognise the ISA 2.05 tlbiel version. Eventually do this more smartly. The whole thing with TLBIE and TLBIEL in this file seems a bit

  1   2   >