[edk2-devel] [PATCH v3 17/35] OvmfPkg/XenPlatformPei: Reinit XenHypercallLib

Anthony PERARD posted 35 patches 5 years, 4 months ago
There is a newer version of this series
[edk2-devel] [PATCH v3 17/35] OvmfPkg/XenPlatformPei: Reinit XenHypercallLib
Posted by Anthony PERARD 5 years, 4 months ago
The XenPlatformPei needs to make hypercalls, but the XenHypercallLib was
initialised before the HyperPage was ready. Now that XenPlatformPei has
initialised the HyperPage, reinitialise the XenHypercallLib.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v3:
    - new patch split from XenHypercallLib: Enable it in PEIM.
    - check for Lib initialisation failure.

 OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 1 +
 OvmfPkg/XenPlatformPei/Xen.c              | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
index 4d00206d09..0ef77db92c 100644
--- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
+++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
@@ -59,6 +59,7 @@ [LibraryClasses]
   MtrrLib

   MemEncryptSevLib

   PcdLib

+  XenHypercallLib

 

 [Pcd]

   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase

diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
index c5293498c4..877d776de8 100644
--- a/OvmfPkg/XenPlatformPei/Xen.c
+++ b/OvmfPkg/XenPlatformPei/Xen.c
@@ -26,6 +26,7 @@
 #include <Library/ResourcePublicationLib.h>

 #include <Library/MtrrLib.h>

 #include <IndustryStandard/Xen/arch-x86/hvm/start_info.h>

+#include <Library/XenHypercallLib.h>

 

 #include "Platform.h"

 #include "Xen.h"

@@ -88,6 +89,7 @@ XenConnect (
   EFI_XEN_OVMF_INFO *Info;

   CHAR8 Sig[sizeof (Info->Signature) + 1];

   UINT32 *PVHResetVectorData;

+  RETURN_STATUS Status;

 

   AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL);

   mXenInfo.HyperPages = AllocatePages (TransferPages);

@@ -152,6 +154,13 @@ XenConnect (
     sizeof(mXenInfo)

     );

 

+  //

+  // Initialize the XenHypercall library, now that the XenInfo HOB is

+  // available

+  //

+  Status = XenHypercallLibInit ();

+  ASSERT_RETURN_ERROR (Status);

+

   return EFI_SUCCESS;

 }

 

-- 
Anthony PERARD


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43300): https://edk2.groups.io/g/devel/message/43300
Mute This Topic: https://groups.io/mt/32308724/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v3 17/35] OvmfPkg/XenPlatformPei: Reinit XenHypercallLib
Posted by Laszlo Ersek 5 years, 4 months ago
On 07/04/19 16:42, Anthony PERARD wrote:
> The XenPlatformPei needs to make hypercalls, but the XenHypercallLib was
> initialised before the HyperPage was ready. Now that XenPlatformPei has
> initialised the HyperPage, reinitialise the XenHypercallLib.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     v3:
>     - new patch split from XenHypercallLib: Enable it in PEIM.
>     - check for Lib initialisation failure.
> 
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf | 1 +
>  OvmfPkg/XenPlatformPei/Xen.c              | 9 +++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
> index 4d00206d09..0ef77db92c 100644
> --- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
> +++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
> @@ -59,6 +59,7 @@ [LibraryClasses]
>    MtrrLib
>    MemEncryptSevLib
>    PcdLib
> +  XenHypercallLib
>  
>  [Pcd]
>    gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase
> diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
> index c5293498c4..877d776de8 100644
> --- a/OvmfPkg/XenPlatformPei/Xen.c
> +++ b/OvmfPkg/XenPlatformPei/Xen.c
> @@ -26,6 +26,7 @@
>  #include <Library/ResourcePublicationLib.h>
>  #include <Library/MtrrLib.h>
>  #include <IndustryStandard/Xen/arch-x86/hvm/start_info.h>
> +#include <Library/XenHypercallLib.h>
>  
>  #include "Platform.h"
>  #include "Xen.h"
> @@ -88,6 +89,7 @@ XenConnect (
>    EFI_XEN_OVMF_INFO *Info;
>    CHAR8 Sig[sizeof (Info->Signature) + 1];
>    UINT32 *PVHResetVectorData;
> +  RETURN_STATUS Status;
>  
>    AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL);
>    mXenInfo.HyperPages = AllocatePages (TransferPages);
> @@ -152,6 +154,13 @@ XenConnect (
>      sizeof(mXenInfo)
>      );
>  
> +  //
> +  // Initialize the XenHypercall library, now that the XenInfo HOB is
> +  // available
> +  //
> +  Status = XenHypercallLibInit ();
> +  ASSERT_RETURN_ERROR (Status);
> +
>    return EFI_SUCCESS;
>  }
>  
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43406): https://edk2.groups.io/g/devel/message/43406
Mute This Topic: https://groups.io/mt/32308724/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-