All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
@ 2017-03-05 15:23 ` Shanker Donthineni
  0 siblings, 0 replies; 7+ messages in thread
From: Shanker Donthineni @ 2017-03-05 15:23 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Catalin Marinas, Will Deacon, Jonathan Corbet, Thomas Gleixner,
	Jason Cooper, linux-arm-kernel, linux-doc, linux-kernel,
	Vikram Sethi, Shanker Donthineni

On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
implementation uses 16Bytes for Interrupt Translation Entry (ITTE),
but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.

It might cause kernel memory corruption depending on the number
of MSI(x) that are configured and the amount of memory that has
been allocated for ITTEs in its_create_device().

This patch fixes the potential memory corruption by setting the
correct ITTE size to 16Bytes.

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 Documentation/arm64/silicon-errata.txt |  1 +
 arch/arm64/Kconfig                     | 10 ++++++++++
 drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index a71b809..2f66683 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -68,3 +68,4 @@ stable kernels.
 |                |                 |                 |                             |
 | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
 | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
+| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 896eba6..6bd51fb 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
 
 	  If unsure, say Y.
 
+config QCOM_QDF2400_ERRATUM_0065
+	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
+	default y
+	help
+	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
+	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
+	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
+
+	  If unsure, say Y.
+
 endmenu
 
 
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 2320100..86bd428 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
 	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
 }
 
+static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
+{
+	struct its_node *its = data;
+
+	/* On QDF2400, the size of the ITTE is 16Bytes */
+	its->ite_size = 16;
+}
+
 static const struct gic_quirk its_quirks[] = {
 #ifdef CONFIG_CAVIUM_ERRATUM_22375
 	{
@@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
 		.init	= its_enable_quirk_cavium_23144,
 	},
 #endif
+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
+	{
+		.desc	= "ITS: QDF2400 erratum 0065",
+		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
+		.mask	= 0xffffffff,
+		.init	= its_enable_quirk_qdf2400_e0065,
+	},
+#endif
 	{
 	}
 };
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
@ 2017-03-05 15:23 ` Shanker Donthineni
  0 siblings, 0 replies; 7+ messages in thread
From: Shanker Donthineni @ 2017-03-05 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
implementation uses 16Bytes for Interrupt Translation Entry (ITTE),
but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.

It might cause kernel memory corruption depending on the number
of MSI(x) that are configured and the amount of memory that has
been allocated for ITTEs in its_create_device().

This patch fixes the potential memory corruption by setting the
correct ITTE size to 16Bytes.

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 Documentation/arm64/silicon-errata.txt |  1 +
 arch/arm64/Kconfig                     | 10 ++++++++++
 drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index a71b809..2f66683 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -68,3 +68,4 @@ stable kernels.
 |                |                 |                 |                             |
 | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
 | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
+| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 896eba6..6bd51fb 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
 
 	  If unsure, say Y.
 
+config QCOM_QDF2400_ERRATUM_0065
+	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
+	default y
+	help
+	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
+	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
+	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
+
+	  If unsure, say Y.
+
 endmenu
 
 
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 2320100..86bd428 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
 	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
 }
 
+static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
+{
+	struct its_node *its = data;
+
+	/* On QDF2400, the size of the ITTE is 16Bytes */
+	its->ite_size = 16;
+}
+
 static const struct gic_quirk its_quirks[] = {
 #ifdef CONFIG_CAVIUM_ERRATUM_22375
 	{
@@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
 		.init	= its_enable_quirk_cavium_23144,
 	},
 #endif
+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
+	{
+		.desc	= "ITS: QDF2400 erratum 0065",
+		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
+		.mask	= 0xffffffff,
+		.init	= its_enable_quirk_qdf2400_e0065,
+	},
+#endif
 	{
 	}
 };
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
  2017-03-05 15:23 ` Shanker Donthineni
@ 2017-03-07  8:03   ` Marc Zyngier
  -1 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2017-03-07  8:03 UTC (permalink / raw)
  To: Shanker Donthineni
  Cc: Catalin Marinas, Will Deacon, Jonathan Corbet, Thomas Gleixner,
	Jason Cooper, linux-arm-kernel, linux-doc, linux-kernel,
	Vikram Sethi

