* Documentation/powerpc: Ultravisor API @ 2020-07-30 10:35 Julia Lawall 2020-07-30 16:48 ` Ram Pai 2020-07-30 23:21 ` [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall Ram Pai 0 siblings, 2 replies; 5+ messages in thread From: Julia Lawall @ 2020-07-30 10:35 UTC (permalink / raw) To: sukadev, corbet, linuxppc-dev, linux-doc 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_IN_NONSHARED indicates that the UV is not anymore interested in the page. Applicable if the page is a shared page. The flag H_PAGE_IN_SHARED exists in the Linux kernel (arch/powerpc/include/asm/hvcall.h), but the flag H_PAGE_IN_NONSHARED does not. Should the documentation be changed in some way? julia ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Documentation/powerpc: Ultravisor API 2020-07-30 10:35 Documentation/powerpc: Ultravisor API Julia Lawall @ 2020-07-30 16:48 ` Ram Pai 2020-07-30 23:21 ` [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall Ram Pai 1 sibling, 0 replies; 5+ messages in thread From: Ram Pai @ 2020-07-30 16:48 UTC (permalink / raw) To: Julia Lawall; +Cc: sukadev, linuxppc-dev, linux-doc, corbet 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_IN_NONSHARED indicates that the UV is not anymore > interested in the page. Applicable if the page is a shared page. > > The flag H_PAGE_IN_SHARED exists in the Linux kernel > (arch/powerpc/include/asm/hvcall.h), but the flag H_PAGE_IN_NONSHARED does > not. Should the documentation be changed in some way? Currently the code assumes H_PAGE_IN_NONSHARED as !H_PAGE_IN_SHARED. We need to patch the kernel to explicitly define the flag. I will submit a patch towards this. Thanks, RP ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall 2020-07-30 10:35 Documentation/powerpc: Ultravisor API Julia Lawall 2020-07-30 16:48 ` Ram Pai @ 2020-07-30 23:21 ` Ram Pai 2020-07-31 4:33 ` Bharata B Rao 1 sibling, 1 reply; 5+ messages in thread From: Ram Pai @ 2020-07-30 23:21 UTC (permalink / raw) To: Julia Lawall Cc: ldufour, linux-doc, corbet, kvm-ppc, bharata, sathnaga, sukadev, linuxppc-dev, david 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 page will not be shared but its contents will be copied. However 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 <julia.lawall@inria.fr> Signed-off-by: Ram Pai <linuxram@us.ibm.com> --- arch/powerpc/include/asm/hvcall.h | 4 +++- arch/powerpc/kvm/book3s_hv_uvmem.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index e90c073..43e3f8d 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -343,7 +343,9 @@ #define H_COPY_TOFROM_GUEST 0xF80C /* Flags for H_SVM_PAGE_IN */ -#define H_PAGE_IN_SHARED 0x1 +#define H_PAGE_IN_NONSHARED 0x0 /* Page is not shared with the UV */ +#define H_PAGE_IN_SHARED 0x1 /* Page is shared with UV */ +#define H_PAGE_IN_MASK 0x1 /* Platform-specific hcalls used by the Ultravisor */ #define H_SVM_PAGE_IN 0xEF00 diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c index 2dde0fb..2806983 100644 --- a/arch/powerpc/kvm/book3s_hv_uvmem.c +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c @@ -947,12 +947,13 @@ unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, unsigned long gpa, if (page_shift != PAGE_SHIFT) return H_P3; - if (flags & ~H_PAGE_IN_SHARED) + if (flags & ~H_PAGE_IN_MASK) return H_P2; if (flags & H_PAGE_IN_SHARED) return kvmppc_share_page(kvm, gpa, page_shift); + /* handle H_PAGE_IN_NONSHARED */ ret = H_PARAMETER; srcu_idx = srcu_read_lock(&kvm->srcu); mmap_read_lock(kvm->mm); -- 1.8.3.1 -- Ram Pai ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall 2020-07-30 23:21 ` [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall Ram Pai @ 2020-07-31 4:33 ` Bharata B Rao 2020-07-31 8:10 ` Ram Pai 0 siblings, 1 reply; 5+ messages in thread From: Bharata B Rao @ 2020-07-31 4:33 UTC (permalink / raw) To: Ram Pai Cc: ldufour, linux-doc, corbet, kvm-ppc, Julia Lawall, sathnaga, sukadev, linuxppc-dev, david 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 page will not be shared but its contents will > be copied. Looks like you got the definitions of shared and non-shared interchanged. > > However 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. What is the use of defining this? Is this used directly in any place? Or, are youp planning to introduce such a usage? Regards, Bharata. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall 2020-07-31 4:33 ` Bharata B Rao @ 2020-07-31 8:10 ` Ram Pai 0 siblings, 0 replies; 5+ messages in thread From: Ram Pai @ 2020-07-31 8:10 UTC (permalink / raw) To: Bharata B Rao Cc: ldufour, linux-doc, corbet, kvm-ppc, Julia Lawall, sathnaga, sukadev, linuxppc-dev, david 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 > > that the page will be shared with the Secure VM, and H_PAGE_IN_SHARED > > indicates that the page will not be shared but its contents will > > be copied. > > Looks like you got the definitions of shared and non-shared interchanged. Yes. Realized it after sending the patch. Will fix it. > > > > > However 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. > > What is the use of defining this? Is this used directly in any place? > Or, are youp planning to introduce such a usage? I know the Hypervisor code currently has no use for that define. It assumes H_PAGE_IN_NONSHARED to be !H_PAGE_IN_SHARED. But H_PAGE_IN_NONSHARED is defined in the Ultravisor API, and hence has to be captured in the header, to stay consistent. RP ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-31 8:13 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-30 10:35 Documentation/powerpc: Ultravisor API Julia Lawall 2020-07-30 16:48 ` Ram Pai 2020-07-30 23:21 ` [PATCH] KVM: PPC: Book3S HV: Define H_PAGE_IN_NONSHARED for H_SVM_PAGE_IN hcall Ram Pai 2020-07-31 4:33 ` Bharata B Rao 2020-07-31 8:10 ` Ram Pai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).