From ca2a45a5eeb0991be806ef79ba6705c96ad284a2 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 19 Mar 2026 14:33:10 +0000 Subject: [PATCH] UefiPayloadPkg/SmmStoreLib: honor SMI retry delay The retry path loads RCX before REP PAUSE, but PAUSE already uses the REP prefix and does not consume RCX. It therefore waits for one PAUSE instruction instead of the intended 10,000 iterations. Use an explicit loop so a missed synchronous SMI gets the intended delay. Check RAX again after waiting so a response received during the delay is returned without triggering another SMI. Signed-off-by: Sean Rhodes --- UefiPayloadPkg/Library/SmmStoreLib/X64/SmmStore.nasm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/Library/SmmStoreLib/X64/SmmStore.nasm b/UefiPayloadPkg/Library/SmmStoreLib/X64/SmmStore.nasm index ee20c1fae8..4bafe65da8 100644 --- a/UefiPayloadPkg/Library/SmmStoreLib/X64/SmmStore.nasm +++ b/UefiPayloadPkg/Library/SmmStoreLib/X64/SmmStore.nasm @@ -37,8 +37,12 @@ ASM_PFX(TriggerSmi): jne @Return ; SMM modified rax, return now push rcx ; save rcx to stack mov rcx, 10000 - rep pause ; add a small delay +@Pause: + pause ; add a small delay + loop @Pause pop rcx ; restore rcx + cmp rax, rcx ; Check for a response during the delay + jne @Return cmp r8, 0 je @Return dec r8