On Wed, Sep 08, 2021 at 13:33:51 +0200, Gerd Hoffmann wrote:
> On Wed, Sep 08, 2021 at 12:06:46PM +0100, Leif Lindholm wrote:
> > On Wed, Sep 08, 2021 at 11:01:11 +0200, Gerd Hoffmann wrote:
> > > Skip host bridge setup on microvm.
> > > 
> > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
> > > Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
> > > Acked-by: Jiewen Yao <jiewen....@intel.com>
> > > ---
> > >  OvmfPkg/PlatformPei/MemDetect.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/OvmfPkg/PlatformPei/MemDetect.c 
> > > b/OvmfPkg/PlatformPei/MemDetect.c
> > > index 2c2c4641ec8a..d736b85e0d90 100644
> > > --- a/OvmfPkg/PlatformPei/MemDetect.c
> > > +++ b/OvmfPkg/PlatformPei/MemDetect.c
> > > @@ -135,6 +135,10 @@ QemuUc32BaseInitialization (
> > >    UINT32 LowerMemorySize;
> > >    UINT32 Uc32Size;
> > >  
> > > +  if (mHostBridgeDevId == 0xffff /* microvm */) {
> > > +    return;
> > > +  }
> > > +
> > 
> > This, and the same conditional in the subsequent patch, weirds me out
> > a bit. This doesn't tell us we're on microvm, it tells us the device
> > ID is invalid.
> 
> Well, sort of, yes.  microvm doesn't support pci config space access via
> 0xcf8, so any attempt to read something there returns 0xff
> 
> > Since we know at compile-time that we want to skip this function,
> > could we achieve that some other way?
> 
> Sure.  Suggestions?  Add a Pcd and set it in Microvm.dsc?
> Or is there some better way?

It's all a question of how much we want to overengineer things :)

I'm tempted to suggest a balanced version would be adding
  GCC: *_*_*_CC_FLAGS = -D PLATFORM_IS_MICROVM
to [BuildOptions] in the .dsc, and test for that.

FixedPcds might be architecturally nicer, but should then probably be
a different one for each use-case.

/
    Leif


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80349): https://edk2.groups.io/g/devel/message/80349
Mute This Topic: https://groups.io/mt/85454885/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to