[PATCH] x86/efi: remove unreachable efi_halt_system() function

Roger Pau Monne posted 1 patch 6 days, 5 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260224200708.51120-1-roger.pau@citrix.com
xen/common/efi/common-stub.c |  1 -
xen/common/efi/runtime.c     | 13 -------------
xen/include/xen/efi.h        |  1 -
3 files changed, 15 deletions(-)
[PATCH] x86/efi: remove unreachable efi_halt_system() function
Posted by Roger Pau Monne 6 days, 5 hours ago
After e4c3755d4dd7 the function efi_halt_system() is unreachable, remove it
from the file.

No functional change expected, as the function is not called.

Fixes: e4c3755d4dd7 ("x86-64/EFI: don't call EfiResetSystem() from machine_halt()")
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/efi/common-stub.c |  1 -
 xen/common/efi/runtime.c     | 13 -------------
 xen/include/xen/efi.h        |  1 -
 3 files changed, 15 deletions(-)

diff --git a/xen/common/efi/common-stub.c b/xen/common/efi/common-stub.c
index 77f138a6c574..9dc8aa538cc1 100644
--- a/xen/common/efi/common-stub.c
+++ b/xen/common/efi/common-stub.c
@@ -18,7 +18,6 @@ unsigned long efi_get_time(void)
     return 0;
 }
 
-void efi_halt_system(void) { }
 void efi_reset_system(bool warm) { }
 
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index f786ceb00763..ba27c62132d2 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -188,19 +188,6 @@ unsigned long efi_get_time(void)
                   time.Hour, time.Minute, time.Second);
 }
 
-void efi_halt_system(void)
-{
-    EFI_STATUS status;
-    struct efi_rs_state state = efi_rs_enter();
-
-    if ( !state.cr3 )
-        return;
-    status = efi_rs->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
-    efi_rs_leave(&state);
-
-    printk(XENLOG_WARNING "EFI: could not halt system (%#lx)\n", status);
-}
-
 void efi_reset_system(bool warm)
 {
     EFI_STATUS status;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 723cb8085270..2e36b01e205b 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -42,7 +42,6 @@ void efi_init_memory(void);
 bool efi_boot_mem_unused(unsigned long *start, unsigned long *end);
 bool efi_rs_using_pgtables(void);
 unsigned long efi_get_time(void);
-void efi_halt_system(void);
 void efi_reset_system(bool warm);
 #ifndef COMPAT
 int efi_get_info(uint32_t idx, union xenpf_efi_info *info);
-- 
2.51.0


Re: [PATCH] x86/efi: remove unreachable efi_halt_system() function
Posted by Jason Andryuk 6 days, 6 hours ago
On 2026-02-24 15:07, Roger Pau Monne wrote:
> After e4c3755d4dd7 the function efi_halt_system() is unreachable, remove it
> from the file.
> 
> No functional change expected, as the function is not called.
> 
> Fixes: e4c3755d4dd7 ("x86-64/EFI: don't call EfiResetSystem() from machine_halt()")
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>

I see this dropped with --gc-sections, FWIW.

Thanks,
Jason

Re: [PATCH] x86/efi: remove unreachable efi_halt_system() function
Posted by Marek Marczykowski-Górecki 9 hours ago
On Tue, Feb 24, 2026 at 02:05:10PM -0500, Jason Andryuk wrote:
> On 2026-02-24 15:07, Roger Pau Monne wrote:
> > After e4c3755d4dd7 the function efi_halt_system() is unreachable, remove it
> > from the file.
> > 
> > No functional change expected, as the function is not called.
> > 
> > Fixes: e4c3755d4dd7 ("x86-64/EFI: don't call EfiResetSystem() from machine_halt()")
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>

Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab