From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v7][RFC][PATCH 07/13] xen/x86/p2m: introduce p2m_check_reserved_device_memory Date: Mon, 27 Oct 2014 16:50:52 +0800 Message-ID: <544E076C.8020606@intel.com> References: <1414136077-18599-1-git-send-email-tiejun.chen@intel.com> <1414136077-18599-8-git-send-email-tiejun.chen@intel.com> <544A862B020000780004203A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <544A862B020000780004203A@mail.emea.novell.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: Jan Beulich Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 2014/10/24 23:02, Jan Beulich wrote: >>>> On 24.10.14 at 09:34, wrote: >> --- a/xen/include/asm-x86/p2m.h >> +++ b/xen/include/asm-x86/p2m.h >> @@ -713,6 +713,19 @@ extern int arch_grant_map_page_identity(struct domain *d, unsigned long frame, >> bool_t writeable); >> extern int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame); >> >> +/* Check if we are accessing rdm. */ >> +static inline int p2m_check_reserved_device_memory(xen_pfn_t start, >> + xen_ulong_t nr, void *d) >> +{ >> + unsigned long *gfn = d; >> + xen_pfn_t end = start + nr; >> + >> + if ( *gfn >= start && *gfn <= end ) >> + return 1; >> + >> + return 0; >> +} > > There is absolutely nothing in the function connecting it to its name. > And the last parameter being void looks pretty bogus too. Both > signs of it (again) being wrong to add such a function without at > least one first caller. Looks you hope I fold this into sequent patch, lets address this in that sequent patch as well. Thanks Tiejun > > Also the way you return from the function suggests the return > type really ought to be bool_t. And instead of the last four lines in > the function body you could again use a single simple return > statement. > > Jan > >