Re: [edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-12 Thread duntan
Yes, let's do the cleanup for PcdCpuS3DataAddress in another new patch set.

Thanks,
Dun

-Original Message-
From: Wu, Jiaxin  
Sent: Monday, May 13, 2024 11:04 AM
To: Tan, Dun ; devel@edk2.groups.io
Cc: Ni, Ray ; Kumar, Rahul R ; Gerd 
Hoffmann 
Subject: RE: [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

I think the MtrrTable is not needed in the AcpiCpuDataEx (which is from the 
PcdCpuS3DataAddress).

That mean: we can cleanup unused definition in the PcdCpuS3DataAddress. Maybe 
in the future patches set, not this one.

Thanks,
Jiaxin 

> -Original Message-
> From: Tan, Dun 
> Sent: Friday, May 10, 2024 6:08 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray ; Kumar, Rahul R 
> ; Gerd Hoffmann ; Wu, 
> Jiaxin 
> Subject: [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in 
> CpuS3DataDxe
> 
> Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting 
> will be restored in S3Resume.c in following patches. Then S3Resume.c 
> will wakeup all APs to load the MTRR setting. This can avoid waking up 
> APs in CpuS3.c.
> 
> Signed-off-by: Dun Tan 
> Cc: Ray Ni 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Jiaxin Wu 
> ---
>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 11 +++
>  UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> index 86ce5303ca..825bb00b74 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  
> #include   #include   #include 
> 
> +#include 
> 
>  #include 
>  #include 
> @@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe (
>DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
>MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);
> 
> +  //
> +  // Save MTRR in lockbox
> +  //
> +  Status = SaveLockBox (
> + &gEdkiiS3MtrrSettingGuid,
> + &AcpiCpuDataEx->MtrrTable,
> + sizeof (MTRR_SETTINGS)
> + );
> +  ASSERT_EFI_ERROR (Status);
> +
>//
>// Close event, so it will not be invoked again.
>//
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> index 510133a614..a09254746b 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> @@ -46,9 +46,11 @@
>BaseLib
>MtrrLib
>MemoryAllocationLib
> +  LockBoxLib
> 
>  [Guids]
>gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
> +  gEdkiiS3MtrrSettingGuid
> 
>  [Protocols]
>gEfiMpServiceProtocolGuid  ## CONSUMES
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-12 Thread Wu, Jiaxin
I think the MtrrTable is not needed in the AcpiCpuDataEx (which is from the 
PcdCpuS3DataAddress).

That mean: we can cleanup unused definition in the PcdCpuS3DataAddress. Maybe 
in the future patches set, not this one.

Thanks,
Jiaxin 

> -Original Message-
> From: Tan, Dun 
> Sent: Friday, May 10, 2024 6:08 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray ; Kumar, Rahul R ;
> Gerd Hoffmann ; Wu, Jiaxin 
> Subject: [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe
> 
> Save MTRR by lockbox in CpuS3DataDxe. In S3 boot,
> The MTRR setting will be restored in S3Resume.c
> in following patches. Then S3Resume.c will wakeup
> all APs to load the MTRR setting. This can avoid
> waking up APs in CpuS3.c.
> 
> Signed-off-by: Dun Tan 
> Cc: Ray Ni 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Jiaxin Wu 
> ---
>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 11 +++
>  UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> index 86ce5303ca..825bb00b74 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include 
>  #include 
> @@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe (
>DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
>MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);
> 
> +  //
> +  // Save MTRR in lockbox
> +  //
> +  Status = SaveLockBox (
> + &gEdkiiS3MtrrSettingGuid,
> + &AcpiCpuDataEx->MtrrTable,
> + sizeof (MTRR_SETTINGS)
> + );
> +  ASSERT_EFI_ERROR (Status);
> +
>//
>// Close event, so it will not be invoked again.
>//
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> index 510133a614..a09254746b 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
> @@ -46,9 +46,11 @@
>BaseLib
>MtrrLib
>MemoryAllocationLib
> +  LockBoxLib
> 
>  [Guids]
>gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
> +  gEdkiiS3MtrrSettingGuid
> 
>  [Protocols]
>gEfiMpServiceProtocolGuid  ## CONSUMES
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-12 Thread Ni, Ray
Reviewed-by: Ray Ni 



Thanks,
Ray

From: Tan, Dun 
Sent: Friday, May 10, 2024 18:08
To: devel@edk2.groups.io 
Cc: Ni, Ray ; Kumar, Rahul R ; Gerd 
Hoffmann ; Wu, Jiaxin 
Subject: [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

Save MTRR by lockbox in CpuS3DataDxe. In S3 boot,
The MTRR setting will be restored in S3Resume.c
in following patches. Then S3Resume.c will wakeup
all APs to load the MTRR setting. This can avoid
waking up APs in CpuS3.c.

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Jiaxin Wu 
---
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 11 +++
 UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
index 86ce5303ca..825bb00b74 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe (
   DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
   MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);

+  //
+  // Save MTRR in lockbox
+  //
+  Status = SaveLockBox (
+ &gEdkiiS3MtrrSettingGuid,
+ &AcpiCpuDataEx->MtrrTable,
+ sizeof (MTRR_SETTINGS)
+ );
+  ASSERT_EFI_ERROR (Status);
+
   //
   // Close event, so it will not be invoked again.
   //
diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
index 510133a614..a09254746b 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
@@ -46,9 +46,11 @@
   BaseLib
   MtrrLib
   MemoryAllocationLib
+  LockBoxLib

 [Guids]
   gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
+  gEdkiiS3MtrrSettingGuid

 [Protocols]
   gEfiMpServiceProtocolGuid  ## CONSUMES
--
2.31.1.windows.1



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




[edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-10 Thread duntan
Save MTRR by lockbox in CpuS3DataDxe. In S3 boot,
The MTRR setting will be restored in S3Resume.c
in following patches. Then S3Resume.c will wakeup
all APs to load the MTRR setting. This can avoid
waking up APs in CpuS3.c.

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Jiaxin Wu 
---
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c  | 11 +++
 UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
index 86ce5303ca..825bb00b74 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe (
   DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
   MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);
 
+  //
+  // Save MTRR in lockbox
+  //
+  Status = SaveLockBox (
+ &gEdkiiS3MtrrSettingGuid,
+ &AcpiCpuDataEx->MtrrTable,
+ sizeof (MTRR_SETTINGS)
+ );
+  ASSERT_EFI_ERROR (Status);
+
   //
   // Close event, so it will not be invoked again.
   //
diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf 
b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
index 510133a614..a09254746b 100644
--- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
+++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
@@ -46,9 +46,11 @@
   BaseLib
   MtrrLib
   MemoryAllocationLib
+  LockBoxLib
 
 [Guids]
   gEfiEndOfDxeEventGroupGuid ## CONSUMES   ## Event
+  gEdkiiS3MtrrSettingGuid
 
 [Protocols]
   gEfiMpServiceProtocolGuid  ## CONSUMES
-- 
2.31.1.windows.1



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