[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen 4.12.0 Dom0=pvh mode EFI variables 'not supported' after boot



Thx.

not ignoring you -- opensuse kernel build system is having a hissy-fit atm; builds are failing. :-/

if I can't get it to behave a build a nice pkg for me, I'll work on a manual spin.




On 4/17/19 5:05 AM, Roger Pau Monné wrote:
On Tue, Apr 16, 2019 at 12:50:43PM +0200, Roger Pau Monné wrote:
Adding the Linux Xen maintainers, in case they can provide some insight.

On Mon, Apr 15, 2019 at 03:27:43PM -0700, PGNet Dev wrote:
ref: from chat in #xen

        [08:53] <royger> pgnd: would be good to send an email so we can keep 
track of this in a more formal way.

I've got Xen PV Dom0 booted on a Linux UEFI box

        dmesg | grep -i "xen version"
                [    1.185996] Xen version: 4.12.0_09-lp150.640 (preserve-AD)

        uname -rm
                5.0.7-lp150.5.g012b5f1-default x86_64

        lsb_release -rd
                Description:    openSUSE Leap 15.0
                Release:        15.0

        rpm -qa | grep -i qemu | egrep "seabios|u-3"
                qemu-seabios-1.12.0-lp150.513.13.noarch
                qemu-3.1.0-lp150.513.13.x86_64

        rpm -qa | grep -i ovmf
                ovmf-tools-2019+git1552059899.89910a39dcfd-lp150.100.3.x86_64
                
qemu-ovmf-x86_64-2019+git1552059899.89910a39dcfd-lp150.100.3.noarch
                ovmf-2019+git1552059899.89910a39dcfd-lp150.100.3.x86_64

        rpm -qa | grep grub2 |egrep "xen|efi"
                grub2-x86_64-efi-2.02-lp150.64.10.noarch
                grub2-x86_64-xen-2.02-lp150.64.10.noarch
&

        rpm -qa | grep -i efi | grep git | sort
                efibootmgr-999.git.20190306.438ba96-lp150.7.22.x86_64
                efivar-devel-999.git.20190305.836461e-lp150.6.21.x86_64
                libefivar1-999.git.20190305.836461e-lp150.6.21.x86_64

note these^^ EFI* tools -- src from efi master branch, pkgs available here,

        https://build.opensuse.org/package/show/home:pgnd:Kernel:stable/efivar
        
https://build.opensuse.org/package/show/home:pgnd:Kernel:stable/efibootmgr

-- were needed, as distro packaged versions' were old/problematic ...

With this^^ config, all's well

        serial boot log
                ...
                [    0.000000] efi: EFI v2.31 by American Megatrends
                [    0.000000] efi:  ESRT=0x9ef8d998  ACPI 2.0=0x9e819000  
ACPI=0x9e819000  SMBIOS=0xf04c0  MPS=0xfd490
                [    0.000000] SMBIOS 2.7 present.
                [    0.000000] Hypervisor detected: Xen PV
                [    0.000000] Xen version 4.12.
                ...

at shell prompt,

        xl list
                Name                                        ID   Mem VCPUs      
State   Time(s)
                Domain-0                                     0  4016     4     
r-----    5949.6
                Xenstore                                     1    31     1     
-b----       0.2

        efibootmgr -v
                BootCurrent: 0000
                Timeout: 1 seconds
                BootOrder: 0000
                Boot0000* openSUSE-pgnXEN 
HD(2,GPT,98026223-f11d-3c68-8d30-3f9856c8c21e,0x1000,0x96000)/File(\EFI\opensuse\grubx64.efi)
                      dp: 04 01 2a ... 04 00

enabling PVH Dom0, adding to grub configs,

        GRUB_CMDLINE_LINUX_XEN_REPLACE="... intel_iommu=on ..."
        GRUB_CMDLINE_XEN="... dom0=pvh dom0-iommu=map-reserved ..."

then mkinitrd & grub reconfig,

        serial boot log
                Xen 4.12.0_09-lp150.640 (c/s ) EFI loader
                ...
                (XEN) [00000027dcded44e] Bootloader: EFI
                ...
                Using configuration file 'xen-4.12.0_09-lp150.640.cfg'
                ...
                [    0.000000] BIOS-e820: [mem 
0x0000000100000000-0x000000016a2acfff] usable
                [    0.000000] BIOS-e820: [mem 
0x000000016a2ad000-0x000000085dffffff] unusable
                [    0.000000] NX (Execute Disable) protection: active
                [    0.000000] SMBIOS 2.7 present.
                [    0.000000] Hypervisor detected: Xen HVM
                [    0.000000] Xen version 4.12.
                ...

Note, there is NO "efi: ..." log content, as in the prior, PV mode example.

at shell prompt,

        xl list
                Name                                        ID   Mem VCPUs      
State   Time(s)
                Domain-0                                     0  4015     4     
r-----     563.0
                Xenstore                                     1    31     1     
-b----       0.0

but, in this Dom0=pvh mode,

        efibootmgr -v
                EFI variables are not supported on this system.

So boot works as expected, it's just interaction with the EFI firmware
by dom0 that seems to be broken. I'm currently setting up a Linux EFI
box to test this, thanks for the report.

I've managed to reproduce this, and have a patch for the Linux kernel
for you to try. If you can give it a try and report back whether if
fixes the issue that would be appreciated.

Thanks, Roger.

---8<---
diff --git a/arch/x86/platform/pvh/enlighten.c 
b/arch/x86/platform/pvh/enlighten.c
index 62f5c7045944..a748d2ea2d90 100644
--- a/arch/x86/platform/pvh/enlighten.c
+++ b/arch/x86/platform/pvh/enlighten.c
@@ -11,6 +11,7 @@
  #include <asm/xen/interface.h>
#include <xen/xen.h>
+#include <xen/xen-ops.h>
  #include <xen/interface/hvm/start_info.h>
/*
@@ -44,8 +45,6 @@ void __init __weak mem_map_via_hcall(struct boot_params *ptr 
__maybe_unused)
static void __init init_pvh_bootparams(bool xen_guest)
  {
-       memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
-
        if ((pvh_start_info.version > 0) && (pvh_start_info.memmap_entries)) {
                struct hvm_memmap_table_entry *ep;
                int i;
@@ -111,8 +110,10 @@ void __init __weak xen_pvh_init(void)
static void hypervisor_specific_init(bool xen_guest)
  {
-       if (xen_guest)
+       if (xen_guest) {
                xen_pvh_init();
+               xen_efi_init(&pvh_bootparams);
+       }
  }
/*
@@ -131,6 +132,8 @@ void __init xen_prepare_pvh(void)
                BUG();
        }
+ memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
+
        hypervisor_specific_init(xen_guest);
init_pvh_bootparams(xen_guest);
diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index 1fbb629a9d78..0d3365cb64de 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -158,7 +158,7 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
        return efi_secureboot_mode_unknown;
  }
-void __init xen_efi_init(void)
+void __init xen_efi_init(struct boot_params *boot_params)
  {
        efi_system_table_t *efi_systab_xen;
@@ -167,12 +167,12 @@ void __init xen_efi_init(void)
        if (efi_systab_xen == NULL)
                return;
- strncpy((char *)&boot_params.efi_info.efi_loader_signature, "Xen",
-                       sizeof(boot_params.efi_info.efi_loader_signature));
-       boot_params.efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
-       boot_params.efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 
32);
+       strncpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
+                       sizeof(boot_params->efi_info.efi_loader_signature));
+       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 = xen_efi_get_secureboot();
+       boot_params->secure_boot = xen_efi_get_secureboot();
set_bit(EFI_BOOT, &efi.flags);
        set_bit(EFI_PARAVIRT, &efi.flags);
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index c54a493e139a..4722ba2966ac 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1403,7 +1403,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
        /* We need this for printk timestamps */
        xen_setup_runstate_info(0);
- xen_efi_init();
+       xen_efi_init(&boot_params);
/* Start the world */
  #ifdef CONFIG_X86_32
diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c
index 35b7599d2d0b..69438fc32df5 100644
--- a/arch/x86/xen/enlighten_pvh.c
+++ b/arch/x86/xen/enlighten_pvh.c
@@ -27,6 +27,11 @@ void __init xen_pvh_init(void)
        u64 pfn;
xen_pvh = 1;
+       /*
+        * NB: xen_domain_type must be set to HVM or else xen_domain()
+        * returns false.
+        */
+       xen_domain_type = XEN_HVM_DOMAIN;
        xen_start_flags = pvh_start_info.flags;
msr = cpuid_ebx(xen_cpuid_base() + 2);
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 0e60bd918695..357eb3fa2144 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -121,14 +121,6 @@ static inline void __init xen_init_vga(const struct 
dom0_vga_console_info *info,
void __init xen_init_apic(void); -#ifdef CONFIG_XEN_EFI
-extern void xen_efi_init(void);
-#else
-static inline void __init xen_efi_init(void)
-{
-}
-#endif
-
  __visible void xen_irq_enable_direct(void);
  __visible void xen_irq_disable_direct(void);
  __visible unsigned long xen_save_fl_direct(void);
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 4969817124a8..51ef98e96d88 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -209,6 +209,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void 
**vaddr,
bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); +#ifdef CONFIG_XEN_EFI
  efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
  efi_status_t xen_efi_set_time(efi_time_t *tm);
  efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
@@ -233,7 +234,12 @@ efi_status_t 
xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
                                        int *reset_type);
  void xen_efi_reset_system(int reset_type, efi_status_t status,
                          unsigned long data_size, efi_char16_t *data);
-
+extern void xen_efi_init(struct boot_params *boot_params);
+#else
+static inline void __init xen_efi_init(struct boot_params *boot_params)
+{
+}
+#endif
#ifdef CONFIG_PREEMPT


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.