public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Brijesh Singh" <brijesh.singh@amd.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: brijesh.singh@amd.com, James Bottomley <jejb@linux.ibm.com>,
	"Xu, Min M" <min.m.xu@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Laszlo Ersek <lersek@redhat.com>,
	Erdem Aktas <erdemaktas@google.com>,
	"Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>,
	"Kumar, Rahul1" <rahul1.kumar@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	Michael Roth <Michael.Roth@amd.com>
Subject: Re: [edk2-devel] [RFC PATCH v4 00/27] Add AMD Secure Nested Paging (SEV-SNP) support
Date: Tue, 3 Aug 2021 10:01:16 -0500	[thread overview]
Message-ID: <3ea6b4f8-80e2-2f70-2880-d0666246db4b@amd.com> (raw)
In-Reply-To: <PH0PR11MB48851FE59DD11928BB7080A48CEB9@PH0PR11MB4885.namprd11.prod.outlook.com>



On 7/28/21 9:22 PM, Yao, Jiewen wrote:
> Hi Brijesh
> Thanks for the patient.
> Most of my comment focus on the *common* part, and *interface* between SEV and common code.
> I will leave you to decide the detailed SEV specific implementation.
> 

Thank you Jiewen for your feedback. I will try to address the comments 
in next version.

> 
> Patch-04:
> Can we use consistent naming conversion?
> We have PcdOvmfSecGhcbPageTableBase, PcdOvmfSecGhcbBase, PcdSevLaunchSecretBase. Now we are adding PcdOvmfSnpSecretsBase.
> Can we change PcdOvmfSnpSecretsBase to PcdSevSnpSecretsBase?
> Or we change PcdSevLaunchSecretBase to PcdOvmfSevLaunchSecretBase?

I don't know why we choose "Ovmf" from the LaunchSecretsBase PCD. I 
thought PCD's specific the Uefi typically contains the Ovmf name. Maybe 
we can fix the LaunchSecretsBase to match with the name. I will do that 
as a separate patch.

> 
> Patch-05:
> Ditto. Naming convention.
> 
> Patch-06:
> I have recommendation to Min, to separate SEV stuff to a standalone file from ResetVectorVtf0.asm.
> Intel can add TDX stuff to a standalone file, and make it included by ResetVectorVtf0.asm.
> 
> I am not sure if you want to do it, or you leave Min to do it.
> 

For the SEV stuff, I will do it myself so that I can test it as well :)

