Commit 704a6d719d4c4228c7f0b1fbaf6bc35fe2ccf1d8

Authored by Jiandi An
Committed by Greg Kroah-Hartman
1 parent f76ddff6c5

Xen: ARM: Zero reserved fields of xatp before making hypervisor call

[ Upstream commit 0b47a6bd1150f4846b1d61925a4cc5a96593a541 ]

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>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff

drivers/xen/arm-device.c
... ... @@ -58,9 +58,13 @@
58 58 xen_pfn_t *gpfns;
59 59 xen_ulong_t *idxs;
60 60 int *errs;
61   - struct xen_add_to_physmap_range xatp;
62 61  
63 62 for (i = 0; i < count; i++) {
  63 + struct xen_add_to_physmap_range xatp = {
  64 + .domid = DOMID_SELF,
  65 + .space = XENMAPSPACE_dev_mmio
  66 + };
  67 +
64 68 r = &resources[i];
65 69 nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE);
66 70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
67 71  
... ... @@ -87,9 +91,7 @@
87 91 idxs[j] = XEN_PFN_DOWN(r->start) + j;
88 92 }
89 93  
90   - xatp.domid = DOMID_SELF;
91 94 xatp.size = nr;
92   - xatp.space = XENMAPSPACE_dev_mmio;
93 95  
94 96 set_xen_guest_handle(xatp.gpfns, gpfns);
95 97 set_xen_guest_handle(xatp.idxs, idxs);