Re: [PATCH] powerpc/pkeys: Remove unused code

2021-02-03 Thread Ram Pai
struct thread_struct *old_thread); > -extern void thread_pkey_regs_init(struct thread_struct *thread); > #endif /*_ASM_POWERPC_KEYS_H */ Looking at this code after a long time. Though I do not entirely understand, the reason to change the logic for save and restore of the AMR/IAMR register, I do understand that with those changes these three function-prototypes became unnecessary. Reviewed-by: Ram Pai RP

Re: [PATCH] powerpc/mm: Limit allocation of SWIOTLB on server machines

2020-12-23 Thread Ram Pai
On Wed, Dec 23, 2020 at 09:06:01PM -0300, Thiago Jung Bauermann wrote: > > Hi Ram, > > Thanks for reviewing this patch. > > Ram Pai writes: > > > On Fri, Dec 18, 2020 at 03:21:03AM -0300, Thiago Jung Bauermann wrote: > >> On server-class POWER machines, we

Re: [PATCH] powerpc/mm: Limit allocation of SWIOTLB on server machines

2020-12-23 Thread Ram Pai
On Fri, Dec 18, 2020 at 03:21:03AM -0300, Thiago Jung Bauermann wrote: > On server-class POWER machines, we don't need the SWIOTLB unless we're a > secure VM. Nevertheless, if CONFIG_SWIOTLB is enabled we unconditionally > allocate it. > > In most cases this is harmless, but on a few machine confi

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

2020-12-08 Thread Ram Pai
vm_page_in(struct vm_area_struct *vma, > } > } > > - *mig.dst = migrate_pfn(page_to_pfn(dpage)) | MIGRATE_PFN_LOCKED; > - migrate_vma_pages(&mig); > out_finalize: > migrate_vma_finalize(&mig); > return ret; Though this patch did not solve the specific problem, I am running into, my tests did not expose any regression. Tested-by: Ram Pai Reviewed-by: Ram Pai

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

2020-12-04 Thread Ram Pai
On Fri, Dec 04, 2020 at 03:48:41PM +0530, Bharata B Rao wrote: > On Thu, Dec 03, 2020 at 04:08:12PM +1100, Alistair Popple wrote: > > migrate_vma_pages() may still clear MIGRATE_PFN_MIGRATE on pages which > > are not able to be migrated. Drivers may safely copy data prior to > > calling migrate_vma

RE: [RFC v1 0/2] Plumbing to support multiple secure memory backends.

2020-10-14 Thread Ram Pai
ranches. Ok. Not planning on upstreaming these patches till we have atleast another backend. -- Ram Pai

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

2020-10-12 Thread Ram Pai
On Mon, Oct 12, 2020 at 08:58:36PM +0530, Bharata B Rao wrote: > 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

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

2020-10-12 Thread Ram Pai
generic calls. This plumbing will provide the flexibility to add more backends in the future. Signed-off-by: Ram Pai --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 100 --- arch/powerpc/include/asm/kvmppc_svm_backend.h | 250 ++ arch/powerpc/kvm

[RFC v1 1/2] KVM: PPC: Book3S HV: rename all variables in book3s_hv_uvmem.c

2020-10-12 Thread Ram Pai
Preparing this file to be one of the many backends. Since this file supports Ultravisor backend, renaming all variable from kvmppc_* to uvmem_*. This is to avoid clash with some generic top level functions to be defined in the next patch. Signed-off-by: Ram Pai --- arch/powerpc/kvm

[RFC v1 0/2] Plumbing to support multiple secure memory backends.

2020-10-12 Thread Ram Pai
to be a plugin that provides an implementation of the backend. Ram Pai (2): KVM: PPC: Book3S HV: rename all variables in book3s_hv_uvmem.c KVM: PPC: Book3S HV: abstract secure VM related calls. arch/powerpc/include/asm/kvm_book3s_uvmem.h | 100 - arch/powerpc/include/asm

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

