[PATCH] KVM: PPC: Book3S HV P9: Optimise loads around context switch

2022-01-23 Thread Nicholas Piggin
It is better to get all loads for the register values in flight before starting to switch LPID, PID, and LPCR because those mtSPRs are expensive and serialising. This also just tidies up the code for a potential future change to the context switching sequence. Signed-off-by: Nicholas Piggin ---

Re: [PATCH] powerpc: fix building after binutils changes.

2022-01-23 Thread Mike
Maybe cite the correct parts of the patch where my questions arose for context. --- diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index a94b0cd0bdc5ca..4ffd6791b03ec0 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -1465,7 +1465,7 @@ int

[PATCH 3/6] KVM: PPC: Book3S HV: Use IDA allocator for LPID allocator

2022-01-23 Thread Nicholas Piggin
This removes the fixed-size lpid_inuse array. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/powerpc.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 102993462872..c527a5751b46

[PATCH 4/6] KVM: PPC: Book3S HV Nested: Change nested guest lookup to use idr

2022-01-23 Thread Nicholas Piggin
This removes the fixed sized kvm->arch.nested_guests array. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_host.h | 3 +- arch/powerpc/kvm/book3s_hv_nested.c | 110 +++- 2 files changed, 59 insertions(+), 54 deletions(-) diff --git

[GIT PULL] Please pull powerpc/linux.git powerpc-5.17-2 tag

2022-01-23 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull powerpc fixes for 5.17. There's a change to kernel/bpf and one in tools/bpf, both have Daniel's ack. cheers The following changes since commit 29ec39fcf11e4583eb8d5174f756ea109c77cc44: Merge tag 'powerpc-5.17-1' of

[PATCH 5/6] KVM: PPC: Book3S Nested: Use explicit 4096 LPID maximum

2022-01-23 Thread Nicholas Piggin
Rather than tie this to KVMPPC_NR_LPIDS which is becoming more dynamic, fix it to 4096 (12-bits) explicitly for now. kvmhv_get_nested() does not have to check against KVM_MAX_NESTED_GUESTS because the L1 partition table registration hcall already did that, and it checks against the partition

[PATCH 6/6] KVM: PPC: Book3S HV: Remove KVMPPC_NR_LPIDS

2022-01-23 Thread Nicholas Piggin
KVMPPC_NR_LPIDS no longer represents any size restriction on the LPID space and can be removed. A CPU with more than 12 LPID bits implemented will now be able to create more than 4095 guests. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_book3s_asm.h | 3 ---

[PATCH] powerpc: fix building after binutils changes.

2022-01-23 Thread Mike
As some have probably noticed, we are seeing errors like ' Error: unrecognized opcode: `ptesync'' 'dssall' and 'stbcix' as a result of binutils changes, making compiling all that more fun again. The only question on my mind still is this: diff --git a/arch/powerpc/include/asm/io.h

[PATCH 1/6] KVM: PPC: Remove kvmppc_claim_lpid

2022-01-23 Thread Nicholas Piggin
Removing kvmppc_claim_lpid makes the lpid allocator API a bit simpler to change the underlying implementation in a future patch. The host LPID is always 0, so that can be a detail of the allocator. If the allocator range is restricted, that can reserve LPIDs at the top of the range. This allows

[PATCH 2/6] KVM: PPC: Book3S HV: Update LPID allocator init for POWER9, Nested

2022-01-23 Thread Nicholas Piggin
The LPID allocator init is changed to: - use mmu_lpid_bits rather than hard-coding; - use KVM_MAX_NESTED_GUESTS for nested hypervisors; - not reserve the top LPID on POWER9 and newer CPUs. The reserved LPID is made a POWER7/8-specific detail. Signed-off-by: Nicholas Piggin ---

[PATCH 0/6] KVM: PPC: Book3S: Make LPID/nested LPID allocations dynamic

