From: "Lendacky, Thomas" <thomas.lendacky@amd.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
"Xu, Min M" <min.m.xu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Brijesh Singh <brijesh.singh@amd.com>,
"Aktas, Erdem" <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>
Subject: Re: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver
Date: Tue, 19 Apr 2022 08:23:50 -0500 [thread overview]
Message-ID: <d2d596cd-d22f-9cee-953d-fa1146b09549@amd.com> (raw)
In-Reply-To: <MW4PR11MB58723A7034BD220F5AD6C11B8CF29@MW4PR11MB5872.namprd11.prod.outlook.com>
On 4/18/22 23:47, Yao, Jiewen wrote:
> Can SEV clear the C-bit in SEC phase?
Not really. IIRC, even if cleared in the SEC phase, the DXE phase replaces
the page tables and it has to be cleared again.
Thanks,
Tom
>
> I think that is right way to ensure PCI Express can always be accessed by anyone.
>
>
>> -----Original Message-----
>> From: Xu, Min M <min.m.xu@intel.com>
>> Sent: Tuesday, April 19, 2022 12:39 PM
>> To: Yao, Jiewen <jiewen.yao@intel.com>; devel@edk2.groups.io
>> Cc: Brijesh Singh <brijesh.singh@amd.com>; Aktas, Erdem
>> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Tom
>> Lendacky <thomas.lendacky@amd.com>
>> Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver
>>
>> In AmdSevDxe's entry point it clears the C-bit from PcdPciExpressBaseAddress
>> and other memory spaces if needed. Please see
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2Fmaster%2FOvmfPkg%2FAmdSevDxe%2FAmdSev&data=04%7C01%7Cthomas.lendacky%40amd.com%7Cc39c49fd4e944900bdb708da21bfac91%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637859404370071519%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9sxJnGXyaiHTdIzS%2BTzziBnwTAsKvSLFRMmHT4HGe60%3D&reserved=0
>> Dxe.c#L81-L95. After that OVMF can use PCI express.
>>
>> This broken is caused by the call sequence of TdxDxe driver and AmdSevDxe
>> driver. Currently TdxDxe driver is loaded before AmdSevDxe, so in SEV-ES guest
>> the C-bit of PcdPciExpressBaseAddress hasn't been cleared. In this situation the
>> access to PciExpressBaseAddress trigger exceptions (lib constructor in TdxDxe).
>>
>> There are 2 options to fix this issue.
>> 1. Adjust the load sequence of AmdSevDxe and TdxDxe (Load AmdSevDxe before
>> TdxDxe)
>> 2. Make TdxDxe to import BasePciLibCf8.inf instead of DxePciLibI440FxQ35.inf
>> (just like AmdSevDxe)
>>
>> Tom and I tested above 2 options in SEV and TDX and all work.
>>
>>> -----Original Message-----
>>> From: Yao, Jiewen <jiewen.yao@intel.com>
>>> Sent: Tuesday, April 19, 2022 12:16 PM
>>> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
>>> Cc: Brijesh Singh <brijesh.singh@amd.com>; Aktas, Erdem
>>> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Tom
>>> Lendacky <thomas.lendacky@amd.com>
>>> Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe driver
>>>
>>> Do you mean, with SEV introduced, OVMF cannot use PCI express any more?
>>>
>>> Thank you
>>> Yao Jiewen
>>>
>>>
>>>> -----Original Message-----
>>>> From: Xu, Min M <min.m.xu@intel.com>
>>>> Sent: Tuesday, April 19, 2022 11:05 AM
>>>> To: Yao, Jiewen <jiewen.yao@intel.com>; devel@edk2.groups.io
>>>> Cc: Brijesh Singh <brijesh.singh@amd.com>; Aktas, Erdem
>>>> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Tom
>>>> Lendacky <thomas.lendacky@amd.com>
>>>> Subject: RE: [edk2-devel] [PATCH] OvmfPkg: Set PciLib for TdxDxe
>>>> driver
>>>>
>>>> On April 19, 2022 10:54 AM, Yao Jiewen wrote:
>>>>>
>>>>> Why does TdxDxe call TdxMailbox in an SEV platform?
>>>>> Or why does TdxMailbox call SynchronizationLib in an SEV platform?
>>>>>
>>>> TdxDxe will not call TdxMailbox/SynchronizationLib in SEV platform.
>>>> The problem is in the lib constructor. When TdxDxe driver is loaded,
>>>> before its entry point is called, the lib constructors will be called even in a
>>> SEV platform.
>>>>>
>>>>> There are many places we can do CcProbe to stop action. Why we need
>>>>> do it in DSC?
>>>> So we cannot stop the lib constructor with CcProbe in this case.
>>>>
>>>> Thanks
>>>> Min
next prev parent reply other threads:[~2022-04-19 13:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 1:58 [PATCH] OvmfPkg: Set PciLib for TdxDxe driver Min Xu
2022-04-19 2:07 ` [edk2-devel] " Yao, Jiewen
2022-04-19 2:42 ` Min Xu
2022-04-19 2:54 ` Yao, Jiewen
2022-04-19 3:05 ` Min Xu
2022-04-19 4:15 ` Yao, Jiewen
2022-04-19 4:39 ` Min Xu
2022-04-19 4:47 ` Yao, Jiewen
2022-04-19 13:23 ` Lendacky, Thomas [this message]
[not found] ` <16E732CAB3014272.17418@groups.io>
2022-04-19 5:06 ` Yao, Jiewen
2022-04-21 16:12 ` Lendacky, Thomas
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=d2d596cd-d22f-9cee-953d-fa1146b09549@amd.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