From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
Ard Biesheuvel <ardb@kernel.org>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
Feng Tang <feng.tang@linux.alibaba.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
Sunil V L <sunilvl@ventanamicro.com>,
Bibo Mao <maobibo@loongson.cn>,
linux-rtc@vger.kernel.org, linux-efi@vger.kernel.org,
xen-devel@lists.xenproject.org, x86@kernel.org,
linux-riscv@lists.infradead.org, loongarch@lists.linux.dev
Subject: [RFC PATCH 2/3] efi/test: Don't bother pseudo-testing unused EFI services
Date: Mon, 14 Jul 2025 08:08:46 +0200 [thread overview]
Message-ID: <20250714060843.4029171-7-ardb+git@google.com> (raw)
In-Reply-To: <20250714060843.4029171-5-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
The EFI test module covers the get/set wakeup time EFI runtime
services, as well as GetNextHighMonoCount(). In both cases, though, it
just mindlessly exercises the API, without any functional testing.
In case of the get/set wakeup time services, this would involve setting
the wakeup time, and subsequently checking whether the system actually
wakes up at the configured time, which is difficult for obvious reasons.
In case of GetNextHighMonoCount(), this would involve performing some
kind of verification that the returned number increases monotonically
across reboots.
Given that these APIs are not used in Linux to begin with, let's not
pretend that testing them in this manner has any value, and just drop
these tests entirely, so that we can drop the APIs themselves from the
Linux EFI runtime layer.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/test/efi_test.c | 108 +-------------------
1 file changed, 2 insertions(+), 106 deletions(-)
diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 77b5f7ac3e20..bb2ace902346 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -333,77 +333,6 @@ static long efi_runtime_set_time(unsigned long arg)
return status == EFI_SUCCESS ? 0 : -EINVAL;
}
-static long efi_runtime_get_waketime(unsigned long arg)
-{
- struct efi_getwakeuptime __user *getwakeuptime_user;
- struct efi_getwakeuptime getwakeuptime;
- efi_bool_t enabled, pending;
- efi_status_t status;
- efi_time_t efi_time;
-
- getwakeuptime_user = (struct efi_getwakeuptime __user *)arg;
- if (copy_from_user(&getwakeuptime, getwakeuptime_user,
- sizeof(getwakeuptime)))
- return -EFAULT;
-
- status = efi.get_wakeup_time(
- getwakeuptime.enabled ? (efi_bool_t *)&enabled : NULL,
- getwakeuptime.pending ? (efi_bool_t *)&pending : NULL,
- getwakeuptime.time ? &efi_time : NULL);
-
- if (put_user(status, getwakeuptime.status))
- return -EFAULT;
-
- if (status != EFI_SUCCESS)
- return -EINVAL;
-
- if (getwakeuptime.enabled && put_user(enabled,
- getwakeuptime.enabled))
- return -EFAULT;
-
- if (getwakeuptime.pending && put_user(pending,
- getwakeuptime.pending))
- return -EFAULT;
-
- if (getwakeuptime.time) {
- if (copy_to_user(getwakeuptime.time, &efi_time,
- sizeof(efi_time_t)))
- return -EFAULT;
- }
-
- return 0;
-}
-
-static long efi_runtime_set_waketime(unsigned long arg)
-{
- struct efi_setwakeuptime __user *setwakeuptime_user;
- struct efi_setwakeuptime setwakeuptime;
- efi_bool_t enabled;
- efi_status_t status;
- efi_time_t efi_time;
-
- setwakeuptime_user = (struct efi_setwakeuptime __user *)arg;
-
- if (copy_from_user(&setwakeuptime, setwakeuptime_user,
- sizeof(setwakeuptime)))
- return -EFAULT;
-
- enabled = setwakeuptime.enabled;
- if (setwakeuptime.time) {
- if (copy_from_user(&efi_time, setwakeuptime.time,
- sizeof(efi_time_t)))
- return -EFAULT;
-
- status = efi.set_wakeup_time(enabled, &efi_time);
- } else
- status = efi.set_wakeup_time(enabled, NULL);
-
- if (put_user(status, setwakeuptime.status))
- return -EFAULT;
-
- return status == EFI_SUCCESS ? 0 : -EINVAL;
-}
-
static long efi_runtime_get_nextvariablename(unsigned long arg)
{
struct efi_getnextvariablename __user *getnextvariablename_user;
@@ -505,37 +434,6 @@ static long efi_runtime_get_nextvariablename(unsigned long arg)
return rv;
}
-static long efi_runtime_get_nexthighmonocount(unsigned long arg)
-{
- struct efi_getnexthighmonotoniccount __user *getnexthighmonocount_user;
- struct efi_getnexthighmonotoniccount getnexthighmonocount;
- efi_status_t status;
- u32 count;
-
- getnexthighmonocount_user = (struct
- efi_getnexthighmonotoniccount __user *)arg;
-
- if (copy_from_user(&getnexthighmonocount,
- getnexthighmonocount_user,
- sizeof(getnexthighmonocount)))
- return -EFAULT;
-
- status = efi.get_next_high_mono_count(
- getnexthighmonocount.high_count ? &count : NULL);
-
- if (put_user(status, getnexthighmonocount.status))
- return -EFAULT;
-
- if (status != EFI_SUCCESS)
- return -EINVAL;
-
- if (getnexthighmonocount.high_count &&
- put_user(count, getnexthighmonocount.high_count))
- return -EFAULT;
-
- return 0;
-}
-
static long efi_runtime_reset_system(unsigned long arg)
{
struct efi_resetsystem __user *resetsystem_user;
@@ -697,16 +595,14 @@ static long efi_test_ioctl(struct file *file, unsigned int cmd,
return efi_runtime_set_time(arg);
case EFI_RUNTIME_GET_WAKETIME:
- return efi_runtime_get_waketime(arg);
-
case EFI_RUNTIME_SET_WAKETIME:
- return efi_runtime_set_waketime(arg);
+ return -EINVAL;
case EFI_RUNTIME_GET_NEXTVARIABLENAME:
return efi_runtime_get_nextvariablename(arg);
case EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT:
- return efi_runtime_get_nexthighmonocount(arg);
+ return -EINVAL;
case EFI_RUNTIME_QUERY_VARIABLEINFO:
return efi_runtime_query_variableinfo(arg);
--
2.50.0.727.gbf7dc18ff4-goog
next prev parent reply other threads:[~2025-07-14 6:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 6:08 [RFC PATCH 0/3] Remove unused EFI runtime APIs Ard Biesheuvel
2025-07-14 6:08 ` [RFC PATCH 1/3] efi-rtc: Remove wakeup functionality Ard Biesheuvel
2025-07-14 6:13 ` Demi Marie Obenour
2025-07-14 6:19 ` Ard Biesheuvel
2025-07-14 6:22 ` Demi Marie Obenour
2025-07-14 6:34 ` Ard Biesheuvel
2025-07-14 7:16 ` Feng Tang
2025-08-03 1:04 ` Alexandre Belloni
2025-08-09 23:02 ` Ard Biesheuvel
2025-07-14 6:08 ` Ard Biesheuvel [this message]
2025-07-14 6:08 ` [RFC PATCH 3/3] efi: Remove support for pointless, unused EFI services Ard Biesheuvel
2025-07-17 0:49 ` Stefano Stabellini
2025-07-14 8:10 ` [RFC PATCH 0/3] Remove unused EFI runtime APIs Heinrich Schuchardt
2025-07-15 3:29 ` Ard Biesheuvel
2025-07-15 14:58 ` Sunil V L
2025-07-16 3:52 ` 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=20250714060843.4029171-7-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=alexandre.belloni@bootlin.com \
--cc=ardb@kernel.org \
--cc=feng.tang@linux.alibaba.com \
--cc=heinrich.schuchardt@canonical.com \
--cc=jgross@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=oleksandr_tyshchenko@epam.com \
--cc=sstabellini@kernel.org \
--cc=sunilvl@ventanamicro.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).