首页 > 编程知识 正文

SDEI学习笔记

时间:2023-05-06 02:28:10 阅读:280032 作者:515

# SDEI学习笔记 ## Introduction


Software Delegated Exception Interface (SDEI) is an Arm specification for Non-secure 
world to register handlers with firmware to receive notifications about system events.

SDEI是ARM做的一种system events的通知方式。Firmware收到system events后,使用SDEI通知Non-secure world,
并执行注册好的handler。

经典应用场景
System Error handling (RAS)
Software Watchdog timer
Kernel Debugging
Sample Profiling

详细介绍,请参考ARM的以下文档。
https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/sdei.rst
http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf

## APEI对SDEI的支持


ACPI-v6.2开始增加对SDEI的支持,作为一种Hardware Error Notification方式。
这样,APEI表就包含以下11中Notification类型:
0 – Polled
1 – External Interrupt
2 – Local Interrupt
3 – SCI
4 – NMI
5 - CMCI
6 - MCE
7 - GPIO-Signal
8 - ARMv8 SEA
9 - ARMv8 SEI
10 - External Interrupt - GSIV
11 - Software Delegated Exception – See Links to ACPI-Related Documents (http://uefi.org/acpi) under the heading, “SDEI Specification.”

## TF对SDEI的支持


./include/services/sdei.h
sdei_dispatch_event()应该是在BIOS的RAS driver里面调用。
void begin_sdei_synchronous_dispatch(struct jmpbuf *buffer);
./services/std_svc/sdei/sdei_dispatch.S
汇编实现的dispatch函数,同步dispatch
int setjmp(struct jmpbuf *buf);
./lib/aarch64/setjmp.S

## UEFI对SDEI的支持


Trust firmware需要升级到TF1.5。
UEFI增加一个SDEI表,用来与OS对齐版本信息。
UEFI使能TF中的SDEI功能,需要做什么还没搞清楚
UEFI收到system event之后,比如RAS中断,调用TF提供的以下API,通知SDEI Client。
int sdei_dispatch_event(int ev_num);

## OS对SDEI的支持

HEST中定义了vector,作为event_num用于sdei_event_register()
sdei_event_create()添加到sdei_list

_sdei_event_register() --> _local_event_register() --> invoke_sdei_fn() --> sdei_firmware_call()
sdei_firmware_call有两种实现方式,HVC和SMC,通过acpi或者DTS表选择。
sdei_event_enable --> sdei_api_event_enable() --> invoke_sdei_fn

bios还需要定义一个SDEI表,./drivers/firmware/arm_sdei.c驱动初始化的时候会解析。
 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。