Re: [edk2-devel] [PATCH v11 4/4] OvmfPkg/PlatformPei: SEV-SNP make >=4GB unaccepted

2023-01-26 Thread Dionna Glaze via groups.io
> Shouldn't this check be inside the if () below? Or are all resources
> that start at or above 4 GiB guaranteed to be system memory?
>
> No need to resend - if needed, I can fix that up when applying.
>

Ah, yes that sounds right.



-- 
-Dionna Glaze, PhD (she/her)


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




Re: [edk2-devel] [PATCH v11 4/4] OvmfPkg/PlatformPei: SEV-SNP make >=4GB unaccepted

2023-01-26 Thread Ard Biesheuvel
On Thu, 26 Jan 2023 at 22:17, Dionna Glaze  wrote:
>
> Instead of eagerly accepting all memory in PEI, only accept memory under
> the 4GB address. This allows a loaded image to use the
> MEMORY_ACCEPTANCE_PROTOCOL to disable the accept behavior and indicate
> that it can interpret the memory type accordingly.
>
> This classification is safe since ExitBootServices will accept and
> reclassify the memory as conventional if the disable protocol is not
> used.
>
> Cc: Ard Biescheuvel 
> Cc: "Min M. Xu" 
> Cc: Gerd Hoffmann 
> Cc: James Bottomley 
> Cc: Tom Lendacky 
> Cc: Jiewen Yao 
> Cc: Erdem Aktas 
>
> Signed-off-by: Dionna Glaze 
> ---
>  OvmfPkg/PlatformPei/AmdSev.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
> index e4e7b72e67..7d824cc282 100644
> --- a/OvmfPkg/PlatformPei/AmdSev.c
> +++ b/OvmfPkg/PlatformPei/AmdSev.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -63,6 +64,10 @@ AmdSevSnpInitialize (
>for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST (Hob); Hob.Raw = 
> GET_NEXT_HOB (Hob)) {
>  if ((Hob.Raw != NULL) && (GET_HOB_TYPE (Hob) == 
> EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)) {
>ResourceHob = Hob.ResourceDescriptor;
> +  if (ResourceHob->PhysicalStart >= SIZE_4GB) {

Shouldn't this check be inside the if () below? Or are all resources
that start at or above 4 GiB guaranteed to be system memory?

No need to resend - if needed, I can fix that up when applying.


> +ResourceHob->ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED;
> +continue;
> +  }
>
>if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
>  MemEncryptSevSnpPreValidateSystemRam (
> --
> 2.39.1.456.gfc5497dd1b-goog
>


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




[edk2-devel] [PATCH v11 4/4] OvmfPkg/PlatformPei: SEV-SNP make >=4GB unaccepted

2023-01-26 Thread Dionna Glaze via groups.io
Instead of eagerly accepting all memory in PEI, only accept memory under
the 4GB address. This allows a loaded image to use the
MEMORY_ACCEPTANCE_PROTOCOL to disable the accept behavior and indicate
that it can interpret the memory type accordingly.

This classification is safe since ExitBootServices will accept and
reclassify the memory as conventional if the disable protocol is not
used.

Cc: Ard Biescheuvel 
Cc: "Min M. Xu" 
Cc: Gerd Hoffmann 
Cc: James Bottomley 
Cc: Tom Lendacky 
Cc: Jiewen Yao 
Cc: Erdem Aktas 

Signed-off-by: Dionna Glaze 
---
 OvmfPkg/PlatformPei/AmdSev.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index e4e7b72e67..7d824cc282 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +64,10 @@ AmdSevSnpInitialize (
   for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB 
(Hob)) {
 if ((Hob.Raw != NULL) && (GET_HOB_TYPE (Hob) == 
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR)) {
   ResourceHob = Hob.ResourceDescriptor;
+  if (ResourceHob->PhysicalStart >= SIZE_4GB) {
+ResourceHob->ResourceType = BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED;
+continue;
+  }
 
   if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
 MemEncryptSevSnpPreValidateSystemRam (
-- 
2.39.1.456.gfc5497dd1b-goog



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