[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 0/3] Remove unused EFI runtime APIs



On 7/14/25 08:08, Ard Biesheuvel wrote:
From: Ard Biesheuvel <ardb@xxxxxxxxxx>

Using EFI runtime services to program the RTC to wake up the system is
supported in theory, but rarely works in practice. Fortunately, this
functionality is rarely [if ever] used to begin with so we can just drop
it. (Note that the EFI rtc driver is not used by x86, which programs the
CMOS rtc directly)

The main problem I see with firmware offering access to the RTC via UEFI services is that two different drivers, the firmware one and the Linux one might be trying to access the same busses or registers which might lead to unexpected results.

Recently there was a discussion in the RISC-V technical group for the server platform specification where the same issue was discussed concerning SetTime().

As a UEFI firmware should not care which operating system is booted, it should be up to the OS to disable EFI access to the RTC if it has native access.

Could we disable all the EFI services for the RTC in Linux dynamically when an RTC driver is successfully probed?

Best regards

Heinrich


The same applies to GetNextHighMonoCount(), which, if implemented,
usually relies on SetVariable() under the hood *, which is often not
supported at runtime by non-x86 platforms. But it has no known users
either so let's drop support for it as well.

This means we need to drop the slightly pointless tests for it too.

* EDK2 based EFI implementations usually have a MTC variable carrying
   the monotonic counter variable, which is therefore not truly
   monotonic, given that SetVariable() will happily overwrite it.

Cc: Heinrich Schuchardt <heinrich.schuchardt@xxxxxxxxxxxxx>
Cc: Feng Tang <feng.tang@xxxxxxxxxxxxxxxxx>
Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
Cc: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
Cc: Bibo Mao <maobibo@xxxxxxxxxxx>
Cc: linux-rtc@xxxxxxxxxxxxxxx
Cc: linux-efi@xxxxxxxxxxxxxxx
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx
Cc: loongarch@xxxxxxxxxxxxxxx

Ard Biesheuvel (3):
   efi-rtc: Remove wakeup functionality
   efi/test: Don't bother pseudo-testing unused EFI services
   efi: Remove support for pointless, unused EFI services

  arch/x86/platform/efi/efi_64.c          |  22 ----
  drivers/firmware/efi/runtime-wrappers.c |  68 ------------
  drivers/firmware/efi/test/efi_test.c    | 108 +-------------------
  drivers/rtc/rtc-efi.c                   |  76 +-------------
  drivers/xen/efi.c                       |  56 ----------
  include/linux/efi.h                     |   6 --
  6 files changed, 4 insertions(+), 332 deletions(-)





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.