Re: [RFC PATCH v0 5/5] pseries: Asynchronous page fault support

2021-08-12 Thread Bharata B Rao
On Fri, Aug 13, 2021 at 02:06:40PM +1000, Nicholas Piggin wrote: > Excerpts from Bharata B Rao's message of August 5, 2021 5:24 pm: > > Add asynchronous page fault support for pseries guests. > > > > 1. Setup the guest to handle async-pf > >- Issue H_REG_SNS hcall to register the SNS region.

Re: [RFC PATCH v0 0/5] PPC: KVM: pseries: Asynchronous page fault

2021-08-05 Thread Bharata B Rao
On Thu, Aug 05, 2021 at 12:54:34PM +0530, Bharata B Rao wrote: > Hi, > > This series adds asynchronous page fault support for pseries guests > and enables the support for the same in powerpc KVM. This is an > early RFC with details and multiple TODOs listed in patch descriptions.

[RFC PATCH v0 5/5] pseries: Asynchronous page fault support

2021-08-05 Thread Bharata B Rao
reused here. TODO: - Check how to keep this feature together with other CMO features. - The async-pf check in the page fault handler path is limited to guest with an #ifdef. This isn't sufficient and hence needs to be replaced by an appropriate check. Signed-off-by: Bharata B Rao --- arch

[RFC PATCH v0 4/5] KVM: PPC: BOOK3S HV: Async PF support

2021-08-05 Thread Bharata B Rao
fulfilled by host leading the long delays in guest. This needs some debugging. - A few other aspects recommended by PAPR around this feature(like setting of page state flags) need to be evaluated and incorporated into the implementation if found appropriate. Signed-off-by: Bharata B Rao

[RFC PATCH v0 3/5] KVM: PPC: Book3S: Enable setting SRR1 flags for DSI

2021-08-05 Thread Bharata B Rao
to the guest. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/kvm_ppc.h | 3 ++- arch/powerpc/kvm/book3s.c | 6 +++--- arch/powerpc/kvm/book3s_64_mmu_radix.c | 6 +++--- arch/powerpc/kvm/book3s_hv.c | 4 ++-- arch/powerpc/kvm/book3s_hv_nested.c| 4 ++-- arch

[RFC PATCH v0 2/5] KVM: PPC: Add support for KVM_REQ_ESN_EXIT

2021-08-05 Thread Bharata B Rao
Add a new KVM exit request KVM_REQ_ESN_EXIT that will be used to exit to userspace (QEMU) whenever subvention notification needs to be sent to the guest. The userspace (QEMU) issues the subvention notification by injecting an interrupt into the guest. Signed-off-by: Bharata B Rao --- arch

[RFC PATCH v0 0/5] PPC: KVM: pseries: Asynchronous page fault

2021-08-05 Thread Bharata B Rao
. Bharata B Rao (5): powerpc: Define Expropriation interrupt bit to VPA byte offset 0xB9 KVM: PPC: Add support for KVM_REQ_ESN_EXIT KVM: PPC: Book3S: Enable setting SRR1 flags for DSI KVM: PPC: BOOK3S HV: Async PF support pseries: Asynchronous page fault support Documentation/virt/kvm/api.rst

[RFC PATCH v0 1/5] powerpc: Define Expropriation interrupt bit to VPA byte offset 0xB9

2021-08-05 Thread Bharata B Rao
VPA byte offset 0xB9 was named as donate_dedicated_cpu as that was the only used bit. The Expropriation/Subvention support defines a bit in byte offset 0xB9. Define this bit and rename the field in VPA to a generic name. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/lppaca.h | 8

Re: [RFC PATCH v0 1/1] powerpc/percpu: Use 2MB atom_size in percpu allocator on radix

2021-07-11 Thread Bharata B Rao
here for long, so was just checking if it makes sense here too. > > > > > Signed-off-by: Bharata B Rao > > --- > > arch/powerpc/kernel/setup_64.c | 34 +- > > 1 file changed, 25 insertions(+), 9 deletions(-) > > > >

