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

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>
This commit is contained in:
Jiandi An 2016-12-27 18:47:32 -06:00 committed by Stefano Stabellini
parent f9751a60f1
commit 0b47a6bd11
1 changed files with 5 additions and 3 deletions

View File

@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,
xen_pfn_t *gpfns; xen_pfn_t *gpfns;
xen_ulong_t *idxs; xen_ulong_t *idxs;
int *errs; int *errs;
struct xen_add_to_physmap_range xatp;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
struct xen_add_to_physmap_range xatp = {
.domid = DOMID_SELF,
.space = XENMAPSPACE_dev_mmio
};
r = &resources[i]; r = &resources[i];
nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE);
if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources,
idxs[j] = XEN_PFN_DOWN(r->start) + j; idxs[j] = XEN_PFN_DOWN(r->start) + j;
} }
xatp.domid = DOMID_SELF;
xatp.size = nr; xatp.size = nr;
xatp.space = XENMAPSPACE_dev_mmio;
set_xen_guest_handle(xatp.gpfns, gpfns); set_xen_guest_handle(xatp.gpfns, gpfns);
set_xen_guest_handle(xatp.idxs, idxs); set_xen_guest_handle(xatp.idxs, idxs);