> Patch-07:
> Same naming convention issue. See #04 and #05.
> 
> Patch-08:
> I hope we can move all below code to AmdSev.asm, such as PostPageTableHookSev().
> Then the PageTable64.asm can be SEV/TDX agnostic.
> 
> I am not sure if you want to do it, or you leave Min to do it.
> 
> ==============
>      ;
>      ; Clear the encryption bit from the GHCB entry
>      ;
>      mov     ecx, (GHCB_BASE & 0x1F_FFFF) >> 12
>      mov     [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0
> 
>      mov     ecx, GHCB_SIZE / 4
>      xor     eax, eax
> clearGhcbMemoryLoop:
>      mov     dword[ecx * 4 + GHCB_BASE - 4], eax
>      loop    clearGhcbMemoryLoop
> 
>      ;
>      ; The page table built above cleared the memory encryption mask from the
>      ; GHCB_BASE (aka made it shared). When SEV-SNP is enabled, to maintain
>      ; the security guarantees, the page state transition from private to
>      ; shared must go through the page invalidation steps. Invalidate the
>      ; memory range before loading the page table below.
>      ;
>      ; NOTE: the invalidation must happen after zeroing the GHCB memory. This
>      ;       is because, in the 32-bit mode all the access are considered private.
>      ;       The invalidation before the zero'ing will cause a #VC.
>      ;
>      OneTimeCall  InvalidateGHCBPage
> ==============
> 

I will try to see if I can move that out as well.

> Patch-10:
> I am not UEFI CPU package maintainer. But I do have a little concern to add more PcdXxxIsEnable style PCD, especially when they are mutual exclusive (like TDX v.s SEV).
> If we follow this pattern, we will have PcdSevEsIsEnabled, PcdSevSnpIsEnabled, PcdSevFutureIsEnabled, PcdTdxIsEnabled, PcdTdxFutureIsEnabled, ... that will be an endless list.
> 
> If possible, I suggest define one PcdConfidentialComputingType - indicate Legacy, SEV, TDX.
> 

There are certain things which are applicable to SEV-ES and not for the 
SEV-SNP and vice versa. I am not oppose to create a generic helper e.g

enum {
	AmdSev,
	AmdSevEs,
	AmdSevSnp,
	IntelTdx,
	IntelSgx,
	..
	..
};

bool EncryptedGuestFeatureEnabled(enum type);

But I think some of this can be done later as well.

> Patch-12:
> Can we move all SEV stuff to a standalone file, such as AmdSev.c?
> 
> I am not sure if you want to do it, or you leave Min to do it.
> 

Yes, I can do it.

> Patch-18:
> If we have a standalone AmdSev.c (#12), then we can move the function to that file, and only leave a hook call to SEV.
> 

I will try to consolidate it in AmdSev.c

> Patch-23:
> This is UEFI CPU package update. I am thinking if we can follow same patter to move all SEV stuff to a standalone file, such as AmdSev.c, AmdSev.asm.
> In the future, we may add TDX stuff as well.
> 
> Patch-26:
> Same comment as #23.
> 
> Patch-27:
> Can we move that function to a standalone AmdSev.c ?
> 
> Patch-28:
> Would you please describe more on what is ConfidentialComputingBlob ?

While launching the SEV-SNP guests, the hypervisor may need to provide
some additional information during the guest boot. When booting under 
the EFI based BIOS, the EFI configuration table contains an entry for 
the confidential computing blob that contains the required information. 
The Linux kernel will lookup for this EFI table during the boot to 
locate the secrets and cpuid page.


> Is that generic concept? Or SEV specific thing?

Its designed as a generic and the current only SEV-SNP provides it.
> Who is consumer?

Any guest kernel (window or Linux)

> What is difference between ConfidentialComputingSecret and ConfidentialComputingBlob ? When to use which?
> 

The confidentialComputingSecrets contains the secrets keys where the 
CCBlob contains the information which maybe used during the boot.

You can see some more about it on my kernel patches:

https://lore.kernel.org/lkml/20210707181506.30489-26-brijesh.singh@amd.com/

> I can understand how TDX use ConfidentialComputingSecret, but how do you expect TDX use ConfidentialComputingBlob (if it is a generic concept) ?

I think in the case of TDX , the information needed during the boot is 
provided through the ACPI tables but in SEV-SNP those are provided 
throught the CCBlob. In the contianer environement there will be no EFI 
so in that case the Blob will be passed to the boot loader setup data. 
If required then TDX can use it to pass the boot information.

thanks

  reply	other threads:[~2021-08-03 15:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 17:41 [RFC PATCH v4 00/27] Add AMD Secure Nested Paging (SEV-SNP) support Brijesh Singh
2021-06-28 17:41 ` [RFC PATCH v4 01/27] OvmfPkg/ResetVector: move SEV specific code in a separate file Brijesh Singh
2021-06-28 17:41 ` [RFC PATCH v4 02/27] OvmfPkg/ResetVector: add the macro to invoke MSR protocol based VMGEXIT Brijesh Singh
2021-06-29 18:06   ` Brijesh Singh
2021-06-28 17:41 ` [RFC PATCH v4 03/27] OvmfPkg/ResetVector: add the macro to request guest termination Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 04/27] OvmfPkg: reserve SNP secrets page Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 05/27] OvmfPkg: reserve CPUID page for SEV-SNP Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 06/27] OvmfPkg/ResetVector: introduce SEV-SNP boot block GUID Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 07/27] OvmfPkg/ResetVector: pre-validate the data pages used in SEC phase Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 08/27] OvmfPkg/ResetVector: invalidate the GHCB page Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 09/27] UefiCpuPkg: Define the SEV-SNP specific dynamic PCDs Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 10/27] OvmfPkg/MemEncryptSevLib: add MemEncryptSevSnpEnabled() Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 11/27] OvmfPkg/SecMain: register GHCB gpa for the SEV-SNP guest Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 12/27] OvmfPkg/PlatformPei: " Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 13/27] OvmfPkg/AmdSevDxe: do not use extended PCI config space Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 14/27] OvmfPkg/MemEncryptSevLib: add support to validate system RAM Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 15/27] OvmfPkg/BaseMemEncryptSevLib: skip the pre-validated " Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 16/27] OvmfPkg/MemEncryptSevLib: add support to validate > 4GB memory in PEI phase Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 17/27] OvmfPkg/SecMain: pre-validate the memory used for decompressing Fv Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 18/27] OvmfPkg/PlatformPei: validate the system RAM when SNP is active Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 19/27] OvmfPkg/PlatformPei: set the SEV-SNP enabled PCD Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 20/27] OvmfPkg/PlatformPei: set the Hypervisor Features PCD Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 21/27] MdePkg/GHCB: increase the GHCB protocol max version Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 22/27] UefiCpuPkg/MpLib: add support to register GHCB GPA when SEV-SNP is enabled Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 23/27] OvmfPkg/MemEncryptSevLib: change the page state in the RMP table Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 24/27] OvmfPkg/MemEncryptSevLib: skip page state change for Mmio address Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 25/27] UefiCpuPkg/MpInitLib: Use SEV-SNP AP Creation NAE event to launch APs Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 26/27] OvmfPkg/PlatformPei: mark cpuid and secrets memory reserved in EFI map Brijesh Singh
2021-06-28 17:42 ` [RFC PATCH v4 27/27] OvmfPkg/AmdSev: expose the SNP reserved pages through configuration table Brijesh Singh
2021-07-28  8:16 ` [RFC PATCH v4 00/27] Add AMD Secure Nested Paging (SEV-SNP) support Yao, Jiewen
2021-07-28 15:22   ` Brijesh Singh
2021-07-28 16:38     ` [edk2-devel] " Yao, Jiewen
2021-07-29  2:22       ` Yao, Jiewen
2021-08-03 15:01         ` Brijesh Singh [this message]
2021-08-04 13:16           ` Yao, Jiewen

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=3ea6b4f8-80e2-2f70-2880-d0666246db4b@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