Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934187AbcLSStg (ORCPT ); Mon, 19 Dec 2016 13:49:36 -0500 Received: from mail.kernel.org ([198.145.29.136]:51474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933595AbcLSStf (ORCPT ); Mon, 19 Dec 2016 13:49:35 -0500 Date: Mon, 19 Dec 2016 10:49:32 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-X260 To: Juergen Gross cc: Jiandi An , boris.ostrovsky@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, julien.grall@arm.com, sstabellini@kernel.org, shankerd@codeaurora.org, shannon.zhao@linaro.org Subject: Re: [PATCH] Xen: ARM: Zero reserved fields of xatp before making hypervisor call In-Reply-To: Message-ID: References: <1482116198-28940-1-git-send-email-anjiandi@codeaurora.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1237 Lines: 36 On Mon, 19 Dec 2016, Juergen Gross wrote: > On 19/12/16 03:56, Jiandi An wrote: > > Ensure all reserved fields of xatp are zero before making hypervisor > > call to XEN in xen_map_device_mmio(). xenmem_add_to_physmap_one() in > > XEN fails the mapping request if extra.res reserved field in xatp is > > not zero for XENMAPSPACE_dev_mmio request. > > > > Signed-off-by: Jiandi An > > --- > > drivers/xen/arm-device.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c > > index 778acf8..208273b 100644 > > --- a/drivers/xen/arm-device.c > > +++ b/drivers/xen/arm-device.c > > @@ -87,6 +87,9 @@ static int xen_map_device_mmio(const struct resource *resources, > > idxs[j] = XEN_PFN_DOWN(r->start) + j; > > } > > > > + /* Ensure reserved fields are set to zero */ > > + memset(&xatp, 0, sizeof(xatp)); > > + > > xatp.domid = DOMID_SELF; > > xatp.size = nr; > > xatp.space = XENMAPSPACE_dev_mmio; > > Instead of setting xatp to 0 in each iteration I'd prefer a static > initialization of .domid and .space: > > struct xen_add_to_physmap_range xatp = { > .domid = DOMID_SELF, > .space = XENMAPSPACE_dev_mmio > }; +1