From: Tim Deegan Subject: Re: [v2][PATCH 1/1] xen:vtd: missing RMRR mapping while share EPT Date: Thu, 24 Jul 2014 11:56:51 +0200 Message-ID: <20140724095651.GC1817@deinos.phlegethon.org> References: <1406191841-5258-1-git-send-email-tiejun.chen@intel.com> <53D0CA69.6090500@citrix.com> <53D0CBDF.4010606@intel.com> <53D0CDA9.7020306@citrix.com> <53D0D44C.2090606@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <53D0D44C.2090606@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: "Chen, Tiejun" Cc: yang.z.zhang@intel.com, Andrew Cooper , kevin.tian@intel.com, JBeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Hi, At 17:39 +0800 on 24 Jul (1406219964), Chen, Tiejun wrote: > diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c > index 642ec28..d0cc586 100644 > --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -385,6 +385,19 @@ int p2m_set_entry(struct p2m_domain *p2m, unsigned > long gfn, mfn_t mfn, > return rc; > } > > +/* Just hold p2m_lock then public. */ I can't understand this comment at all. If you need to add a new function, it should have a comment describing _what it does_. > +int p2m_set_identity(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, > + unsigned int page_order, p2m_type_t p2mt, > p2m_access_t p2ma) Also it shouldn't just allow the caller to set anything in a p2m entry; that will cause endless trouble down the line as code outside x86/mm breaks invariants that the p2m code is maintaining. AFAICT a function to set an identity map should only need two arguments, the domain and the mfn; it should then internally DTRT with the other arguments. But as mentioned in a few other emails, you might be able to use set_mmio_p2m_entry() instead of adding new code. Cheers, Tim.