From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ram Pai Date: Wed, 01 Apr 2020 05:32:00 +0000 Subject: Re: [PATCH v2] powerpc/XIVE: SVM: share the event-queue page with the Hypervisor. Message-Id: <20200401053200.GE5903@oc0525413822.ibm.com> List-Id: References: <1585211927-784-1-git-send-email-linuxram@us.ibm.com> <87r1x86pzw.fsf@morokweng.localdomain> In-Reply-To: <87r1x86pzw.fsf@morokweng.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Thiago Jung Bauermann Cc: aik@ozlabs.ru, andmike@linux.ibm.com, groug@kaod.org, kvm-ppc@vger.kernel.org, clg@fr.ibm.com, sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, david@gibson.dropbear.id.au 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/sysdev/xive/spapr.c > > +++ b/arch/powerpc/sysdev/xive/spapr.c > > @@ -26,6 +26,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #include "xive-internal.h" > > > > @@ -501,6 +503,9 @@ static int xive_spapr_configure_queue(u32 target, struct xive_q *q, u8 prio, > > rc = -EIO; > > } else { > > q->qpage = qpage; > > + if (is_secure_guest()) > > + uv_share_page(PHYS_PFN(qpage_phys), > > + 1 << xive_alloc_order(order)); > > If I understand this correctly, you're passing the number of bytes of > the queue to uv_share_page(), but that ultracall expects the number of > pages to be shared. static inline u32 xive_alloc_order(u32 queue_shift) { return (queue_shift > PAGE_SHIFT) ? (queue_shift - PAGE_SHIFT) : 0; } xive_alloc_order(order) returns the order of PAGE_SIZE pages. Hence the value passed to uv_shared_pages is the number of pages, and not the number of bytes. BTW: I did verify through testing that it was indeed passing 1 page to the uv_share_page(). RP