10-ARM gicv3/gicv4的总结-基础篇

news2024/9/28 14:54:07

目录

        • 1、gic的版本
        • 2、GICv3/gicv4的模型图
        • 3、gic中断号的划分
        • 4、GIC连接方式
        • 5、gic的状态
        • 6、gic框架
        • 7、gic Configuring
        • 推荐

本文转自 周贺贺,baron,代码改变世界ctw,Arm精选, armv8/armv9,trustzone/tee,secureboot,资深安全架构专家,11年手机安全/SOC底层安全开发经验。擅长trustzone/tee安全产品的设计和开发。

在这里插入图片描述

1、gic的版本

GIC是一个为Cortex-A和Arm Cortex-R设计的标准的中断控制器
在这里插入图片描述

2、GICv3/gicv4的模型图

在这里插入图片描述

3、gic中断号的划分
  • Shared Peripheral Interrupt (SPI)

  • Private Peripheral Interrupt (PPI)

  • Software Generated Interrupt (SGI)

  • Locality-specific Peripheral Interrupt (LPI)
    在这里插入图片描述
    (使用示例)
    在这里插入图片描述

4、GIC连接方式

在这里插入图片描述

5、gic的状态

在这里插入图片描述
中断的生命周期:
对于电平触发的中断(level-sensitive interrupts),一个上升沿输入,将中断变成pending,中断信号线保持高电平直到PE断言该中断信号.
对于边沿触发的中断(edge-sensitive interrupts),一个上升沿输入,将中断变成pending,中断信号线不会保持高电平.
在这里插入图片描述

6、gic框架

• Distributor interface
• Redistributor interface
• CPU interface
在这里插入图片描述

Distributor (GICD_*) for SPIs
• Interrupt prioritization and distribution of SPIs
• Enable and disable SPIs
• Set the priority level of each SPI
• Route information for each SPI
• Set each SPI to be level-sensitive or edge-triggered
• Generate message-signaled SPIs
• Control the active and pending state of SPIs
• Determine the programmer’s model that is used in each Security state: affinity routing or legacy

Redistributors (GICR_*)
• Enable and disable SGIs and PPIs
• Set the priority level of SGIs and PPIs
• Set each PPI to be level-sensitive or edge-triggered
• Assign each SGI and PPI to an interrupt group
• Control the state of SGIs and PPIs
• Control the base address for the data structures in memory that support the associated interrupt properties and pending state for LPIs
• Provide power management support for the connected PE

CPU interfaces (ICC_*_ELn)
• Provide general control and configuration to enable interrupt handling
• Acknowledge an interrupt
• Perform a priority drop and deactivation of interrupts
• Set an interrupt priority mask for the PE
• Define the preemption policy for the PE
• Determine the highest priority pending interrupt for the PE

In Arm CoreLink GICv3, the CPU Interface registers are accessed as System registers: ICC_*_ELn.

7、gic Configuring

全局配置
GICD_CTLR.ARE: Enable Affinity routing (ARE bits), 1-使用gicv3 mode,0-使用legacy mode(gicv2 mode). 默认为1
GICD_CTLR.EnableGrp1S
GICD_CTLR.EnableGrp1NS
GICD_CTLR.EnableGrp0

注意在GIC-600 does not support legacy operation

(Redistributor)Settings for each PE
Redistributor中包含了一个GICR_WAKER寄存器,用于记录connected PE的状态是onLine还是offline. 如果让PE变成online,软件则必需这样做:
• Clear GICR_WAKER.ProcessorSleep to 0.
• Poll GICR_WAKER.ChildrenAsleep until it reads 0

如果PE is offline (GICR_WAKER.ProcessorSleep==1)时,来了一个中断target到该PE上,将产一个wake request信号,这个信号连接PE的power controller,该controller将会打开PE。然后PE clear the ProcessorSleep bit
在这里插入图片描述

CPU interfaces (ICC_*_ELn)

SRE bit— enable cpu interface
注:有些处理器可能不支持legacy operation,SRE比特位也是固定为1,那么软件就不需要处理该比特了

