Port-xen archive

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

Re: Xen EFI bootstrap



Hi Emmanuel,

Emmanuel Dreyfus <manu%netbsd.org@localhost> writes:

> Hello
>
> Booting Xen from EFI requires the multiboot 2 protocol, which I 

I believe Xen has an EFI build - I'm not sure if we support it from
pkgsrc.

> implemented (but not yet commited) for our bootx64.efi. I have

Does this match with the non-efi multiboot method ?


[...]


> ACPI RSDP is supposed to be discovered in sys/sarch/x86/acpi/acpi_machdep.c
> There are two methods:
> 1) #ifndef XENPV, get it from EFI SystemTable
> 2) Otherwise search BIOS extended memory E0000-FFFFF
>

Have you considered using:
https://nxr.netbsd.org/xref/src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h#232

> Second method will not work with EFI boot, since E0000-FFFFF is not
> even mapped. The RSDP is somewhere else, and the EFI kernel is
> supposed to discover it from EFI system table. I can see that xen
> does find it:
> (XEN) System RAM: 252MB (258252kB)
> (XEN) ACPI: RSDP 0FBFA014, 0024 (r2 BOCHS )
>

Yes, I think the problem here is that Xen boots multiboot and is thus
unaware that it's come from the EFI environment and expects the dom0 to
just probe it as you describe. (I'm speculating here - a lot of the
xen<->dom0 'API' is adhoc and not formally specified).

> Hence we need to use first method, which means removing this #ifndef XENPV
> and building EFI code that let us access EFI SystemTable, in 
> src/sys/arch/x86/x86/efi.c:efi_getsystblpa()
>
> The physical address of the EFI SystemTable is obtained from bootinfo
> BTINFO_EFI, which is filled by bootx64.efi when booting NetBSD without
> Xen, but Xen does not provides it to the dom0.
>
> I assume there must be a way to ask the hypervisor about SystemTable
> address, but how? Any hint? 

What I would try is to use the xen efi method, and then use the platform
firmware info hypercall to find the efi table:
https://nxr.netbsd.org/xref/src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h#275

and then parse the EFI table for the RSDP etc.
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/uefi-requirements-that-apply-to-all-windows-platforms

(See: EFI_ACPI_Table GUID )

I hope this helps.

Cherry


Home | Main Index | Thread Index | Old Index