mirror of https://github.com/acidanthera/audk.git
OvmfPkg/XenHypercallLib: Enable it in PEIM
Allow to use Xen hypercalls earlier, during the PEIM stage, but XenHypercallLibInit() must be called once the XenInfo HOB is created with the HyperPage setup. Change the return value of XenHypercallLibInit so failure can be detected when the call shouldn't fail, but still have the constructor always succeed. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20190813113119.14804-17-anthony.perard@citrix.com>
This commit is contained in:
parent
2a4a6242b7
commit
68f4599dfc
|
@ -10,6 +10,18 @@
|
||||||
#ifndef __XEN_HYPERCALL_LIB_H__
|
#ifndef __XEN_HYPERCALL_LIB_H__
|
||||||
#define __XEN_HYPERCALL_LIB_H__
|
#define __XEN_HYPERCALL_LIB_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
To call when the gEfiXenInfoGuid HOB became available after the library init
|
||||||
|
function has already been executed.
|
||||||
|
|
||||||
|
This allow to make hypercall in the PEIM stage.
|
||||||
|
**/
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
XenHypercallLibInit (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if the Xen Hypercall library is able to make calls to the Xen
|
Check if the Xen Hypercall library is able to make calls to the Xen
|
||||||
hypervisor.
|
hypervisor.
|
||||||
|
|
|
@ -59,13 +59,7 @@ XenHypercallLibInit (
|
||||||
|
|
||||||
GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
|
GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
|
||||||
if (GuidHob == NULL) {
|
if (GuidHob == NULL) {
|
||||||
//
|
return RETURN_NOT_FOUND;
|
||||||
// We don't fail library construction, since that has catastrophic
|
|
||||||
// consequences for client modules (whereas those modules may easily be
|
|
||||||
// running on a non-Xen platform). Instead, XenHypercallIsAvailable() above
|
|
||||||
// will return FALSE.
|
|
||||||
//
|
|
||||||
return RETURN_SUCCESS;
|
|
||||||
}
|
}
|
||||||
XenInfo = (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob);
|
XenInfo = (EFI_XEN_INFO *) GET_GUID_HOB_DATA (GuidHob);
|
||||||
HyperPage = XenInfo->HyperPages;
|
HyperPage = XenInfo->HyperPages;
|
||||||
|
|
|
@ -15,6 +15,22 @@
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/XenHypercallLib.h>
|
#include <Library/XenHypercallLib.h>
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
XenHypercallLibConstruct (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
XenHypercallLibInit ();
|
||||||
|
//
|
||||||
|
// We don't fail library construction, since that has catastrophic
|
||||||
|
// consequences for client modules (whereas those modules may easily be
|
||||||
|
// running on a non-Xen platform). Instead, XenHypercallIsAvailable()
|
||||||
|
// will return FALSE.
|
||||||
|
//
|
||||||
|
return RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
XenHypercallHvmGetParam (
|
XenHypercallHvmGetParam (
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
FILE_GUID = B5EE9A32-CA5A-49A8-82E3-ADA4CCB77C7C
|
FILE_GUID = B5EE9A32-CA5A-49A8-82E3-ADA4CCB77C7C
|
||||||
MODULE_TYPE = BASE
|
MODULE_TYPE = BASE
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
CONSTRUCTOR = XenHypercallLibInit
|
CONSTRUCTOR = XenHypercallLibConstruct
|
||||||
|
|
||||||
[Defines.IA32, Defines.X64]
|
[Defines.IA32, Defines.X64]
|
||||||
LIBRARY_CLASS = XenHypercallLib|DXE_DRIVER UEFI_DRIVER
|
LIBRARY_CLASS = XenHypercallLib|PEIM DXE_DRIVER UEFI_DRIVER
|
||||||
|
|
||||||
[Defines.ARM, Defines.AARCH64]
|
[Defines.ARM, Defines.AARCH64]
|
||||||
LIBRARY_CLASS = XenHypercallLib
|
LIBRARY_CLASS = XenHypercallLib
|
||||||
|
|
Loading…
Reference in New Issue