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


Groups > linux.kernel > #1206906

Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX erratum 23154

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX erratum 23154
Date 2015-08-13 17:20 +0200
Message-ID <pX2sq-74a-19@gated-at.bofh.it> (permalink)
References <pX1Zo-6gD-13@gated-at.bofh.it> <pX294-6rZ-13@gated-at.bofh.it>
Organization ARM Ltd

Show all headers | View raw


On 13/08/15 15:47, Robert Richter wrote:
> From: Robert Richter <rrichter@cavium.com>
> 
> This patch implements Cavium ThunderX erratum 23154.
> 
> The gicv3 of ThunderX requires a modified version for reading the IAR
> status to ensure data synchronization. Since this is in the fast-path
> and called with each interrupt, runtime patching is used using jump
> label patching for smallest overhead (no-op). This is the same
> technique as used for tracepoints.
> 
> v2:
>  * implement code in a single asm() to keep instruction sequence
>  * added comment to the code that explains the erratum
>  * apply workaround also if running as guest, thus check MIDR
> 
> Signed-off-by: Robert Richter <rrichter@cavium.com>
> ---
>  drivers/irqchip/irq-gic-v3.c | 45 +++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 1a91902be0b1..2f80a11621a0 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -107,7 +107,7 @@ static void gic_redist_wait_for_rwp(void)
>  }
>  
>  /* Low level accessors */
> -static u64 __maybe_unused gic_read_iar(void)
> +static u64 gic_read_iar_common(void)
>  {
>  	u64 irqstat;
>  
> @@ -115,6 +115,38 @@ static u64 __maybe_unused gic_read_iar(void)
>  	return irqstat;
>  }
>  
> +/*
> + * Cavium ThunderX erratum 23154
> + *
> + * The gicv3 of ThunderX requires a modified version for reading the
> + * IAR status to ensure data synchronization (access to icc_iar1_el1
> + * is not sync'ed before and after).
> + */
> +static u64 gic_read_iar_cavium_thunderx(void)
> +{
> +	u64 irqstat;
> +
> +	asm volatile(
> +		"nop;nop;nop;nop\n\t"
> +		"nop;nop;nop;nop\n\t"
> +		"mrs_s %0, " __stringify(ICC_IAR1_EL1) "\n\t"
> +		"nop;nop;nop;nop"
> +		: "=r" (irqstat));
> +	mb();
> +
> +	return irqstat;
> +}
> +
> +struct static_key is_cavium_thunderx = STATIC_KEY_INIT_FALSE;
> +
> +static u64 __maybe_unused gic_read_iar(void)
> +{
> +	if (static_key_false(&is_cavium_thunderx))
> +		return gic_read_iar_common();
> +	else
> +		return gic_read_iar_cavium_thunderx();
> +}
> +
>  static void __maybe_unused gic_write_pmr(u64 val)
>  {
>  	asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val));
> @@ -766,8 +798,19 @@ static const struct irq_domain_ops gic_irq_domain_ops = {
>  	.free = gic_irq_domain_free,
>  };
>  
> +static void gicv3_enable_cavium_thunderx(void *data)
> +{
> +	static_key_slow_inc(&is_cavium_thunderx);
> +}
> +
>  static const struct gic_capabilities gicv3_errata[] = {
>  	{
> +		.desc		= "GIC: Cavium erratum 23154",
> +		.iidr		= 0xa100034c,	/* ThunderX pass 1.x */
> +		.iidr_mask	= 0xffff0fff,
> +		.init		= gicv3_enable_cavium_thunderx,
> +	},

I'm even more puzzled. You're working around a CPU bug based on the ITS
ID registers? Or have you swapped the detection methods for the two errata?

	M.
-- 
Jazz is not dead. It just smells funny...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v2 0/5] irqchip, gicv3: Updates and Cavium ThunderX errata workarounds Robert Richter <rric@kernel.org> - 2015-08-13 16:50 +0200
  [PATCH v2 5/5] irqchip, gicv3-its: Workaround for Cavium ThunderX errata 22375, 24313 Robert Richter <rric@kernel.org> - 2015-08-13 16:50 +0200
  [PATCH v2 2/5] irqchip, gicv3: Add HW revision detection and configuration Robert Richter <rric@kernel.org> - 2015-08-13 16:50 +0200
    Re: [PATCH v2 2/5] irqchip, gicv3: Add HW revision detection and  configuration Marc Zyngier <marc.zyngier@arm.com> - 2015-08-13 17:10 +0200
  [PATCH v2 1/5] arm64: gicv3: its: Add range check for number of allocated pages Robert Richter <rric@kernel.org> - 2015-08-13 16:50 +0200
  [PATCH v2 4/5] irqchip, gicv3-its: Read typer register outside the loop Robert Richter <rric@kernel.org> - 2015-08-13 17:00 +0200
  [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX erratum 23154 Robert Richter <rric@kernel.org> - 2015-08-13 17:00 +0200
    Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Marc Zyngier <marc.zyngier@arm.com> - 2015-08-13 17:20 +0200
      Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Robert Richter <robert.richter@caviumnetworks.com> - 2015-08-13 18:20 +0200
        Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Marc Zyngier <marc.zyngier@arm.com> - 2015-08-13 19:00 +0200
          Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Robert Richter <robert.richter@caviumnetworks.com> - 2015-08-13 19:20 +0200
            Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Marc Zyngier <marc.zyngier@arm.com> - 2015-08-14 10:30 +0200
              Re: [PATCH v2 3/5] irqchip, gicv3: Workaround for Cavium ThunderX  erratum 23154 Robert Richter <robert.richter@caviumnetworks.com> - 2015-08-14 14:10 +0200

csiph-web