lkml.org 
[lkml]   [2016]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Xen: ARM: Zero reserved fields of xatp before making hypervisor call
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 <anjiandi@codeaurora.org>
> > ---
> > 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

\
 
 \ /
  Last update: 2016-12-19 19:50    [W:0.076 / U:1.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site