中断分组与安全
GICv3 架构支持 ARM TrustZone 技术。 每个 INTID 必须分配一个组和安全设置,GICv4则在此基础上增加了更多虚拟化的特性。
和 X86不同的是,ARM推出了 el0~el3 4个异常等级,el2用于虚拟化,和 X86里面的 R0~R3相似,但是引入了引入物理安全态模型,意味着虚拟化也有在 el2下。
安全态的引入主要是由于消费类的 CPU(也称AP) 使用非常广泛,手机平板各种电子产品,各种指纹、人脸等识别方案,很多重要数据需要通过安全的的系统处理之后,然后转移到linux系统(安卓)。市面上, 基于 arm的消费类产品很多已经运行了双系统(安卓+TEE),这种安全系统的中断重点依赖ATF及各相关的寄存器。
In a system with two Security states, an interrupt is configured as one of the following:
A Group 0:ARM expects these interrupts to be handled at EL3.
A Secure Group 1:ARM expects these interrupts to be handled at Secure EL1.
A Non-secure Group 1:ARM expects these interrupts to be handled at Non-secure EL2 in systems using virtualization, or at Non-secure EL1 in systems not using virtualization.
从上面可以看出, Group0: 只处理 el3里面的中断,也就是在 ATF里面做的
secure group1: 处理 secure_el1和 secure_el0,也就是只针对安全的系统内核
nosecure group: 只处理非安全的系统中断,包括 qemu等 hypervisor种的 vgic
实际上 secure_el2也存在的, 重点双系统间中断切换,CPU所在的系统和中断来的不在同一个安全态时,需要借助 ATF种的 el3来进行中断切换。