[edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
Ni, Ray
ray.ni at intel.com
Fri Feb 3 13:31:17 UTC 2023
I think we need to define a new chunk hob type for solution proposed by Gerd.
I will leave that to PIWG (PI spec working group) for discussion.
In this topic, I prefer to solve the problem in the CPU domain.
> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu at intel.com>
> Sent: Friday, February 3, 2023 9:23 PM
> To: kraxel at redhat.com; Ni, Ray <ray.ni at intel.com>
> Cc: Johnson, Brian <brian.johnson at hpe.com>; devel at edk2.groups.io; Laszlo
> Ersek <lersek at redhat.com>; Dong, Eric <eric.dong at intel.com>; Zeng, Star
> <star.zeng at intel.com>; Kumar, Rahul R <rahul.r.kumar at intel.com>; Kinney,
> Michael D <michael.d.kinney at intel.com>; Zimmer, Vincent
> <vincent.zimmer at intel.com>
> Subject: RE: [edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add SMM
> Base HOB Data
>
> Hi Gerd,
>
> Is it still the solution with multiple hobs created for big data but you want the
> hob splitting and reassembling can be encapsulated in the Hoblib?
>
> Does it need define the new hob type for chunk?
>
> Thanks,
> Jiaxin
>
> > -----Original Message-----
> > From: kraxel at redhat.com <kraxel at redhat.com>
> > Sent: Friday, February 3, 2023 3:55 PM
> > To: Ni, Ray <ray.ni at intel.com>
> > Cc: Johnson, Brian <brian.johnson at hpe.com>; devel at edk2.groups.io; Laszlo
> > Ersek <lersek at redhat.com>; Wu, Jiaxin <jiaxin.wu at intel.com>; Dong, Eric
> > <eric.dong at intel.com>; Zeng, Star <star.zeng at intel.com>; Kumar, Rahul R
> > <rahul.r.kumar at intel.com>; Kinney, Michael D <michael.d.kinney at intel.com>;
> > Zimmer, Vincent <vincent.zimmer at intel.com>
> > Subject: Re: [edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add
> > SMM Base HOB Data
> >
> > On Fri, Feb 03, 2023 at 03:14:42AM +0000, Ni, Ray wrote:
> > > Gerd,
> > > Can you please explain a bit more on the chunk idea?
> >
> > > > > to introduce a generic and reusable concept of chunked HOBs, so you
> can
> > > > > add helper functions to HobLib for splitting and reassembling, with a
> > > > > struct along the lines of:
> > > > >
> > > > > typedef struct {
> > > > > // offset and size of this particular chunk
> > > > > UINT32 ChunkOffset;
> > > > > UINT32 ChunkSize;
> > > > >
> > > > > // number of chunks and size of all chunks combined.
> > > > > UINT32 ChunkCount;
> > > > > UINT32 TotalSize;
> > > > >
> > > > > // chunk data
> > > > > UINT8 Data[0];
> > > > > } EFI_HOB_CHUNK;
> >
> > Reassembling would work like this:
> >
> > // once
> > AssembledHob = malloc(HobChunk->TotalSize);
> >
> > // for each chunk
> > memcpy(AssembledHob + HobChunk->ChunkOffset, HobChunk->Data,
> > HobChunk->ChunkSize);
> >
> > Possible shortcut:
> >
> > if (HobChunk->ChunkSize == HobChunk->TotalSize)
> > // data is not splitted into multiple chunks
> > AssembledHob = HobChunk->Data
> >
> > Advantage: you avoid the allocation in case the data fits into a single
> > HOB. Disadvantage: you need to track whenever AssembledHob is allocated
> > (and must eventually be freed) or not.
> >
> > HobChunk->ChunkCount is not really needed but might be useful for sanity
> > checking.
> >
> > take care,
> > Gerd
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99596): https://edk2.groups.io/g/devel/message/99596
Mute This Topic: https://groups.io/mt/96350760/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list