Set Priority Mask and Binary Point registers
ICC_PMR_EL1、ICC_BPRn_EL1

Set EOI mode (EOI:End of interrupt)
ICC_CTLR_EL1 and ICC_CTLR_EL3

Enable signaling of each interrupt group
ICC_IGRPEN1_EL1 (banked by Security state)
ICC_IGRPEN0_EL1

PE configuration

  • Routing controls - SCR_EL3 、 HCR_EL2
  • Interrupt masks - PSTATE
  • Vector table - VBAR_ELn
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

interrupt sources configuration

  • SPIs are configured through the Distributor, using the GICD_* registers.
  • PPIs and SGIs are configured through the individual Redistributors, using the GICR_* registers

对于每一个中断,软件必需配置的:

  • Priority: GICD_IPRIORITYn, GICR_IPRIORITYn
  • Group: GICD_IGROUPn, GICD_IGRPMODn, GICR_IGROUPn, GICR_IGRPMODn
  • Edge-triggered or level-sensitive: GICD_ICFGRn, GICR_ICFGRn
  • Enable: GICD_ISENABLERn, GICD_ICENABLER, GICR_ISENABLERn, GICR_ICENABLERn

在这里插入图片描述
Setting the target PE for SPIs

  • GICD_IROUTERn.Interrupt_Routing_Mode == 0 rounting到制定的PE
  • GICD_IROUTERn.Interrupt_Routing_Mode == 1 Distributor硬件会自动选择一个PE,可以是0-n
    A PE can opt out of receiving 1-of-N interrupts. This is controlled by the DPG1S, DPG1NS and DPG0 bits in GICR_CTLR.

在这里插入图片描述
在这里插入图片描述

Routing a pending interrupt to a PE

  • Check that the group associated with the interrupt is enabled
  • Check that the interrupt is enabled
  • Check the routing controls to decide which PEs can receive the interrupt.
    routing is controlled by GICD_IROUTERn,An SPI can target one specific PE, or any one of the connected PEs
  • Check the interrupt priority and priority mask to decide which PEs are suitable to handle the interrupt
    Each PE has a Priority Mask register, ICC_PMR_EL1, in its CPU interface
  • Check the running priority to decide which PEs are available to handle the interrup
    Only an interrupt with a higher priority than the running priority can preempt the current interrupt

软件读取中断号
在这里插入图片描述
中断优先级
在这里插入图片描述

中断结束End of interrupt

  • Priority drop - 将中断优先级降到中断产生之前的值
  • Deactivation - 将中断从active变成inactive

在gicv3中,drop和deactivation通常是一起打开的。

ICC_CTLR_ELn.EOImode = 1: 通过写ICC_EOIR0_EL1、ICC_EOIR1_EL1让drop and deactivation同时生效
ICC_CTLR_ELn.EOImode = 0: 通过写ICC_EOIR0_EL1、ICC_EOIR1_EL1让drop生效,写ICC_DIR_EL1让deactivation生效,这在虚拟化中会用到.

大多数的软件系统中 EOIMode0,而下hypervisor的系统中 EOIMode1

中断号的状态
在这里插入图片描述
产生SGI中断
在这里插入图片描述
PE在secure执行时,可以产生secure和non-secure的SGI;
PE在non-secure执行时,也是可以产生secure的SGI,但是取决于GICR_NSACR寄存器的配置,该寄存器只能在secure中读写
在这里插入图片描述

比较GICv3和GICv2
在gicv2中,SGI INTIDs对于originating PE和the target PE是banked
在gicv3中,SGI仅仅对target PE是banked

在gicv2中同时收到两个SGI=5中断,两个中断都会被PE处理。
而在gicv3上,由于originating不是banked,所有前一个SGI=5中断将会丢失。PE只能收到一个

Legacy operation

  • When ARE==0, affinity routing is disabled (legacy operation)
  • When ARE==1, affinity routing is enabled (GICv3 operation)

在这里插入图片描述

