GIC v3 Interrupt Affinity Routing and SMC Secure Monitor Call Interoperability on aarch64
0 reputation · 21 Sept 2020, 05:14 UTC
0 reputation · 21 Sept 2020, 05:14 UTC
Determine how to ensure consistent interrupt handling between GIC v3 affinity routing and SMC secure call interfaces across different aarch64 platforms.
GIC affinity is platform‑specific and depends on kernel device‑tree settings, while SMC/HVC behavior varies with firmware implementations such as UEFI, OP‑TEE, or coreboot and with kernel version.
How can the kernel enforce a unified interrupt routing policy that aligns with SMC call expectations across heterogeneous firmware? What device‑tree or kernel configuration knobs are required to guarantee that GIC v3 affinity masks match the CPU interface used by SMC? Is there a documented method to synchronize periodic timer state with SMC secure world entry/exit on aarch64?
There is no single kernel knob or device-tree property that forces GIC v3 affinity masks to match the CPU interface used by SMC secure calls across heterogeneous firmware. The normal-world kernel cannot synchronize periodic timer state with secure-world entry/exit from device tree alone; this requires platform-specific firmware cooperation (OP-TEE, Trusted Firmware-A, UEFI). You must validate the alignment per platform by correlating GIC redistributor affinity, PSCI conduit, and secure-monitor timer ownership.
/proc/irq/N/smp_affinity masks derived from CPU device-tree reg properties.psci node: method = "smc" or "hvc" with enable-method = "psci". The kernel probes this at boot and does not provide a runtime knob to rebind it.CNTKCTL_EL1) and secure timer configuration are owned by the secure monitor/firmware. No standard device-tree property defines this behavior.Heterogeneous firmware (UEFI, OP-TEE, coreboot, TF-A) implements SMC calling conventions, CPU affinity for secure entry, and timer virtualization differently. A "unified routing policy" can only be achieved by:
psci node matches the firmware's actual conduit.reg in gic-v3 node) cover the same MPIDR values the secure monitor uses for SMC entry.Enable these options (typically default on aarch64 distro kernels):
CONFIG_GIC_V3CONFIG_GIC_V3_ITS (if ITS present)CONFIG_IRQ_DOMAIN_AFFINITYCONFIG_PSCICONFIG_ARM64_PSCI_CPUIDLE (for cpuidle integration)These expose the affinity infrastructure but do not automate cross-world alignment.
irqchip: gic-v3 and PSCI probe messages confirming conduit./proc/irq/N/smp_affinity for target interrupts; ensure masks reference online CPUs present in GIC redistributor affinity./proc/cpuinfo against GIC redistributor affinity fields in the device tree.psci node in /proc/device-tree/firmware/psci (or /sys/firmware/devicetree/base/psci) for method and enable-method.Which secure monitor/firmware stack (OP-TEE version, TF-A version, UEFI vendor) and platform (SoC/board) are you targeting? Timer synchronization behavior and SMC entry CPU affinity are defined in that firmware's documentation and porting guide, not in the Linux kernel.
Use comments to ask for clarification. Post a solution as an answer.
6,650 reputation · 21 Sept 2020, 16:32 UTC
GICv3 affinity routing targets the redistributor attached to each PE, not the CPU interface used by the secure monitor directly. Before changing /proc/irq/N/smp_affinity at runtime, compare the destination CPU's MPIDR affinity fields with the GIC redistributor node in the device tree or ACPI. Linux builds smp_affinity_list from those same MPIDR fields, but moving an interrupt to a PE whose SMC handler expects different GICR_CTLR or timer ownership can delay or lose secure interrupts. On mainline kernels with CONFIG_GIC_V3, confirm redistributor registration in dmesg and verify each CPU node's reg matches /proc/irq/*/smp_affinity_list. Timer preservation across world switches remains firmware-specific.