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

目录

        • 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.mfbz.cn/a/445829.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

LeetCode59:螺旋矩阵Ⅱ

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

AWS 入门实践-远程访问AWS EC2 Linux虚拟机

远程访问AWS EC2 Linux虚拟机是AWS云计算服务中的一个基本且重要的技能。本指南旨在为初学者提供一系列步骤,以便成功地设置并远程访问他们的EC2 Linux实例。包括如何上传下载文件、如何ssh远程登录EC2虚拟机。 一、创建一个AWS EC2 Linux 虚拟机 创建一个Amazon…

GSEA -- 学习记录

文章目录 brief统计学原理部分其他注意事项转录组部分单细胞部分 brief 上一篇学习记录写了ORA,其中ORA方法只关心差异表达基因而不关心其上调、下调的方向,也许同一条通路里既有显著高表达的基因,也有显著低表达的基因,因此最后…

iMazing3 2024详细解析数据备份与恢复备份

iMazing 3的备份功能支持增量备份(类似苹果电脑里的Time Machine功能),意思是第一次把移动设备的数据全部备份下来,之后的备份就只针对数据有变化的那部分,这样可以节省大量的时间和存储空间,不会让使用者为…

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…

ubuntu 23.04 安装 中文输入法

1、安装 fcitx sudo apt install fcitxfcitx 安装好后&#xff0c;可以使用 fcitx-configtool 命令进行配置&#xff0c;其界面如下所示。在这里可以配置不同输入法的切换快捷键&#xff0c;默认输入法等。刚安装系统后&#xff0c;这里只有一个输入法&#xff0c;所以接下来要…

Mysql深入学习 基础篇 Ss.02 详解四类SQL语句

我亲爱的对手&#xff0c;亦敌亦友&#xff0c;但我同样希望你能成功&#xff0c;与我一起&#xff0c;站在人生的山顶上 ——24.3.1 一、DDL 数据定义语言 1.DDL —— 数据库操作 查询 查询所有数据库 show databases; 查询当前数据库 select database(); 创建 create databa…

力扣难题:重排链表

首先通过快慢指针找到中间节点&#xff0c;然后将中间节点之后和之前的部分分为两个链表&#xff0c;然后翻转后面的链表&#xff0c;注意方法&#xff0c;然后将两个链表交替链接。 /*** Definition for singly-linked list.* struct ListNode {* int val;* ListNode…

Unity 使用HyBirdCLR调用Newtonsoft.json报错问题

查了老半天&#xff0c;原来是这里的问题 官方解释 解释&#xff1a; 在Unity的IL2CPP Code Generation中&#xff0c;"Faster runtime"和"Faster (smaller) builds"是两种不同的优化设置选项&#xff0c;它们分别影响着运行时性能和构建大小。下面是它们…

一元函数积分学——刷题(16

目录 1.题目&#xff1a;2.解题思路和步骤&#xff1a;3.总结&#xff1a;小结&#xff1a; 1.题目&#xff1a; 比较这两种题的求解方法 2.解题思路和步骤&#xff1a; 3.13&#xff1a; 这个题就很适合用万能公式&#xff0c;因为可以把1t2消掉&#xff1a; 也可以用三角…

多模太与交叉注意力应用

要解决的问题 对同一特征点1从不同角度去拍&#xff0c;在我们拿到这些不同视觉的特征后&#xff0c;就可以知道如何从第一个位置到第二个位置&#xff0c;再到第三个位置 对于传统算法 下面很多点检测都是错 loftr当今解决办法 整体流程 具体步骤 卷积提取特征&#xff0c;…

unity学习(53)——选择角色界面--分配服务器返回的信息

好久没写客户端了&#xff0c;一上手还不太适应 1.经过测试&#xff0c;成功登陆后&#xff0c;客户端请求list_request&#xff0c;成功返回&#xff0c;如下图&#xff1a; 可见此时model第三个位置的参数是1.也成功返回了所有已注册角色的信息。 2.之前已知创建的角色信息…

少儿编程机器人技术开发公司的创新之路

行业背景&#xff0c;国家政策利好 随着科技的不断发展&#xff0c;少儿编程机器人技术作为一种新兴的教育方式逐渐受到人们的关注。这项技术将编程与机器人技术相结合&#xff0c;通过互动性强、趣味性高的方式&#xff0c;帮助儿童学习编程知识&#xff0c;培养逻辑思维和创…

【从部署服务器到安装autodock vina】

注意&#xff1a;服务器 linux系统选用ubuntu 登录系统&#xff0c;如果没有图形化见面可以先安装图形化界面 可以参考该视频 --> linux安装图形化界面 非阿里云ubuntu 依次执行以下命令 sudo apt-get update sudo apt-get install gnome sudo reboot阿里云ubuntu 需多执…

python:布伊山德U检验(Buishand U test,BUT)突变点检测(以NDVI时间序列为例)

作者:CSDN @ _养乐多_ 本文将介绍布伊山德U检验(Buishand U test,BUT)突变点检测代码。以 NDVI 时间序列为例。输入数据可以是csv,一列NDVI值,一列时间。代码可以扩展到遥感时间序列突变检测(突变年份、突变幅度等)中。 结果如下图所示, 文章目录 一、准备数据二、…

【数据可视化】动手用matplotlib绘制关联规则网络图

下载文中数据、代码、绘图结果 文章目录 关于数据绘图函数完整可运行的代码运行结果 关于数据 如果想知道本文的关联规则数据是怎么来的&#xff0c;请阅读这篇文章 绘图函数 Python中似乎没有很方便的绘制网络图的函数。 下面是本人自行实现的绘图函数&#xff0c;如果想…

解决idea各种奇葩报错(前提代码正确)

1.当idea中报错&#xff0c;把idea系统关掉 2.删除.idea中原有的配置 3.重新打开工程&#xff0c;基本上可以解决&#xff08;具体情况具体分析&#xff09;

DDT+yaml实现数据驱动接口自动化

前言 在之前的文章中我们知道了yaml文件可以进行接口自动化。除了yaml文件&#xff0c;Excel文档也可以用来编写自动化测试用例。 一定很想知道这两者有什么区别吧&#xff1f; 1、Excel使用简单&#xff0c;维护难&#xff0c;多种数据类型转换起来比较复杂 2、yaml学习稍…

解决QT cc1plus.exe: error: out of memory allocating

QT中增加资源文件过大时&#xff0c;会编译不过&#xff0c;报错&#xff1a; cc1plus.exe: out of memory allocating 1073745919 bytes 使用qrc资源文件&#xff0c;也就是在QT的工程中添加资源文件&#xff0c;就是添加的资源文件&#xff08;如qrc.cpp&#xff09;会直接被…

解决轻松解决谷歌浏览器火狐浏览器主页被360导航篡改问题浏览器启动页被篡改为360导航栏等

重置Chrome浏览器设置 尝试重置chrome浏览器全部设置。进入Chrome设置页&#xff0c;点击最下方的“高级设置”。 将鼠标滚到最底部&#xff0c;点击“重置设置” 然后关闭浏览器&#xff0c;重新打开即可。 包括ie几乎所有浏览器都可以重置... 重置火狐浏览器设置 设置——主…
最新文章