Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: bf03c4a52ae2dcf8690667aa798fa24b9c94d102
      
https://github.com/tianocore/edk2/commit/bf03c4a52ae2dcf8690667aa798fa24b9c94d102
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Add internal function MtrrLibIsMtrrSupported.

Add internal function MtrrLibIsMtrrSupported and
update IsMtrrSupported to call the new internal function.

Signed-off-by: Ray Ni <[email protected]>

Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: ca3f8638fa4f5dd2ab52b5f29b3c5c3a2ddf536e
      
https://github.com/tianocore/edk2/commit/ca3f8638fa4f5dd2ab52b5f29b3c5c3a2ddf536e
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update the Unit Test for IsMtrrSupported().

The previous implementation returns FALSE if either fixed MTRR is
unsupported or the number of variable MTRRs is 0. The correct behavior
is to return FALSE only when both fixed MTRR is unsupported and the
number of variable MTRRs is 0.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: f784fc0e39f9837dc409aa4f776bcd80e88e925f
      
https://github.com/tianocore/edk2/commit/f784fc0e39f9837dc409aa4f776bcd80e88e925f
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update UnitTestGetFirmwareVariableMtrrCount.

Update UnitTestGetFirmwareVariableMtrrCount for the case the when
Fixed MTRRs are not supported.

The original implementation returns FALSE when either fixed MTRR isn't
supported or the number of variable MTRRs is 0. The correct behavior
should return FALSE only when both fixed MTRR isn't supported and the
number of variable MTRRs is 0.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 1ec374cb5052dd7999b8289927c5257216fa1026
      
https://github.com/tianocore/edk2/commit/1ec374cb5052dd7999b8289927c5257216fa1026
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrGetDefaultMemoryType.

Update UnitTestMtrrGetDefaultMemoryType for the case the when Fixed
MTRRs are not supported.
The original implementation returns FALSE when either fixed MTRR isn't
supported or the number of variable MTRRs is 0. The correct behavior
should return FALSE only when both fixed MTRR isn't supported and the
number of variable MTRRs is 0.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 5b76b4a9f974d3ff57b7c9c43f3f4b72794a2feb
      
https://github.com/tianocore/edk2/commit/5b76b4a9f974d3ff57b7c9c43f3f4b72794a2feb
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
    M UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update test to cover no-fixed-mtrr cases.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 0d89ceae31f54befd1cfaa2e36eb7a03bdcd94b0
      
https://github.com/tianocore/edk2/commit/0d89ceae31f54befd1cfaa2e36eb7a03bdcd94b0
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Fix MtrrGetAllMtrrs to return correct MTRR setting.

The patch fixes the following issues in the original implementation:

1. MtrrSetting contains random value if MTRR is not supported.
2. Unconditionally access fixed MTRR on CPU that may not support
    fixed MTRR.
3. The maximum number of Variable MTRR entries are initialized, while
the portion exceeding the maximum number remains uninitialized.

Signed-off-by: Ray Ni <[email protected]>
Signed-off-by: Yuanhao Xie <[email protected]>

Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: a519014472a309174b1a89f3fcb14fc8a33f6ce5
      
https://github.com/tianocore/edk2/commit/a519014472a309174b1a89f3fcb14fc8a33f6ce5
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrGetAllMtrrs().

Update UnitTestMtrrGetAllMtrrs() for the case that fixed MtrrLib
is not always supported

Signed-off-by: Yuanhao Xie <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Ray Ni <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 0103d09ebe6dede5b3cbea09c9e3f64662d8cabf
      
https://github.com/tianocore/edk2/commit/0103d09ebe6dede5b3cbea09c9e3f64662d8cabf
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Update MtrrGetFixedMtrr().

IsMtrrSupported() return true when either fixed mtrr supported or
variable mtrr suppored. In this case, rather than checking whether
MTRR is supported or not, we should specifically check for fixed MTRR
support.

Signed-off-by: Yuanhao Xie <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Ray Ni <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: cc070b88e4ffef9d7acf3965058a4ab737f3cbde
      
https://github.com/tianocore/edk2/commit/cc070b88e4ffef9d7acf3965058a4ab737f3cbde
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrGetFixedMtrr().

UnitTestMtrrGetFixedMtrr updated for the case that fixed MtrrLib
is not always supported.

Signed-off-by: Yuanhao Xie <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Ray Ni <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 1217f59d23b7c1cc6fa3be658f9ec00bfe0854c0
      
https://github.com/tianocore/edk2/commit/1217f59d23b7c1cc6fa3be658f9ec00bfe0854c0
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Include/Library/MtrrLib.h
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Fix MtrrSetAllMtrrs to handle absent fixed MTRRs.

