mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jiandi An <anjiandi@codeaurora.org>,
	boris.ostrovsky@oracle.com, xen-devel@lists.xenproject.org,
	linux-kernel@vger.kernel.org, sstabellini@kernel.org,
	julien.grall@arm.com
Subject: Re: [PATCH V2] Xen: ARM: Zero reserved fields of xatp before making hypervisor call
Date: Mon, 2 Jan 2017 07:13:35 +0100	[thread overview]
Message-ID: <a926f4b6-0bfd-bcd6-3313-e1bd01ce4fa2@suse.com> (raw)
In-Reply-To: <1482886052-30111-1-git-send-email-anjiandi@codeaurora.org>

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

  reply	other threads:[~2017-01-02  6:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  0:47 Jiandi An
2017-01-02  6:13 ` Juergen Gross [this message]
2017-01-03 18:03   ` Stefano Stabellini
2017-01-16 15:03     ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a926f4b6-0bfd-bcd6-3313-e1bd01ce4fa2@suse.com \
    --to=jgross@suse.com \
    --cc=anjiandi@codeaurora.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=julien.grall@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome