如何禁用 A53 上的所有 IRQ?
How to disable all IRQs on A53?
我有这样的代码希望在 wfi 上停止 cpu:
__asm volatile ( "MSR DAIFSET, #15" );
__asm volatile ( "DSB SY" );
__asm volatile ( "ISB SY" );
__asm volatile ("wfi");
print("never get here\n");
问题是我总是收到日志 "never get here",为什么会这样?
我猜想发生的 irq 是 arch timer PPI。但它不应该被禁用吗?
平台是 el3 中的 cortex-a53。
我将代码更改为:
__asm volatile ( "MSR DAIFSET, #15" );
__asm volatile ( "DSB SY" );
__asm volatile ( "ISB SY" );
while (1) {
__asm volatile ("wfe");
print("never get here\n");
}
我没完没了"never get here",唤醒事件源是什么?
wfi
并不像您想象的那样工作。请参阅 ARMv8 Reference Manual,D1.17.2 部分:
D1.17.2 Wait For Interrupt
[...]
The architecture permits a PE to leave the low-power state for any reason, but requires that it must leave the low-power state on receipt of any architected WFI wake-up event.
---------- Note ----------
Because the architecture permits a PE to leave the low-power state for any reason, it is permissible for a PE to treat WFI as a NOP, but this is not recommended for lowest power operation.
----------------------------
[...]
WFI wake-up events
The following are WFI wake-up events:
- Any physical SError interrupt, IRQ interrupt, or FIQ interrupt received by the PE, [...] regardless of the value of the corresponding PSTATE.{A, I, F} mask bit.
- [...]
---------- Note ----------
- WFI wake-up events are never disabled by EDSCR.INTdis, and are never masked by the PSTATE.{A, I, F} mask bits. If wake-up is invoked by an interrupt that is disabled or masked the interrupt is not taken.
- [...]
----------------------------
所以你的中断屏蔽工作正常,只是 wfi
不关心那个,可以简单地作为一个 nop
开始。
与此相反,wfe
似乎旨在强制进入低功耗状态,并且确实遵守中断掩码。我只是浏览了一下,所以可能还有一个警告,但请参阅手册中的 G1.18.1 部分。
我有这样的代码希望在 wfi 上停止 cpu:
__asm volatile ( "MSR DAIFSET, #15" );
__asm volatile ( "DSB SY" );
__asm volatile ( "ISB SY" );
__asm volatile ("wfi");
print("never get here\n");
问题是我总是收到日志 "never get here",为什么会这样? 我猜想发生的 irq 是 arch timer PPI。但它不应该被禁用吗?
平台是 el3 中的 cortex-a53。
我将代码更改为:
__asm volatile ( "MSR DAIFSET, #15" );
__asm volatile ( "DSB SY" );
__asm volatile ( "ISB SY" );
while (1) {
__asm volatile ("wfe");
print("never get here\n");
}
我没完没了"never get here",唤醒事件源是什么?
wfi
并不像您想象的那样工作。请参阅 ARMv8 Reference Manual,D1.17.2 部分:
D1.17.2 Wait For Interrupt
[...]
The architecture permits a PE to leave the low-power state for any reason, but requires that it must leave the low-power state on receipt of any architected WFI wake-up event.---------- Note ----------
Because the architecture permits a PE to leave the low-power state for any reason, it is permissible for a PE to treat WFI as a NOP, but this is not recommended for lowest power operation.
----------------------------[...]
WFI wake-up events
The following are WFI wake-up events:
- Any physical SError interrupt, IRQ interrupt, or FIQ interrupt received by the PE, [...] regardless of the value of the corresponding PSTATE.{A, I, F} mask bit.
- [...]
---------- Note ----------
- WFI wake-up events are never disabled by EDSCR.INTdis, and are never masked by the PSTATE.{A, I, F} mask bits. If wake-up is invoked by an interrupt that is disabled or masked the interrupt is not taken.
- [...]
----------------------------
所以你的中断屏蔽工作正常,只是 wfi
不关心那个,可以简单地作为一个 nop
开始。
与此相反,wfe
似乎旨在强制进入低功耗状态,并且确实遵守中断掩码。我只是浏览了一下,所以可能还有一个警告,但请参阅手册中的 G1.18.1 部分。