All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Frediano Ziglio <frediano.ziglio@huawei.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tim Deegan <tim@xen.org>
Cc: zoltan.kiss@huawei.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] xen/arm: Handle translated addresses for hardware domains in GICv2
Date: Wed, 25 Feb 2015 13:03:21 +0000	[thread overview]
Message-ID: <54EDC819.3090901@linaro.org> (raw)
In-Reply-To: <1424862882-11269-1-git-send-email-frediano.ziglio@huawei.com>

On 25/02/15 11:14, Frediano Ziglio wrote:
> Translated address (in d->arch.vgic.{c,d}base) are now bus addresses

addresses

> which could not always be applied to the DT.
> Copy the original address from DT directly to get the original

addresses

> untraslated reg property which will give same d->arch.vgic.{c,d}base

untranslated

> values once translated again.
> 
> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
> ---
>  xen/arch/arm/gic-v2.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> Updated comment and commit message as requested.
> 
> diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
> index 31fb81a..6899ab1 100644
> --- a/xen/arch/arm/gic-v2.c
> +++ b/xen/arch/arm/gic-v2.c
> @@ -590,7 +590,7 @@ static int gicv2_make_dt_node(const struct domain *d,
>      const struct dt_device_node *gic = dt_interrupt_controller;
>      const void *compatible = NULL;
>      u32 len;
> -    __be32 *new_cells, *tmp;
> +    const __be32 *regs;
>      int res = 0;
>  
>      compatible = dt_get_property(gic, "compatible", &len);
> @@ -617,18 +617,22 @@ static int gicv2_make_dt_node(const struct domain *d,
>      if ( res )
>          return res;
>  
> -    len = dt_cells_to_size(dt_n_addr_cells(node) + dt_n_size_cells(node));
> -    len *= 2; /* GIC has two memory regions: Distributor + CPU interface */
> -    new_cells = xzalloc_bytes(len);
> -    if ( new_cells == NULL )
> -        return -FDT_ERR_XEN(ENOMEM);
> +    /*
> +     * Copy only GICC and GICD regions, not entire regions.
> +     * DTB provides up to 4 regions to handle virtualization
> +     * however dom0 just needs GICC and GICD provided by Xen.

The 2 sentences say pretty much the same things. Although, the second
one is more complete. I would only keep the second one.

> +     */
> +    regs = dt_get_property(gic, "reg", &len);
> +    if ( !regs )
> +    {
> +        dprintk(XENLOG_ERR, "Can't find reg property for the gic node\n");
> +        return -FDT_ERR_XEN(ENOENT);
> +    }
>  
> -    tmp = new_cells;
> -    dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE);
> -    dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2);
> +    len = dt_cells_to_size(dt_n_addr_cells(node) + dt_n_size_cells(node));
> +    len *= 2;
>  
> -    res = fdt_property(fdt, "reg", new_cells, len);
> -    xfree(new_cells);
> +    res = fdt_property(fdt, "reg", regs, len);
>  
>      return res;
>  }
> 


Regards,

-- 
Julien Grall

  reply	other threads:[~2015-02-25 13:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20  9:38 [PATCH] xen/arm: Handle translated addresses for hardware domains in GICv2 Frediano Ziglio
2015-02-23 16:30 ` Julien Grall
2015-02-24 16:01   ` Ian Campbell
2015-02-24 16:21     ` Julien Grall
2015-02-24 17:00       ` Ian Campbell
2015-02-24 17:09         ` Julien Grall
2015-02-24 16:00 ` Ian Campbell
2015-02-25 11:14   ` Frediano Ziglio
2015-02-25 13:03     ` Julien Grall [this message]
2015-02-25 13:21       ` Frediano Ziglio
2015-02-27 13:53         ` Julien Grall
2015-02-27 13:57           ` Ian Campbell
2015-02-27 14:00             ` Julien Grall
2015-02-27 14:08               ` Frediano Ziglio
2015-03-02 14:50                 ` Ian Campbell
2015-03-02 15:00                   ` Frediano Ziglio

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=54EDC819.3090901@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=frediano.ziglio@huawei.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=zoltan.kiss@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.