Update MtrrSetAllMtrrs to not access fixed MTRRs if CPU doesn't
support them.

Signed-off-by: Ray Ni <[email protected]>
Signed-off-by: Yuanhao Xie <[email protected]>

Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 1d0fd0bb3d182a699b07129a2560acf14bf669ab
      
https://github.com/tianocore/edk2/commit/1d0fd0bb3d182a699b07129a2560acf14bf669ab
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Update UnitTestMtrrSetAllMtrrs().

Update UnitTestMtrrSetAllMtrrs() for the case that fixed MtrrLib
is not always supported.

Signed-off-by: Yuanhao Xie <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Ray Ni <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: c032db330805993bb29e4ff3d9daad160f3fb35e
      
https://github.com/tianocore/edk2/commit/c032db330805993bb29e4ff3d9daad160f3fb35e
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Update APIs related to set memory attributes.

Update APIs related to set memory attributes to handle the fixed MTRR
is not always supported.

There are 3 APIs in MtrrLib that can set memory attributes:
1. MtrrSetMemoryAttributesInMtrrSettings
2. MtrrSetMemoryAttributeInMtrrSettings
3. MtrrSetMemoryAttribute

The general idea applied in MtrrSetMemoryAttributesInMtrrSettings is:
1. MtrrLibPreMtrrChange saves the old MTRR default type which
   contains bit to enable fixed MTRR.
2. Main logic in MtrrSetMemoryAttributesInMtrrSettings applies
    memory attribute settings for below 1MB to variable MTRRs
    if fixed MTRR is not supported.
3. MtrrLibPostMtrrChange unconditionally sets E bit in MTRR default
    type MSR but only set FE bit when fixed MTRRs are modified.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 4b7b32f846edbd2970f5b7c34041c2abe9d0724e
      
https://github.com/tianocore/edk2/commit/4b7b32f846edbd2970f5b7c34041c2abe9d0724e
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Include/Library/MtrrLib.h
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Add API MtrrGetMemoryAttributesInMtrrSettings.

MtrrGetMemoryAttributesInMtrrSettings parses the MTRR settings
either from hardware or from the parameter and returns an
array containing the memory cache types of all memory addresses.

This API could elinimate the needs of following APIs:
1. MtrrGetMemoryAttributeInVariableMtr
2. MtrrGetFixedMtrr

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: c4fdec0a83d69bd0399b1b4351fa9c3af3c6fd65
      
https://github.com/tianocore/edk2/commit/c4fdec0a83d69bd0399b1b4351fa9c3af3c6fd65
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/MtrrLib.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrLib: Improve MtrrDebugPrintAllMtrrsWorker.

Improve MtrrDebugPrintAllMtrrsWorker by making use of
MtrrGetMemoryAttributesInMtrrSettings.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 01b0d19dbbc58034808e4f0cac8d8df56f4787f7
      
https://github.com/tianocore/edk2/commit/01b0d19dbbc58034808e4f0cac8d8df56f4787f7
  Author: YuanhaoXie <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c

  Log Message:
  -----------
  UefiCpuPkg/MtrrUnitTest: Add Unit test of setting/getting memory
attributes

Add Unit test of trrGetMemoryAttributesInMtrrSettings and
MtrrSetMemoryAttributesInMtrrSettings.

Signed-off-by: Ray Ni <[email protected]>
Signed-off-by: Yuanhao Xie <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>

Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


  Commit: 137f799aaed91e592700e0488067292495b7ea7e
      
https://github.com/tianocore/edk2/commit/137f799aaed91e592700e0488067292495b7ea7e
  Author: Ray Ni <[email protected]>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M UefiCpuPkg/CpuDxe/CpuDxe.c

  Log Message:
  -----------
  UefiCpuPkg/CpuDxe: Update RefreshMemoryAttributesFromMtrr

Old implementation of RefreshMemoryAttributesFromMtrr directly
retrieves the MTRR register content and applies the MTRR cache type
to GCD database following the precedence order defined by SDM.

The code can updated to simply get all the memory cache types for all
memory through newly introduced API With the new introduced API
MtrrGetMemoryAttributesInMtrrSettings.

Benefits:
1. Remove the duplicated logic in CpuDxe driver that handles MTRR
    details.
2. Let the MtrrLib to handle the case when fixed MTRR is absent.
    (Old logic cannot handle the case.)

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>


Compare: https://github.com/tianocore/edk2/compare/4ddd8ac3a29d...137f799aaed9


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to