Linux ACPI
 help / color / mirror / Atom feed
From: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
To: linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	Pawel Chmielewski <pawel.chmielewski@intel.com>,
	acpica-devel@lists.linux.dev,
	Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Subject: [PATCH 2/2] efi: don't register rtc-efi if the ACPI TAD can drive the RTC
Date: Thu, 22 Oct 2026 17:13:04 -0400	[thread overview]
Message-ID: <20261022211304.2285792-2-hamzamahfooz@linux.microsoft.com> (raw)
In-Reply-To: <20261022211304.2285792-1-hamzamahfooz@linux.microsoft.com>

EFI runtime services are best avoided where possible, and ACPI defines a
standard interface to the real time clock in the form of the Time and
Alarm Device (TAD), which the acpi-tad driver has been exposing as an
RTC class device since commit 8a1e7f4b1764 ("ACPI: TAD: Add RTC class
device interface").

So, don't register the rtc-efi platform device if acpi-tad is going to
register an RTC class device for the TAD, according to
acpi_tad_rtc_available().

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
 drivers/firmware/efi/efi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 9bc22de0d..706064479 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -34,6 +34,8 @@
 #include <linux/security.h>
 #include <linux/notifier.h>
 
+#include <acpi/acpi_tad.h>
+
 #include <asm/early_ioremap.h>
 
 struct efi __read_mostly efi = {
@@ -459,7 +461,8 @@ static int __init efisubsys_init(void)
 	if (!efi_enabled(EFI_BOOT))
 		return 0;
 
-	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES) &&
+	    !acpi_tad_rtc_available())
 		platform_device_register_simple("rtc-efi", 0, NULL, 0);
 
 	/* We register the efi directory at /sys/firmware/efi */
-- 
2.56.0


  reply	other threads:[~2026-10-22 21:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 21:13 [PATCH 1/2] ACPI: TAD: introduce acpi_tad_rtc_available() Hamza Mahfooz
2026-10-22 21:13 ` Hamza Mahfooz [this message]
2026-10-23 13:50 ` Ard Biesheuvel
2026-10-23 21:28   ` Hamza Mahfooz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022211304.2285792-2-hamzamahfooz@linux.microsoft.com \
    --to=hamzamahfooz@linux.microsoft.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=ardb@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=pawel.chmielewski@intel.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox