Re: [PATCH] KVM: PPC: Book3S HV: Use feature flag CPU_FTR_P9_TIDR when accessing TIDR

2020-07-20 Thread Paul Mackerras
On Tue, Jun 23, 2020 at 06:50:27PM +0200, Cédric Le Goater wrote: > The TIDR register is only available on POWER9 systems and code > accessing this register is not always protected by the CPU_FTR_P9_TIDR > flag. Fix that to make sure POWER10 systems won't use it as TIDR has > been removed. I'm

Re: [v3 02/15] KVM: PPC: Book3S HV: Cleanup updates for kvm vcpu MMCR

2020-07-20 Thread Paul Mackerras
On Fri, Jul 17, 2020 at 10:38:14AM -0400, Athira Rajeev wrote: > Currently `kvm_vcpu_arch` stores all Monitor Mode Control registers > in a flat array in order: mmcr0, mmcr1, mmcra, mmcr2, mmcrs > Split this to give mmcra and mmcrs its own entries in vcpu and > use a flat array for mmcr0 to mmcr2.

Re: [PATCH] pseries: Fix 64 bit logical memory block panic

2020-07-16 Thread Paul Mackerras
On Wed, Jul 15, 2020 at 06:12:25PM +0530, Aneesh Kumar K.V wrote: > Anton Blanchard writes: > > > Booting with a 4GB LMB size causes us to panic: > > > > qemu-system-ppc64: OS terminated: OS panic: > > Memory block size not suitable: 0x0 > > > > Fix pseries_memory_block_size() to handle