On Sun, Mar 05 2017 at  3:23:56 pm GMT, Shanker Donthineni <shankerd@codeaurora.org> wrote:
> On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
> implementation uses 16Bytes for Interrupt Translation Entry (ITTE),

nit: Interrupt Translation Entry is abbreviated as ITE. I know the vITS
has the ITTE thing all over the place, which I plan to address. No need
to respin for that.

> but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.
>
> It might cause kernel memory corruption depending on the number
> of MSI(x) that are configured and the amount of memory that has
> been allocated for ITTEs in its_create_device().
>
> This patch fixes the potential memory corruption by setting the
> correct ITTE size to 16Bytes.
>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
>  Documentation/arm64/silicon-errata.txt |  1 +
>  arch/arm64/Kconfig                     | 10 ++++++++++
>  drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
>  3 files changed, 27 insertions(+)
>
> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
> index a71b809..2f66683 100644
> --- a/Documentation/arm64/silicon-errata.txt
> +++ b/Documentation/arm64/silicon-errata.txt
> @@ -68,3 +68,4 @@ stable kernels.
>  |                |                 |                 |                             |
>  | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
>  | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
> +| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 896eba6..6bd51fb 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
>  
>  	  If unsure, say Y.
>  
> +config QCOM_QDF2400_ERRATUM_0065
> +	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
> +	default y
> +	help
> +	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
> +	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
> +	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
> +
> +	  If unsure, say Y.
> +
>  endmenu
>  
>  
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 2320100..86bd428 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>  	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
>  }
>  
> +static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
> +{
> +	struct its_node *its = data;
> +
> +	/* On QDF2400, the size of the ITTE is 16Bytes */
> +	its->ite_size = 16;
> +}
> +
>  static const struct gic_quirk its_quirks[] = {
>  #ifdef CONFIG_CAVIUM_ERRATUM_22375
>  	{
> @@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>  		.init	= its_enable_quirk_cavium_23144,
>  	},
>  #endif
> +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
> +	{
> +		.desc	= "ITS: QDF2400 erratum 0065",
> +		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
> +		.mask	= 0xffffffff,
> +		.init	= its_enable_quirk_qdf2400_e0065,
> +	},
> +#endif
>  	{
>  	}
>  };

OK, that's pretty bad. Should this be CC stable?

Thanks,

	M.
-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
@ 2017-03-07  8:03   ` Marc Zyngier
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2017-03-07  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 05 2017 at  3:23:56 pm GMT, Shanker Donthineni <shankerd@codeaurora.org> wrote:
> On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
> implementation uses 16Bytes for Interrupt Translation Entry (ITTE),

nit: Interrupt Translation Entry is abbreviated as ITE. I know the vITS
has the ITTE thing all over the place, which I plan to address. No need
to respin for that.

> but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.
>
> It might cause kernel memory corruption depending on the number
> of MSI(x) that are configured and the amount of memory that has
> been allocated for ITTEs in its_create_device().
>
> This patch fixes the potential memory corruption by setting the
> correct ITTE size to 16Bytes.
>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
>  Documentation/arm64/silicon-errata.txt |  1 +
>  arch/arm64/Kconfig                     | 10 ++++++++++
>  drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
>  3 files changed, 27 insertions(+)
>
> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
> index a71b809..2f66683 100644
> --- a/Documentation/arm64/silicon-errata.txt
> +++ b/Documentation/arm64/silicon-errata.txt
> @@ -68,3 +68,4 @@ stable kernels.
>  |                |                 |                 |                             |
>  | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
>  | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
> +| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 896eba6..6bd51fb 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
>  
>  	  If unsure, say Y.
>  
> +config QCOM_QDF2400_ERRATUM_0065
> +	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
> +	default y
> +	help
> +	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
> +	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
> +	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
> +
> +	  If unsure, say Y.
> +
>  endmenu
>  
>  
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 2320100..86bd428 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>  	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
>  }
>  
> +static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
> +{
> +	struct its_node *its = data;
> +
> +	/* On QDF2400, the size of the ITTE is 16Bytes */
> +	its->ite_size = 16;
> +}
> +
>  static const struct gic_quirk its_quirks[] = {
>  #ifdef CONFIG_CAVIUM_ERRATUM_22375
>  	{
> @@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>  		.init	= its_enable_quirk_cavium_23144,
>  	},
>  #endif
> +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
> +	{
> +		.desc	= "ITS: QDF2400 erratum 0065",
> +		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
> +		.mask	= 0xffffffff,
> +		.init	= its_enable_quirk_qdf2400_e0065,
> +	},
> +#endif
>  	{
>  	}
>  };

OK, that's pretty bad. Should this be CC stable?

Thanks,

	M.
-- 
Jazz is not dead, it just smell funny.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
  2017-03-07  8:03   ` Marc Zyngier
