public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
@ 2022-12-19 16:36 Anthony PERARD
  2022-12-20  7:25 ` [edk2-devel] " Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony PERARD @ 2022-12-19 16:36 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann,
	Anthony PERARD

From: Anthony PERARD <anthony.perard@citrix.com>

Copy the function BuildPlatformInfoHob() from OvmfPkg/PlatformPei.

QemuFwCfgLib expect this HOB to be present, or fails to do anything.
InternalQemuFwCfgIsAvailable() from QemuFwCfgPeiLib module will not
check if the HOB is actually present for example and try to use a NULL
pointer.

Fixes: cda98df16228 ("OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 OvmfPkg/XenPlatformPei/Platform.h |  1 +
 OvmfPkg/XenPlatformPei/Platform.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Platform.h
index 039af50ffa32..7b4de128e713 100644
--- a/OvmfPkg/XenPlatformPei/Platform.h
+++ b/OvmfPkg/XenPlatformPei/Platform.h
@@ -12,6 +12,7 @@
 #define _PLATFORM_PEI_H_INCLUDED_
 
 #include <IndustryStandard/E820.h>
+#include <Library/PlatformInitLib.h>
 
 VOID
 AddIoMemoryBaseSizeHob (
diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c
index 2d97a41ca78e..6c1886c158b5 100644
--- a/OvmfPkg/XenPlatformPei/Platform.c
+++ b/OvmfPkg/XenPlatformPei/Platform.c
@@ -17,6 +17,7 @@
 //
 // The Library classes this module consumes
 //
+#include <Library/BaseMemoryLib.h>
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
 #include <Library/HobLib.h>
@@ -409,6 +410,20 @@ DebugDumpCmos (
   }
 }
 
+EFI_HOB_PLATFORM_INFO *
+BuildPlatformInfoHob (
+  VOID
+  )
+{
+  EFI_HOB_PLATFORM_INFO  PlatformInfoHob;
+  EFI_HOB_GUID_TYPE      *GuidHob;
+
+  ZeroMem (&PlatformInfoHob, sizeof PlatformInfoHob);
+  BuildGuidDataHob (&gUefiOvmfPkgPlatformInfoGuid, &PlatformInfoHob, sizeof (EFI_HOB_PLATFORM_INFO));
+  GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+  return (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
+}
+
 /**
   Perform Platform PEI initialization.
 
@@ -429,6 +444,11 @@ InitializeXenPlatform (
 
   DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
 
+  //
+  // Platform Info HOB used by QemuFw libraries
+  //
+  BuildPlatformInfoHob ();
+
   DebugDumpCmos ();
 
   if (!XenDetect ()) {
-- 
Anthony PERARD


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
  2022-12-19 16:36 [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei Anthony PERARD
@ 2022-12-20  7:25 ` Gerd Hoffmann
  2022-12-21  8:12   ` Yao, Jiewen
       [not found]   ` <1732C0C7E7695AF7.27785@groups.io>
  0 siblings, 2 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2022-12-20  7:25 UTC (permalink / raw)
  To: devel, anthony.perard; +Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen

On Mon, Dec 19, 2022 at 04:36:20PM +0000, Anthony PERARD via groups.io wrote:
> From: Anthony PERARD <anthony.perard@citrix.com>
> 
> Copy the function BuildPlatformInfoHob() from OvmfPkg/PlatformPei.
> 
> QemuFwCfgLib expect this HOB to be present, or fails to do anything.
> InternalQemuFwCfgIsAvailable() from QemuFwCfgPeiLib module will not
> check if the HOB is actually present for example and try to use a NULL
> pointer.
> 
> Fixes: cda98df16228 ("OvmfPkg/QemuFwCfgLib: remove mQemuFwCfgSupported + mQemuFwCfgDmaSupported")
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

You might also consider moving global variables to the PlatformInfoHob
or use PlatformInitLib functions instead of your own copy or both.

