All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: xen-devel@lists.xenproject.org, Vijaya.Kumar@caviumnetworks.com,
	tim@xen.org, stefano.stabellini@citrix.com
Subject: Re: [PATCH v2 06/15] xen/arm: vgic-v3: Set stride during domain initialization
Date: Mon, 2 Feb 2015 15:40:54 +0000	[thread overview]
Message-ID: <1422891654.5838.10.camel@citrix.com> (raw)
In-Reply-To: <1422555950-31821-7-git-send-email-julien.grall@linaro.org>

On Thu, 2015-01-29 at 18:25 +0000, Julien Grall wrote:
> The stride may not be set if the hardware GIC is using the default
> layout. It happens on the Foundation model.
> 
> On GICv3, the default stride is 2 * 64K. Therefore it's possible to avoid
> checking at every redistributor MMIO access if the stride is not set.

Can this defaulting not be pulled further to the initialisation of
gicv3.rdist_stride?

> This is only happening for DOM0,

Please say instead "Because domU uses a static stride configuration this
only happens for dom0..." or similar (i.e. include the reason why domU
is excluded)

>  so we can move this code in
> gicv_v3_init. Take the opportunity to move the stride setting a bit ealier

"earlier".

> because the loop to set regions will require the stride.
> 
> Also, use 2 * 64K rather than 128K and explain the reason.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> ---
>     I wasn't not sure where to move this code. I find very confusion the
>     splitting between vgic and gicv. Maybe we should introduce a
>     hwdom_gicv_init and giccc_map callbacks. Then move most of the
>     initialization in the vgic one.
> 
>     Changes in v2:
>         - Patch added
> ---
>  xen/arch/arm/gic-v3.c  | 11 ++++++++++-
>  xen/arch/arm/vgic-v3.c |  6 +-----
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 47452ca..7b33ff7 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -897,12 +897,21 @@ static int gicv_v3_init(struct domain *d)
>      {
>          d->arch.vgic.dbase = gicv3.dbase;
>          d->arch.vgic.dbase_size = gicv3.dbase_size;
> +
> +        d->arch.vgic.rdist_stride = gicv3.rdist_stride;
> +        /*
> +         * If the stride is not set, the default stride for GICv3 is 2 * 64K:
> +         *     - first 64k page for Control and Physical LPIs
> +         *     - second 64k page for Control and Generation of SGIs
> +         */
> +        if ( !d->arch.vgic.rdist_stride )
> +            d->arch.vgic.rdist_stride = 2 * SZ_64K;
> +
>          for ( i = 0; i < gicv3.rdist_count; i++ )
>          {
>              d->arch.vgic.rbase[i] = gicv3.rdist_regions[i].base;
>              d->arch.vgic.rbase_size[i] = gicv3.rdist_regions[i].size;
>          }
> -        d->arch.vgic.rdist_stride = gicv3.rdist_stride;
>          d->arch.vgic.rdist_count = gicv3.rdist_count;
>      }
>      else
> diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
> index 2c14717..db6b514 100644
> --- a/xen/arch/arm/vgic-v3.c
> +++ b/xen/arch/arm/vgic-v3.c
> @@ -625,11 +625,7 @@ static int vgic_v3_rdistr_mmio_read(struct vcpu *v, mmio_info_t *info)

Why not the write case too?

>  
>      perfc_incr(vgicr_reads);
>  
> -    if ( v->domain->arch.vgic.rdist_stride != 0 )
> -        offset = info->gpa & (v->domain->arch.vgic.rdist_stride - 1);
> -    else
> -        /* If stride is not set. Default 128K */
> -        offset = info->gpa & (SZ_128K - 1);
> +    offset = info->gpa & (v->domain->arch.vgic.rdist_stride - 1);
>  
>      if ( offset < SZ_64K )
>          return __vgic_v3_rdistr_rd_mmio_read(v, info, offset);

  reply	other threads:[~2015-02-02 15:40 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 18:25 [PATCH v2 00/15] xen/arm: Bug fixes for the vGIC Julien Grall
2015-01-29 18:25 ` [PATCH v2 01/15] xen/arm: vgic-v3: Correctly set GICD_TYPER.IDbits Julien Grall
2015-02-02 15:15   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 02/15] xen/arm: vgic-v3: Correctly set GICD_TYPER.CPUNumber Julien Grall
2015-01-29 18:25 ` [PATCH v2 03/15] xen/arm: vgic-v3: Correctly handle GICD_CTLR Julien Grall
2015-02-02 15:18   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 04/15] xen/arm: vgic-v3: Correctly handle RAZ/WI registers Julien Grall
2015-02-02 15:24   ` Ian Campbell
2015-02-02 15:59     ` Julien Grall
2015-02-02 16:08       ` Ian Campbell
2015-02-02 16:11         ` Julien Grall
2015-02-03 13:37           ` Julien Grall
2015-02-02 15:27   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 05/15] xen/arm: vgic-v3: Correctly implement read into GICR_NSACR Julien Grall
2015-02-02 15:35   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 06/15] xen/arm: vgic-v3: Set stride during domain initialization Julien Grall
2015-02-02 15:40   ` Ian Campbell [this message]
2015-02-02 16:14     ` Julien Grall
2015-01-29 18:25 ` [PATCH v2 07/15] xen/arm: vgic-v3: Use a struct to describe contiguous rdist regions Julien Grall
2015-02-02 15:47   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 08/15] xen/arm: vgic-v3: Emulate correctly the re-distributor Julien Grall
2015-02-02 15:59   ` Ian Campbell
2015-02-02 16:33     ` Julien Grall
2015-02-02 16:47       ` Ian Campbell
2015-02-02 17:05         ` Julien Grall
2015-02-02 17:38           ` Ian Campbell
2015-02-03 13:13             ` Julien Grall
2015-02-03 13:37               ` Ian Campbell
2015-02-03  6:47   ` Vijay Kilari
2015-02-03 13:09     ` Julien Grall
2015-01-29 18:25 ` [PATCH v2 09/15] xen/arm: vgic-v3: Clarify which distributor is used in the common emulation Julien Grall
2015-02-02 16:00   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 10/15] xen/arm: vgic-v2: Correctly set GICD_TYPER.CPUNumber Julien Grall
2015-01-29 18:25 ` [PATCH v2 11/15] xen/arm: vgic-v2: Correctly handle RAZ/WI registers Julien Grall
2015-02-02 16:02   ` Ian Campbell
2015-02-02 16:36     ` Julien Grall
2015-02-02 16:50       ` Ian Campbell
2015-02-02 17:08         ` Julien Grall
2015-02-02 17:41           ` Ian Campbell
2015-02-03 13:14             ` Julien Grall
2015-02-03 13:29               ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 12/15] xen/arm: vgic-v2: Take the lock when writing into GICD_CTLR Julien Grall
2015-01-29 18:25 ` [PATCH v2 13/15] xen/arm: vgic-v2: GICD_I{S, C}PENDR* are only word-accessible Julien Grall
2015-02-02 16:03   ` Ian Campbell
2015-01-29 18:25 ` [PATCH v2 14/15] xen/arm: vgic: Drop iactive, ipend, pendsgi field Julien Grall
2015-02-02 16:05   ` Ian Campbell
2015-02-03 13:17     ` Julien Grall
2015-03-09 18:14     ` Stefano Stabellini
2015-01-29 18:25 ` [PATCH v2 15/15] xen/arm: gic-v3: Update some comments in the code Julien Grall
2015-02-02 16:05   ` Ian Campbell
2015-02-02 16:37     ` Julien Grall
2015-02-02 16:48       ` Ian Campbell

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=1422891654.5838.10.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.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 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.