irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
Subsystems (4)
PATCH v5 1/1 irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
The T241 platform suffers from the T241-FABRIC-4 erratum which causes unexpected behavior in the GIC when multiple transactions are received simultaneously from different sources. This hardware issue impacts NVIDIA server platforms that use more than two T241 chips interconnected. Each chip has support for 320 {E}SPIs.
This issue occurs when multiple packets from different GICs are incorrectly interleaved at the target chip. The erratum text below specifies exactly what can cause multiple transfer packets susceptible to interleaving and GIC state corruption. GIC state corruption can lead to a range of problems, including kernel panics, and unexpected behavior.
From the erratum text:
"In some cases, inter-socket AXI4 Stream packets with multiple transfers, may be interleaved by the fabric when presented to ARM Generic Interrupt Controller. GIC expects all transfers of a packet to be delivered without any interleaving.
The following GICv3 commands may result in multiple transfer packets over inter-socket AXI4 Stream interface:
- Register reads from GICD_I* and GICD_N*
- Register writes to 64-bit GICD registers other than GICD_IROUTERn*
- ITS command MOVALL
Multiple commands in GICv4+ utilize multiple transfer packets, including VMOVP, VMOVI, VMAPP, and 64-bit register accesses."
This issue impacts system configurations with more than 2 sockets, that require multi-transfer packets to be sent over inter-socket AXI4 Stream interface between GIC instances on different sockets. GICv4 cannot be supported. GICv3 SW model can only be supported with the workaround. Single and Dual socket configurations are not impacted by this issue and support GICv3 and GICv4."
Writing to the chip alias region of the GICD_In{E} registers except GICD_ICENABLERn has an equivalent effect as writing to the global distributor. The SPI interrupt deactivate path is not impacted by the erratum.
To fix this problem, implement a workaround that ensures read accesses to the GICD_In{E} registers are directed to the chip that owns the SPI, and disable GICv4.x features. To simplify code changes, the gic_configure_irq() function uses the same alias region for both read and write operations to GICD_ICFGR.
---
Changes since v4:
- Resolve Marc's comments https://lore.kernel.org/all/[email protected]/
Changes since v3:
- Fix the build issue for the 32bit arch
Changes since v2:
- Add accessors for the SOC-ID version & revision
- Include "linux/bitfield.h" and "linux/bits.h" in irq-gic-v3.c
Changes since v1:
- Use SMCCC SOC-ID API for detecting the T241 chip
- Implement Marc's suggestions
- Edit commit text
Documentation/arm64/silicon-errata.rst | 2 + drivers/firmware/smccc/smccc.c | 26 ++++++ drivers/firmware/smccc/soc_id.c | 28 ++---- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-gic-v3.c | 115 ++++++++++++++++++++++--- include/linux/arm-smccc.h | 18 ++++ 6 files changed, 156 insertions(+), 34 deletions(-)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -170,6 +170,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | +----------------+-----------------+-----------------+-----------------------------+ +| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A | ++----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +----------------+-----------------+-----------------+-----------------------------+
drivers/firmware/smccc/smccc.c +26 -0
@@ -17,9 +17,13 @@ static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE;bool __ro_after_init smccc_trng_available = false;u64 __ro_after_init smccc_has_sve_hint = false; +s32 __ro_after_init smccc_soc_id_version =SMCCC_RET_NOT_SUPPORTED ; +s32 __ro_after_init smccc_soc_id_revision =SMCCC_RET_NOT_SUPPORTED ;void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit) { +struct arm_smccc_res res; + smccc_version = version; smccc_conduit = conduit;
@@ -27,6 +31,18 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)if (IS_ENABLED (CONFIG_ARM64_SVE ) && smccc_version >=ARM_SMCCC_VERSION_1_3 ) smccc_has_sve_hint = true; + +if ((smccc_version >=ARM_SMCCC_VERSION_1_2 ) && + (smccc_conduit !=SMCCC_CONDUIT_NONE )) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , +ARM_SMCCC_ARCH_SOC_ID , &res); +if ((s32 )res.a0 >=0 ) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); + smccc_soc_id_version = (s32 )res.a0; +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); + smccc_soc_id_revision = (s32 )res.a0; + } + } }enum arm_smccc_conduit arm_smccc_1_1_get_conduit (void )
@@ -44,6 +60,16 @@ u32 arm_smccc_get_version(void) }EXPORT_SYMBOL_GPL (arm_smccc_get_version); +s32 arm_smccc_get_soc_id_version (void ) +{ +return smccc_soc_id_version; +} + +s32 arm_smccc_get_soc_id_revision (void ) +{ +return smccc_soc_id_revision; +} +static int __init smccc_devices_init (void ) {struct platform_device *pdev;
drivers/firmware/smccc/soc_id.c +5 -23
@@ -42,41 +42,23 @@ static int __init smccc_soc_init(void)if (arm_smccc_get_version () <ARM_SMCCC_VERSION_1_2 )return 0 ; -if (arm_smccc_1_1_get_conduit () ==SMCCC_CONDUIT_NONE ) { -pr_err ("%s: invalid SMCCC conduit\n" , __func__); -return -EOPNOTSUPP ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , -ARM_SMCCC_ARCH_SOC_ID , &res); - -if ((int )res.a0 ==SMCCC_RET_NOT_SUPPORTED ) { + soc_id_version =arm_smccc_get_soc_id_version (); +if (soc_id_version ==SMCCC_RET_NOT_SUPPORTED ) {pr_info ("ARCH_SOC_ID not implemented, skipping ....\n" );return 0 ; } -if ((int )res.a0 <0 ) { -pr_info ("ARCH_FEATURES(ARCH_SOC_ID) returned error: %lx\n" , - res.a0); -return -EINVAL ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); -if ((int )res.a0 <0 ) { +if (soc_id_version <0 ) {pr_err ("ARCH_SOC_ID(0) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_version = res.a0; - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); -if ((int )res.a0 <0 ) { + soc_id_rev =arm_smccc_get_soc_id_revision (); +if (soc_id_rev <0 ) {pr_err ("ARCH_SOC_ID(1) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_rev = res.a0; - soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr)return -ENOMEM ;
drivers/irqchip/Kconfig +1 -0
@@ -35,6 +35,7 @@ config ARM_GIC_V3 select IRQ_DOMAIN_HIERARCHY select PARTITION_PERCPU select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP + select HAVE_ARM_SMCCC_DISCOVERY config ARM_GIC_V3_ITS bool
drivers/irqchip/irq-gic-v3.c +104 -11
205 lines not on this page · raw message
include/linux/arm-smccc.h +18 -0
@@ -226,6 +226,24 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit);extern u64 smccc_has_sve_hint; +/** +* arm_smccc_get_soc_id_version() +* +* Returns the SOC ID version. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_version (void ); + +/** +* arm_smccc_get_soc_id_revision() +* +* Returns the SOC ID revision. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_revision (void ); +/** * struct arm_smccc_res - Result from SMC/HVC call * @a0-a3 result values from registers 0 to 3
Signature · 1 line
2.25.1
PATCH v5 1/1 irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
The T241 platform suffers from the T241-FABRIC-4 erratum which causes unexpected behavior in the GIC when multiple transactions are received simultaneously from different sources. This hardware issue impacts NVIDIA server platforms that use more than two T241 chips interconnected. Each chip has support for 320 {E}SPIs.
This issue occurs when multiple packets from different GICs are incorrectly interleaved at the target chip. The erratum text below specifies exactly what can cause multiple transfer packets susceptible to interleaving and GIC state corruption. GIC state corruption can lead to a range of problems, including kernel panics, and unexpected behavior.
From the erratum text:
"In some cases, inter-socket AXI4 Stream packets with multiple transfers, may be interleaved by the fabric when presented to ARM Generic Interrupt Controller. GIC expects all transfers of a packet to be delivered without any interleaving.
The following GICv3 commands may result in multiple transfer packets over inter-socket AXI4 Stream interface:
- Register reads from GICD_I* and GICD_N*
- Register writes to 64-bit GICD registers other than GICD_IROUTERn*
- ITS command MOVALL
Multiple commands in GICv4+ utilize multiple transfer packets, including VMOVP, VMOVI, VMAPP, and 64-bit register accesses."
This issue impacts system configurations with more than 2 sockets, that require multi-transfer packets to be sent over inter-socket AXI4 Stream interface between GIC instances on different sockets. GICv4 cannot be supported. GICv3 SW model can only be supported with the workaround. Single and Dual socket configurations are not impacted by this issue and support GICv3 and GICv4."
Writing to the chip alias region of the GICD_In{E} registers except GICD_ICENABLERn has an equivalent effect as writing to the global distributor. The SPI interrupt deactivate path is not impacted by the erratum.
To fix this problem, implement a workaround that ensures read accesses to the GICD_In{E} registers are directed to the chip that owns the SPI, and disable GICv4.x features. To simplify code changes, the gic_configure_irq() function uses the same alias region for both read and write operations to GICD_ICFGR.
---
Changes since v4:
- Resolve Marc's comments https://lore.kernel.org/all/[email protected]/
Changes since v3:
- Fix the build issue for the 32bit arch
Changes since v2:
- Add accessors for the SOC-ID version & revision
- Include "linux/bitfield.h" and "linux/bits.h" in irq-gic-v3.c
Changes since v1:
- Use SMCCC SOC-ID API for detecting the T241 chip
- Implement Marc's suggestions
- Edit commit text
Documentation/arm64/silicon-errata.rst | 2 + drivers/firmware/smccc/smccc.c | 26 ++++++ drivers/firmware/smccc/soc_id.c | 28 ++---- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-gic-v3.c | 115 ++++++++++++++++++++++--- include/linux/arm-smccc.h | 18 ++++ 6 files changed, 156 insertions(+), 34 deletions(-)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -170,6 +170,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | +----------------+-----------------+-----------------+-----------------------------+ +| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A | ++----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +----------------+-----------------+-----------------+-----------------------------+
drivers/firmware/smccc/smccc.c +26 -0
@@ -17,9 +17,13 @@ static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE;bool __ro_after_init smccc_trng_available = false;u64 __ro_after_init smccc_has_sve_hint = false; +s32 __ro_after_init smccc_soc_id_version =SMCCC_RET_NOT_SUPPORTED ; +s32 __ro_after_init smccc_soc_id_revision =SMCCC_RET_NOT_SUPPORTED ;void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit) { +struct arm_smccc_res res; + smccc_version = version; smccc_conduit = conduit;
@@ -27,6 +31,18 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)if (IS_ENABLED (CONFIG_ARM64_SVE ) && smccc_version >=ARM_SMCCC_VERSION_1_3 ) smccc_has_sve_hint = true; + +if ((smccc_version >=ARM_SMCCC_VERSION_1_2 ) && + (smccc_conduit !=SMCCC_CONDUIT_NONE )) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , +ARM_SMCCC_ARCH_SOC_ID , &res); +if ((s32 )res.a0 >=0 ) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); + smccc_soc_id_version = (s32 )res.a0; +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); + smccc_soc_id_revision = (s32 )res.a0; + } + } }enum arm_smccc_conduit arm_smccc_1_1_get_conduit (void )
@@ -44,6 +60,16 @@ u32 arm_smccc_get_version(void) }EXPORT_SYMBOL_GPL (arm_smccc_get_version); +s32 arm_smccc_get_soc_id_version (void ) +{ +return smccc_soc_id_version; +} + +s32 arm_smccc_get_soc_id_revision (void ) +{ +return smccc_soc_id_revision; +} +static int __init smccc_devices_init (void ) {struct platform_device *pdev;
drivers/firmware/smccc/soc_id.c +5 -23
@@ -42,41 +42,23 @@ static int __init smccc_soc_init(void)if (arm_smccc_get_version () <ARM_SMCCC_VERSION_1_2 )return 0 ; -if (arm_smccc_1_1_get_conduit () ==SMCCC_CONDUIT_NONE ) { -pr_err ("%s: invalid SMCCC conduit\n" , __func__); -return -EOPNOTSUPP ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , -ARM_SMCCC_ARCH_SOC_ID , &res); - -if ((int )res.a0 ==SMCCC_RET_NOT_SUPPORTED ) { + soc_id_version =arm_smccc_get_soc_id_version (); +if (soc_id_version ==SMCCC_RET_NOT_SUPPORTED ) {pr_info ("ARCH_SOC_ID not implemented, skipping ....\n" );return 0 ; } -if ((int )res.a0 <0 ) { -pr_info ("ARCH_FEATURES(ARCH_SOC_ID) returned error: %lx\n" , - res.a0); -return -EINVAL ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); -if ((int )res.a0 <0 ) { +if (soc_id_version <0 ) {pr_err ("ARCH_SOC_ID(0) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_version = res.a0; - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); -if ((int )res.a0 <0 ) { + soc_id_rev =arm_smccc_get_soc_id_revision (); +if (soc_id_rev <0 ) {pr_err ("ARCH_SOC_ID(1) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_rev = res.a0; - soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr)return -ENOMEM ;
drivers/irqchip/Kconfig +1 -0
@@ -35,6 +35,7 @@ config ARM_GIC_V3 select IRQ_DOMAIN_HIERARCHY select PARTITION_PERCPU select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP + select HAVE_ARM_SMCCC_DISCOVERY config ARM_GIC_V3_ITS bool
drivers/irqchip/irq-gic-v3.c +104 -11
205 lines not on this page · raw message
include/linux/arm-smccc.h +18 -0
@@ -226,6 +226,24 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit);extern u64 smccc_has_sve_hint; +/** +* arm_smccc_get_soc_id_version() +* +* Returns the SOC ID version. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_version (void ); + +/** +* arm_smccc_get_soc_id_revision() +* +* Returns the SOC ID revision. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_revision (void ); +/** * struct arm_smccc_res - Result from SMC/HVC call * @a0-a3 result values from registers 0 to 3
Signature · 1 line
2.25.1
Quoted 51 lines · Shanker Donthineni
The T241 platform suffers from the T241-FABRIC-4 erratum which causes unexpected behavior in the GIC when multiple transactions are received simultaneously from different sources. This hardware issue impacts NVIDIA server platforms that use more than two T241 chips interconnected. Each chip has support for 320 {E}SPIs.
This issue occurs when multiple packets from different GICs are incorrectly interleaved at the target chip. The erratum text below specifies exactly what can cause multiple transfer packets susceptible to interleaving and GIC state corruption. GIC state corruption can lead to a range of problems, including kernel panics, and unexpected behavior.
From the erratum text:
"In some cases, inter-socket AXI4 Stream packets with multiple transfers, may be interleaved by the fabric when presented to ARM Generic Interrupt Controller. GIC expects all transfers of a packet to be delivered without any interleaving.The following GICv3 commands may result in multiple transfer packets over inter-socket AXI4 Stream interface:
- Register reads from GICD_I* and GICD_N*
- Register writes to 64-bit GICD registers other than GICD_IROUTERn*
- ITS command MOVALLMultiple commands in GICv4+ utilize multiple transfer packets, including VMOVP, VMOVI, VMAPP, and 64-bit register accesses."
This issue impacts system configurations with more than 2 sockets, that require multi-transfer packets to be sent over inter-socket AXI4 Stream interface between GIC instances on different sockets. GICv4 cannot be supported. GICv3 SW model can only be supported with the workaround. Single and Dual socket configurations are not impacted by this issue and support GICv3 and GICv4."
Writing to the chip alias region of the GICD_In{E} registers except
GICD_ICENABLERnhas an equivalent effect as writing to the global distributor. The SPI interrupt deactivate path is not impacted by the erratum.To fix this problem, implement a workaround that ensures read accesses to the GICD_In{E} registers are directed to the chip that owns the SPI, and disable GICv4.x features. To simplify code changes, the
gic_configure_irq()function uses the same alias region for both read and write operations toGICD_ICFGR.Co-developed-by Vikram Sethi <[email protected]>Signed-off-by Vikram Sethi <[email protected]>Signed-off-by Shanker Donthineni <[email protected]>
Quoted 7 lines
---
Changes since v4:
- Resolve Marc's comments https://lore.kernel.org/all/[email protected]/
Changes since v3:
- Fix the build issue for the 32bit arch
Changes since v2:
- Add accessors for the SOC-ID version & revision
SMCCC/SOC ID part looks good to me. In case you spin another version for any reason, I would prefer you split those changes into separate patch. Otherwise
Signature · 7 lines
Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
The following commit has been merged into the irq/irqchip-next branch of irqchip:
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: 35727af2b15d98a2dd2811d631d3a3886111312e Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/35727af2b15d98a2dd2811d631d3a3886111312e Author: Shanker Donthineni <[email protected]> AuthorDate: Sat, 18 Mar 2023 21:43:14 -05:00 Committer: Marc Zyngier <[email protected]> CommitterDate: Sat, 08 Apr 2023 10:51:23 +01:00
irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
The T241 platform suffers from the T241-FABRIC-4 erratum which causes unexpected behavior in the GIC when multiple transactions are received simultaneously from different sources. This hardware issue impacts NVIDIA server platforms that use more than two T241 chips interconnected. Each chip has support for 320 {E}SPIs.
This issue occurs when multiple packets from different GICs are incorrectly interleaved at the target chip. The erratum text below specifies exactly what can cause multiple transfer packets susceptible to interleaving and GIC state corruption. GIC state corruption can lead to a range of problems, including kernel panics, and unexpected behavior.
Quoted 1 line
From the erratum text:
"In some cases, inter-socket AXI4 Stream packets with multiple transfers, may be interleaved by the fabric when presented to ARM Generic Interrupt Controller. GIC expects all transfers of a packet to be delivered without any interleaving.
The following GICv3 commands may result in multiple transfer packets over inter-socket AXI4 Stream interface:
- Register reads from GICD_I* and GICD_N*
- Register writes to 64-bit GICD registers other than GICD_IROUTERn*
- ITS command MOVALL
Multiple commands in GICv4+ utilize multiple transfer packets, including VMOVP, VMOVI, VMAPP, and 64-bit register accesses."
This issue impacts system configurations with more than 2 sockets, that require multi-transfer packets to be sent over inter-socket AXI4 Stream interface between GIC instances on different sockets. GICv4 cannot be supported. GICv3 SW model can only be supported with the workaround. Single and Dual socket configurations are not impacted by this issue and support GICv3 and GICv4."
Writing to the chip alias region of the GICD_In{E} registers except GICD_ICENABLERn has an equivalent effect as writing to the global distributor. The SPI interrupt deactivate path is not impacted by the erratum.
To fix this problem, implement a workaround that ensures read accesses to the GICD_In{E} registers are directed to the chip that owns the SPI, and disable GICv4.x features. To simplify code changes, the gic_configure_irq() function uses the same alias region for both read and write operations to GICD_ICFGR.
--- Documentation/arm64/silicon-errata.rst | 2 +- drivers/firmware/smccc/smccc.c | 26 +++++- drivers/firmware/smccc/soc_id.c | 28 +----- drivers/irqchip/Kconfig | 1 +- drivers/irqchip/irq-gic-v3.c | 115 +++++++++++++++++++++--- include/linux/arm-smccc.h | 18 ++++- 6 files changed, 156 insertions(+), 34 deletions(-)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -172,6 +172,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | +----------------+-----------------+-----------------+-----------------------------+ +| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A | ++----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +----------------+-----------------+-----------------+-----------------------------+
drivers/firmware/smccc/smccc.c +26 -0
@@ -17,9 +17,13 @@ static enum arm_smccc_conduit smccc_conduit = SMCCC_CONDUIT_NONE;bool __ro_after_init smccc_trng_available = false;u64 __ro_after_init smccc_has_sve_hint = false; +s32 __ro_after_init smccc_soc_id_version =SMCCC_RET_NOT_SUPPORTED ; +s32 __ro_after_init smccc_soc_id_revision =SMCCC_RET_NOT_SUPPORTED ;void __init arm_smccc_version_init (u32 version,enum arm_smccc_conduit conduit) { +struct arm_smccc_res res; + smccc_version = version; smccc_conduit = conduit;
@@ -27,6 +31,18 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit)if (IS_ENABLED (CONFIG_ARM64_SVE ) && smccc_version >=ARM_SMCCC_VERSION_1_3 ) smccc_has_sve_hint = true; + +if ((smccc_version >=ARM_SMCCC_VERSION_1_2 ) && + (smccc_conduit !=SMCCC_CONDUIT_NONE )) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , +ARM_SMCCC_ARCH_SOC_ID , &res); +if ((s32 )res.a0 >=0 ) { +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); + smccc_soc_id_version = (s32 )res.a0; +arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); + smccc_soc_id_revision = (s32 )res.a0; + } + } }enum arm_smccc_conduit arm_smccc_1_1_get_conduit (void )
@@ -44,6 +60,16 @@ u32 arm_smccc_get_version(void) }EXPORT_SYMBOL_GPL (arm_smccc_get_version); +s32 arm_smccc_get_soc_id_version (void ) +{ +return smccc_soc_id_version; +} + +s32 arm_smccc_get_soc_id_revision (void ) +{ +return smccc_soc_id_revision; +} +static int __init smccc_devices_init (void ) {struct platform_device *pdev;
drivers/firmware/smccc/soc_id.c +5 -23
@@ -42,41 +42,23 @@ static int __init smccc_soc_init(void)if (arm_smccc_get_version () <ARM_SMCCC_VERSION_1_2 )return 0 ; -if (arm_smccc_1_1_get_conduit () ==SMCCC_CONDUIT_NONE ) { -pr_err ("%s: invalid SMCCC conduit\n" , __func__); -return -EOPNOTSUPP ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_FEATURES_FUNC_ID , -ARM_SMCCC_ARCH_SOC_ID , &res); - -if ((int )res.a0 ==SMCCC_RET_NOT_SUPPORTED ) { + soc_id_version =arm_smccc_get_soc_id_version (); +if (soc_id_version ==SMCCC_RET_NOT_SUPPORTED ) {pr_info ("ARCH_SOC_ID not implemented, skipping ....\n" );return 0 ; } -if ((int )res.a0 <0 ) { -pr_info ("ARCH_FEATURES(ARCH_SOC_ID) returned error: %lx\n" , - res.a0); -return -EINVAL ; - } - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,0 , &res); -if ((int )res.a0 <0 ) { +if (soc_id_version <0 ) {pr_err ("ARCH_SOC_ID(0) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_version = res.a0; - -arm_smccc_1_1_invoke (ARM_SMCCC_ARCH_SOC_ID ,1 , &res); -if ((int )res.a0 <0 ) { + soc_id_rev =arm_smccc_get_soc_id_revision (); +if (soc_id_rev <0 ) {pr_err ("ARCH_SOC_ID(1) returned error: %lx\n" , res.a0);return -EINVAL ; } - soc_id_rev = res.a0; - soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr)return -ENOMEM ;
drivers/irqchip/Kconfig +1 -0
@@ -36,6 +36,7 @@ config ARM_GIC_V3 select IRQ_DOMAIN_HIERARCHY select PARTITION_PERCPU select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP + select HAVE_ARM_SMCCC_DISCOVERY config ARM_GIC_V3_ITS bool
drivers/irqchip/irq-gic-v3.c +104 -11
205 lines not on this page · raw message
include/linux/arm-smccc.h +18 -0
@@ -227,6 +227,24 @@ void __init arm_smccc_version_init(u32 version, enum arm_smccc_conduit conduit);extern u64 smccc_has_sve_hint;/** +* arm_smccc_get_soc_id_version() +* +* Returns the SOC ID version. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_version (void ); + +/** +* arm_smccc_get_soc_id_revision() +* +* Returns the SOC ID revision. +* +* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED. +*/ +s32 arm_smccc_get_soc_id_revision (void ); + +/** * struct arm_smccc_res - Result from SMC/HVC call * @a0-a3 result values from registers 0 to 3 */