2022-01-23 Thread Nicholas Piggin
With LPID width plumbed through from firmware, LPID allocations can now be dynamic, which requires changing the fixed sized bitmap. Rather than just dynamically sizing it, switch to IDA allocator. Nested KVM stays with a fixed 12-bit LPID width for now, but it is also moved to a more dynamic

Re: [PATCH v3 2/2] powerpc/fadump: opt out from freeing pages on cma activation failure

2022-01-23 Thread Michael Ellerman
Hari Bathini writes: > With commit a4e92ce8e4c8 ("powerpc/fadump: Reservationless firmware > assisted dump"), Linux kernel's Contiguous Memory Allocator (CMA) > based reservation was introduced in fadump. That change was aimed at > using CMA to let applications utilize the memory reserved for

Re: [RFC PATCH 0/2] powerpc/pseries: add support for local secure storage called Platform Keystore(PKS)

2022-01-23 Thread Daniel Axtens
Hi Greg, > Ok, this is like the 3rd or 4th different platform-specific proposal for > this type of functionality. I think we need to give up on > platform-specific user/kernel apis on this (random sysfs/securityfs > files scattered around the tree), and come up with a standard place for > all of

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.17-2 tag

2022-01-23 Thread pr-tracker-bot
The pull request you sent on Sun, 23 Jan 2022 22:19:16 +1100: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.17-2 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0 Thank you! --

[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate

2022-01-23 Thread Yury Norov
PowerPC code uses cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov ---

[PATCH 46/54] soc: replace cpumask_weight with cpumask_weight_lt

2022-01-23 Thread Yury Norov
qman_test_stash() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_lt because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov ---

Re: [PATCH] powerpc: fix building after binutils changes.

2022-01-23 Thread Mike
Now I remembered reading something from 2013 on 'lwsync', https://gcc.gnu.org/legacy-ml/gcc-patches/2006-11/msg01238.html https://gcc.gnu.org/legacy-ml/gcc-patches/2012-07/msg01062.html so that would end up something like ---

Re: [PATCH 0/2] powerpc: Disable syscall emulation and stepping

2022-01-23 Thread Christophe Leroy
Le 24/01/2022 à 06:57, Nicholas Piggin a écrit : > As discussed previously > > https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-January/238946.html > > I'm wondering whether PPC32 should be returning -1 for syscall > instructions too here? That could be done in another patch anyway. >

Re: [PATCH v3 1/2] mm/cma: provide option to opt out from exposing pages on activation failure

2022-01-23 Thread Hari Bathini
Hi Andrew, Could you please pick these patches via -mm tree. On 17/01/22 1:22 pm, Hari Bathini wrote: Commit 072355c1cf2d ("mm/cma: expose all pages to the buddy if activation of an area fails") started exposing all pages to buddy allocator on CMA activation failure. But there can be CMA

[PATCH 0/2] powerpc: Disable syscall emulation and stepping

2022-01-23 Thread Nicholas Piggin
As discussed previously https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-January/238946.html I'm wondering whether PPC32 should be returning -1 for syscall instructions too here? That could be done in another patch anyway. Thanks, Nick Nicholas Piggin (2): powerpc/64: remove system call

[PATCH 2/2] powerpc/uprobes: Reject uprobe on a system call instruction

2022-01-23 Thread Nicholas Piggin
Per the ISA, a Trace interrupt is not generated for a system call [vectored] instruction. Reject uprobes on such instructions as we are not emulating a system call [vectored] instruction anymore. Signed-off-by: Naveen N. Rao [np: Switch to pr_info_ratelimited] Signed-off-by: Nicholas Piggin ---

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

2022-01-23 Thread Nicholas Piggin
emulate_step instruction emulation including sc instruction emulation initially appeared in xmon. It then emulation code was then moved into sstep.c where kprobes could use it too, and later hw_breakpoint and uprobes started to use it. Until uprobes, the only instruction emulation users were for