@ 2017-03-07 14:22     ` Shanker Donthineni
  -1 siblings, 0 replies; 7+ messages in thread
From: Shanker Donthineni @ 2017-03-07 14:22 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Jason Cooper, Vikram Sethi, Jonathan Corbet, Catalin Marinas,
	linux-doc, Will Deacon, linux-kernel, Thomas Gleixner,
	linux-arm-kernel

Hi Marc,


On 03/07/2017 02:03 AM, Marc Zyngier wrote:
> On Sun, Mar 05 2017 at  3:23:56 pm GMT, Shanker Donthineni <shankerd@codeaurora.org> wrote:
>> On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
>> implementation uses 16Bytes for Interrupt Translation Entry (ITTE),
> nit: Interrupt Translation Entry is abbreviated as ITE. I know the vITS
> has the ITTE thing all over the place, which I plan to address. No need
> to respin for that.
>
Yeah, I saw your your patch in GICv4 branch which has change, I posted 
v2 with your suggestion.

>> but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.
>>
>> It might cause kernel memory corruption depending on the number
>> of MSI(x) that are configured and the amount of memory that has
>> been allocated for ITTEs in its_create_device().
>>
>> This patch fixes the potential memory corruption by setting the
>> correct ITTE size to 16Bytes.
>>
>> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
>> ---
>>   Documentation/arm64/silicon-errata.txt |  1 +
>>   arch/arm64/Kconfig                     | 10 ++++++++++
>>   drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
>>   3 files changed, 27 insertions(+)
>>
>> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
>> index a71b809..2f66683 100644
>> --- a/Documentation/arm64/silicon-errata.txt
>> +++ b/Documentation/arm64/silicon-errata.txt
>> @@ -68,3 +68,4 @@ stable kernels.
>>   |                |                 |                 |                             |
>>   | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
>>   | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
>> +| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 896eba6..6bd51fb 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
>>   
>>   	  If unsure, say Y.
>>   
>> +config QCOM_QDF2400_ERRATUM_0065
>> +	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
>> +	default y
>> +	help
>> +	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
>> +	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
>> +	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
>> +
>> +	  If unsure, say Y.
>> +
>>   endmenu
>>   
>>   
>> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
>> index 2320100..86bd428 100644
>> --- a/drivers/irqchip/irq-gic-v3-its.c
>> +++ b/drivers/irqchip/irq-gic-v3-its.c
>> @@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>>   	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
>>   }
>>   
>> +static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
>> +{
>> +	struct its_node *its = data;
>> +
>> +	/* On QDF2400, the size of the ITTE is 16Bytes */
>> +	its->ite_size = 16;
>> +}
>> +
>>   static const struct gic_quirk its_quirks[] = {
>>   #ifdef CONFIG_CAVIUM_ERRATUM_22375
>>   	{
>> @@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>>   		.init	= its_enable_quirk_cavium_23144,
>>   	},
>>   #endif
>> +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
>> +	{
>> +		.desc	= "ITS: QDF2400 erratum 0065",
>> +		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
>> +		.mask	= 0xffffffff,
>> +		.init	= its_enable_quirk_qdf2400_e0065,
>> +	},
>> +#endif
>>   	{
>>   	}
>>   };
> OK, that's pretty bad. Should this be CC stable?

Yes, please do CC stable if there is no merge conflicts.

> Thanks,
>
> 	M.

-- 
Shanker Donthineni
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
@ 2017-03-07 14:22     ` Shanker Donthineni
  0 siblings, 0 replies; 7+ messages in thread
