public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest
@ 2022-08-26  0:41 Min Xu
  2022-08-26  5:27 ` Gerd Hoffmann
  2022-09-06  6:40 ` Yao, Jiewen
  0 siblings, 2 replies; 3+ messages in thread
From: Min Xu @ 2022-08-26  0:41 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Erdem Aktas, James Bottomley, Jiewen Yao, Gerd Hoffmann,
	Tom Lendacky

From: Min M Xu <min.m.xu@intel.com>

In previous implementation below Pci related PCDs were set based on the
ResourceDescriptor passed in TdHob.
 - PcdPciMmio64Base / PcdPciMmio64Size
 - PcdPciMmio32Base / PcdPciMmio32Size
 - PcdPciIoBase / PcdPciIoSize

The PCDs will not be set if TdHob doesn't include these information. This
patch set the PCDs with the information initialized in PlatformInitLib
by default. Then TdxDxe will check the ResourceDescriptor in TdHob and
reset them if they're included.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 OvmfPkg/TdxDxe/TdxDxe.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/OvmfPkg/TdxDxe/TdxDxe.c b/OvmfPkg/TdxDxe/TdxDxe.c
index 2318db989792..bfdaef59dd58 100644
--- a/OvmfPkg/TdxDxe/TdxDxe.c
+++ b/OvmfPkg/TdxDxe/TdxDxe.c
@@ -68,20 +68,20 @@ SetPcdSettings (
     PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
     ASSERT_RETURN_ERROR (PcdStatus);
     DEBUG ((DEBUG_INFO, "TdxSharedBitMask=0x%llx\n", PcdGet64 (PcdTdxSharedBitMask)));
-  } else {
-    PcdStatus = PcdSet64S (PcdPciMmio64Base, PlatformInfoHob->PcdPciMmio64Base);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciMmio64Size, PlatformInfoHob->PcdPciMmio64Size);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciMmio32Base, PlatformInfoHob->PcdPciMmio32Base);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciMmio32Size, PlatformInfoHob->PcdPciMmio32Size);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciIoBase, PlatformInfoHob->PcdPciIoBase);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciIoSize, PlatformInfoHob->PcdPciIoSize);
-    ASSERT_RETURN_ERROR (PcdStatus);
   }