Re: [RFC PATCH v0 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-07-09 Thread Paul Mackerras
On Thu, Jul 09, 2020 at 02:38:51PM +0530, Bharata B Rao wrote: > On Thu, Jul 09, 2020 at 03:18:03PM +1000, Paul Mackerras wrote: > > On Fri, Jul 03, 2020 at 04:14:20PM +0530, Bharata B Rao wrote: > > > In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall >

Re: [RFC PATCH v0 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-07-08 Thread Paul Mackerras
On Fri, Jul 03, 2020 at 04:14:20PM +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. What are

Re: [PATCH v2 2/3] powerpc/64s: remove PROT_SAO support

2020-07-08 Thread Paul Mackerras
On Fri, Jul 03, 2020 at 11:19:57AM +1000, Nicholas Piggin wrote: > ISA v3.1 does not support the SAO storage control attribute required to > implement PROT_SAO. PROT_SAO was used by specialised system software > (Lx86) that has been discontinued for about 7 years, and is not thought > to be used

Re: [PATCH 1/1] KVM/PPC: Fix typo on H_DISABLE_AND_GET hcall

2020-07-08 Thread Paul Mackerras
for InfiniBand usage"), and was > later used without having the typo noticed. > > Signed-off-by: Leonardo Bras Acked-by: Paul Mackerras Since this hypercall is not implemented in KVM nor used by KVM guests, I'll leave this one for Michael to pick up. Paul.

Re: [PATCH v2 02/10] KVM: PPC: Book3S HV: Save/restore new PMU registers

2020-07-01 Thread Paul Mackerras
On Wed, Jul 01, 2020 at 05:20:54AM -0400, Athira Rajeev wrote: > PowerISA v3.1 has added new performance monitoring unit (PMU) > special purpose registers (SPRs). They are > > Monitor Mode Control Register 3 (MMCR3) > Sampled Instruction Event Register A (SIER2) > Sampled Instruction Event

Re: [PATCH 3/3] powerpc/pseries: Add KVM guest doorbell restrictions

2020-06-30 Thread Paul Mackerras
On Tue, Jun 30, 2020 at 03:35:08PM +1000, Nicholas Piggin wrote: > Excerpts from Paul Mackerras's message of June 30, 2020 12:27 pm: > > On Sun, Jun 28, 2020 at 01:04:28AM +1000, Nicholas Piggin wrote: > >> KVM guests have certain restrictions and performance quirks when > >> using doorbells. This

Re: [PATCH 3/3] powerpc/pseries: Add KVM guest doorbell restrictions

2020-06-29 Thread Paul Mackerras
On Sun, Jun 28, 2020 at 01:04:28AM +1000, Nicholas Piggin wrote: > KVM guests have certain restrictions and performance quirks when > using doorbells. This patch tests for KVM environment in doorbell > setup, and optimises IPI performance: > > - PowerVM guests may now use doorbells even if they

Re: [PATCH v4 09/22] powerpc/kvm/book3s: Add helper to walk partition scoped linux page table.

2020-05-28 Thread Paul Mackerras
On Thu, May 28, 2020 at 11:31:04AM +0530, Aneesh Kumar K.V wrote: > On 5/28/20 7:13 AM, Paul Mackerras wrote: > > On Tue, May 05, 2020 at 12:47:16PM +0530, Aneesh Kumar K.V wrote: > > > The locking rules for walking partition scoped table is different from > > > proces

Re: [PATCH v4 09/22] powerpc/kvm/book3s: Add helper to walk partition scoped linux page table.

2020-05-27 Thread Paul Mackerras
On Tue, May 05, 2020 at 12:47:16PM +0530, Aneesh Kumar K.V wrote: > The locking rules for walking partition scoped table is different from process > scoped table. Hence add a helper for secondary linux page table walk and also > add check whether we are holding the right locks. This patch is

Re: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes

2020-05-26 Thread Paul Mackerras
On Thu, Apr 16, 2020 at 06:27:15PM +0200, Laurent Dufour wrote: > The newly introduced ibm,secure-memory nodes supersede the > ibm,uv-firmware's property secure-memory-ranges. > > Firmware will no more expose the secure-memory-ranges property so first > read the new one and if not found rollback

Re: [PATCH v4 3/7] KVM: PPC: Remove redundant kvm_run from vcpu_arch

2020-05-26 Thread Paul Mackerras
On Mon, Apr 27, 2020 at 12:35:10PM +0800, Tianjia Zhang wrote: > The 'kvm_run' field already exists in the 'vcpu' structure, which > is the same structure as the 'kvm_run' in the 'vcpu_arch' and > should be deleted. > > Signed-off-by: Tianjia Zhang Thanks, patches 3 and 4 of this series applied

Re: [PATCH -next] KVM: PPC: Book3S HV: remove redundant NULL check

2020-05-26 Thread Paul Mackerras
On Wed, Apr 01, 2020 at 09:09:03PM +0800, Chen Zhou wrote: > Free function kfree() already does NULL check, so the additional > check is unnecessary, just remove it. > > Signed-off-by: Chen Zhou Thanks, applied to my kvm-ppc-next branch. Paul.

Re: [PATCH v2] KVM: PPC: Book3S HV: relax check on H_SVM_INIT_ABORT

2020-05-26 Thread Paul Mackerras
On Wed, May 20, 2020 at 07:43:08PM +0200, Laurent Dufour wrote: > The commit 8c47b6ff29e3 ("KVM: PPC: Book3S HV: Check caller of H_SVM_* > Hcalls") added checks of secure bit of SRR1 to filter out the Hcall > reserved to the Ultravisor. > > However, the Hcall H_SVM_INIT_ABORT is made by the

Re: [PATCH] powerpc/kvm/radix: ignore kmemleak false positives

2020-05-26 Thread Paul Mackerras
On Wed, May 13, 2020 at 09:39:15AM -0400, Qian Cai wrote: > kvmppc_pmd_alloc() and kvmppc_pte_alloc() allocate some memory but then > pud_populate() and pmd_populate() will use __pa() to reference the newly > allocated memory. > > Since kmemleak is unable to track the physical memory resulting in

Re: [PATCH] powerpc/kvm/book3s64/vio: fix some RCU-list locks

2020-05-26 Thread Paul Mackerras
On Sun, May 10, 2020 at 01:18:34AM -0400, Qian Cai wrote: > It is unsafe to traverse kvm->arch.spapr_tce_tables and > stt->iommu_tables without the RCU read lock held. Also, add > cond_resched_rcu() in places with the RCU read lock held that could take > a while to finish. > >

Re: [PATCH] powerpc/kvm/book3s64/vio: fix some RCU-list locks

2020-05-26 Thread Paul Mackerras
On Sun, May 10, 2020 at 01:18:34AM -0400, Qian Cai wrote: > It is unsafe to traverse kvm->arch.spapr_tce_tables and > stt->iommu_tables without the RCU read lock held. Also, add > cond_resched_rcu() in places with the RCU read lock held that could take > a while to finish. This mostly looks fine.

Re: [linux-next PATCH] mm/gup.c: Convert to use get_user_{page|pages}_fast_only()

2020-05-26 Thread Paul Mackerras
f the API. > > Signed-off-by: Souptick Joarder The arch/powerpc/kvm bits look reasonable. Reviewed-by: Paul Mackerras

Re: [PATCH v4 5/7] KVM: PPC: clean up redundant kvm_run parameters in assembly

2020-05-26 Thread Paul Mackerras
On Mon, Apr 27, 2020 at 12:35:12PM +0800, Tianjia Zhang wrote: > In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu' > structure. For historical reasons, many kvm-related function parameters > retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time. This > patch does

Re: [PATCH v4 4/7] KVM: PPC: clean up redundant 'kvm_run' parameters

2020-05-25 Thread Paul Mackerras
; patch does a unified cleanup of these remaining redundant parameters. > > Signed-off-by: Tianjia Zhang This looks OK, though possibly a little larger than it needs to be because of variable name changes (kvm_run -> run) that aren't strictly necessary. Reviewed-by: Paul Mackerras

Re: [PATCH v4 3/7] KVM: PPC: Remove redundant kvm_run from vcpu_arch

2020-05-25 Thread Paul Mackerras
ch architecture sub-maintainer is taking the relevant patches from this series via their tree - is that right? Reviewed-by: Paul Mackerras

[PATCH RFC 2/4] powerpc: Add Microwatt platform

2020-05-08 Thread Paul Mackerras
Microwatt is a FPGA-based implementation of the Power ISA. It currently only implements little-endian 64-bit mode, and does not (yet) support SMP. This adds a new machine type to support FPGA-based SoCs with a Microwatt core. Signed-off-by: Paul Mackerras --- arch/powerpc/Kconfig

[PATCH RFC 0/4] Add support for Microwatt-based SoCs

2020-05-08 Thread Paul Mackerras
This patch series adds support for running Linux on a Microwatt SoC (system on chip) implementation on an FPGA. Microwatt is a small Power ISA implementation, targetted at FPGAs, aiming for PowerISA v3.0B compliance. It does not currently implement any floating-point or vector instructions,

[PATCH RFC 1/4] powerpc/radix: Fix compilation for radix with CONFIG_SMP=n

2020-05-08 Thread Paul Mackerras
This fixes the compile errors we currently get with CONFIG_SMP=n and CONFIG_PPC_RADIX_MMU=y. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/book3s/64/tlbflush-radix.h | 2 ++ arch/powerpc/mm/book3s64/radix_tlb.c| 2 -- 2 files changed, 2 insertions(+), 2 deletions

[PATCH RFC 4/4] powerpc/radix: Add support for microwatt's PRTBL SPR

2020-05-08 Thread Paul Mackerras
, as that is in the range of SPR numbers assigned for experimental use. PRTBL is only written when we have neither the FW_FEATURE_LPAR feature nor the CPU_FTR_HVMODE feature. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/mm/book3s64/radix_pgtable.c

[PATCH RFC 3/4] powerpc/microwatt: Add early debug UART support for Microwatt

2020-05-08 Thread Paul Mackerras
Currently microwatt-based SoCs come with a "potato" UART. This adds udbg support for the potato UART, giving us both an early debug console, and a runtime console using the hvc-udbg support. Signed-off-by: Paul Mackerras --- arch/powerpc/Kconfig.debug | 6 ++ ar

[PATCH] KVM: PPC: Book3S HV: Handle non-present PTEs in page fault functions

2020-04-15 Thread Paul Mackerras
_to_pfn_memslot in HPT page fault handler" Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820402 Reported-by: David Gibson Signed-off-by: Paul Mackerras --- This is a reworked version of the patch David Gibson sent recently, with the fix applied to the radix case as well. The comm

Re: CVE-2020-11669: Linux kernel 4.10 to 5.1: powerpc: guest can cause DoS on POWER9 KVM hosts

2020-04-15 Thread Paul Mackerras
On Wed, Apr 15, 2020 at 04:03:29PM +0200, Michal Suchánek wrote: > On Wed, Apr 15, 2020 at 10:52:53PM +1000, Andrew Donnellan wrote: > > The Linux kernel for powerpc from v4.10 to v5.1 has a bug where the > > Authority Mask Register (AMR), Authority Mask Override Register (AMOR) and > > User

Re: [PATCH v3 1/1] ppc/crash: Reset spinlocks during crash

2020-04-08 Thread Paul Mackerras
On Wed, Apr 08, 2020 at 10:21:29PM +1000, Michael Ellerman wrote: > > We should be able to just allocate the rtas_args on the stack, it's only > ~80 odd bytes. And then we can use rtas_call_unlocked() which doesn't > take the global lock. Do we instantiate a 64-bit RTAS these days, or is it

Re: [RFC PATCH 1/1] ppc/smp: Replace unnecessary 'while' by 'if'

2020-03-26 Thread Paul Mackerras
On Thu, Mar 26, 2020 at 05:37:52PM -0300, Leonardo Bras wrote: > spin_until_cond() will wait until nmi_ipi_busy == false, and > nmi_ipi_lock_start() does not seem to change nmi_ipi_busy, so there is > no way this while will ever repeat. > > Replace this 'while' by an 'if', so it does not look

Re: [PATCH 0/2] Fix SVM hang at startup

2020-03-23 Thread Paul Mackerras
On Fri, Mar 20, 2020 at 11:26:41AM +0100, Laurent Dufour wrote: > This series is fixing a SVM hang occurring when starting a SVM requiring > more secure memory than available. The hang happens in the SVM when calling > UV_ESM. > > The following is happening: > > 1. SVM calls UV_ESM > 2.

Re: [PATCH] KVM: PPC: Book3S HV: Skip kvmppc_uvmem_free if Ultravisor is not supported

2020-03-23 Thread Paul Mackerras
On Thu, Mar 19, 2020 at 07:55:10PM -0300, Fabiano Rosas wrote: > kvmppc_uvmem_init checks for Ultravisor support and returns early if > it is not present. Calling kvmppc_uvmem_free at module exit will cause > an Oops: > > $ modprobe -r kvm-hv > > Oops: Kernel access of bad area, sig: 11 [#1] >

Re: [PATCH 1/2] KVM: PPC: Book3S HV: check caller of H_SVM_* Hcalls

2020-03-23 Thread Paul Mackerras
On Fri, Mar 20, 2020 at 01:22:48PM +0100, Greg Kurz wrote: > On Fri, 20 Mar 2020 11:26:42 +0100 > Laurent Dufour wrote: > > > The Hcall named H_SVM_* are reserved to the Ultravisor. However, nothing > > prevent a malicious VM or SVM to call them. This could lead to weird result > > and should be

Re: [PATCH] KVM: PPC: Book3S HV: Skip kvmppc_uvmem_free if Ultravisor is not supported

2020-03-19 Thread Paul Mackerras
Support for running secure guests") > Reported-by: Greg Kurz > Signed-off-by: Fabiano Rosas Good catch! This should be Cc: sta...@vger.kernel.org # v5.5+ Acked-by: Paul Mackerras Paul.

Re: [PATCH 0/3] KVM: PPC: Fix host kernel crash with PR KVM

2020-03-19 Thread Paul Mackerras
On Wed, Mar 18, 2020 at 06:43:24PM +0100, Greg Kurz wrote: > Recent cleanup from Sean Christopherson introduced a use-after-free > condition that crashes the kernel when shutting down the VM with > PR KVM. It went unnoticed so far because PR isn't tested/used much > these days (mostly used for

Re: [PATCH] KVM: PPC: Book3S HV: Use RADIX_PTE_INDEX_SIZE in Radix MMU code

2020-03-19 Thread Paul Mackerras
On Tue, Feb 18, 2020 at 03:36:50PM +1100, Michael Ellerman wrote: > In kvmppc_unmap_free_pte() in book3s_64_mmu_radix.c, we use the > non-constant value PTE_INDEX_SIZE to clear a PTE page. > > We can instead use the constant RADIX_PTE_INDEX_SIZE, because we know > this code will only be running

Re: [PATCH -next 016/491] KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc): Use fallthrough;

2020-03-19 Thread Paul Mackerras
On Wed, Mar 18, 2020 at 06:22:29PM -0700, Joe Perches wrote: > On Thu, 2020-03-19 at 12:18 +1100, Paul Mackerras wrote: > > On Tue, Mar 10, 2020 at 09:51:30PM -0700, Joe Perches wrote: > > > Convert the various uses of fallthrough comments to fallthrough; > > > >

Re: [PATCH] KVM: PPC: Book3S HV: Fix H_CEDE return code for nested guests

2020-03-19 Thread Paul Mackerras
78556 > > Fixes: 4bad77799fed ("KVM: PPC: Book3S HV: Handle hypercalls correctly when > nested") > Cc: linuxppc-...@ozlabs.org > Cc: David Gibson > Cc: Paul Mackerras > Signed-off-by: Michael Roth Thanks, applied to my kvm-ppc-next branch. Paul.

Re: [PATCH v3] KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones

2020-03-19 Thread Paul Mackerras
On Fri, Feb 21, 2020 at 11:29:50AM -0500, Gustavo Romero wrote: > On P9 DD2.2 due to a CPU defect some TM instructions need to be emulated by > KVM. This is handled at first by the hardware raising a softpatch interrupt > when certain TM instructions that need KVM assistance are executed in the >

Re: [PATCH -next 016/491] KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc): Use fallthrough;

2020-03-18 Thread Paul Mackerras
d-off-by: Joe Perches The subject line should look like "KVM: PPC: Use fallthrough". Apart from that, Acked-by: Paul Mackerras How are these patches going upstream? Do you want me to take this via my tree? Paul.

Re: [PATCH FIX] KVM: PPC: Book3S HV: Release lock on page-out failure path

2020-01-29 Thread Paul Mackerras
On Wed, Jan 22, 2020 at 10:25:42AM +0530, Bharata B Rao wrote: > When migrate_vma_setup() fails in kvmppc_svm_page_out(), > release kvm->arch.uvmem_lock before returning. > > Fixes: ca9f4942670 ("KVM: PPC: Book3S HV: Support for running secure guests") > Signed-off-by: Bharata B Rao Thanks,

Re: [PATCH v3] powerpc/mm: Remove kvm radix prefetch workaround for Power9 DD2.2

2020-01-16 Thread Paul Mackerras
ormed. This means that we can get rid of the workarounds for > Power9 DD2.2 and later revisions. Add a new cpu feature > CPU_FTR_P9_RADIX_PREFETCH_BUG to indicate if the workarounds are needed. > > Signed-off-by: Jordan Niethe Acked-by: Paul Mackerras

Re: [PATCH v3 2/2] powerpc/pseries/svm: Disable BHRB/EBB/PMU access

2020-01-12 Thread Paul Mackerras
On Thu, Jan 09, 2020 at 09:19:57PM -0800, Sukadev Bhattiprolu wrote: > Ultravisor disables some CPU features like BHRB, EBB and PMU in > secure virtual machines (SVMs). Skip accessing those registers > in SVMs to avoid getting a Program Interrupt. It would be useful to have more explanation of

Re: [PATCH 2/3] powerpc sstep: add support for divde[.] and divdeu[.] instructions

2020-01-08 Thread Paul Mackerras
On Tue, Dec 10, 2019 at 12:49:03PM +0530, Balamuruhan S wrote: > This patch adds emulation support for divde, divdeu instructions, > * Divide Doubleword Extended (divde[.]) > * Divide Doubleword Extended Unsigned (divdeu[.]) > > Signed-off-by: Balamuruhan S > --- >

Re: [PATCH V3 2/2] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-12-17 Thread Paul Mackerras
MSR_S bit will be clear and the VM wont be able to > access its pages even to do a clean exit). > > Based on patches and discussion with Paul Mackerras, Ram Pai and > Bharata Rao. > > Signed-off-by: Ram Pai > Signed-off-by: Sukadev Bhattiprolu > Signed-off-by: Bharata B Rao Mino

