Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1548959

Re: [PATCH V2] Xen: ARM: Zero reserved fields of xatp before making hypervisor call

From Juergen Gross <jgross@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2] Xen: ARM: Zero reserved fields of xatp before making hypervisor call
Date 2017-01-02 07:20 +0100
Message-ID <sV48p-2C9-3@gated-at.bofh.it> (permalink)
References <sTaBj-RM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 28/12/16 01:47, 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>
> ---
> 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(-)
> 
> diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c
> index 778acf8..85dd20e 100644
> --- a/drivers/xen/arm-device.c
> +++ b/drivers/xen/arm-device.c
> @@ -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
> +		};
> +

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

>  		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);
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH V2] Xen: ARM: Zero reserved fields of xatp before making hypervisor call Jiandi An <anjiandi@codeaurora.org> - 2016-12-28 01:50 +0100
  Re: [PATCH V2] Xen: ARM: Zero reserved fields of xatp before making  hypervisor call Juergen Gross <jgross@suse.com> - 2017-01-02 07:20 +0100

csiph-web