2020-07-31 Thread Ram Pai
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: > > Observed the following oops while stress-testing, using multiple > > secureVM on a distro kernel. However this issue theoritically exists in > >

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

2020-07-31 Thread Ram Pai
On Fri, Jul 31, 2020 at 10:03:34AM +0530, Bharata B Rao wrote: > 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 > >

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

2020-07-30 Thread Ram Pai
<89230011> e8c3 e9030008 2f89 -- Fix the oops.. fixes: ca9f49 ("KVM: PPC: Book3S HV: Support for running secure guests") Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 6 -- 1

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

2020-07-30 Thread Ram Pai
H_PAGE_IN_NONSHARED is not defined in the header file, though it is defined and documented in the API captured in Documentation/powerpc/ultravisor.rst Define H_PAGE_IN_NONSHARED in the header file. Reported-by: Julia Lawall Signed-off-by: Ram Pai --- arch/powerpc/include/asm/hvcall.h | 4

Re: Documentation/powerpc: Ultravisor API

2020-07-30 Thread Ram Pai
On Thu, Jul 30, 2020 at 12:35:38PM +0200, Julia Lawall wrote: > The file Documentation/powerpc/ultravisor.rst contains: > > Only valid value(s) in ``flags`` are: > > * H_PAGE_IN_SHARED which indicates that the page is to be shared > with the Ultravisor. > > * H_PAGE_I

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

2020-07-27 Thread Ram Pai
tion on the secure device. Cc: Ram Pai Cc: Bharata B Rao Cc: Paul Mackerras Reviewed-by: Bharata B Rao Signed-off-by: Ram Pai [modified the changelog description] Signed-off-by: Laurent Dufour [modified check on the VMA in kvmppc_uvmem_drop_pages] --- arch/powerpc/kvm/book3s_hv_u

[PATCH v2 1/2] KVM: PPC: Book3S HV: move kvmppc_svm_page_out up

2020-07-27 Thread Ram Pai
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 Reviewed-by: Bharata B Rao Signed-off-by: Ram Pai Signed-off-by: Laurent Dufour --- arch/powerpc/kvm/book3s_hv_uvmem.c |

[PATCH v2 0/2] Rework secure memslot dropping

2020-07-27 Thread Ram Pai
From: Laurent Dufour When doing memory hotplug on a secure VM, the secure pages are not well cleaned from the secure device when dropping the memslot. This silent error, is then preventing the SVM to reboot properly after the following sequence of commands are run in the Qemu monitor: device_ad

[PATCH v6 5/5] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-07-27 Thread Ram Pai
Rao Signed-off-by: Ram Pai [rearranged the code, and modified the commit log] Signed-off-by: Laurent Dufour --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 14 ++ arch/powerpc/kvm/book3s_hv.c| 14 ++ arch/powerpc/kvm/book3s_hv_uvmem.c | 23

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

2020-07-27 Thread Ram Pai
hiago Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Bharata B Rao Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 2 + arch/powerpc/kvm/book3s_hv_uvmem.c

[PATCH v6 2/5] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-27 Thread Ram Pai
references , making it impossible to migrate those pages in H_SVM_PAGE_IN handler. Disable page-migration in H_SVM_INIT_START handling. Reviewed-by: Bharata B Rao Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 1 + arch/powerpc/kvm/book3s_hv_uvmem.c | 123

[PATCH v6 3/5] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-07-27 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Bharata B Rao Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerp

[PATCH v6 0/5] Migrate non-migrated pages of a SVM.

2020-07-27 Thread Ram Pai
e-organized the code, for easier review. . Better description of the patch series. v1: . fixed a bug observed by Bharata. Pages that where paged-in and later paged-out must also be skipped from migration during H_SVM_INIT_DONE. Laurent Dufour (1): KVM: PPC: Book3S HV: migrate hot plu

[PATCH v6 1/5] KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c

2020-07-27 Thread Ram Pai
Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm

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

