From: Feng Tang <feng.tang@linux.alibaba.com>
To: Ard Biesheuvel <ardb@kernel.org>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Feng Tang <feng.tang@linux.alibaba.com>
Subject: [PATCH] efi: remove the rtc-wakeup capability from default value
Date: Wed, 9 Jul 2025 18:35:41 +0800 [thread overview]
Message-ID: <20250709103541.7268-1-feng.tang@linux.alibaba.com> (raw)
The kernel selftest of rtc reported a error on an ARM server:
RUN rtc.alarm_alm_set ...
rtctest.c:262:alarm_alm_set:Alarm time now set to 17:31:36.
rtctest.c:267:alarm_alm_set:Expected -1 (-1) != rc (-1)
alarm_alm_set: Test terminated by assertion
FAIL rtc.alarm_alm_set
not ok 5 rtc.alarm_alm_set
The root cause is, the unerlying EFI firmware doesn't support wakeup
service (get/set alarm), while it doesn't have the efi 'RT_PROP'
table either. The current code logic will claim efi supports these
runtime service capability by default, and let following 'RT_PROP'
table parsing to correct it, if that table exists.
This issue was reproduced on ARM server from another verndor, and not
reproudce on one x86 server (Icelake). All these 3 platforms don't have
'RT_PROP' tables, so they are all claimed to support alarm service,
but x86 server uses real CMOS RTC device instead rtc-efi device, and
passes the test.
So remove the wakeup/alarm capability from default value, and setup
the capability bits according to the 'RT_PROP' table parsing.
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
drivers/firmware/efi/efi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index e57bff702b5f..7cf35376a2f7 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -789,6 +789,17 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
}
}
+ /*
+ * After bootup, the runtime_supported_mask was set to be capable of
+ * all features, which could be kind of too optimistici. In real
+ * world, many platforms don't support advanced RTC wakeup runtime
+ * service, while they don't provide RT_PROPERTY table either, which
+ * led to rtc-wakeup capability being worngly claimed.
+ *
+ * So remove the wakeup capbility from default value, and let the
+ * RT_PROPERTY do the judge.
+ */
+ efi.runtime_supported_mask &= ~EFI_RT_SUPPORTED_WAKEUP_SERVICES;
if (rt_prop != EFI_INVALID_TABLE_ADDR) {
efi_rt_properties_table_t *tbl;
--
2.43.5
next reply other threads:[~2025-07-09 10:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 10:35 Feng Tang [this message]
2025-07-09 10:42 ` Ard Biesheuvel
2025-07-09 10:59 ` Feng Tang
2025-07-09 23:33 ` Ard Biesheuvel
2025-07-10 7:24 ` Feng Tang
2025-07-10 7:32 ` Ard Biesheuvel
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=20250709103541.7268-1-feng.tang@linux.alibaba.com \
--to=feng.tang@linux.alibaba.com \
--cc=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®