Re: [PATCH] powerpc: preempt: Don't touch the idle task's preempt_count during hotplug

2021-07-08 Thread Bharata B Rao
would invoke init_idle() via > idle_thread_get(), which would have already reset the CPU's idle task's > preempt_count to PREEMPT_ENABLED. > > Get rid of this preempt_count write. > > Cc: Guenter Roeck > Fixes: f1a0a376ca0c ("sched/core: Initialize the idle task with preempti

[RFC PATCH v0 1/1] powerpc/percpu: Use 2MB atom_size in percpu allocator on radix

2021-07-07 Thread Bharata B Rao
allocation). Signed-off-by: Bharata B Rao --- arch/powerpc/kernel/setup_64.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 1ff258f6c76c..45ce2d6e8112 100644 --- a/arch

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

2021-07-05 Thread Bharata B Rao
On Mon, Jul 05, 2021 at 02:42:33PM +1000, David Gibson wrote: > On Mon, Jun 21, 2021 at 02:20:00PM +0530, Bharata B Rao wrote: > > diff --git a/arch/powerpc/include/asm/mmu_context.h > > b/arch/powerpc/include/asm/mmu_context.h > > index 4bc45d3ed8b0..b44f291fc909 100644 &

Re: PowerPC guest getting "BUG: scheduling while atomic" on linux-next-20210623 during secondary CPUs bringup

2021-06-25 Thread Bharata B Rao
On Fri, Jun 25, 2021 at 12:16:52PM +0200, Peter Zijlstra wrote: > You mean: CONFIG_PREEMPTION=n, what about CONFIG_PREEMPT_COUNT? > > Because if both are =n, then I don't see how that warning could trigger. > in_atomic_preempt_off() would then result in prempt_count() == 0, and > per the print

Re: PowerPC guest getting "BUG: scheduling while atomic" on linux-next-20210623 during secondary CPUs bringup

2021-06-25 Thread Bharata B Rao
On Fri, Jun 25, 2021 at 09:28:09AM +0200, Peter Zijlstra wrote: > On Fri, Jun 25, 2021 at 11:16:08AM +0530, Srikar Dronamraju wrote: > > * Bharata B Rao [2021-06-24 21:25:09]: > > > > > A PowerPC KVM guest gets the following BUG message when booting > > > linu

Re: PowerPC guest getting "BUG: scheduling while atomic" on linux-next-20210623 during secondary CPUs bringup

2021-06-24 Thread Bharata B Rao
On Fri, Jun 25, 2021 at 11:16:08AM +0530, Srikar Dronamraju wrote: > * Bharata B Rao [2021-06-24 21:25:09]: > > > A PowerPC KVM guest gets the following BUG message when booting > > linux-next-20210623: > > > > smp: Bringing up secondary CPUs ... > > BUG:

PowerPC guest getting "BUG: scheduling while atomic" on linux-next-20210623 during secondary CPUs bringup

2021-06-24 Thread Bharata B Rao
Hi, A PowerPC KVM guest gets the following BUG message when booting linux-next-20210623: smp: Bringing up secondary CPUs ... BUG: scheduling while atomic: swapper/1/0/0x no locks held by swapper/1/0. Modules linked in: CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.13.0-rc7-next-20210623

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

2021-06-22 Thread Bharata B Rao
On Tue, Jun 22, 2021 at 10:05:45AM +0530, Bharata B Rao wrote: > On Mon, Jun 21, 2021 at 10:12:42AM -0700, Nathan Chancellor wrote: > > I have not seen this reported yet so apologies if it has and there is a > > fix I am missing: > > > > arch/powerpc/kvm/book3s

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

