mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 12:54:09 +07:00
72813bfbf0
This involves initializing the boot params EFI related fields and the efi global variable. Without this fix a PVH dom0 doesn't detect when booted from EFI, and thus doesn't support accessing any of the EFI related data. Reported-by: PGNet Dev <pgnet.dev@gmail.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: stable@vger.kernel.org # 4.19+
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/acpi.h>
|
|
|
|
#include <xen/hvc-console.h>
|
|
|
|
#include <asm/io_apic.h>
|
|
#include <asm/hypervisor.h>
|
|
#include <asm/e820/api.h>
|
|
|
|
#include <xen/xen.h>
|
|
#include <asm/xen/interface.h>
|
|
#include <asm/xen/hypercall.h>
|
|
|
|
#include <xen/interface/memory.h>
|
|
|
|
#include "xen-ops.h"
|
|
|
|
/*
|
|
* PVH variables.
|
|
*
|
|
* The variable xen_pvh needs to live in the data segment since it is used
|
|
* after startup_{32|64} is invoked, which will clear the .bss segment.
|
|
*/
|
|
bool xen_pvh __attribute__((section(".data"))) = 0;
|
|
|
|
void __init xen_pvh_init(struct boot_params *boot_params)
|
|
{
|
|
u32 msr;
|
|
u64 pfn;
|
|
|
|
xen_pvh = 1;
|
|
xen_domain_type = XEN_HVM_DOMAIN;
|
|
xen_start_flags = pvh_start_info.flags;
|
|
|
|
msr = cpuid_ebx(xen_cpuid_base() + 2);
|
|
pfn = __pa(hypercall_page);
|
|
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
|
|
|
|
xen_efi_init(boot_params);
|
|
}
|
|
|
|
void __init mem_map_via_hcall(struct boot_params *boot_params_p)
|
|
{
|
|
struct xen_memory_map memmap;
|
|
int rc;
|
|
|
|
memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
|
|
set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
|
|
rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
|
|
if (rc) {
|
|
xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
|
|
BUG();
|
|
}
|
|
boot_params_p->e820_entries = memmap.nr_entries;
|
|
}
|