From: Ian Campbell Subject: Re: [PATCH v5 04/10] xen/arm: Store p2m type in each page of the guest Date: Mon, 16 Dec 2013 17:49:32 +0000 Message-ID: <1387216172.21086.57.camel@kazak.uk.xensource.com> References: <1387215452-10951-1-git-send-email-julien.grall@linaro.org> <1387215452-10951-5-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 1VscIT-0004pL-JI for xen-devel@lists.xenproject.org; Mon, 16 Dec 2013 17:49:38 +0000 In-Reply-To: <1387215452-10951-5-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-12-16 at 17:37 +0000, Julien Grall wrote: > Use the field 'avail' to store the type of the page. Rename it to 'type' for > convenience. > The information stored in this field 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 > > --- > Changes in v5: > - Foreign mapping doesn't need to have execution right Neither does MMIO for that matter... > > + switch (t) > + { > + case p2m_map_foreign: > + case p2m_grant_map_rw: > + e.p2m.xn = 1; > + /* Fallthrough */ > + case p2m_ram_rw: > + case p2m_mmio_direct: ... so move this up. > + e.p2m.write = 1; > + break; > + > + case p2m_grant_map_ro: > + e.p2m.xn = 1; > + /* Fallthrough */ > + case p2m_invalid: > + case p2m_ram_ro: > + default: You were going to remove the default case IIRC to let the compiler catch new type additions. > + e.p2m.write = 0; > + } > + >diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h > index 0625464..670d4e7 100644 > --- a/xen/include/asm-arm/page.h > +++ b/xen/include/asm-arm/page.h > @@ -153,7 +153,7 @@ typedef struct { > unsigned long contig:1; /* In a block of 16 contiguous entries */ > unsigned long sbz2:1; > unsigned long xn:1; /* eXecute-Never */ > - unsigned long avail:4; /* Ignored by hardware */ > + unsigned long type:4; /* Ignore by hardware. Used to store p2m types */ "Ignored" was correct. > > unsigned long sbz1:5; > } __attribute__((__packed__)) lpae_p2m_t;