From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 476D3218596 for ; Mon, 14 Jul 2025 06:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752473464; cv=none; b=S568egBuaZobAXCNKpdUyhB14J4W+1YBKqgzaQBfK12lSrSz0fKKj01scHGWWZPmR92to0O1qh0bOjMpJnaPru41z48CF/WFQJ5TenHdNs8nXHMbTZ/jvr/c+IKBD0mSr0Qj8lNTskAoTyi6mrY8q3uoN89RewdWzVNcCXZAq0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752473464; c=relaxed/simple; bh=XDk/UZY05XJ4EiH/B3HsLcLcKWy6I2jZ9/dIhAfsBko=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=P98g5QN7OvMSFRL0ittOU/Gez42EI9fcHVwCQbnISd3HeXyX6y3w1CFl7OHEx+FeNfIjkng+FW6bs3BR5JLRuZ0N/iFoq46bhpqbqTHZrGShyXEJVIEa6GXf8GvhloLqZjtwsPNKYv/9sjTmZHdFk1TsWMDqco+TzpqAHXSAHwk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=u7CT9GeC; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="u7CT9GeC" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-3a4e713e05bso1698970f8f.3 for ; Sun, 13 Jul 2025 23:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1752473460; x=1753078260; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=DAtRoMW47q6eWngfmkGzhbl2Om3dflePIieHts+FOBI=; b=u7CT9GeCl2xxA/GEByWex/W9jP6wWP5hxAlLaijiICOs8TMmOOtfipd02hTZ2QVKNQ sNzpJ1i6ykhWO+NKJvDxjr7GTJ9x+lmjTyyA01g5lEMF/k3fYfh2rm7W5XJ3bbvroxXs cE5O1p09Ov9+xge5ysBe/JESGgOvLxnJOdUU65T73y/AXyUQ+WNCnA/bBoa7wLfQgwlb TTGW7X4mFeBYkDnaGRTukCVB38joFZe5eSj7INEyXrRsQI4cZId6L7KiuKmTtDmkOjBO p40akamQlej73JznY/VoJf9iIppojr7b0POg1+uI7NNTVpf7OaQSaa4cZmU25HZUaSTJ XlJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752473460; x=1753078260; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DAtRoMW47q6eWngfmkGzhbl2Om3dflePIieHts+FOBI=; b=B1nDxv4MJtz31W7kQ3fRAusNA427my2HCWYCVadQ41UkoPd6cjzgBBAdMH8/K6Qz9j a/wQjDGUlMNGDK1OKGQcPAl/Mx5ypjI+Gb/XVE5VENK1G+nEQL14tYicZKXa2r586BzV D3bZ2R/4hoRzpqEoloV8sfda3ZheF0Tb3JFsOQchrtsAzmFA2oB7qEQ0jrrf3jJXadaZ E2JT5nswCn75LfOB6q3TBnuFnwxoYaj17yQc+wr5lZ/D0SzosmMXhDII050IJmTjtTTr FFOGtwgMA1JzI5zdT9plakwM/SokIlUwdAIIWv/tbOTwYp2YjJy+IVuuV9aIOAh+wq1E m5Mg== X-Forwarded-Encrypted: i=1; AJvYcCVsunlWDrviYbNmbnH9NuGRIk9n6hnwY08Lu/e2XZJi2Gh189r5xTbtunytNEF8uBhuholJj6Xizmc=@lists.linux.dev X-Gm-Message-State: AOJu0YxHycet4C9AaAhVOyk5CxHWaZfl0WhHXfFEiub1+bKaRmhtjiGg IkFUPmIlePfGyjVDj98EB0j9Vjrhvqa6M/IAYuMb5plgr/RVqu6YBwB9n1FRCrWJ6QkiOMQXMQ= = X-Google-Smtp-Source: AGHT+IFsCLtHJL4bZduQByJdBWFSePt0ZVoqPC5acNqYECl/7QLB3y/VpTPIitmJ3C2pFikEet6/1z+u X-Received: from wmbay17.prod.google.com ([2002:a05:600c:1e11:b0:450:cd94:c302]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:240a:b0:3a5:8a68:b839 with SMTP id ffacd0b85a97d-3b5f2e26c14mr9849725f8f.45.1752473460616; Sun, 13 Jul 2025 23:11:00 -0700 (PDT) Date: Mon, 14 Jul 2025 08:08:46 +0200 In-Reply-To: <20250714060843.4029171-5-ardb+git@google.com> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250714060843.4029171-5-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=5138; i=ardb@kernel.org; h=from:subject; bh=ntdr4EjVjZJfnyc3XZ20vyNdLzsBSSjtiozuNHpTjes=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIaNk3s+Lmbqczj0rvAVfRxbEdM6a85TrRHj8D0lpvTzZ/ Fdaq652lLIwiHExyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgIk4VjL8T33FvUb59jozdqnm q/uqv/H1Tplbn7TcdSZ/lf6yLc3mAgz/jPUOZcXfVexgUWyuFC302nb67J1Gr/K2qWeKJ0eZ/2j hBwA= X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Message-ID: <20250714060843.4029171-7-ardb+git@google.com> Subject: [RFC PATCH 2/3] efi/test: Don't bother pseudo-testing unused EFI services From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Heinrich Schuchardt , Feng Tang , Alexandre Belloni , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Sunil V L , Bibo Mao , 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 Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel 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 --- 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