2021-06-21 Thread Bharata B Rao
On Mon, Jun 21, 2021 at 10:12:42AM -0700, Nathan Chancellor wrote: > > +long do_h_rpt_invalidate_pat(struct kvm_vcpu *vcpu, unsigned long lpid, > > +unsigned long type, unsigned long pg_sizes, > > +unsigned long start, unsigned long end) > > +{ > > +

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

2021-06-21 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas Reviewed

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

2021-06-21 Thread Bharata B Rao
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 | 18 ++ arch/powerpc/kvm/powerpc.c | 3 +++ include

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

2021-06-21 Thread Bharata B Rao
invalidation requests are forwarded to the right nested guest, handled there and passed down to L0 for eventual handling. Signed-off-by: Bharata B Rao Signed-off-by: Aneesh Kumar K.V [Nested guest partition-scoped invalidation changes] --- .../include/asm/book3s/64/tlbflush-radix.h| 4

[PATCH v8 0/6] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-06-21 Thread Bharata B Rao
complaining. - Used a threshold in the partition-scoped range flushing to switch to full LPID invalidation v7: https://lore.kernel.org/linuxppc-dev/20210505154642.178702-1-bhar...@linux.ibm.com/ Aneesh Kumar K.V (1): KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments Bharata B Rao (5

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

2021-06-21 Thread Bharata B Rao
nge are to be invalidated.   Those which are partially covered are considered outside invalidation range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/mmu_context.h |

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

2021-06-21 Thread Bharata B Rao
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: Bharata B Rao Reviewed-by: David Gibson --- arch/powerpc/include/as

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

2021-06-21 Thread Bharata B Rao
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. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- arch

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

2021-05-06 Thread Bharata B Rao
On Thu, May 06, 2021 at 03:45:21PM +1000, Nicholas Piggin wrote: > Excerpts from Bharata B Rao's message of May 6, 2021 1:46 am: > > > > +static long kvmppc_h_rpt_invalidate(struct kvm_vcpu *vcpu, > > + unsigned long id, unsigned long target, > > +

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

2021-05-05 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas Reviewed

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

2021-05-05 Thread Bharata B Rao
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 | 18 ++ arch/powerpc/kvm/powerpc.c | 3 +++ include

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

2021-05-05 Thread Bharata B Rao
nge are to be invalidated.   Those which are partially covered are considered outside invalidation range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- arch/powerpc/incl

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

2021-05-05 Thread Bharata B Rao
invalidation requests are forwarded to the right nested guest, handled there and passed down to L0 for eventual handling. Signed-off-by: Bharata B Rao Signed-off-by: Aneesh Kumar K.V [Nested guest partition-scoped invalidation changes] --- .../include/asm/book3s/64/tlbflush-radix.h| 4

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

2021-05-05 Thread Bharata B Rao
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. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- arch

[PATCH v7 0/6] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-05-05 Thread Bharata B Rao
of H_RPT_INVALIDATE arguments Bharata B Rao (5): powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE KVM: PPC: Book3S HV: Add

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

2021-05-05 Thread Bharata B Rao
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: Bharata B Rao Reviewed-by: David Gibson --- arch/powerpc/include/as

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 i

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

2021-03-11 Thread Bharata B Rao
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 --- Documentation/virt/kvm/api.rst | 18 ++ arch/powerpc/kvm/powerpc.c | 3 +++ include/uapi/linux/kvm.h | 1

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

2021-03-11 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

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

2021-03-11 Thread Bharata B Rao
invalidation requests are forwarded to the right nested guest, handled there and passed down to L0 for eventual handling. Signed-off-by: Bharata B Rao Signed-off-by: Aneesh Kumar K.V [Nested guest partition-scoped invalidation changes] --- arch/powerpc/include/asm/kvm_book3s.h | 3 + arch

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

2021-03-11 Thread Bharata B Rao
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. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/book3s/64

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

2021-03-11 Thread Bharata B Rao
nge are to be invalidated.   Those which are partially covered are considered outside invalidation range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Signed-off-by: Bharata B Rao --- .../include/asm/book3s/64/tlbflush-radi

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

2021-03-11 Thread Bharata B Rao
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: Bharata B Rao --- arch/powerpc/include/asm/hvcall.h | 4 ++-- 1 file

[PATCH v6 0/6] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-03-11 Thread Bharata B Rao
Kumar K.V (1): KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments Bharata B Rao (5): powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE

Re: [PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-01 Thread Bharata B Rao
On Tue, Mar 02, 2021 at 12:45:18PM +1100, David Gibson wrote: > > diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > > index 45fd862ac128..38ce3f21b21f 100644 > > --- a/Documentation/virt/kvm/api.rst > > +++ b/Documentation/virt/kvm/api.rst > > @@ -6225,6 +6225,24 @@

Re: [PATCH v5 1/3] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-03-01 Thread Bharata B Rao
On Tue, Mar 02, 2021 at 12:28:34PM +1100, David Gibson wrote: > On Wed, Feb 24, 2021 at 01:55:08PM +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 &

Re: [PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-03-01 Thread Bharata B Rao
On Wed, Feb 24, 2021 at 12:58:02PM -0300, Fabiano Rosas wrote: > > @@ -1590,6 +1662,24 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu > > *vcpu) > > if (!xics_on_xive()) > > kvmppc_xics_rm_complete(vcpu, 0); > > break; > > + case

[PATCH v5 3/3] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-02-24 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

[PATCH v5 1/3] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-02-24 Thread Bharata B Rao
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. Signed-off-by: Bharata B Rao --- arch/powerpc/include/asm/book3s/64

[PATCH v5 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-24 Thread Bharata B Rao
-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 18 +++ .../include/asm/book3s/64/tlbflush-radix.h| 4 + arch/powerpc/include/asm/kvm_book3s.h | 3 + arch/powerpc/include/asm/mmu_context.h| 11 ++ arch/powerpc/kvm/book3s_hv.c | 90

[PATCH v5 0/3] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-02-24 Thread Bharata B Rao
. - Redid nested exit changes as per Paul Mackerras' suggestion. - Folded the patch that added tlbie primitives into the hcall implementation patch. v4: https://lore.kernel.org/linuxppc-dev/20210215063542.3642366-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (3): powerpc/book3s64/radix: Add

Re: [PATCH v4 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-21 Thread Bharata B Rao
On Wed, Feb 17, 2021 at 11:38:07AM +1100, David Gibson wrote: > On Mon, Feb 15, 2021 at 12:05:41PM +0530, Bharata B Rao wrote: > > Implement H_RPT_INVALIDATE hcall and add KVM capability > > KVM_CAP_PPC_RPT_INVALIDATE to indicate the support for the same. > > > > This

Re: [PATCH v4 1/3] powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests

2021-02-21 Thread Bharata B Rao
On Wed, Feb 17, 2021 at 11:24:48AM +1100, David Gibson wrote: > On Mon, Feb 15, 2021 at 12:05:40PM +0530, Bharata B Rao wrote: > > H_RPT_INVALIDATE hcall needs to perform process scoped tlbie > > invalidations of L1 and nested guests from L0. This needs RS register > >

[PATCH v4 2/3] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-02-14 Thread Bharata B Rao
H_TLB_INVALIDATE hcall. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst | 17 + arch/powerpc/include/asm/kvm_book3s.h | 3 + arch/powerpc/include/asm/mmu_context.h | 11 +++ arch/powerpc/kvm/book3s_hv.c | 91 arch/powerpc/kvm

[PATCH v4 1/3] powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests

2021-02-14 Thread Bharata B Rao
hcall. While we are here, move RIC_FLUSH definitions to header file and introduce helper rpti_pgsize_to_psize() that will be needed by the upcoming hcall. Signed-off-by: Bharata B Rao --- .../include/asm/book3s/64/tlbflush-radix.h| 18 +++ arch/powerpc/mm/book3s64/radix_tlb.c | 122

[PATCH v4 0/3] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-02-14 Thread Bharata B Rao
nested guest exit path. v3: https://lore.kernel.org/linuxppc-dev/20210105090557.2150104-1-bhar...@linux.ibm.com/T/#t Bharata B Rao (3): powerpc/book3s64/radix/tlb: tlbie primitives for process-scoped invalidations from guests KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM

[PATCH v4 3/3] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-02-14 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

Re: [PATCH v3 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-01-06 Thread Bharata B Rao
On Wed, Jan 06, 2021 at 05:27:27PM -0300, Fabiano Rosas wrote: > Bharata B Rao writes: > > + > > +long kvmhv_h_rpti_nested(struct kvm_vcpu *vcpu, unsigned long lpid, > > +unsigned long type, unsigned long pg_sizes, > > +unsigne

[PATCH v3 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-01-05 Thread Bharata B Rao
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-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas --- arch/p

[PATCH v3 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-01-05 Thread Bharata B Rao
disabled in KVM. 2. Partition-scoped invalidations that an L1 hypervisor does on behalf of an L2 guest. This replaces the uses of the existing hcall H_TLB_INVALIDATE. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 .../include/asm/book3s/64/tlbflush

[PATCH v3 0/2] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-01-05 Thread Bharata B Rao
ted.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (2): KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE KVM: PPC: Book3S

Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-17 Thread Bharata B Rao
On Thu, Dec 17, 2020 at 02:42:15PM +1100, David Gibson wrote: > On Wed, Dec 16, 2020 at 02:24:46PM +0530, Bharata B Rao wrote: > > +static void do_tlb_invalidate(unsigned long rs, unsigned long target, > > + unsigned long type, unsigned

Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-17 Thread Bharata B Rao
On Wed, Dec 16, 2020 at 07:47:29PM -0300, Fabiano Rosas wrote: > > +static void do_tlb_invalidate(unsigned long rs, unsigned long target, > > + unsigned long type, unsigned long page_size, > > + unsigned long ap, unsigned long start, > > +

[PATCH v2 0/2] Support for H_RPT_INVALIDATE in PowerPC KVM

2020-12-16 Thread Bharata B Rao
ich are fully covered by the range are to be invalidated.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao (2): KVM: PPC: Book3S HV:

[PATCH v2 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-12-16 Thread Bharata B Rao
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-off-by: Bharata B Rao --- arch/powerpc/kvm/book3s_64_mmu_ra

[PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2020-12-16 Thread Bharata B Rao
disabled in KVM. 2. Partition-scoped invalidations that an L1 hypervisor does on behalf of an L2 guest. This replaces the uses of the existing hcall H_TLB_INVALIDATE. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 +++ .../include/asm/book3s/64/tlbflush

Re: [PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-12-11 Thread Bharata B Rao
On Mon, Oct 19, 2020 at 04:56:41PM +0530, Bharata B Rao wrote: > Implements H_RPT_INVALIDATE hcall and supports only nested case > currently. > > A KVM capability KVM_CAP_RPT_INVALIDATE is added to indicate the > support for this hcall. As Paul mentioned in the thread, this

Re: [PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-12-09 Thread Bharata B Rao
On Wed, Dec 09, 2020 at 03:15:42PM +1100, Paul Mackerras wrote: > On Mon, Oct 19, 2020 at 04:56:41PM +0530, Bharata B Rao wrote: > > Implements H_RPT_INVALIDATE hcall and supports only nested case > > currently. > > > > A KVM capability KVM_CAP_RPT_INVALIDATE is added

Re: [PATCH] powerpc/book3s_hv_uvmem: Check for failed page migration

2020-12-04 Thread Bharata B Rao
ge_in(struct vm_area_struct *vma, > } > } > > - *mig.dst = migrate_pfn(page_to_pfn(dpage)) | MIGRATE_PFN_LOCKED; > - migrate_vma_pages(); > out_finalize: > migrate_vma_finalize(); > return ret; Reviewed-by: Bharata B Rao Did you actually hit this scenario with secure VMs where a UV-paged-in page was later found to be not migratable? Regards, Bharata.

Re: [PATCH v1 0/2] Use H_RPT_INVALIDATE for nested guest

2020-11-24 Thread Bharata B Rao
Hi, Any comments on this patchset? Anything specific to be addressed before it could be considered for inclusion? Regards, Bharata. On Mon, Oct 19, 2020 at 04:56:40PM +0530, Bharata B Rao wrote: > This patchset adds support for the new hcall H_RPT_INVALIDATE > (currently handles neste

[PATCH v1 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE (nested case only)

2020-10-19 Thread Bharata B Rao
Implements H_RPT_INVALIDATE hcall and supports only nested case currently. A KVM capability KVM_CAP_RPT_INVALIDATE is added to indicate the support for this hcall. Signed-off-by: Bharata B Rao --- Documentation/virt/kvm/api.rst| 17 .../include/asm/book3s/64/tlbflush

[PATCH v1 2/2] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2020-10-19 Thread Bharata B Rao
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-off-by: Bharata B Rao --- arch/powerpc/kvm/book3s_64_mmu_ra

[PATCH v1 0/2] Use H_RPT_INVALIDATE for nested guest

2020-10-19 Thread Bharata B Rao
ses are quadrant 0. * Pages which are fully covered by the range are to be invalidated.   Those which are partially covered are considered outside invalidation   range, which allows a caller to optimally invalidate ranges that may   contain mixed page sizes. * Return H_SUCCESS on success. Bharata B Rao

Re: [RFC v1 2/2] KVM: PPC: Book3S HV: abstract secure VM related calls.

2020-10-12 Thread Bharata B Rao
On Mon, Oct 12, 2020 at 12:27:43AM -0700, Ram Pai wrote: > Abstract the secure VM related calls into generic calls. > > These generic calls will call the corresponding method of the > backend that prvoides the implementation to support secure VM. > > Currently there is only the ultravisor based

Re: [PATCH] KVM: PPC: Book3S HV: fix a oops in kvmppc_uvmem_page_free()

2020-07-31 Thread Bharata B Rao
On Fri, Jul 31, 2020 at 01:37:00AM -0700, Ram Pai wrote: > On Fri, Jul 31, 2020 at 09:59:40AM +0530, Bharata B Rao wrote: > > On Thu, Jul 30, 2020 at 04:25:26PM -0700, Ram Pai wrote: > > In our case, device pages that are in use are always associated with a valid >

Re: [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall

2020-07-30 Thread Bharata B Rao
On Thu, Jul 30, 2020 at 04:21:01PM -0700, Ram Pai wrote: > H_SVM_PAGE_IN hcall takes a flag parameter. This parameter specifies the > way in which a page will be treated. H_PAGE_IN_NONSHARED indicates > that the page will be shared with the Secure VM, and H_PAGE_IN_SHARED > indicates that the

Re: [PATCH] KVM: PPC: Book3S HV: fix a oops in kvmppc_uvmem_page_free()

2020-07-30 Thread Bharata B Rao
On Thu, Jul 30, 2020 at 04:25:26PM -0700, Ram Pai wrote: > Observed the following oops while stress-testing, using multiple > secureVM on a distro kernel. However this issue theoritically exists in > 5.5 kernel and later. > > This issue occurs when the total number of requested device-PFNs exceed

Re: [PATCH v2] powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE

2020-07-27 Thread Bharata B Rao
all. 2. radix_hcall_invalidate=on w/o H_RPT_INVALIDATE hcall, the guest kernel panics as per design. Tested-by: Bharata B Rao

[PATCH] powerpc/mm: Limit resize_hpt_for_hotplug() call to hash guests only

2020-07-27 Thread Bharata B Rao
Lynch Signed-off-by: Bharata B Rao --- Tested with memory hotplug and unplug for hash and radix KVM guests. arch/powerpc/include/asm/sparsemem.h | 6 -- arch/powerpc/mm/book3s64/hash_utils.c | 8 +++- arch/powerpc/mm/mem.c | 5 - 3 files changed, 7 insertions(+), 12

Re: [PATCH] powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE

2020-07-27 Thread Bharata B Rao
On Fri, Jul 24, 2020 at 01:26:00PM +0530, Aneesh Kumar K.V wrote: > This adds a kernel command line option that can be used to disable GTSE > support. > Disabling GTSE implies kernel will make hcalls to invalidate TLB entries. > > This was done so that we can do VM migration between configs that

Re: [PATCH v5 5/7] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-07-26 Thread Bharata B Rao
gt; + kvmppc_uvmem_memslot_create(kvm, new); Only concern is that kvmppc_uvmem_memslot_create() can fail due to multiple reasons but we ignore them and go ahead with memory hotplug. May be this hasn't been observed in reality but if we can note this as a TODO in the comments to dig further and explore the possibility of recovering from here, then Reviewed-by: Bharata B Rao Regards, Bharata.

Re: [PATCH v5 6/7] KVM: PPC: Book3S HV: move kvmppc_svm_page_out up

2020-07-26 Thread Bharata B Rao
> holding the kvm->arch.uvmem_lock, so prefix the original function with __ > and remove the locking in it, and introduce a wrapper which call that > function with the lock held. > > There is no functional change. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras &g

Re: [PATCH] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-26 Thread Bharata B Rao
g > that time, not in write mode since the virual memory layout is not > impacted, and kvm->arch.uvmem_lock prevents concurrent operation > on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Ram Pai > [modified the

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-24 Thread Bharata B Rao
On Fri, Jul 24, 2020 at 09:52:14PM +1000, Michael Ellerman wrote: > Bharata B Rao writes: > > On Tue, Jul 21, 2020 at 10:25:58PM +1000, Michael Ellerman wrote: > >> Bharata B Rao writes: > >> > On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote

Re: [PATCH v5 4/7] KVM: PPC: Book3S HV: in H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs.

2020-07-23 Thread Bharata B Rao
amin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > Cc: David Gibson > Cc: Claudio Carvalho > Cc: kvm-...@vger.kernel.org > Cc: linuxppc-dev@lists.ozla

Re: [PATCH v5 7/7] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-23 Thread Bharata B Rao
_sem is held in read mode during > that time, not in write mode since the virual memory layout is not > impacted, and kvm->arch.uvmem_lock prevents concurrent operation > on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Ram

Re: [v4 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out

2020-07-23 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:26AM -0700, Ram Pai wrote: > @@ -812,7 +842,7 @@ unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, > unsigned long gpa, > struct vm_area_struct *vma; > int srcu_idx; > unsigned long gfn = gpa >> page_shift; > - int ret; > + int ret,

Re: [v4 3/5] KVM: PPC: Book3S HV: in H_SVM_INIT_DONE, migrate remaining normal-GFNs to secure-GFNs.

2020-07-23 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:25AM -0700, Ram Pai wrote: > > +int kvmppc_uv_migrate_mem_slot(struct kvm *kvm, > + const struct kvm_memory_slot *memslot) Don't see any callers for this outside of this file, so why not static? > +{ > + unsigned long gfn = memslot->base_gfn; > +

Re: [v4 2/5] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-07-22 Thread Bharata B Rao
| > | Normal | Normal| Transient|Error|Error |Normal | > | | | | | | | > | Secure | Error | Error|Error|Error |Normal | > | | | | | |

Re: [PATCH v2 2/2] KVM: PPC: Book3S HV: rework secure mem slot dropping

2020-07-22 Thread Bharata B Rao
uring that time, not in write > mode since the virual memory layout is not impacted, and > kvm->arch.uvmem_lock prevents concurrent operation on the secure device. > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Laurent Dufour > --- > ar

Re: [v4 5/5] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-07-22 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 01:00:27AM -0700, Ram Pai wrote: > From: Laurent Dufour > > When a memory slot is hot plugged to a SVM, PFNs associated with the > GFNs in that slot must be migrated to secure-PFNs, aka device-PFNs. > > Call kvmppc_uv_migrate_mem_slot() to accomplish this. > Disable

Re: [v4 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-22 Thread Bharata B Rao
ition. Delaying this operation, increases > the probability for those pages to acquire new references , making it > impossible to migrate those pages. > > Disable page-migration in H_SVM_INIT_START handling. > > Signed-off-by: Ram Pai Reviewed-by: Bharata B Rao with a few observations

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-22 Thread Bharata B Rao
On Tue, Jul 21, 2020 at 10:25:58PM +1000, Michael Ellerman wrote: > Bharata B Rao writes: > > On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote: > >> Nathan Lynch writes: > >> > "Aneesh Kumar K.V" writes: > >> >> This is t

Re: [PATCH v3 0/4] powerpc/mm/radix: Memory unplug fixes

2020-07-20 Thread Bharata B Rao
On Tue, Jul 21, 2020 at 11:45:20AM +1000, Michael Ellerman wrote: > Nathan Lynch writes: > > "Aneesh Kumar K.V" writes: > >> This is the next version of the fixes for memory unplug on radix. > >> The issues and the fix are described in the actual patches. > > > > I guess this isn't actually

Re: [FIX PATCH] powerpc/prom: Enable Radix GTSE in cpu pa-features

2020-07-20 Thread Bharata B Rao
t in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels if CONFIG_PPC_DT_CPU_FTRS isn't enabled. Fixes: 029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.") Reported-by: Qian Cai Signed-off-by: Nicholas Piggin Signed-off-by: Bh

[FIX PATCH] powerpc/prom: Enable Radix GTSE in cpu pa-features

2020-07-19 Thread Bharata B Rao
nels where CONFIG_PPC_DT_CPU_FTRS isn't enabled. Fixes: 029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.") Reported-by: Qian Cai Signed-off-by: Nicholas Piggin Signed-off-by: Bharata B Rao --- arch/powerpc/kernel/prom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

Re: [PATCH v3 0/3] Off-load TLB invalidations to host for !GTSE

2020-07-16 Thread Bharata B Rao
On Fri, Jul 17, 2020 at 12:44:00PM +1000, Nicholas Piggin wrote: > Excerpts from Nicholas Piggin's message of July 17, 2020 12:08 pm: > > Excerpts from Qian Cai's message of July 17, 2020 3:27 am: > >> On Fri, Jul 03, 2020 at 11:06:05AM +0530, Bharata B Rao wrote: > >

Re: [v3 3/5] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-07-15 Thread Bharata B Rao
On Tue, Jul 14, 2020 at 10:05:41PM -0700, Ram Pai wrote: > On Mon, Jul 13, 2020 at 03:15:06PM +0530, Bharata B Rao wrote: > > On Sat, Jul 11, 2020 at 02:13:45AM -0700, Ram Pai wrote: > > > The Ultravisor is expected to explicitly call H_SVM_PAGE_IN for al

Re: [v3 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-15 Thread Bharata B Rao
On Tue, Jul 14, 2020 at 10:16:14PM -0700, Ram Pai wrote: > On Mon, Jul 13, 2020 at 10:59:41AM +0530, Bharata B Rao wrote: > > On Sat, Jul 11, 2020 at 02:13:43AM -0700, Ram Pai wrote: > > > Merging of pages associated with each memslot of a SVM is > > > di

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

2020-07-13 Thread Bharata B Rao
On Thu, Jul 09, 2020 at 08:07:11PM +1000, Paul Mackerras wrote: > 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: > > &g

Re: [v3 4/5] KVM: PPC: Book3S HV: retry page migration before erroring-out H_SVM_PAGE_IN

2020-07-13 Thread Bharata B Rao
ate. > > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > Cc: David Gibson > Cc: Claudio Carvalho > Cc: kvm-.

Re: [v3 3/5] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-07-13 Thread Bharata B Rao
Paged-in or Shared or > Paged-in followed by a Paged-out. > > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Cc: Bharata B Rao > Cc: Aneesh Kumar K.V > Cc: Sukadev Bhattiprolu > Cc: Laurent Dufour > Cc: Thiago Jung Bauermann > C

Re: [v3 1/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-12 Thread Bharata B Rao
On Sat, Jul 11, 2020 at 02:13:43AM -0700, Ram Pai wrote: > Merging of pages associated with each memslot of a SVM is > disabled the page is migrated in H_SVM_PAGE_IN handler. > > This operation should have been done much earlier; the moment the VM > is initiated for secure-transition. Delaying

  1   2   3   4   >