take care,
  Gerd


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
  2022-12-20  7:25 ` [edk2-devel] " Gerd Hoffmann
@ 2022-12-21  8:12   ` Yao, Jiewen
       [not found]   ` <1732C0C7E7695AF7.27785@groups.io>
  1 sibling, 0 replies; 4+ messages in thread
From: Yao, Jiewen @ 2022-12-21  8:12 UTC (permalink / raw)
  To: Gerd Hoffmann, devel@edk2.groups.io, anthony.perard@citrix.com
  Cc: Ard Biesheuvel, Justen, Jordan L

Acked-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Tuesday, December 20, 2022 3:26 PM
> To: devel@edk2.groups.io; anthony.perard@citrix.com
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen
> <jiewen.yao@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>
> Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info
> HOB in XenPlatformPei
> 
> On Mon, Dec 19, 2022 at 04:36:20PM +0000, Anthony PERARD via groups.io
> wrote:
> > From: Anthony PERARD <anthony.perard@citrix.com>
> >
> > Copy the function BuildPlatformInfoHob() from OvmfPkg/PlatformPei.
> >
> > QemuFwCfgLib expect this HOB to be present, or fails to do anything.
> > InternalQemuFwCfgIsAvailable() from QemuFwCfgPeiLib module will not
> > check if the HOB is actually present for example and try to use a NULL
> > pointer.
> >
> > Fixes: cda98df16228 ("OvmfPkg/QemuFwCfgLib: remove
> mQemuFwCfgSupported + mQemuFwCfgDmaSupported")
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> You might also consider moving global variables to the PlatformInfoHob
> or use PlatformInitLib functions instead of your own copy or both.
> 
> take care,
>   Gerd


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei
       [not found]   ` <1732C0C7E7695AF7.27785@groups.io>
@ 2022-12-21  8:54     ` Yao, Jiewen
  0 siblings, 0 replies; 4+ messages in thread
From: Yao, Jiewen @ 2022-12-21  8:54 UTC (permalink / raw)
  To: devel@edk2.groups.io, Yao, Jiewen, Gerd Hoffmann,
	anthony.perard@citrix.com
  Cc: Ard Biesheuvel, Justen, Jordan L

Merged https://github.com/tianocore/edk2/pull/3814

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao,
> Jiewen
> Sent: Wednesday, December 21, 2022 4:13 PM
> To: Gerd Hoffmann <kraxel@redhat.com>; devel@edk2.groups.io;
> anthony.perard@citrix.com
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Justen, Jordan L
> <jordan.l.justen@intel.com>
> Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info
> HOB in XenPlatformPei
> 
> Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
> 
> > -----Original Message-----
> > From: Gerd Hoffmann <kraxel@redhat.com>
> > Sent: Tuesday, December 20, 2022 3:26 PM
> > To: devel@edk2.groups.io; anthony.perard@citrix.com
> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Yao, Jiewen
> > <jiewen.yao@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>
> > Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfXen: Build platform
> info
> > HOB in XenPlatformPei
> >
> > On Mon, Dec 19, 2022 at 04:36:20PM +0000, Anthony PERARD via groups.io
> > wrote:
> > > From: Anthony PERARD <anthony.perard@citrix.com>
> > >
> > > Copy the function BuildPlatformInfoHob() from OvmfPkg/PlatformPei.
> > >
> > > QemuFwCfgLib expect this HOB to be present, or fails to do anything.
> > > InternalQemuFwCfgIsAvailable() from QemuFwCfgPeiLib module will not
> > > check if the HOB is actually present for example and try to use a NULL
> > > pointer.
> > >
> > > Fixes: cda98df16228 ("OvmfPkg/QemuFwCfgLib: remove
> > mQemuFwCfgSupported + mQemuFwCfgDmaSupported")
> > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> >
> > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
> >
> > You might also consider moving global variables to the PlatformInfoHob
> > or use PlatformInitLib functions instead of your own copy or both.
> >
> > take care,
> >   Gerd
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-21  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 16:36 [PATCH 1/1] OvmfPkg/OvmfXen: Build platform info HOB in XenPlatformPei Anthony PERARD
2022-12-20  7:25 ` [edk2-devel] " Gerd Hoffmann
2022-12-21  8:12   ` Yao, Jiewen
     [not found]   ` <1732C0C7E7695AF7.27785@groups.io>
2022-12-21  8:54     ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox