xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: mjaggi@caviumnetworks.com, xen-devel@lists.xen.org,
	marc.zyngier@arm.com, sstabellini@kernel.org,
	andre.przywara@linaro.org
Cc: manish.jaggi@cavium.com
Subject: Re: [PATCH 10/10] Enable Trapping of Group1 registers which is controlled by command line
Date: Thu, 25 Jan 2018 17:00:00 +0000	[thread overview]
Message-ID: <1bed1ea4-e187-2f7b-fbf8-da1c1af25baf@linaro.org> (raw)
In-Reply-To: <20180116154305.19186-11-mjaggi@caviumnetworks.com>

Hi Manish,

On 16/01/18 15:43, mjaggi@caviumnetworks.com wrote:
> From: Manish Jaggi <manish.jaggi@cavium.com>
> 
> In order to be able to trap Group-1 GICv3 system registers, we need to
> set ICH_HCR_EL2.TALL1 before entering the guest. This is controlled by
> the command line parameter group1_trap.

I was expecting a patch to enable group1_trap by default on affected 
platform.

> 
> Singed-off-by: Manish Jaggi <manish.jaggi@cavium.com>
> ---
>   xen/arch/arm/gic-v3.c     | 11 ++++++++++-
>   xen/include/asm-arm/gic.h |  1 +
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 5dba8bc932..f22877c468 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -833,9 +833,12 @@ static void gicv3_cpu_disable(void)
>       isb();
>   }
>   
> +static unsigned int group1_trap = 0;
> +integer_param("group1_trap", group1_trap);

New parameter should be describe in docs/misc/xen-command-line.markdown.

Also, you likely want to use a boolean_param here.

> +
>   static void gicv3_hyp_init(void)
>   {
> -    uint32_t vtr;
> +    uint32_t vtr, reg32;
>   
>       vtr = READ_SYSREG32(ICH_VTR_EL2);
>       gicv3_info.nr_lrs  = (vtr & GICH_VTR_NRLRGS) + 1;
> @@ -847,6 +850,12 @@ static void gicv3_hyp_init(void)
>   
>       WRITE_SYSREG32(GICH_VMCR_EOI | GICH_VMCR_VENG1, ICH_VMCR_EL2);
>       WRITE_SYSREG32(GICH_HCR_EN, ICH_HCR_EL2);
> +
> +    reg32 = READ_SYSREG32(ICH_HCR_EL2);

There are no point to read ICH_HCR_EL2. You know the value (see the line 
above).

So this code could simplified as:

reg32 = GICH_HCR_EN;
reg32 |= (group1_trap) ? GICH_HCR_TALL1 : 0;

WRITE_SYSREG32(reg32, ICH_HCR_EL2);

> +    if ( group1_trap )
> +        reg32 |= GICH_HCR_TALL1;
> +
> +    WRITE_SYSREG32(reg32, ICH_HCR_EL2);
>   }
>   
>   /* Set up the per-CPU parts of the GIC for a secondary CPU */
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index d3d7bda50d..e4c77fefd6 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -117,6 +117,7 @@
>   #define GICH_HCR_VGRP0DIE (1 << 5)
>   #define GICH_HCR_VGRP1EIE (1 << 6)
>   #define GICH_HCR_VGRP1DIE (1 << 7)
> +#define GICH_HCR_TALL1    (1 << 12)
>   
>   #define GICH_MISR_EOI     (1 << 0)
>   #define GICH_MISR_U       (1 << 1) >

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-01-25 17:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 15:42 [RFC PATCH 00/10] arm64: Mediate access to GICv3 sysregs at EL2 mjaggi
2018-01-16 15:42 ` [RFC PATCH 01/10] Add CONFIG_VGIC_ERRATA mjaggi
2018-01-25 13:48   ` Julien Grall
2018-02-21 15:17     ` Manish Jaggi
2018-02-21 15:56       ` Julien Grall
2018-01-16 15:42 ` [RFC PATCH 02/10] arm64: Add hook to handle guest GICv3 sysreg accesses mjaggi
2018-01-25 16:17   ` Julien Grall
2018-01-25 18:07   ` Julien Grall
2018-02-01  8:51     ` Manish Jaggi
2018-02-01 10:54       ` Julien Grall
2018-02-26  6:42         ` Manish Jaggi
2018-02-26  6:58           ` Manish Jaggi
2018-02-26 10:43           ` Julien Grall
2018-01-16 15:42 ` [PATCH 03/10] arm64: Add ICV_BPR1_EL1 handler mjaggi
2018-01-25 16:44   ` Julien Grall
2018-02-01  8:57     ` Manish Jaggi
2018-02-01 10:55       ` Julien Grall
2018-01-16 15:42 ` [PATCH 04/10] arm64: Add ICV_IGRPEN1_EL1 handler mjaggi
2018-01-16 15:43 ` [PATCH 05/10] arm64: Add accessors for the ICH_APxRn_EL2 registers mjaggi
2018-01-16 15:43 ` [PATCH 06/10] Expose gicv3_ich_read/write_lr mjaggi
2018-01-25 16:52   ` Julien Grall
2018-02-01  8:54     ` Manish Jaggi
2018-01-16 15:43 ` [PATCH 07/10] arm64: Add ICV_IAR1_EL1 handler mjaggi
2018-01-16 15:43 ` [PATCH 08/10] Add ICV_EOIR1_EL1 handler mjaggi
2018-01-16 15:43 ` [PATCH 09/10] arm64: Add a handler for ICV_HPPIR1_EL1 mjaggi
2018-01-16 15:43 ` [PATCH 10/10] Enable Trapping of Group1 registers which is controlled by command line mjaggi
2018-01-25 17:00   ` Julien Grall [this message]
2018-02-01  8:53     ` Manish Jaggi

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=1bed1ea4-e187-2f7b-fbf8-da1c1af25baf@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=andre.przywara@linaro.org \
    --cc=manish.jaggi@cavium.com \
    --cc=marc.zyngier@arm.com \
    --cc=mjaggi@caviumnetworks.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).