UefiCpuPkg/CpuDxeRiscV64: Read hardware state in GetInterruptState

Fix CpuGetInterruptState() to read the actual hardware interrupt flag
(sstatus.SIE) via BaseLib's GetInterruptState() instead of returning a cached
boolean variable. The cached variable becomes stale in interrupt context
where hardware disables interrupts without going through the protocol's
DisableInterrupt() call.

This is a PI Spec conformance fix: EFI_CPU_ARCH_PROTOCOL.GetInterruptState()
is specified to return the current processor interrupt state.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2026-06-01 21:47:09 -07:00 committed by mergify[bot]
parent d91dff7cbe
commit 3120fb4b69

View file

@ -13,8 +13,7 @@
//
// Global Variables
//
STATIC BOOLEAN mInterruptState = FALSE;
STATIC EFI_HANDLE mCpuHandle = NULL;
STATIC EFI_HANDLE mCpuHandle = NULL;
STATIC UINTN mBootHartId;
RISCV_EFI_BOOT_PROTOCOL gRiscvBootProtocol;
@ -123,7 +122,6 @@ CpuEnableInterrupt (
)
{
EnableInterrupts ();
mInterruptState = TRUE;
return EFI_SUCCESS;
}
@ -143,7 +141,6 @@ CpuDisableInterrupt (
)
{
DisableInterrupts ();
mInterruptState = FALSE;
return EFI_SUCCESS;
}
@ -168,7 +165,7 @@ CpuGetInterruptState (
return EFI_INVALID_PARAMETER;
}
*State = mInterruptState;
*State = GetInterruptState ();
return EFI_SUCCESS;
}