From: Shanker Donthineni @ 2017-03-07 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,


On 03/07/2017 02:03 AM, Marc Zyngier wrote:
> On Sun, Mar 05 2017 at  3:23:56 pm GMT, Shanker Donthineni <shankerd@codeaurora.org> wrote:
>> On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
>> implementation uses 16Bytes for Interrupt Translation Entry (ITTE),
> nit: Interrupt Translation Entry is abbreviated as ITE. I know the vITS
> has the ITTE thing all over the place, which I plan to address. No need
> to respin for that.
>
Yeah, I saw your your patch in GICv4 branch which has change, I posted 
v2 with your suggestion.

>> but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.
>>
>> It might cause kernel memory corruption depending on the number
>> of MSI(x) that are configured and the amount of memory that has
>> been allocated for ITTEs in its_create_device().
>>
>> This patch fixes the potential memory corruption by setting the
>> correct ITTE size to 16Bytes.
>>
>> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
>> ---
>>   Documentation/arm64/silicon-errata.txt |  1 +
>>   arch/arm64/Kconfig                     | 10 ++++++++++
>>   drivers/irqchip/irq-gic-v3-its.c       | 16 ++++++++++++++++
>>   3 files changed, 27 insertions(+)
>>
>> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
>> index a71b809..2f66683 100644
>> --- a/Documentation/arm64/silicon-errata.txt
>> +++ b/Documentation/arm64/silicon-errata.txt
>> @@ -68,3 +68,4 @@ stable kernels.
>>   |                |                 |                 |                             |
>>   | Qualcomm Tech. | Falkor v1       | E1003           | QCOM_FALKOR_ERRATUM_1003    |
>>   | Qualcomm Tech. | Falkor v1       | E1009           | QCOM_FALKOR_ERRATUM_1009    |
>> +| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 896eba6..6bd51fb 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -509,6 +509,16 @@ config QCOM_FALKOR_ERRATUM_1009
>>   
>>   	  If unsure, say Y.
>>   
>> +config QCOM_QDF2400_ERRATUM_0065
>> +	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
>> +	default y
>> +	help
>> +	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
>> +	  ITTE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
>> +	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
>> +
>> +	  If unsure, say Y.
>> +
>>   endmenu
>>   
>>   
>> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
>> index 2320100..86bd428 100644
>> --- a/drivers/irqchip/irq-gic-v3-its.c
>> +++ b/drivers/irqchip/irq-gic-v3-its.c
>> @@ -1601,6 +1601,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>>   	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
>>   }
>>   
>> +static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
>> +{
>> +	struct its_node *its = data;
>> +
>> +	/* On QDF2400, the size of the ITTE is 16Bytes */
>> +	its->ite_size = 16;
>> +}
>> +
>>   static const struct gic_quirk its_quirks[] = {
>>   #ifdef CONFIG_CAVIUM_ERRATUM_22375
>>   	{
>> @@ -1618,6 +1626,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
>>   		.init	= its_enable_quirk_cavium_23144,
>>   	},
>>   #endif
>> +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
>> +	{
>> +		.desc	= "ITS: QDF2400 erratum 0065",
>> +		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
>> +		.mask	= 0xffffffff,
>> +		.init	= its_enable_quirk_qdf2400_e0065,
>> +	},
>> +#endif
>>   	{
>>   	}
>>   };
> OK, that's pretty bad. Should this be CC stable?

Yes, please do CC stable if there is no merge conflicts.

> Thanks,
>
> 	M.

-- 
Shanker Donthineni
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
@ 2017-03-20 16:09 Marc Zyngier
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2017-03-20 16:09 UTC (permalink / raw)
  To: stable; +Cc: Shanker Donthineni

From: Shanker Donthineni <shankerd@codeaurora.org>

commit 90922a2d03d84de36bf8a9979d62580102f31a92 upstream

On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
implementation uses 16Bytes for Interrupt Translation Entry (ITE),
but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.

It might cause kernel memory corruption depending on the number
of MSI(x) that are configured and the amount of memory that has
been allocated for ITEs in its_create_device().