推荐
  • ARMv8/ARMv9架构从入门到精通 --博客专栏
  • 《Armv8/Armv9架构从入门到精通 第二期》 --大课程
  • 8天入门ARM架构 --入门课程

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1506482.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LeetCode刷题日志-17.电话号码的字母组合

纯暴力解法&#xff0c;digits有多长&#xff0c;就循环多少次进行字母组合 class Solution {public List<String> letterCombinations(String digits) {List<String> reslut new ArrayList<>();if(digits.equals(""))return reslut;Map<Inte…

C语言程序与设计——函数(二)递归练习

在上一篇文章中接触到了递归这种编程方法&#xff0c;下面我们将用几个程序加深以下对递归的理解。 递归实际上就是程序调用自身的编程技巧 递归程序的组成&#xff1a; 边界条件处理针对于问题的处理过程和递归过程结果返回 二分查找 首先分析二分查找的查找逻辑&#xff1a; …

操作系统笔记(进程)

注&#xff1a; 下面图片资源来源于 王道计算机考研 操作系统 1.进程概念 进程&#xff08;process&#xff09;&#xff1a;是动态的&#xff0c;是程序的一次执行过程&#xff08;同一程序多次执行&#xff0c;会产生多个进程&#xff09;程序&#xff1a;是静态的&…

Linux:锁和线程同步的相关概念以及生产者消费者模型

文章目录 加锁的基本原则死锁死锁的概念死锁的条件 线程同步生产者消费者模型模型的理解 理解cp问题条件变量 本篇总结的是关于Linux中锁的相关概念以及生产者消费者模型 加锁的基本原则 加锁的基本原则&#xff1a;谁加锁谁解锁&#xff0c;不要把加锁和解锁这样的操作放在两…

Java线程池ThreadPoolExecutor源码阅读

文章目录 概述线程池提交任务流程线程池提交任务源码阅读 源码阅读属性字段工作线程worker 线程池方法runWorker(Worker w) 运行工作线程getTask() 获取任务tryTerminate() 尝试终止线程池interruptWorkers、interruptIdleWorkers 中断工作线程reject(Runnable command) 拒绝任…

数组名的理解,看这一篇就够了!!!

&#xff01;&#xff01;&#xff01;以下是会涉及到的知识的讲解&#xff1a; 一&#xff1a;数组名的理解&#xff1a; 数组名是数组首元素的地址&#xff0c;但是有2个例外&#xff1a; 1. sizeof(数组名)&#xff0c;这里的数组名表示整个数组&#xff0c;计算的是整个…

LeetCode59:螺旋矩阵Ⅱ

题目描述 给你一个正整数 n &#xff0c;生成一个包含 1 到 n2 所有元素&#xff0c;且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 示例 1&#xff1a; 输入&#xff1a;n 3 输出&#xff1a;[[1,2,3],[8,9,4],[7,6,5]] 代码 class Solution { public:vector…

查看pip当前关联python版本及位置

好久没用python了&#xff0c;把各种pip指向的环境忘光光啦&#xff0c;这里记录一下查看pip当前关联的python版本及位置的方法&#xff1a; pip -V结果&#xff1a; 我一般不用这个版本的python&#xff0c;去环境变量看了一下&#xff0c;原来是anaconda的Scripts自带pip&a…

Vue class和style绑定:动态美化你的组件

&#x1f90d; 前端开发工程师、技术日更博主、已过CET6 &#x1f368; 阿珊和她的猫_CSDN博客专家、23年度博客之星前端领域TOP1 &#x1f560; 牛客高级专题作者、打造专栏《前端面试必备》 、《2024面试高频手撕题》 &#x1f35a; 蓝桥云课签约作者、上架课程《Vue.js 和 E…

EB tersos 24.0.1 添加MCU模块失败

1、问题&#xff1a; 新建工程&#xff0c;添加MCU模块总是失败&#xff0c;错误信息如下&#xff1a; 2、解决方案 创建工程时只保留Resource模块&#xff0c;直接点击Finish&#xff0c;其他模块之后再添加 在工程创建成功后再单独添加需要的模块

StableDiffusion3 官方blog论文研究

博客源地址&#xff1a;Stable Diffusion 3: Research Paper — Stability AI 论文源地址&#xff1a;https://arxiv.org/pdf/2403.03206.pdf Stability.AI 官方发布了Stable diffusion 3.0的论文研究&#xff0c;不过目前大家都沉浸在SORA带来的震撼中&#xff0c;所以这个水…

力扣530. 二叉搜索树的最小绝对差

思路1&#xff1a;中序遍历&#xff0c;递归排序成有序数组&#xff1b;因为是有序&#xff0c;只需要求相邻两个值的最小差值。 class Solution {ArrayList <Integer> list new ArrayList();int ans 100001;//题目最大 100000public int getMinimumDifference(TreeNo…

docker学习笔记——Dockerfile

Dockerfile是一个镜像描述文件&#xff0c;通过Dockerfile文件可以构建一个属于自己的镜像。 如何通过Dockerfile构建自己的镜像&#xff1a; 在指定位置创建一个Dockerfile文件&#xff0c;在文件中编写Dockerfile相关语法。 构建镜像&#xff0c;docker build -t aa:1.0 .(指…

异步编程实战:使用C#实现FTP文件下载及超时控制

博客标题: 异步编程实战&#xff1a;使用C#实现FTP文件下载及超时控制 如果你的函数不是async&#xff0c;你仍然可以实现相同的超时功能&#xff0c;但你将不得不依赖更多的同步代码或使用.Result或.GetAwaiter().GetResult()来阻塞等待任务完成&#xff0c;这可能导致死锁的风…

Breach-2.1

靶场环境说明 该靶场是静态IP地址&#xff0c;需要更改网络配置&#xff0c;攻击机kali做了两张网卡&#xff1b; 信息收集 # nmap -sT --min-rate 10000 -p- 192.168.110.151 -oN port.nmap Starting Nmap 7.94 ( https://nmap.org ) at 2024-02-09 10:47 CST Stats: 0:00:…

java通过poi-tl生成word

我看公司之前做电子合同&#xff0c;使用TIBCO jaspersoft做的报表模板&#xff0c;如果是给自己公司开发或者给客户做项目&#xff0c;这个也没有什么&#xff0c;因为反正模板是固定的&#xff0c;一次性开发&#xff0c;不用担心后续的问题。即使后期有调整&#xff0c;改一…

深入解读 Elasticsearch 磁盘水位设置

本文将带你通过查看 Elasticsearch 源码来了解磁盘使用阈值在达到每个阶段的处理情况。 跳转文章末尾获取答案 环境 本文使用 Macos 系统测试&#xff0c;512M 的磁盘&#xff0c;目前剩余空间还有 60G 左右&#xff0c;所以按照 Elasticsearch 的设定&#xff0c;ES 中分片应…

总结:Spring创建Bean循环依赖问题与@Lazy注解使用详解

总结&#xff1a;Spring创建Bean循环依赖问题与Lazy注解使用详解 一前提知识储备&#xff1a;1.Spring Bean生命周期机制&#xff08;IOC&#xff09;2.Spring依赖注入机制&#xff08;DI&#xff09;&#xff08;1&#xff09;Autowired注解标注属性set方法注入&#xff08;2&…

面具安装LSP模块时提示 Unzip error错误的解决办法

面具(Magisk Delta)安装LSP模块时提示 Unzip error错误的解决办法 ​​ 如果前面的配置都正常的话&#xff0c;可能是LSP版本有问题重新去Github下载一个最新版的吧&#xff1b;我是这么解决的。 我安装1.91那个版本的LSP就是死活安装不上&#xff0c;下载了1.92的版本一次就…

Golang-channel合集——源码阅读、工作流程、实现原理、已关闭channel收发操作、优雅的关闭等面试常见问题。

前言 面试被问到好几次“channel是如何实现的”&#xff0c;我只会说“啊&#xff0c;就一块内存空间传递数据呗”…所以这篇文章来深入学习一下Channel相关。从源码开始学习其组成、工作流程及一些常见考点。 NO&#xff01;共享内存 Golang的并发哲学是“要通过共享内存的…