Re: [PATCH V3 1/2] KVM: PPC: Add skip_page_out parameter

2019-12-17 Thread Paul Mackerras
c 2019 15:06:16 -0600 > Subject: [PATCH V3 1/2] KVM: PPC: Add skip_page_out parameter > > Add 'skip_page_out' parameter to kvmppc_uvmem_drop_pages() which will > be needed in a follow-on patch that implements H_SVM_INIT_ABORT hcall. > > Signed-off-by: Sukadev Bhattiprolu Reviewed-by: Paul Mackerras

Re: [PATCH 1/1] powerpc/kvm/book3s: Fixes possible 'use after release' of kvm

2019-11-27 Thread Paul Mackerras
On Tue, Nov 26, 2019 at 02:52:12PM -0300, Leonardo Bras wrote: > Fixes a possible 'use after free' of kvm variable. > It does use mutex_unlock(>lock) after possible freeing a variable > with kvm_put_kvm(kvm). Comments below... > diff --git a/arch/powerpc/kvm/book3s_64_vio.c >

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-13 Thread Paul Mackerras
On Wed, Nov 13, 2019 at 01:50:42PM -0800, Ram Pai wrote: > On Thu, Nov 14, 2019 at 08:18:24AM +1100, Paul Mackerras wrote: > > On Tue, Nov 12, 2019 at 10:32:33PM -0800, Ram Pai wrote: > > > On Wed, Nov 13, 2019 at 11:14:27AM +1100, Paul Mackerras wrote: > > > > On T

Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-13 Thread Paul Mackerras
On Wed, Nov 13, 2019 at 08:59:08PM +0530, Bharata B Rao wrote: > On Tue, Nov 12, 2019 at 04:34:34PM +1100, Paul Mackerras wrote: > > On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: > > [snip] > > > @@ -5442,6 +5471,64 @@ static int kvmhv_store_to_eaddr(stru

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-13 Thread Paul Mackerras
On Tue, Nov 12, 2019 at 10:32:33PM -0800, Ram Pai wrote: > On Wed, Nov 13, 2019 at 11:14:27AM +1100, Paul Mackerras wrote: > > On Tue, Nov 12, 2019 at 06:45:55AM -0800, Ram Pai wrote: > > > On Tue, Nov 12, 2019 at 10:32:04PM +1100, Paul Mackerras wrote: > > > > On M

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-12 Thread Paul Mackerras
On Tue, Nov 12, 2019 at 06:45:55AM -0800, Ram Pai wrote: > On Tue, Nov 12, 2019 at 10:32:04PM +1100, Paul Mackerras wrote: > > On Mon, Nov 11, 2019 at 11:52:15PM -0800, Ram Pai wrote: > > > There is subtle problem removing that code from the assembly. > > > > >

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-12 Thread Paul Mackerras
On Mon, Nov 11, 2019 at 11:52:15PM -0800, Ram Pai wrote: > On Tue, Nov 12, 2019 at 04:38:36PM +1100, Paul Mackerras wrote: > > On Mon, Nov 11, 2019 at 05:01:58PM -0800, Ram Pai wrote: > > > On Mon, Nov 11, 2019 at 03:19:24PM +1100, Paul Mackerras wrote: > > > > On M

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-11 Thread Paul Mackerras
On Mon, Nov 11, 2019 at 05:01:58PM -0800, Ram Pai wrote: > On Mon, Nov 11, 2019 at 03:19:24PM +1100, Paul Mackerras wrote: > > On Mon, Nov 04, 2019 at 09:47:59AM +0530, Bharata B Rao wrote: > > > From: Sukadev Bhattiprolu > > > > > > Implement the H_SVM_INIT_

Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-11 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: [snip] > @@ -5442,6 +5471,64 @@ static int kvmhv_store_to_eaddr(struct kvm_vcpu *vcpu, > ulong *eaddr, void *ptr, > return rc; > } > > +/* > + * IOCTL handler to turn off secure mode of guest > + * > + * - Issue ucall to

Re: [PATCH v10 6/8] KVM: PPC: Support reset of secure guest

2019-11-10 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:58AM +0530, Bharata B Rao wrote: > Add support for reset of secure guest via a new ioctl KVM_PPC_SVM_OFF. > This ioctl will be issued by QEMU during reset and includes the > the following steps: > > - Ask UV to terminate the guest via UV_SVM_TERMINATE ucall > - Unpin

Re: [PATCH v10 5/8] KVM: PPC: Handle memory plug/unplug to secure VM

2019-11-10 Thread Paul Mackerras
ukadev Bhattiprolu > [Added skip_page_out arg to kvmppc_uvmem_drop_pages()] Reviewed-by: Paul Mackerras

Re: [PATCH v10 7/8] KVM: PPC: Implement H_SVM_INIT_ABORT hcall

2019-11-10 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:59AM +0530, Bharata B Rao wrote: > From: Sukadev Bhattiprolu > > Implement the H_SVM_INIT_ABORT hcall which the Ultravisor can use to > abort an SVM after it has issued the H_SVM_INIT_START and before the > H_SVM_INIT_DONE hcalls. This hcall could be used when

Re: [PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-06 Thread Paul Mackerras
On Wed, Nov 06, 2019 at 12:15:42PM +0530, Bharata B Rao wrote: > On Wed, Nov 06, 2019 at 03:33:29PM +1100, Paul Mackerras wrote: > > On Mon, Nov 04, 2019 at 09:47:53AM +0530, Bharata B Rao wrote: > > > KVM PPC module needs ksm_madvise() for supporting secure guests. > > &

Re: [PATCH v10 2/8] KVM: PPC: Support for running secure guests

2019-11-05 Thread Paul Mackerras
to the guest becomes secure, a page from > this private device memory is used to represent and track that secure > page on the HV side. The movement of pages between normal and secure > memory is done via migrate_vma_pages() using UV_PAGE_IN and > UV_PAGE_OUT ucalls. > > Signed-off-by: Bharata B Rao Reviewed-by: Paul Mackerras

Re: [PATCH v10 1/8] mm: ksm: Export ksm_madvise()

2019-11-05 Thread Paul Mackerras
m_madvise call, then as far as I can tell, it should all still work correctly, but we might have KSM pulling pages in unnecessarily, causing a reduction in performance. Is that right? > Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras

Re: [PATCH v10 4/8] KVM: PPC: Radix changes for secure guest

2019-11-05 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:56AM +0530, Bharata B Rao wrote: > - After the guest becomes secure, when we handle a page fault of a page > belonging to SVM in HV, send that page to UV via UV_PAGE_IN. > - Whenever a page is unmapped on the HV side, inform UV via UV_PAGE_INVAL. > - Ensure all

Re: [PATCH v10 3/8] KVM: PPC: Shared pages support for secure guests

2019-11-05 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:55AM +0530, Bharata B Rao wrote: > A secure guest will share some of its pages with hypervisor (Eg. virtio > bounce buffers etc). Support sharing of pages between hypervisor and > ultravisor. > > Shared page is reachable via both HV and UV side page tables. Once a >

Re: [PATCH v10 0/8] KVM: PPC: Driver to manage pages of secure guest

2019-11-05 Thread Paul Mackerras
On Mon, Nov 04, 2019 at 09:47:52AM +0530, Bharata B Rao wrote: > Hi, > > This is the next version of the patchset that adds required support > in the KVM hypervisor to run secure guests on PEF-enabled POWER platforms. > > The major change in this version is about not using kvm.arch->rmap[] >

Re: [PATCH v9 2/8] KVM: PPC: Move pages between normal and secure memory

2019-10-22 Thread Paul Mackerras
On Tue, Oct 22, 2019 at 11:59:35AM +0530, Bharata B Rao wrote: > On Fri, Oct 18, 2019 at 8:31 AM Paul Mackerras wrote: > > > > On Wed, Sep 25, 2019 at 10:36:43AM +0530, Bharata B Rao wrote: > > > Manage migration of pages betwen normal and secure memory of secure >

Re: [PATCH v2 0/6] KVM: PPC: Book3S: HV: XIVE: Allocate less VPs in OPAL

2019-10-20 Thread Paul Mackerras
On Wed, Oct 16, 2019 at 11:44:03PM +0200, Greg Kurz wrote: > On Fri, 27 Sep 2019 13:53:32 +0200 > Greg Kurz wrote: > > > This brings some fixes and allows to start more VMs with an in-kernel > > XIVE or XICS-on-XIVE device. > > > > Changes since v1 (https://patchwork.ozlabs.org/cover/1166099/):

Re: [PATCH v9 2/8] KVM: PPC: Move pages between normal and secure memory

2019-10-17 Thread Paul Mackerras
On Wed, Sep 25, 2019 at 10:36:43AM +0530, Bharata B Rao wrote: > Manage migration of pages betwen normal and secure memory of secure > guest by implementing H_SVM_PAGE_IN and H_SVM_PAGE_OUT hcalls. > > H_SVM_PAGE_IN: Move the content of a normal page to secure page > H_SVM_PAGE_OUT: Move the

Re: [PATCH 3/6] KVM: PPC: Book3S HV: XIVE: Ensure VP isn't already in use

2019-09-24 Thread Paul Mackerras
On Mon, Sep 23, 2019 at 05:43:48PM +0200, Greg Kurz wrote: > We currently prevent userspace to connect a new vCPU if we already have > one with the same vCPU id. This is good but unfortunately not enough, > because VP ids derive from the packed vCPU ids, and kvmppc_pack_vcpu_id() > can return

Re: [PATCH 1/6] KVM: PPC: Book3S HV: XIVE: initialize private pointer when VPs are allocated

2019-09-23 Thread Paul Mackerras
On Mon, Sep 23, 2019 at 05:43:37PM +0200, Greg Kurz wrote: > From: Cédric Le Goater > > Do not assign the device private pointer before making sure the XIVE > VPs are allocated in OPAL and test pointer validity when releasing > the device. > > Fixes: 5422e95103cf ("KVM: PPC: Book3S HV: XIVE:

Re: [PATCH v2] KVM: PPC: Book3S HV: use smp_mb() when setting/clearing host_ipi flag

2019-09-23 Thread Paul Mackerras
5: // hangs waiting on 42 to process messages/call_single_queue > > Fixing this scenario would require an smp_mb() *after* clearing > host_ipi flag in kvmppc_set_host_ipi() to order the store vs. > subsequent processing of IPI messages. > > To handle both cases, this patch splits kvmppc_set_host_ipi() into > separate set/clear functions, where we execute smp_mb() prior to > setting host_ipi flag, and after clearing host_ipi flag. These > functions pair with each other to synchronize the sender and receiver > sides. > > With that change in place the above workload ran for 20 hours without > triggering any lock-ups. > > Fixes: 755563bc79c7 ("powerpc/powernv: Fixes for hypervisor doorbell > handling") # v4.0 > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Nicholas Piggin > Cc: kvm-...@vger.kernel.org > Signed-off-by: Michael Roth Looks good, makes sense. Acked-by: Paul Mackerras

Re: [PATCH kernel v2 2/4] KVM: PPC: Invalidate multiple TCEs at once

2019-08-26 Thread Paul Mackerras
MA window; > roughly 20s to 10s for each guest's 100GB of DMA space. > > Signed-off-by: Alexey Kardashevskiy With the addition of "Book3S" to the patch title, Acked-by: Paul Mackerras

[PATCH] KVM: PPC: Book3S: Enable XIVE native capability only if OPAL has required functions

2019-08-26 Thread Paul Mackerras
and the KVM_CAP_PPC_IRQ_XIVE capability returns false. Userspace can then either provide a software emulation of XIVE, or else tell the guest that it does not have a XIVE controller available to it. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h| 1 + arch/powerpc

Re: [PATCH v7 0/7] KVMPPC driver to manage secure guest pages

2019-08-22 Thread Paul Mackerras
On Thu, Aug 22, 2019 at 03:56:13PM +0530, Bharata B Rao wrote: > Hi, > > A pseries guest can be run as a secure guest on Ultravisor-enabled > POWER platforms. On such platforms, this driver will be used to manage > the movement of guest pages between the normal memory managed by > hypervisor(HV)

Re: [PATCH kernel] vfio/spapr_tce: Fix incorrect tce_iommu_group memory free

2019-08-22 Thread Paul Mackerras
nasty since it is a double free. Alex, are you going to take this, or would you prefer it goes via Michael Ellerman's tree? Reviewed-by: Paul Mackerras

Re: [PATCH v6 7/7] powerpc/kvm: Use UV_RETURN ucall to return to ultravisor

2019-08-22 Thread Paul Mackerras
n interrupt for the guest. The ultravisor needs to detect this case and respond appropriately. > Thanks to input from Paul Mackerras, Ram Pai and Mike Anderson. > > Signed-off-by: Sukadev Bhattiprolu > Signed-off-by: Claudio Carvalho Apart from that comment on the patch description - Acked-by: Paul Mackerras

Re: [PATCH v2 1/3] KVM: PPC: Book3S HV: Fix race in re-enabling XIVE escalation interrupts

2019-08-14 Thread Paul Mackerras
On Wed, Aug 14, 2019 at 02:46:38PM +1000, Jordan Niethe wrote: > On Tue, 2019-08-13 at 20:03 +1000, Paul Mackerras wrote: [snip] > > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S > > b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > > index 337e644..2e7e788 100644 >

Re: [PATCH 1/2] powerpc: rewrite LOAD_REG_IMMEDIATE() as an intelligent macro

2019-08-13 Thread Paul Mackerras
On Tue, Aug 13, 2019 at 09:59:35AM +, Christophe Leroy wrote: [snip] > +.macro __LOAD_REG_IMMEDIATE r, x > + .if \x & ~0x != 0 > + __LOAD_REG_IMMEDIATE_32 \r, (\x) >> 32 > + rldicr \r, \r, 32, 31 > + .if (\x) & 0x != 0 > +

[PATCH v2 1/3] KVM: PPC: Book3S HV: Fix race in re-enabling XIVE escalation interrupts

2019-08-13 Thread Paul Mackerras
ll be needed by the following patch. Cc: sta...@vger.kernel.org # v4.16+ Fixes: 9b9b13a6d153 ("KVM: PPC: Book3S HV: Keep XIVE escalation interrupt masked unless ceded") Signed-off-by: Paul Mackerras --- v2: don't set xive_esc_on if we're not using a XIVE escalation interrupt. arch/powerpc/kvm/

[PATCH v2 0/3] powerpc/xive: Fix race condition leading to host crashes and hangs

2019-08-13 Thread Paul Mackerras
This series fixes a race condition that has been observed in testing on POWER9 machines running KVM guests. An interrupt being freed by free_irq() can have an instance present in a XIVE interrupt queue, which can then be presented to the generic interrupt code after the data structures for it

[PATCH v2 2/3] KVM: PPC: Book3S HV: Don't push XIVE context when not using XIVE device

2019-08-13 Thread Paul Mackerras
. Cc: sta...@vger.kernel.org # v4.11+ Reported-by: Cédric Le Goater Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller") Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 ++ arch/powerpc/kvm/book3s_xive.c | 11 +

[PATCH v2 3/3] powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race

2019-08-13 Thread Paul Mackerras
get triggered it will be an indication that the race is occurring and needs to be debugged. Signed-off-by: Paul Mackerras --- v2: call xive_cleanup_single_escalation from kvmppc_xive_native_cleanup_vcpu() too. arch/powerpc/include/asm/xive.h | 8 arch/powerpc/kvm/book3s_xive.

Re: [PATCH 1/2] KVM: PPC: Book3S HV: Fix race in re-enabling XIVE escalation interrupts

2019-08-12 Thread Paul Mackerras
On Mon, Aug 12, 2019 at 03:07:05PM +1000, Paul Mackerras wrote: > lbz r5, VCPU_XIVE_ESC_ON(r9) > cmpwi r5, 0 > - beq 1f > + beq 4f > li r0, 0 > stb r0, VCPU_CEDED(r9) > + li r6, XIVE_ESB_SET_PQ_10 > +

Re: [PATCH 2/2] powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race

2019-08-12 Thread Paul Mackerras
On Mon, Aug 12, 2019 at 10:52:11PM -0500, Lijun Pan wrote: > > > > On Aug 12, 2019, at 12:07 AM, Paul Mackerras wrote: [snip] > > +static void cleanup_single_escalation(struct kvm_vcpu *vcpu, > > + struct kvmppc_xive_vcpu *xc, int ir

[PATCH 0/2] powerpc/xive: Fix race condition leading to host crashes and hangs

2019-08-11 Thread Paul Mackerras
This series fixes a race condition that has been observed in testing on POWER9 machines running KVM guests. An interrupt being freed by free_irq() can have an instance present in a XIVE interrupt queue, which can then be presented to the generic interrupt code after the data structures for it

[PATCH 2/2] powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race

2019-08-11 Thread Paul Mackerras
get triggered it will be an indication that the race is occurring and needs to be debugged. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/xive.h | 8 arch/powerpc/kvm/book3s_xive.c| 31 ++ arch/powerpc/sysdev/xive/common.c | 87 ---

[PATCH 1/2] KVM: PPC: Book3S HV: Fix race in re-enabling XIVE escalation interrupts

2019-08-11 Thread Paul Mackerras
ll be needed by the following patch. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index

Re: [PATCH v2] KVM: PPC: Report single stepping capability

2019-06-17 Thread Paul Mackerras
On Wed, May 29, 2019 at 07:22:19PM -0300, Fabiano Rosas wrote: > When calling the KVM_SET_GUEST_DEBUG ioctl, userspace might request > the next instruction to be single stepped via the > KVM_GUESTDBG_SINGLESTEP control bit of the kvm_guest_debug structure. > > We currently don't have support for

Re: [PATCH v4 4/6] kvmppc: Handle memory plug/unplug to secure VM

2019-06-16 Thread Paul Mackerras
On Tue, May 28, 2019 at 12:19:31PM +0530, Bharata B Rao wrote: > Register the new memslot with UV during plug and unregister > the memslot during unplug. > > Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras

Re: [PATCH v4 3/6] kvmppc: H_SVM_INIT_START and H_SVM_INIT_DONE hcalls

2019-06-16 Thread Paul Mackerras
reader as this patch doesn't touch that assembly code. Apart from that this patch looks fine. > Signed-off-by: Bharata B Rao Acked-by: Paul Mackerras

Re: [PATCH v4 1/6] kvmppc: HMM backend driver to manage pages of secure guest

2019-06-16 Thread Paul Mackerras
On Tue, May 28, 2019 at 12:19:28PM +0530, Bharata B Rao wrote: > HMM driver for KVM PPC to manage page transitions of > secure guest via H_SVM_PAGE_IN and H_SVM_PAGE_OUT hcalls. > > H_SVM_PAGE_IN: Move the content of a normal page to secure page > H_SVM_PAGE_OUT: Move the content of a secure page

Re: [RFC PATCH v4 6/6] kvmppc: Support reset of secure guest

2019-06-16 Thread Paul Mackerras
On Tue, May 28, 2019 at 12:19:33PM +0530, Bharata B Rao wrote: > Add support for reset of secure guest via a new ioctl KVM_PPC_SVM_OFF. > This ioctl will be issued by QEMU during reset and in this ioctl, > we ask UV to terminate the guest via UV_SVM_TERMINATE ucall, > reinitialize guest's

Re: [PATCH v3 4/9] KVM: PPC: Ultravisor: Add generic ultravisor call handler

2019-06-16 Thread Paul Mackerras
On Thu, Jun 06, 2019 at 02:36:09PM -0300, Claudio Carvalho wrote: > From: Ram Pai > > Add the ucall() function, which can be used to make ultravisor calls > with varied number of in and out arguments. Ultravisor calls can be made > from the host or guests. > > This copies the implementation of

Re: [PATCH v3 8/9] KVM: PPC: Ultravisor: Enter a secure guest

2019-06-15 Thread Paul Mackerras
R6,7, which need to be > restored before doing the ucall (UV_RETURN). > > Have fast_guest_return check the kvm_arch.secure_guest field so that a > new CPU enters UV when started (in response to a RTAS start-cpu call). > > Thanks to input from Paul Mackerras, Ram Pai and Mike Anderso

Re: [PATCH v3 9/9] KVM: PPC: Ultravisor: Check for MSR_S during hv_reset_msr

2019-06-15 Thread Paul Mackerras
h based on comment from Paul Mackerras > > Signed-off-by: Michael Anderson > Signed-off-by: Claudio Carvalho Acked-by: Paul Mackerras but you should reword the commit message fix that first sentence. Paul.

Re: [PATCH v3 7/9] KVM: PPC: Ultravisor: Restrict LDBAR access

2019-06-15 Thread Paul Mackerras
off-by: Claudio Carvalho > Signed-off-by: Ram Pai Acked-by: Paul Mackerras Just a note on the signed-off-by: it's a bit weird to have Ram's signoff when he is neither the author nor the sender of the patch. The author is assumed to be Claudio; if that is not correct then the patch should

Re: [PATCH v3 5/9] KVM: PPC: Ultravisor: Use UV_WRITE_PATE ucall to register a PATE

2019-06-15 Thread Paul Mackerras
On Thu, Jun 06, 2019 at 02:36:10PM -0300, Claudio Carvalho wrote: > From: Michael Anderson > > When running under an ultravisor, the ultravisor controls the real > partition table and has it in secure memory where the hypervisor can't > access it, and therefore we (the HV) have to do a ucall

Re: [PATCH v3 4/9] KVM: PPC: Ultravisor: Add generic ultravisor call handler

2019-06-15 Thread Paul Mackerras
On Thu, Jun 06, 2019 at 02:36:09PM -0300, Claudio Carvalho wrote: > From: Ram Pai > > Add the ucall() function, which can be used to make ultravisor calls > with varied number of in and out arguments. Ultravisor calls can be made > from the host or guests. > > This copies the implementation of

Re: [PATCH v3 3/9] powerpc: Introduce FW_FEATURE_ULTRAVISOR

2019-06-15 Thread Paul Mackerras
On Thu, Jun 06, 2019 at 02:36:08PM -0300, Claudio Carvalho wrote: > This feature tells if the ultravisor firmware is available to handle > ucalls. Everything in this patch that depends on CONFIG_PPC_UV should just depend on CONFIG_PPC_POWERNV instead. The reason is that every host kernel needs

Re: [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()

2019-06-12 Thread Paul Mackerras
On Wed, Jun 12, 2019 at 09:42:52AM +0200, Christophe Leroy wrote: > > > Le 12/06/2019 à 09:22, Michael Neuling a écrit : > >In commit c1fe190c0672 ("powerpc: Add force enable of DAWR on P9 > >option") I screwed up some assembler and corrupted a pointer in > >r3. This resulted in crashes like the

<    1   2   3   4   5   6   7   8   9   10   >