This patch fixes the potential memory corruption by setting the
correct ITE size to 16Bytes.

Cc: stable@vger.kernel.org #4.9, 4.10
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 Documentation/arm64/silicon-errata.txt | 44 ++++++++++++++++++----------------
 arch/arm64/Kconfig                     | 10 ++++++++
 drivers/irqchip/irq-gic-v3-its.c       | 16 +++++++++++++
 3 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index 405da11fc3e4..d11af52427b4 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -42,24 +42,26 @@ file acts as a registry of software workarounds in the Linux Kernel and
 will be updated when new workarounds are committed and backported to
 stable kernels.
 
-| Implementor    | Component       | Erratum ID      | Kconfig                 |
-+----------------+-----------------+-----------------+-------------------------+
-| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319    |
-| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
-| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
-| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
-| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719    |
-| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
-| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
-| ARM            | Cortex-A57      | #852523         | N/A                     |
-| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
-| ARM            | Cortex-A72      | #853709         | N/A                     |
-| ARM            | MMU-500         | #841119,#826419 | N/A                     |
-|                |                 |                 |                         |
-| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
-| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144    |
-| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154    |
-| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456    |
-| Cavium         | ThunderX SMMUv2 | #27704          | N/A		       |
-|                |                 |                 |                         |
-| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585     |
+| Implementor    | Component       | Erratum ID      | Kconfig                     |
++----------------+-----------------+-----------------+-----------------------------+
+| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319        |
+| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319        |
+| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069        |
+| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472        |
+| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719        |
+| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419        |
+| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075        |
+| ARM            | Cortex-A57      | #852523         | N/A                         |
+| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220        |
+| ARM            | Cortex-A72      | #853709         | N/A                         |
+| ARM            | MMU-500         | #841119,#826419 | N/A                         |
+|                |                 |                 |                             |
+| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375        |
+| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144        |
+| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154        |
+| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456        |
+| Cavium         | ThunderX SMMUv2 | #27704          | N/A                         |
+|                |                 |                 |                             |
+| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585         |
+|                |                 |                 |                             |
+| Qualcomm Tech. | QDF2400 ITS     | E0065           | QCOM_QDF2400_ERRATUM_0065   |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 111742126897..51634f7f0aff 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -479,6 +479,16 @@ config CAVIUM_ERRATUM_27456
 
 	  If unsure, say Y.
 
+config QCOM_QDF2400_ERRATUM_0065
+	bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size"
+	default y
+	help
+	  On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports
+	  ITE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have
+	  been indicated as 16Bytes (0xf), not 8Bytes (0x7).
+
+	  If unsure, say Y.
+
 endmenu
 
 
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 69b040f47d56..519ff7a18b5b 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1597,6 +1597,14 @@ static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
 	its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
 }
 
+static void __maybe_unused its_enable_quirk_qdf2400_e0065(void *data)
+{
+	struct its_node *its = data;
+
+	/* On QDF2400, the size of the ITE is 16Bytes */
+	its->ite_size = 16;
+}
+
 static const struct gic_quirk its_quirks[] = {
 #ifdef CONFIG_CAVIUM_ERRATUM_22375
 	{
@@ -1614,6 +1622,14 @@ static const struct gic_quirk its_quirks[] = {
 		.init	= its_enable_quirk_cavium_23144,
 	},
 #endif
+#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065
+	{
+		.desc	= "ITS: QDF2400 erratum 0065",
+		.iidr	= 0x00001070, /* QDF2400 ITS rev 1.x */
+		.mask	= 0xffffffff,
+		.init	= its_enable_quirk_qdf2400_e0065,
+	},
+#endif
 	{
 	}
 };
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-20 16:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-05 15:23 [PATCH] irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065 Shanker Donthineni
2017-03-05 15:23 ` Shanker Donthineni
2017-03-07  8:03 ` Marc Zyngier
2017-03-07  8:03   ` Marc Zyngier
2017-03-07 14:22   ` Shanker Donthineni
2017-03-07 14:22     ` Shanker Donthineni
2017-03-20 16:09 Marc Zyngier

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.