Xen: ARM: Zero reserved fields of xatp before making hypervisor call
PATCH v2 1/1 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.
---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.
drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/xen/arm-device.c +5 -3
@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; + r = &resources[i]; nr =DIV_ROUND_UP (resource_size (r),XEN_PAGE_SIZE );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; } - xatp.domid =DOMID_SELF ; xatp.size = nr; - xatp.space = XENMAPSPACE_dev_mmio;set_xen_guest_handle (xatp.gpfns, gpfns);set_xen_guest_handle (xatp.idxs, idxs);
Signature · 3 lines
Jiandi An Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Juergen Gross
maintainerQuoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;
drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +
I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
Juergen
Quoted 14 lines
drivers/xen/arm-device.c +0
-2r = &resources[i]; nr =DIV_ROUND_UP (resource_size (r),XEN_PAGE_SIZE );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; } - xatp.domid =DOMID_SELF ; xatp.size = nr; - xatp.space = XENMAPSPACE_dev_mmio;set_xen_guest_handle (xatp.gpfns, gpfns);set_xen_guest_handle (xatp.idxs, idxs);
Stefano Stabellini
maintainerQuoted 36 lines · Juergen Gross
Quoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
Quoted 2 lines
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
I don't feel strongly about this either - I think this patch is good enough. I'll apply to xentip.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Stefano Stabellini
maintainerQuoted 36 lines · Juergen Gross
Quoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
Quoted 2 lines
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
I don't feel strongly about this either - I think this patch is good enough. I'll apply to xentip.
Hi Stefano,
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Juergen Gross
Quoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
Quoted 5 lines
Quoted 2 lines
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
I don't feel strongly about this either - I think this patch is good enough. I'll apply to xentip.
I think this patch should be backported to stable trees because the issue could appear depending on the compiler.
Cheers,
Signature · 1 line
Julien Grall
Hi Stefano,
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Juergen Gross
Quoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
Quoted 5 lines
Quoted 2 lines
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
I don't feel strongly about this either - I think this patch is good enough. I'll apply to xentip.
I think this patch should be backported to stable trees because the issue could appear depending on the compiler.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerQuoted 20 lines · Jiandi An
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 forXENMAPSPACE_dev_mmiorequest.Signed-off-by Jiandi An <[email protected]>---
Changed zeroing xatp to a static initialization
of .domid and .space for xatp.drivers/xen/arm-device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/xen/arm-device.c +0
-0@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,xen_pfn_t *gpfns;
drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 67
Quoted 10 lines
drivers/xen/arm-device.c +5
-1xen_ulong_t *idxs;int *errs; -struct xen_add_to_physmap_range xatp;for (i =0 ; i < count; i++) { +struct xen_add_to_physmap_range xatp = { + .domid =DOMID_SELF , + .space = XENMAPSPACE_dev_mmio + }; +
I still don't see the need to re-initialize the input parts of xatp on each loop iteration unless you can show the need for it (e.g. a buggy hypervisor version not conforming to the interface specification).
OTOH I don't feel really strong about it and let Stefano being the maintainer for the ARM parts decide.
Juergen
Quoted 5 lines
drivers/xen/arm-device.c +0
-0r = &resources[i]; nr =DIV_ROUND_UP (resource_size (r),XEN_PAGE_SIZE );if ((resource_type (r) !=IORESOURCE_MEM ) || (nr ==0 ))
drivers/xen/arm-device.c static int xen_map_device_mmio(const struct resource *resources, · line 97
Quoted 9 lines
drivers/xen/arm-device.c +0
-2@@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources, idxs[j] =XEN_PFN_DOWN (r->start) + j; } - xatp.domid =DOMID_SELF ; xatp.size = nr; - xatp.space = XENMAPSPACE_dev_mmio;set_xen_guest_handle (xatp.gpfns, gpfns);set_xen_guest_handle (xatp.idxs, idxs);
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel