linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, xen-devel@lists.xenproject.org
Cc: ard.biesheuvel@linaro.org, boris.ostrovsky@oracle.com,
	hpa@zytor.com, jgross@suse.com, konrad.wilk@oracle.com,
	mingo@redhat.com, tglx@linutronix.de
Subject: [PATCH 2/4] x86/xen/efi: Initialize boot_params.secure_boot in xen_efi_init()
Date: Tue,  9 Jan 2018 15:22:23 +0100	[thread overview]
Message-ID: <1515507745-17391-3-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1515507745-17391-1-git-send-email-daniel.kiper@oracle.com>

Otherwise the kernel reports incorrect UEFI secure boot state in the Xen dom0.

By the way fix CFLAGS_mmu_pv.o assignment alignment.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 arch/x86/xen/Makefile |    4 +++-
 arch/x86/xen/efi.c    |   11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index d83cb54..1b07664 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -12,7 +12,9 @@ endif
 # Make sure early boot has no stackprotector
 nostackp := $(call cc-option, -fno-stack-protector)
 CFLAGS_enlighten_pv.o		:= $(nostackp)
-CFLAGS_mmu_pv.o		:= $(nostackp)
+CFLAGS_mmu_pv.o			:= $(nostackp)
+
+CFLAGS_efi.o			+= -I$(srctree)/drivers/firmware
 
 obj-y		:= enlighten.o multicalls.o mmu.o irq.o \
 			time.o xen-asm.o xen-asm_$(BITS).o \
diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index a18703b..e089fa7 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -28,6 +28,15 @@
 #include <asm/setup.h>
 #include <asm/xen/hypercall.h>
 
+#define pr_efi(sys_table, msg)
+#define pr_efi_err(sys_table, msg)
+
+#define get_efi_var(name, vendor, attr, data_size, data) \
+		xen_efi_get_variable((efi_char16_t *)name, (efi_guid_t *)vendor, \
+				     attr, data_size, data)
+
+#include <efi/libstub/secureboot-core.c>
+
 static efi_char16_t vendor[100] __initdata;
 
 static efi_system_table_t efi_systab_xen __initdata = {
@@ -129,6 +138,8 @@ void __init xen_efi_init(void)
 	boot_params.efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
 	boot_params.efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32);
 
+	boot_params.secure_boot = efi_get_secureboot(efi_systab_xen);
+
 	set_bit(EFI_BOOT, &efi.flags);
 	set_bit(EFI_PARAVIRT, &efi.flags);
 	set_bit(EFI_64BIT, &efi.flags);
-- 
1.7.10.4

  parent reply	other threads:[~2018-01-09 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 14:22 [PATCH 0/4] x86/xen/efi: Initialize UEFI secure boot state during dom0 boot Daniel Kiper
2018-01-09 14:22 ` [PATCH 1/4] efi/stub: Extract efi_get_secureboot() to separate file Daniel Kiper
2018-01-09 14:22 ` Daniel Kiper [this message]
2018-01-09 14:22 ` [PATCH 3/4] efi: Tweak efi_get_secureboot() and its data section assignment Daniel Kiper
2018-01-09 14:22 ` [PATCH 4/4] efi: Rename efi_get_secureboot() to __efi_get_secureboot() and make it static Daniel Kiper
2018-01-11 12:51 ` [PATCH 0/4] x86/xen/efi: Initialize UEFI secure boot state during dom0 boot Ard Biesheuvel
2018-01-12 11:24   ` Daniel Kiper
2018-01-23 19:23     ` 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=1515507745-17391-3-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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).