From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH 4/8] xen/arm: Store p2m type in each page of the guest Date: Thu, 05 Dec 2013 16:07:24 +0000 Message-ID: <52A0A4BC.8010803@linaro.org> References: <1386258131-755-1-git-send-email-julien.grall@linaro.org> <1386258131-755-5-git-send-email-julien.grall@linaro.org> <1386258928.20047.86.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VobSb-0006As-09 for xen-devel@lists.xenproject.org; Thu, 05 Dec 2013 16:07:29 +0000 Received: by mail-bk0-f48.google.com with SMTP id v10so7161354bkz.21 for ; Thu, 05 Dec 2013 08:07:27 -0800 (PST) In-Reply-To: <1386258928.20047.86.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, Tim Deegan , stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org On 12/05/2013 03:55 PM, Ian Campbell wrote: > On Thu, 2013-12-05 at 15:42 +0000, Julien Grall wrote: >> Use the field 'avail' to store the type of the page. This information will be >> retrieved in a future patch to change the behaviour when the page is removed. >> >> Also introduce guest_physmap_add_entry to map and set a specific p2m type for >> a page. >> >> Signed-off-by: Julien Grall >> --- >> xen/arch/arm/p2m.c | 49 +++++++++++++++++++++++++++++++-------------- >> xen/include/asm-arm/p2m.h | 18 +++++++++++++---- >> 2 files changed, 48 insertions(+), 19 deletions(-) >> >> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c >> index 8f8b47e..5449a35 100644 >> --- a/xen/arch/arm/p2m.c >> +++ b/xen/arch/arm/p2m.c >> @@ -124,7 +124,8 @@ int p2m_pod_decrease_reservation(struct domain *d, >> return -ENOSYS; >> } >> >> -static lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr) >> +static lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr, >> + p2m_type_t t) >> { >> paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT; >> lpae_t e = (lpae_t) { >> @@ -132,12 +133,25 @@ static lpae_t mfn_to_p2m_entry(unsigned long mfn, unsigned int mattr) >> .p2m.af = 1, >> .p2m.sh = LPAE_SH_OUTER, >> .p2m.read = 1, >> - .p2m.write = 1, >> .p2m.mattr = mattr, >> .p2m.table = 1, >> .p2m.valid = 1, >> + .p2m.avail = t, /* Use avail to store p2m type */ > > Can we change the name in the struct instead and have a comment "using > avail bits for type" there instead please. We only have 5 types so could > only steal 3 but we may as well take all 4. > > A BUILD_BUG_ON to check that the last p2m entry is < 2^4 would be good > too. I will do both modification for the next version. -- Julien Grall