2020-07-23 Thread Ram Pai
tion on the secure device. Cc: Ram Pai Cc: Bharata B Rao Cc: Paul Mackerras Signed-off-by: Ram Pai [modified the changelog description] Signed-off-by: Laurent Dufour --- arch/powerpc/kvm/book3s_hv_uvmem.c | 54 ++ 1 file changed, 37 insertions(+), 1

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

2020-07-23 Thread Ram Pai
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 Signed-off-by: Ram Pai Signed-off-by: Laurent Dufour --- arch/powerpc/kvm/book3s_hv_uvmem.c | 166 -

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

2020-07-23 Thread Ram Pai
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 the secure-PFNs, aka device-PFNs. Call kvmppc_uv_migrate_mem_slot() to accomplish this. Disable page-merge for all pages in the memory slot. Signed-off-by: Ram Pai

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

2020-07-23 Thread Ram Pai
hiago Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst| 2 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 2 + arch/powerpc/kvm/book3s_hv_uv

[PATCH v5 3/7] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-07-23 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Bharata B Rao Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerp

[PATCH v5 2/7] KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START

2020-07-23 Thread Ram Pai
references , making it impossible to migrate those pages in H_SVM_PAGE_IN handler. Disable page-migration in H_SVM_INIT_START handling. Reviewed-by: Bharata B Rao Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 1 + arch/powerpc/kvm/book3s_hv_uvmem.c | 123

[PATCH v5 1/7] KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c

2020-07-23 Thread Ram Pai
Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm

[PATCH v5 0/7] Migrate non-migrated pages of a SVM.

2020-07-23 Thread Ram Pai
(3): KVM: PPC: Book3S HV: migrate hot plugged memory KVM: PPC: Book3S HV: move kvmppc_svm_page_out up KVM: PPC: Book3S HV: rework secure mem slot dropping Ram Pai (4): KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c KVM: PPC: Book3S HV: Disable page merging in H_SVM_I

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

2020-07-23 Thread Ram Pai
I am dropping this patch based on our conversation, where we agreed, we need to rootcause the migration failure. On Thu, Jul 23, 2020 at 11:43:44AM +0530, Bharata B Rao wrote: > On Fri, Jul 17, 2020 at 01:00:26AM -0700, Ram Pai wrote: > > @@ -812,7 +842,7 @@ unsigned long kvmppc_h_sv

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

2020-07-23 Thread Ram Pai
On Thu, Jul 23, 2020 at 11:40:37AM +0530, Bharata B Rao wrote: > 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 f

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