+
+  PcdStatus = PcdSet64S (PcdPciMmio64Base, PlatformInfoHob->PcdPciMmio64Base);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciMmio64Size, PlatformInfoHob->PcdPciMmio64Size);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciMmio32Base, PlatformInfoHob->PcdPciMmio32Base);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciMmio32Size, PlatformInfoHob->PcdPciMmio32Size);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciIoBase, PlatformInfoHob->PcdPciIoBase);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciIoSize, PlatformInfoHob->PcdPciIoSize);
+  ASSERT_RETURN_ERROR (PcdStatus);
 }
 
 /**
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest
  2022-08-26  0:41 [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest Min Xu
@ 2022-08-26  5:27 ` Gerd Hoffmann
  2022-09-06  6:40 ` Yao, Jiewen
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2022-08-26  5:27 UTC (permalink / raw)
  To: Min Xu; +Cc: devel, Erdem Aktas, James Bottomley, Jiewen Yao, Tom Lendacky

On Fri, Aug 26, 2022 at 08:41:09AM +0800, Min Xu wrote:
> From: Min M Xu <min.m.xu@intel.com>
> 
> In previous implementation below Pci related PCDs were set based on the
> ResourceDescriptor passed in TdHob.
>  - PcdPciMmio64Base / PcdPciMmio64Size
>  - PcdPciMmio32Base / PcdPciMmio32Size
>  - PcdPciIoBase / PcdPciIoSize
> 
> The PCDs will not be set if TdHob doesn't include these information. This
> patch set the PCDs with the information initialized in PlatformInitLib
> by default. Then TdxDxe will check the ResourceDescriptor in TdHob and
> reset them if they're included.
> 
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest
  2022-08-26  0:41 [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest Min Xu
  2022-08-26  5:27 ` Gerd Hoffmann
@ 2022-09-06  6:40 ` Yao, Jiewen
  1 sibling, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2022-09-06  6:40 UTC (permalink / raw)
  To: Xu, Min M, devel@edk2.groups.io
  Cc: Aktas, Erdem, James Bottomley, Gerd Hoffmann, Tom Lendacky

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

Merged https://github.com/tianocore/edk2/pull/3291



> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Friday, August 26, 2022 8:41 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Aktas, Erdem
> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>;
> Tom Lendacky <thomas.lendacky@amd.com>
> Subject: [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest
> 
> From: Min M Xu <min.m.xu@intel.com>
> 
> In previous implementation below Pci related PCDs were set based on the
> ResourceDescriptor passed in TdHob.
>  - PcdPciMmio64Base / PcdPciMmio64Size
>  - PcdPciMmio32Base / PcdPciMmio32Size
>  - PcdPciIoBase / PcdPciIoSize
> 
> The PCDs will not be set if TdHob doesn't include these information. This
> patch set the PCDs with the information initialized in PlatformInitLib
> by default. Then TdxDxe will check the ResourceDescriptor in TdHob and
> reset them if they're included.
> 
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> ---
>  OvmfPkg/TdxDxe/TdxDxe.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/OvmfPkg/TdxDxe/TdxDxe.c b/OvmfPkg/TdxDxe/TdxDxe.c
> index 2318db989792..bfdaef59dd58 100644
> --- a/OvmfPkg/TdxDxe/TdxDxe.c
> +++ b/OvmfPkg/TdxDxe/TdxDxe.c
> @@ -68,20 +68,20 @@ SetPcdSettings (
>      PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
>      ASSERT_RETURN_ERROR (PcdStatus);
>      DEBUG ((DEBUG_INFO, "TdxSharedBitMask=0x%llx\n", PcdGet64
> (PcdTdxSharedBitMask)));
> -  } else {
> -    PcdStatus = PcdSet64S (PcdPciMmio64Base, PlatformInfoHob-
> >PcdPciMmio64Base);
> -    ASSERT_RETURN_ERROR (PcdStatus);
> -    PcdStatus = PcdSet64S (PcdPciMmio64Size, PlatformInfoHob-
> >PcdPciMmio64Size);
> -    ASSERT_RETURN_ERROR (PcdStatus);
> -    PcdStatus = PcdSet64S (PcdPciMmio32Base, PlatformInfoHob-
> >PcdPciMmio32Base);
> -    ASSERT_RETURN_ERROR (PcdStatus);
> -    PcdStatus = PcdSet64S (PcdPciMmio32Size, PlatformInfoHob-
> >PcdPciMmio32Size);
> -    ASSERT_RETURN_ERROR (PcdStatus);
> -    PcdStatus = PcdSet64S (PcdPciIoBase, PlatformInfoHob->PcdPciIoBase);
> -    ASSERT_RETURN_ERROR (PcdStatus);
> -    PcdStatus = PcdSet64S (PcdPciIoSize, PlatformInfoHob->PcdPciIoSize);
> -    ASSERT_RETURN_ERROR (PcdStatus);
>    }
> +
> +  PcdStatus = PcdSet64S (PcdPciMmio64Base, PlatformInfoHob-
> >PcdPciMmio64Base);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +  PcdStatus = PcdSet64S (PcdPciMmio64Size, PlatformInfoHob-
> >PcdPciMmio64Size);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +  PcdStatus = PcdSet64S (PcdPciMmio32Base, PlatformInfoHob-
> >PcdPciMmio32Base);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +  PcdStatus = PcdSet64S (PcdPciMmio32Size, PlatformInfoHob-
> >PcdPciMmio32Size);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +  PcdStatus = PcdSet64S (PcdPciIoBase, PlatformInfoHob->PcdPciIoBase);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +  PcdStatus = PcdSet64S (PcdPciIoSize, PlatformInfoHob->PcdPciIoSize);
> +  ASSERT_RETURN_ERROR (PcdStatus);
>  }
> 
>  /**
> --
> 2.29.2.windows.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-06  6:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-26  0:41 [PATCH 1/1] OvmfPkg: Set default Pci PCDs in Tdx guest Min Xu
2022-08-26  5:27 ` Gerd Hoffmann
2022-09-06  6:40 ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox