From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 04/11] x86/MM: Improve p2m type checks. Date: Mon, 12 Jan 2015 17:48:22 +0000 Message-ID: <54B408E6.8060404@citrix.com> References: <1420838801-11704-1-git-send-email-edmund.h.white@intel.com> <1420838801-11704-5-git-send-email-edmund.h.white@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1420838801-11704-5-git-send-email-edmund.h.white@intel.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: Ed White , xen-devel@lists.xen.org Cc: ian.jackson@eu.citrix.com, tim@xen.org, keir@xen.org, ian.campbell@citrix.com, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 09/01/15 21:26, Ed White wrote: > diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h > index 5f7fe71..8193901 100644 > --- a/xen/include/asm-x86/p2m.h > +++ b/xen/include/asm-x86/p2m.h > @@ -193,6 +193,9 @@ struct p2m_domain { > * threaded on in LRU order. */ > struct list_head np2m_list; > > + /* Does this p2m belong to the altp2m code? */ > + bool_t alternate; > + > /* Host p2m: Log-dirty ranges registered for the domain. */ > struct rangeset *logdirty_ranges; > > @@ -290,7 +293,9 @@ struct p2m_domain *p2m_get_nestedp2m(struct vcpu *v, uint64_t np2m_base); > */ > struct p2m_domain *p2m_get_p2m(struct vcpu *v); > > -#define p2m_is_nestedp2m(p2m) ((p2m) != p2m_get_hostp2m((p2m->domain))) > +#define p2m_is_hostp2m(p2m) ((p2m) == p2m_get_hostp2m((p2m->domain))) > +#define p2m_is_altp2m(p2m) ((p2m)->alternate) > +#define p2m_is_nestedp2m(p2m) (!p2m_is_altp2m(p2m) && !p2m_ishostp2m(p2m)) Might this be better expressed as a p2m type, currently of the set {host, alt, nested} ? p2m_is_nestedp2m() is starting to hide some moderately complicated calculations. ~Andrew