2020-07-23 Thread Ram Pai
On Thu, Jul 23, 2020 at 10:18:30AM +0530, Bharata B Rao wrote: > On Fri, Jul 17, 2020 at 01:00:24AM -0700, Ram Pai wrote: > > pvt->gpa = gpa; ..snip.. > > pvt->kvm = kvm; > > @@ -524,6 +663,7 @@ static unsigned long kvmppc_share_page(struct kvm *

RE: [RFC PATCH] powerpc/pseries/svm: capture instruction faulting on MMIO access, in sprg0 register

2020-07-22 Thread Ram Pai
On Wed, Jul 22, 2020 at 12:06:06PM +1000, Michael Ellerman wrote: > Ram Pai writes: > > An instruction accessing a mmio address, generates a HDSI fault. This > > fault is > > appropriately handled by the Hypervisor. However in the case of secureVMs, > > the &g

RE: [RFC PATCH] powerpc/pseries/svm: capture instruction faulting on MMIO access, in sprg0 register

2020-07-22 Thread Ram Pai
On Wed, Jul 22, 2020 at 12:42:05AM -0700, Ram Pai wrote: > On Wed, Jul 22, 2020 at 03:02:32PM +1000, Paul Mackerras wrote: > > On Thu, Jul 16, 2020 at 01:32:13AM -0700, Ram Pai wrote: > > > An instruction accessing a mmio address, generates a HDSI fault. This > > > f

Re: Re: [RFC PATCH] powerpc/pseries/svm: capture instruction faulting on MMIO access, in sprg0 register

2020-07-22 Thread Ram Pai
On Wed, Jul 22, 2020 at 03:02:32PM +1000, Paul Mackerras wrote: > On Thu, Jul 16, 2020 at 01:32:13AM -0700, Ram Pai wrote: > > An instruction accessing a mmio address, generates a HDSI fault. This > > fault is > > appropriately handled by the Hypervisor. However in

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

2020-07-21 Thread Ram Pai
. In > addition, the mmap_sem is help in read mode during that time, not in write ^^ held > mode since the virual memory layout is not impacted, and > kvm->arch.uvmem_lock prevents concurrent operation on the secure device. > > Cc: Ram Pai Reviewed-by: Ram Pai RP

Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: move kvmppc_svm_page_out up

2020-07-21 Thread Ram Pai
ock, 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. Reviewed-by: Ram Pai > > Cc: Ram Pai > Cc: Bharata B Rao > Cc: Paul Mackerras > Signed-off-by: Laurent Dufour > --- RP

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

2020-07-17 Thread Ram Pai
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 page-merge for all pages in the memory slot. Signed-off-by: Ram Pai

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

2020-07-17 Thread Ram Pai
Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 1 + arch/powerpc/kvm/book3s_hv_uvmem.c | 106 --- 2 files changed, 74 insertions(+), 33 deletions(-) diff --git a

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

2020-07-17 Thread Ram Pai
hiago Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst| 2 + arch/powerpc/include/asm/kvm_book3s_uvmem.h | 2 + arch/powerpc/kvm/book3s_hv_uv

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

2020-07-17 Thread Ram Pai
references , making it impossible to migrate those pages. Disable page-migration in H_SVM_INIT_START handling. Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 1 + arch/powerpc/kvm/book3s_hv_uvmem.c | 98 +++- 2 files changed, 76 insertions(+), 23

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

2020-07-17 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c

[v4 0/5] Migrate non-migrated pages of a SVM.

2020-07-17 Thread Ram Pai
ipped from migration during H_SVM_INIT_DONE. Laurent Dufour (1): KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai (4): KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs KVM: PPC: Book3S HV: in H_SVM

[RFC PATCH] powerpc/pseries/svm: capture instruction faulting on MMIO access, in sprg0 register

2020-07-16 Thread Ram Pai
SPRG0 register, before executing the faulting instruction. This enables the ultravisor to easily procure the faulting instruction and emulate it. Signed-off-by: Ram Pai --- arch/powerpc/include/asm/io.h | 85 ++- 1 file changed, 75 insertions(+), 10 dele

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

2020-07-14 Thread Ram Pai
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 > > disabled the page is migrated in H_SVM_PAGE_IN handler. > > > > This operation

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

2020-07-14 Thread Ram Pai
On Mon, Jul 13, 2020 at 03:20:43PM +0530, Bharata B Rao wrote: > On Sat, Jul 11, 2020 at 02:13:46AM -0700, Ram Pai wrote: > > The page requested for page-in; sometimes, can have transient > > references, and hence cannot migrate immediately. Retry a few times > > before retur

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

2020-07-14 Thread Ram Pai
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 all the > > pages > > > > if (!(*mig.src & MIGRATE_PFN_MIGRA

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

2020-07-11 Thread Ram Pai
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.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc

[v3 0/5] Migrate non-migrated pages of a SVM.

2020-07-11 Thread Ram Pai
d-out must also be skipped from migration during H_SVM_INIT_DONE. Laurent Dufour (1): KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai (4): KVM: PPC: Book3S HV: Disable page merging in H_SVM_INIT_START KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs KVM: PPC: B

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

2020-07-11 Thread Ram Pai
content of those pages and hence ignores it. Signed-off-by: Laurent Dufour Signed-off-by: Ram Pai [resolved conflicts, and modified the commit log] --- arch/powerpc/kvm/book3s_hv.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b

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

2020-07-11 Thread Ram Pai
n 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.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst| 2 +

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

2020-07-11 Thread Ram Pai
new references , making it impossible to migrate those pages in H_SVM_PAGE_IN handler. Disable page-migration in H_SVM_INIT_START handling. Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 96 +- 1 file changed, 74 insertions(+), 22 deletions

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

2020-07-11 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c

Re: [PATCH v3 0/4] Migrate non-migrated pages of a SVM.

2020-06-29 Thread Ram Pai
On Mon, Jun 29, 2020 at 07:23:30AM +0530, Bharata B Rao wrote: > On Sun, Jun 28, 2020 at 09:41:53PM +0530, Bharata B Rao wrote: > > On Fri, Jun 19, 2020 at 03:43:38PM -0700, Ram Pai wrote: > > > The time taken to switch a VM to Secure-VM, increases by the size of the > >

[PATCH v3 4/4] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-06-19 Thread Ram Pai
content of those pages and hence ignores it. Signed-off-by: Laurent Dufour Signed-off-by: Ram Pai [resolved conflicts, and modified the commit log] --- arch/powerpc/kvm/book3s_hv.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b

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

2020-06-19 Thread Ram Pai
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.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst| 2 + arch/powerpc/include/asm/kvm_book3s_uvmem.h

[PATCH v3 2/4] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-06-19 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c

[PATCH v3 1/4] KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c

2020-06-19 Thread Ram Pai
Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm

[PATCH v3 0/4] Migrate non-migrated pages of a SVM.

2020-06-19 Thread Ram Pai
ur (1): KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai (3): KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT

Re: [PATCH v2 2/4] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-06-18 Thread Ram Pai
On Thu, Jun 18, 2020 at 03:31:06PM +0200, Laurent Dufour wrote: > Le 18/06/2020 à 11:19, Ram Pai a écrit : > > .snip.. > > > > 1. States of a GFN > > --- > > The GFN can

Re: [PATCH v2 0/4] Migrate non-migrated pages of a SVM.

2020-06-18 Thread Ram Pai
, and thus solves the problem. -- On Thu, Jun 18, 2020 at 02:19:01AM -0700, Ram Pai wrote: > This patch series migrates the non-migrated pages of a SVM. > This is required when the UV calls H_SVM_INIT_DONE, and > when a memor

[PATCH v2 4/4] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-06-18 Thread Ram Pai
content of those pages and hence ignores it. Signed-off-by: Ram Pai [resolved conflicts, and modified the commit log] Signed-off-by: Laurent Dufour --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 2 ++ arch/powerpc/kvm/book3s_hv.c| 10 ++ arch/powerpc/kvm

[PATCH v2 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-18 Thread Ram Pai
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.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 2 + arch/powerpc/kvm/book3s_hv_uvmem.c

[PATCH v2 2/4] KVM: PPC: Book3S HV: track the state GFNs associated with secure VMs

2020-06-18 Thread Ram Pai
neesh 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.ozlabs.org Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/include/asm/kvm_book3s_uvmem.h

[PATCH v2 1/4] KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c

2020-06-18 Thread Ram Pai
Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm

[PATCH v2 0/4] Migrate non-migrated pages of a SVM.

2020-06-18 Thread Ram Pai
. Pages that where paged-in and later paged-out must also be skipped from migration during H_SVM_INIT_DONE. Laurent Dufour (1): KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai (3): KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c KVM: PPC: Book3S HV

Re: [PATCH v1 2/4] KVM: PPC: Book3S HV: track shared GFNs of secure VMs

2020-06-05 Thread Ram Pai
> >diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c > >b/arch/powerpc/kvm/book3s_64_mmu_radix.c > >index 803940d..3448459 100644 > >--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c > >+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c > >@@ -1100,7 +1100,7 @@ void kvmppc_radix_flush_memslot(struct kvm *k

Re: [PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-03 Thread Ram Pai
On Tue, Jun 02, 2020 at 03:36:39PM +0530, Bharata B Rao wrote: > On Mon, Jun 01, 2020 at 12:05:35PM -0700, Ram Pai wrote: > > On Mon, Jun 01, 2020 at 05:25:18PM +0530, Bharata B Rao wrote: > > > On Sat, May 30, 2020 at 07:27:50PM -0700, Ram Pai wrote: > > > > H_SVM

Re: [PATCH v1 4/4] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-06-03 Thread Ram Pai
On Tue, Jun 02, 2020 at 10:31:32AM +0200, Laurent Dufour wrote: > Le 31/05/2020 à 04:27, Ram Pai a écrit : > >From: Laurent Dufour > > > >When a memory slot is hot plugged to a SVM, GFNs associated with that > >memory slot automatically default to secure GFN. Hence mig

Re: [PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-06-01 Thread Ram Pai
On Mon, Jun 01, 2020 at 05:25:18PM +0530, Bharata B Rao wrote: > On Sat, May 30, 2020 at 07:27:50PM -0700, Ram Pai wrote: > > H_SVM_INIT_DONE incorrectly assumes that the Ultravisor has explicitly > > called H_SVM_PAGE_IN for all secure pages. > > I don't think that

[PATCH v1 4/4] KVM: PPC: Book3S HV: migrate hot plugged memory

2020-05-30 Thread Ram Pai
: Thiago Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai (fixed merge conflicts. Modified the commit message) Signed-off-by: Laurent Dufour --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 4

[PATCH v1 3/4] KVM: PPC: Book3S HV: migrate remaining normal-GFNs to secure-GFNs in H_SVM_INIT_DONE

2020-05-30 Thread Ram Pai
Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- Documentation/powerpc/ultravisor.rst | 2 + arch/powerpc/kvm/book3s_hv_uvmem.c | 219 --- 2 files changed, 154 inser

[PATCH v1 2/4] KVM: PPC: Book3S HV: track shared GFNs of secure VMs

2020-05-30 Thread Ram Pai
: Laurent Dufour Cc: Thiago Jung Bauermann Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- arch/powerpc/include/asm/kvm_book3s_uvmem.h | 6 +- arch/powerpc/kvm/book3s_64_mmu_radix.c

[PATCH v1 1/4] KVM: PPC: Book3S HV: Fix function definition in book3s_hv_uvmem.c

2020-05-30 Thread Ram Pai
Cc: David Gibson Cc: Claudio Carvalho Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Ram Pai --- arch/powerpc/kvm/book3s_hv_uvmem.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch

[PATCH v1 0/4] Migrate non-migrated pages of a SVM.

2020-05-30 Thread Ram Pai
This patch series migrates the non-migrate pages of a SVM. This is required when the UV calls H_SVM_INIT_DONE, and when a memory-slot is hotplugged to a Secure VM. Laurent Dufour (1): KVM: PPC: Book3S HV: migrate hot plugged memory Ram Pai (3): KVM: PPC: Book3S HV: Fix function definition in

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

2020-05-20 Thread Ram Pai
NIT_ABORT, this hcall will be > filtered out in kvmppc_h_svm_init_abort() because kvm->arch.secure_guest is > not set in that case. > > Fixes: 8c47b6ff29e3 ("KVM: PPC: Book3S HV: Check caller of H_SVM_* Hcalls") > Signed-off-by: Laurent Dufour Reviewed-by: Ram Pai &

[PATCH v3] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor.

2020-04-26 Thread Ram Pai
l Ellerman Cc: Thiago Jung Bauermann Cc: Michael Anderson Cc: Sukadev Bhattiprolu Cc: Alexey Kardashevskiy Cc: Paul Mackerras Cc: David Gibson Reviewed-by: Cedric Le Goater Reviewed-by: Greg Kurz Signed-off-by: Ram Pai v3: fix a minor semantics in description. and added reviewed-by from

[PATCH v3] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor.

2020-04-25 Thread Ram Pai
>From 10ea2eaf492ca3f22f67a5a63a2b7865e45299ad Mon Sep 17 00:00:00 2001 From: Ram Pai Date: Mon, 24 Feb 2020 01:09:48 -0500 Subject: [PATCH v3] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor. XIVE interrupt controller uses an Event Queue (EQ) to enqueue event notificati

Re: [PATCH v2 01/22] powerpc/pkeys: Avoid using lockless page table walk

2020-04-02 Thread Ram Pai
-fault event and the key-change event. Hence I think the change proposed in this patch may not be necessary. RP > > Cc: Ram Pai > Signed-off-by: Aneesh Kumar K.V > --- > arch/powerpc/include/asm/mmu.h| 9 --- > arch/powerpc/mm/book3s64/hash_utils.c |

Re: [PATCH v2] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor.

2020-03-31 Thread Ram Pai
On Tue, Mar 31, 2020 at 08:53:07PM -0300, Thiago Jung Bauermann wrote: > > Hi Ram, > > Ram Pai writes: > > > diff --git a/arch/powerpc/sysdev/xive/spapr.c > > b/arch/powerpc/sysdev/xive/spapr.c > > index 55dc61c..608b52f 100644 > > --- a/arch/powerpc/sys

[PATCH v2] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor.

2020-03-26 Thread Ram Pai
lerman Cc: Thiago Jung Bauermann Cc: Michael Anderson Cc: Sukadev Bhattiprolu Cc: Alexey Kardashevskiy Cc: Paul Mackerras Cc: Greg Kurz Cc: Cedric Le Goater Cc: David Gibson Signed-off-by: Ram Pai v2: better description of the patch from Cedric. --- arch/powerpc/sysdev/xive/spapr.c | 7

Re: [PATCH] powerpc/prom_init: Include the termination message in ibm,os-term RTAS call

2020-03-25 Thread Ram Pai
args.token = cpu_to_be32(token); > + os_term_args.nargs = cpu_to_be32(1); > + os_term_args.args[0] = cpu_to_be32(__pa(str)); > + Reviewed-by: Ram Pai RP

Re: [PATCH 2/2] KVM: PPC: Book3S HV: H_SVM_INIT_START must call UV_RETURN

2020-03-20 Thread Ram Pai
hael Ellerman > Signed-off-by: Laurent Dufour Reviewed-by: Ram Pai

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

2020-03-20 Thread Ram Pai
gt; Cc: Bharata B Rao > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Signed-off-by: Laurent Dufour Reviewed-by: Ram Pai > --- > arch/powerpc/kvm/book3s_hv.c | 32 +--- > 1 file changed, 21 insertions(+), 11 deletions(-) >

[RFC PATCH v1] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor.

2020-03-15 Thread Ram Pai
Cc: Thiago Jung Bauermann Cc: Michael Anderson Cc: Sukadev Bhattiprolu Cc: Alexey Kardashevskiy Cc: Paul Mackerras Cc: Greg Kurz Cc: Cedric Le Goater Cc: David Gibson Signed-off-by: Ram Pai --- arch/powerpc/sysdev/xive/spapr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/ar

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-05 Thread Ram Pai
On Thu, Mar 05, 2020 at 10:55:45AM +1100, David Gibson wrote: > On Wed, Mar 04, 2020 at 04:56:09PM +0100, Cédric Le Goater wrote: > > [ ... ] > > > > > (1) applied the patch which shares the EQ-page with the hypervisor. > > > (2) set "kernel_irqchip=off" > > > (3) set "ic-mode=xive" > > > > you d

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-04 Thread Ram Pai
On Wed, Mar 04, 2020 at 11:59:48AM +0100, Greg Kurz wrote: > On Tue, 3 Mar 2020 10:56:45 -0800 > Ram Pai wrote: > > > On Tue, Mar 03, 2020 at 06:45:20PM +0100, Greg Kurz wrote: snip. > > > > > > This patch would allow at least to answer Cedric's q

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-04 Thread Ram Pai
On Wed, Mar 04, 2020 at 11:59:48AM +0100, Greg Kurz wrote: > On Tue, 3 Mar 2020 10:56:45 -0800 > Ram Pai wrote: > > > On Tue, Mar 03, 2020 at 06:45:20PM +0100, Greg Kurz wrote: > > > On Tue, 3 Mar 2020 09:02:05 -0800 > > > Ram Pai wrote: > > > > &

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-03 Thread Ram Pai
On Tue, Mar 03, 2020 at 08:08:51PM +0100, Cédric Le Goater wrote: > >>> 4) I'm guessing the problem with XIVE in SVM mode is that XIVE needs > >>> to write to event queues in guest memory, which would have to be > >>> explicitly shared for secure mode. That's true whether it's KVM > >>

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-03 Thread Ram Pai
On Tue, Mar 03, 2020 at 06:45:20PM +0100, Greg Kurz wrote: > On Tue, 3 Mar 2020 09:02:05 -0800 > Ram Pai wrote: > > > On Tue, Mar 03, 2020 at 07:50:08AM +0100, Cédric Le Goater wrote: > > > On 3/3/20 12:32 AM, David Gibson wrote: > > > > On Fri, Feb 28, 202

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-03-03 Thread Ram Pai
On Tue, Mar 03, 2020 at 07:50:08AM +0100, Cédric Le Goater wrote: > On 3/3/20 12:32 AM, David Gibson wrote: > > On Fri, Feb 28, 2020 at 11:54:04PM -0800, Ram Pai wrote: > >> XIVE is not correctly enabled for Secure VM in the KVM Hypervisor yet. > >> > >> Hen

RE: [RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-02-29 Thread Ram Pai
On Sat, Feb 29, 2020 at 09:27:54AM +0100, Cédric Le Goater wrote: > On 2/29/20 8:54 AM, Ram Pai wrote: > > XIVE is not correctly enabled for Secure VM in the KVM Hypervisor yet. > > > > Hence Secure VM, must always default to XICS interrupt controller. > > have you t

[RFC PATCH v1] powerpc/prom_init: disable XIVE in Secure VM.

2020-02-28 Thread Ram Pai
Mackerras Cc: Greg Kurz Cc: Cedric Le Goater Cc: David Gibson Signed-off-by: Ram Pai --- arch/powerpc/kernel/prom_init.c | 43 - 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_

Re: [RESEND PATCH v2 3/3] powerpc/powernv: Parse device tree, population of SPR support

2020-01-12 Thread Ram Pai
if (!np) { > + pr_warn("opal: self restore Node not found"); > + } else { > + rc = extract_save_restore_state_dt(np, SELF_RESTORE_TYPE); > + if (rc != 0) > + return rc; > + } > + /* Self save register population */ > + np1 = of_find_node_by_path("/ibm,opal/power-mgt/self-save"); 'np' can be reused? 'np1' is not needed. Otherwise looks good. Reviewed-by: Ram Pai RP

Re: [RESEND PATCH v2 2/3] powerpc/powernv: Introduce Self save support

2020-01-12 Thread Ram Pai
powerpc/platforms/powernv/idle.c > @@ -1172,6 +1172,8 @@ void pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 > lpcr_val) > if (!is_lpcr_self_save) > opal_slw_set_reg(pir, SPRN_LPCR, >lpcr_val); > + else > +

Re: [RESEND PATCH v2 1/3] powerpc/powernv: Interface to define support and preference for a SPR

2020-01-12 Thread Ram Pai
.spr = SPRN_PTCR, > + .preferred_mode = PREFER_SAVE_RESTORE, > + .supported_mode = SELF_RESTORE_STRICT, > + }, This confuses me. It says SAVE takes precedence over RESTORE. and than it says it is strictly 'RESTORE' only. Maybe you should not initialize the 'supported_mode' ? or put a comment somewhere here, saying this value will be overwritten during system initialization? Otherwise the code looks correct. Reviewed-by: Ram Pai RP

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

2020-01-07 Thread Ram Pai
On Mon, Jan 06, 2020 at 06:02:37PM -0800, Sukadev Bhattiprolu wrote: > Ram Pai [linux...@us.ibm.com] wrote: > > > > One small comment.. H_STATE is a better return code than H_UNSUPPORTED. > > > > Here is the updated patch - we now return H_STATE if the abort call is &

  1   2   3   4   5   6   7   8   9   10   >