diff mbox series

[v5,20/35] OvmfPkg/XenPlatformPei: Introduce XenPvhDetected

Message ID 20190813113119.14804-21-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series Specific platform to run OVMF in Xen PVH and HVM guests | expand

Commit Message

Anthony PERARD Aug. 13, 2019, 11:31 a.m. UTC
XenPvhDetected() can be used to figure out if OVMF has started via the
Xen PVH entry point.

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

Notes:
    v5:
    - in XenPvhDetected, check mXenInfo.HyperPages instead of .VersionMajor

 OvmfPkg/XenPlatformPei/Platform.h |  5 +++++
 OvmfPkg/XenPlatformPei/Xen.c      | 13 +++++++++++++
 2 files changed, 18 insertions(+)

Comments

Laszlo Ersek Aug. 15, 2019, 8:54 a.m. UTC | #1
On 08/13/19 13:31, Anthony PERARD wrote:
> XenPvhDetected() can be used to figure out if OVMF has started via the
> Xen PVH entry point.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v5:
>     - in XenPvhDetected, check mXenInfo.HyperPages instead of .VersionMajor

Right, and that seems to address

http://mid.mail-archive.com/20190808104354.wcl2vicpmvbl3rlz@Air-de-Roger
https://edk2.groups.io/g/devel/message/45159

So my ACK stands.

Thanks
Laszlo

>  OvmfPkg/XenPlatformPei/Platform.h |  5 +++++
>  OvmfPkg/XenPlatformPei/Xen.c      | 13 +++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Platform.h
> index 4a80057bdc..db9a62572f 100644
> --- a/OvmfPkg/XenPlatformPei/Platform.h
> +++ b/OvmfPkg/XenPlatformPei/Platform.h
> @@ -99,6 +99,11 @@ XenHvmloaderDetected (
>    VOID
>    );
>  
> +BOOLEAN
> +XenPvhDetected (
> +  VOID
> +  );
> +
>  VOID
>  AmdSevInitialize (
>    VOID
> diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
> index 29b42b746c..f26f0e56dd 100644
> --- a/OvmfPkg/XenPlatformPei/Xen.c
> +++ b/OvmfPkg/XenPlatformPei/Xen.c
> @@ -214,6 +214,19 @@ XenHvmloaderDetected (
>    return (mXenHvmloaderInfo != NULL);
>  }
>  
> +BOOLEAN
> +XenPvhDetected (
> +  VOID
> +  )
> +{
> +  //
> +  // This function should only be used after XenConnect
> +  //
> +  ASSERT (mXenInfo.HyperPages != NULL);
> +
> +  return mXenHvmloaderInfo == NULL;
> +}
> +
>  VOID
>  XenPublishRamRegions (
>    VOID
>
diff mbox series

Patch

diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Platform.h
index 4a80057bdc..db9a62572f 100644
--- a/OvmfPkg/XenPlatformPei/Platform.h
+++ b/OvmfPkg/XenPlatformPei/Platform.h
@@ -99,6 +99,11 @@  XenHvmloaderDetected (
   VOID
   );
 
+BOOLEAN
+XenPvhDetected (
+  VOID
+  );
+
 VOID
 AmdSevInitialize (
   VOID
diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
index 29b42b746c..f26f0e56dd 100644
--- a/OvmfPkg/XenPlatformPei/Xen.c
+++ b/OvmfPkg/XenPlatformPei/Xen.c
@@ -214,6 +214,19 @@  XenHvmloaderDetected (
   return (mXenHvmloaderInfo != NULL);
 }
 
+BOOLEAN
+XenPvhDetected (
+  VOID
+  )
+{
+  //
+  // This function should only be used after XenConnect
+  //
+  ASSERT (mXenInfo.HyperPages != NULL);
+
+  return mXenHvmloaderInfo == NULL;
+}
+
 VOID
 XenPublishRamRegions (
   VOID