public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"kraxel@redhat.com" <kraxel@redhat.com>
Cc: "thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"Aktas, Erdem" <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg: Reserve the Ovmf work area as RT_DATA
Date: Thu, 25 Aug 2022 07:56:50 +0000	[thread overview]
Message-ID: <PH0PR11MB5064A7E763C44169E0468DD5C5729@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220825074223.qrjhfb5fcixtgq3a@sirius.home.kraxel.org>

On August 25, 2022 3:42 PM, Gerd Hoffmann wrote:
>   Hi,
> 
> > > Runtime service call are restricted so that you don't have
> > > concurrent threads executing (see section 8.1 of the specification).
> > > Without that you would have problems with runtime services today.
> > >
> > One of the situation of CcProbe used is in BaseIoLib.
> > https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseIoLib
> > Intrinsic/IoLibInternalTdx.c#L35-L40
> >
> > BaseIoLib is a basic library and it may be called by APs. While dynamic PCD
> access is not allowed in APs. Of course we can cache the PCD in a variable but
> I think it is still not safe.
> >
> > Reserving the OVMF work area as RT_DATA breaks the original intention of
> the design.
> >
> > Then how about this solution?
> > https://edk2.groups.io/g/devel/message/91132
> > We can design 2 instances of CcProbe. One is to read the OvmfWorkArea.
> The other is to call Cc guest specific way to determine the type.
> 
> When using RT_DATA is out of question there is no way around two instances
> I think.
> 
> I don't see the point in reinventing the wheel though.  We know what the
> guest type is, why determine it *again*?  We only need to copy the guest type
> from the work area to another place before it is gone.  I think the dxe library
> instance could copy it to a variable in the init function.
> 
As I mentioned CcProbe is used in BaseIoLib which is a basic library and it is used in SEC/PEI/DXE phases. Global variable cannot be used in SEC phase. Unless BaseIoLib is split into 2 instance, one for SEC/PEI phase, the other for DXE phase. 
Gerd, do you mean this solution?

Or there is another solution based on https://edk2.groups.io/g/devel/message/91132
We can design 2 instances of CcProbe. One is to read the OvmfWorkArea. This is for SEC/PEI phase.
The other is to save the guest type in Ovmf work area to a global variable in its init function. This is for DXE phase.

Thanks
Min


  reply	other threads:[~2022-08-25  7:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22  2:23 [PATCH 1/1] OvmfPkg: Reserve the Ovmf work area as RT_DATA Min Xu
2022-08-22  8:51 ` Gerd Hoffmann
2022-08-23  1:34   ` Min Xu
2022-08-23  7:37     ` Gerd Hoffmann
2022-08-23  8:40       ` Min Xu
2022-08-23 13:07         ` Lendacky, Thomas
2022-08-25  5:47           ` [edk2-devel] " Min Xu
2022-08-25  7:42             ` Gerd Hoffmann
2022-08-25  7:56               ` Min Xu [this message]
2022-08-25  8:15                 ` Gerd Hoffmann
2022-08-22 13:18 ` Lendacky, Thomas
2022-08-23  1:38   ` Min Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR11MB5064A7E763C44169E0468DD5C5729@PH0PR11MB5064.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox