gicv3_rdist_setup_lpis() calls k_aligned_alloc(), which the kernel only
defines when the system heap is non-empty, so every board that turns on
GIC_V3_ITS without asking for a heap fails to link. Declare the
requirement with HEAP_MEM_POOL_ADD_SIZE_GIC_V3_ITS, which the build sums
into the pool as a minimum, and fold in the equivalent value the FVP
board carried.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
The GICv1/v2 driver (intc_gic.c) has two bugs in AMP configurations
where each core runs an independent Zephyr instance:
1. CPU target mask derivation: gic_dist_init() derived the CPU target
mask from the DTS cpu_mpid_list array. In AMP mode each core's DTS
typically only defines cpu@0, so Core 1's physical CPU interface bit
was never set in GICD_ITARGETSRn. A new gic_get_cpu_mask() helper
reads the hardware-banked GICD_ITARGETSR[0], which returns the
running core's actual target bit regardless of what the DTS defines.
2. Destructive re-initialization: arm_gic_init() on the second core
unconditionally disabled the distributor (GICD_CTLR=0) and
overwrote all SPI enables, priorities, and target registers,
clobbering the first core's configuration. Add the
CONFIG_GIC_SAFE_CONFIG guard to gic_dist_init(): if the distributor
is already enabled (GICD_CTLR bit 0 set), return early. Per-SPI
affinity for the new core is handled by arm_gic_irq_enable(), which
ORs the local CPU mask into the existing SPI target register without
disturbing other cores.
Additionally:
- Extend CONFIG_GIC_SAFE_CONFIG from GICv3-only to all GIC versions
(change Kconfig dependency from GIC_V3 to GIC).
- When CONFIG_GIC_SAFE_CONFIG is enabled, clear all SPI targets during
distributor init and let arm_gic_irq_enable() add each core's mask on
demand.
Tested on AMD Versal VCK190 (Cortex-R5 dual-core split mode):
- SGI delivery to both cores: PASS
- SPI delivery via 1-of-N with GICD_ITARGETSRn=0x03: PASS
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
GIC redistributor on Some platform are connected to a non-coherent
downstream interconnect, it need to use Non-cahable and Non-shareable
access atttributes to access external memory. And also flush the
data cache after CPU update related memory.
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
In case of multiple OSes running on different CPU Cores which share the
same GIC controller, need to avoid the distributor re-configured to avoid
crash the OS has already been started.
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Selection of these GIC Kconfigs have been deprecated
for more than 2 releases, users should use the devicetree
method instead, update the Kconfigs.
The SOCs below have been updated to not select `GIC_V3`, since
their devicetree already have the required compatible:
- fvp_aemv8r
- rzt2m
- rk3658
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Currently, only the presence of a GIC is reflected in the device tree,
and its version must be set separately in each SoC's Kconfig.
This patch adds separate bindings for each GIC version whose presence
in the device tree automatically enables the corresponding Kconfig symbol.
Signed-off-by: Piotr Wojnarowski <pwojnarowski@antmicro.com>
The implementation of GIC v3 ITS uses k_aligned_malloc(), which will
only work if dynamic memory is available (system heap). Tell the user
that a dynamic memory pool is required.
The amount of memory will depend on registers probed during runtime.
Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
Some platforms only use aff0 to match mpdir and GICR.aff. Introduce
GIC_V3_RDIST_MATCHING_AFF0_ONLY to set the matching method only using
aff0. With this config enabled, the matching function will find the
target redistributor by comparing the aff0 only.
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This implements support for the optional Interrupt Translation Service
(ITS) module of the GICv3 Interrupt Controller.
The current implementation is designed for MSI/MSI-X interrupt delivery
in mind.
The gicv3 driver calls each ITS INVALL command when LPI interrupts are
enabled/disabled.
A simple atomic integer is used to allocate unique LPI INTIDs to ITS
users.
CPUs numbers are directly mapped as ICIDs into the Collections Table.
As a limitation it doesn't support indirect Device table to simplify
implementation but may use a large amount of memory.
INV, DISCARD, MOVI and MOVALL commands are not implemented.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
The current GIC configuration scheme is designed to support only one
specific type and version of GIC (i.e. GIC-400 that implements the
GICv2 interface).
This commit adds a set of GIC version configuration symbols that can
be selected by the SoC configuration to specify which version of GIC
interface is implemented in the SoC.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>