From: "Jan Beulich" Subject: Re: [PATCH] Introduce a p2m class. Date: Tue, 27 Jan 2015 08:39:33 +0000 Message-ID: <54C75CD50200007800059BE0@mail.emea.novell.com> References: <1422313071-11236-1-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: <1422313071-11236-1-git-send-email-edmund.h.white@intel.com> Content-Disposition: inline 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 Cc: andrew.cooper3@citrix.com, tim@xen.org, keir@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 26.01.15 at 23:57, wrote: > --- a/xen/include/asm-x86/p2m.h > +++ b/xen/include/asm-x86/p2m.h > @@ -172,6 +172,11 @@ typedef unsigned int p2m_query_t; > (P2M_RAM_TYPES | P2M_GRANT_TYPES | \ > p2m_to_mask(p2m_map_foreign))) > > +typedef enum { > + p2m_host = 0, > + p2m_nested = 1, > +} p2m_class_t; No explicit numbers here please - you don't really have a need to override the language defined default behavior. > @@ -297,7 +304,15 @@ 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))) > +static inline bool_t p2m_is_hostp2m(struct p2m_domain *p2m) > +{ > + return p2m->p2m_class == p2m_host; > +} > + > +static inline bool_t p2m_is_nestedp2m(struct p2m_domain *p2m) > +{ > + return p2m->p2m_class == p2m_nested; > +} Please properly constify the function parameters. Jan