Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, alexandru.elisei@arm.com,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH] efi: Override runtime supported mask from a EFI variable if present
Date: Wed,  9 Nov 2022 18:27:50 +0100	[thread overview]
Message-ID: <20221109172750.2823891-1-ardb@kernel.org> (raw)

For debugging purposes, allow the runtime override mask to be set from a
EFI variable if one exists. For instance, the RT supported mask can be
set to 0xfffd to disable the SetTime() runtime service, and enable all
others:

  echo -ne "\x7\0\0\0\xfd\xff" \
    > /sys/firmware/efi/efivars/LinuxRtMaskOverride-eb66918a-7eef-402a-842e-931d21c38ae9

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/efi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index a46df5d1d0942751..faed1ef78c044924 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -367,7 +367,17 @@ static int __init efisubsys_init(void)
 		}
 	}
 
-	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
+		unsigned long size = sizeof(efi.runtime_supported_mask);
+
+		if (efi.get_variable(L"LinuxRtMaskOverride",
+				     &EFI_RT_PROPERTIES_TABLE_GUID, NULL, &size,
+				     &efi.runtime_supported_mask) == EFI_SUCCESS)
+			pr_info("Overriding runtime_supported_mask to 0x%x\n",
+				efi.runtime_supported_mask);
+	}
+
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_TIME))
 		platform_device_register_simple("rtc-efi", 0, NULL, 0);
 
 	/* We register the efi directory at /sys/firmware/efi */
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-11-09 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 17:27 Ard Biesheuvel [this message]
2022-11-10 14:37 ` [PATCH] efi: Override runtime supported mask from a EFI variable if present Alexandru Elisei
2022-11-11  7:51   ` 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=20221109172750.2823891-1-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@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