From: Chester Lin <clin@suse.com>
To: ardb@kernel.org, catalin.marinas@arm.com, will@kernel.org,
zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, corbet@lwn.net,
mark.rutland@arm.com, vincenzo.frascino@arm.com,
samitolvanen@google.com, masahiroy@kernel.org, mingo@kernel.org
Cc: clin@suse.com, linux-efi@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
jlee@suse.com, linux-integrity@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] efistub: pass uefi secureboot flag via fdt params
Date: Fri, 4 Sep 2020 15:29:00 +0800 [thread overview]
Message-ID: <20200904072905.25332-2-clin@suse.com> (raw)
In-Reply-To: <20200904072905.25332-1-clin@suse.com>
Add a new UEFI parameter: "linux,uefi-secure-boot" in fdt boot params
as other architectures have done in their own boot data. For example,
the boot_params->secure_boot in x86.
Signed-off-by: Chester Lin <clin@suse.com>
---
drivers/firmware/efi/libstub/fdt.c | 39 +++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index 11ecf3c4640e..c9a341e4715f 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -136,6 +136,10 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
if (status)
goto fdt_set_fail;
+ status = fdt_setprop_var(fdt, node, "linux,uefi-secure-boot", fdt_val32);
+ if (status)
+ goto fdt_set_fail;
+
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
efi_status_t efi_status;
@@ -199,6 +203,24 @@ static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map)
return EFI_SUCCESS;
}
+static efi_status_t update_fdt_secboot(void *fdt, u32 secboot)
+{
+ int node = fdt_path_offset(fdt, "/chosen");
+ u32 fdt_val32;
+ int err;
+
+ if (node < 0)
+ return EFI_LOAD_ERROR;
+
+ fdt_val32 = cpu_to_fdt32(secboot);
+
+ err = fdt_setprop_inplace_var(fdt, node, "linux,uefi-secure-boot", fdt_val32);
+ if (err)
+ return EFI_LOAD_ERROR;
+
+ return EFI_SUCCESS;
+}
+
struct exit_boot_struct {
efi_memory_desc_t *runtime_map;
int *runtime_entry_count;
@@ -208,6 +230,9 @@ struct exit_boot_struct {
static efi_status_t exit_boot_func(struct efi_boot_memmap *map,
void *priv)
{
+ efi_status_t status;
+ enum efi_secureboot_mode secboot_status;
+ u32 secboot_var = 0;
struct exit_boot_struct *p = priv;
/*
* Update the memory map with virtual addresses. The function will also
@@ -217,7 +242,19 @@ static efi_status_t exit_boot_func(struct efi_boot_memmap *map,
efi_get_virtmap(*map->map, *map->map_size, *map->desc_size,
p->runtime_map, p->runtime_entry_count);
- return update_fdt_memmap(p->new_fdt_addr, map);
+ status = update_fdt_memmap(p->new_fdt_addr, map);
+
+ if (status != EFI_SUCCESS)
+ return status;
+
+ secboot_status = efi_get_secureboot();
+
+ if (secboot_status == efi_secureboot_mode_enabled)
+ secboot_var = 1;
+
+ status = update_fdt_secboot(p->new_fdt_addr, secboot_var);
+
+ return status;
}
#ifndef MAX_FDT_SIZE
--
2.26.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-04 7:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 7:28 [PATCH 0/6] add ima_arch support for ARM64 Chester Lin
2020-09-04 7:29 ` Chester Lin [this message]
2020-09-11 15:01 ` [PATCH 1/6] efistub: pass uefi secureboot flag via fdt params Ard Biesheuvel
2020-09-14 8:05 ` Chester Lin
2020-10-05 2:20 ` Chester Lin
2020-10-12 8:20 ` Ard Biesheuvel
2020-09-04 7:29 ` [PATCH 2/6] efi/arm: a helper to parse secure boot param in " Chester Lin
2020-09-04 7:29 ` [PATCH 3/6] efi: add secure boot flag Chester Lin
2020-09-04 7:29 ` [PATCH 4/6] efi/arm: check secure boot status in efi init Chester Lin
2020-09-04 7:29 ` [PATCH 5/6] arm64/ima: add ima arch support Chester Lin
2020-09-04 11:47 ` Mimi Zohar
2020-09-04 7:29 ` [PATCH 6/6] docs/arm: add the description of uefi-secure-boot param Chester Lin
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=20200904072905.25332-2-clin@suse.com \
--to=clin@suse.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=dmitry.kasatkin@gmail.com \
--cc=jlee@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mingo@kernel.org \
--cc=samitolvanen@google.com \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
--cc=zohar@linux.ibm.com \
/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).