mbox series

[v3,0/7] OvmfXen: Set PcdFSBClock at runtime

Message ID 20210412133003.146438-1-anthony.perard@citrix.com (mailing list archive)
Headers show
Series OvmfXen: Set PcdFSBClock at runtime | expand

Message

Anthony PERARD April 12, 2021, 1:29 p.m. UTC
Patch series available in this git branch:
git://xenbits.xen.org/people/aperard/ovmf.git br.apic-timer-freq-v3

Changes in v3:
- typos and codying style

Changes in v2:
- main change is to allow mapping of Xen pages outside of the RAM
  see patch: "OvmfPkg/XenPlatformPei: Map extra physical address"
- that new function allows to map the Xen shared info page (where we can find
  information about tsc frequency) at the highest physical address allowed.

Hi,

OvmfXen uses the APIC timer, but with an hard-coded frequency that may change
as pointed out here:
  https://edk2.groups.io/g/devel/message/45185
  <20190808134423.ybqg3qkpw5ucfzk4@Air-de-Roger>

This series changes that so the frequency is calculated at runtime.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2490

There is also one cleanup patch that has nothing to do with the rest.

Cheers,

Anthony PERARD (7):
  OvmfPkg/XenResetVector: Silent a warning from nasm
  MdePkg: Allow PcdFSBClock to by Dynamic
  OvmfPkg/IndustryStandard/Xen: Apply EDK2 coding style to
    XEN_VCPU_TIME_INFO
  OvmfPkg/IndustryStandard: Introduce PageTable.h
  OvmfPkg/XenPlatformPei: Map extra physical address
  OvmfPkg/XenPlatformPei: Calibrate APIC timer frequency
  OvmfPkg/OvmfXen: Set PcdFSBClock

 MdePkg/MdePkg.dec                             |   8 +-
 OvmfPkg/OvmfXen.dsc                           |   4 +-
 OvmfPkg/XenPlatformPei/XenPlatformPei.inf     |   4 +
 .../IndustryStandard/PageTable.h}             | 117 +-------
 OvmfPkg/Include/IndustryStandard/Xen/xen.h    |  17 +-
 .../BaseMemEncryptSevLib/X64/VirtualMemory.h  | 143 +---------
 OvmfPkg/XenPlatformPei/Platform.h             |  10 +
 OvmfPkg/XenPlatformPei/Platform.c             |   1 +
 OvmfPkg/XenPlatformPei/Xen.c                  | 252 ++++++++++++++++++
 OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm    |   2 +-
 10 files changed, 287 insertions(+), 271 deletions(-)
 copy OvmfPkg/{Library/BaseMemEncryptSevLib/X64/VirtualMemory.h => Include/IndustryStandard/PageTable.h} (60%)

Comments

Laszlo Ersek April 13, 2021, 12:10 p.m. UTC | #1
On 04/12/21 15:29, Anthony PERARD via groups.io wrote:
> Patch series available in this git branch:
> git://xenbits.xen.org/people/aperard/ovmf.git br.apic-timer-freq-v3
> 
> Changes in v3:
> - typos and codying style

Merged in commit range 16136f218d54..71cdb91f3133, via <https://github.com/tianocore/edk2/pull/1560>, with the following updates:

1:  cc0477d6a5d6 = 1:  29280c7084ee OvmfPkg/XenResetVector: Silent a warning from nasm
2:  4459ca235222 ! 2:  44ad51d6b19a MdePkg: Allow PcdFSBClock to by Dynamic
    @@ -8,8 +8,8 @@
         Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2490
         Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
         Reviewed-by: Laszlo Ersek <lersek@redhat.com>
    -    Reviewed-by: Liming Gao <liming.gao@intel.com>
         Message-Id: <20210412133003.146438-3-anthony.perard@citrix.com>
    +    Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
     
     diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
     --- a/MdePkg/MdePkg.dec
3:  d2b81d656c53 = 3:  896e68984118 OvmfPkg/IndustryStandard/Xen: Apply EDK2 coding style to XEN_VCPU_TIME_INFO
4:  e2bbc17dc92b ! 4:  9d6861494aaa OvmfPkg/IndustryStandard: Introduce PageTable.h
    @@ -10,6 +10,7 @@
         Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
         Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
         Message-Id: <20210412133003.146438-5-anthony.perard@citrix.com>
    +    Reviewed-by: Laszlo Ersek <lersek@redhat.com>
     
     diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.h b/OvmfPkg/Include/IndustryStandard/PageTable.h
     similarity index 60%
5:  158053f2ea02 = 5:  51e0bd28bba9 OvmfPkg/XenPlatformPei: Map extra physical address
6:  a37eba1a4ef4 = 6:  c75c6405128e OvmfPkg/XenPlatformPei: Calibrate APIC timer frequency
7:  7dfd174c2dc6 ! 7:  71cdb91f3133 OvmfPkg/OvmfXen: Set PcdFSBClock
    @@ -31,6 +31,7 @@
         Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
         Reviewed-by: Laszlo Ersek <lersek@redhat.com>
         Message-Id: <20210412133003.146438-8-anthony.perard@citrix.com>
    +    [lersek@redhat.com: cast Freq to UINT32 for PcdSet32S(), not for ASSERT()]
     
     diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
     --- a/OvmfPkg/OvmfXen.dsc
    @@ -73,8 +74,8 @@
        Freq = DivU64x64Remainder (Dividend, TscTick2 - TscTick, NULL);
        DEBUG ((DEBUG_INFO, "APIC Freq % 8lu Hz\n", Freq));
      
    -+  ASSERT ((UINT32)Freq <= MAX_UINT32);
    -+  Status = PcdSet32S (PcdFSBClock, Freq);
    ++  ASSERT (Freq <= MAX_UINT32);
    ++  Status = PcdSet32S (PcdFSBClock, (UINT32)Freq);
     +  ASSERT_EFI_ERROR (Status);
     +
        UnmapXenPage (SharedInfo);

Thanks
Laszlo

> 
> Changes in v2:
> - main change is to allow mapping of Xen pages outside of the RAM
>   see patch: "OvmfPkg/XenPlatformPei: Map extra physical address"
> - that new function allows to map the Xen shared info page (where we can find
>   information about tsc frequency) at the highest physical address allowed.
> 
> Hi,
> 
> OvmfXen uses the APIC timer, but with an hard-coded frequency that may change
> as pointed out here:
>   https://edk2.groups.io/g/devel/message/45185
>   <20190808134423.ybqg3qkpw5ucfzk4@Air-de-Roger>
> 
> This series changes that so the frequency is calculated at runtime.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2490
> 
> There is also one cleanup patch that has nothing to do with the rest.
> 
> Cheers,
> 
> Anthony PERARD (7):
>   OvmfPkg/XenResetVector: Silent a warning from nasm
>   MdePkg: Allow PcdFSBClock to by Dynamic
>   OvmfPkg/IndustryStandard/Xen: Apply EDK2 coding style to
>     XEN_VCPU_TIME_INFO
>   OvmfPkg/IndustryStandard: Introduce PageTable.h
>   OvmfPkg/XenPlatformPei: Map extra physical address
>   OvmfPkg/XenPlatformPei: Calibrate APIC timer frequency
>   OvmfPkg/OvmfXen: Set PcdFSBClock
> 
>  MdePkg/MdePkg.dec                             |   8 +-
>  OvmfPkg/OvmfXen.dsc                           |   4 +-
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf     |   4 +
>  .../IndustryStandard/PageTable.h}             | 117 +-------
>  OvmfPkg/Include/IndustryStandard/Xen/xen.h    |  17 +-
>  .../BaseMemEncryptSevLib/X64/VirtualMemory.h  | 143 +---------
>  OvmfPkg/XenPlatformPei/Platform.h             |  10 +
>  OvmfPkg/XenPlatformPei/Platform.c             |   1 +
>  OvmfPkg/XenPlatformPei/Xen.c                  | 252 ++++++++++++++++++
>  OvmfPkg/XenResetVector/Ia32/XenPVHMain.asm    |   2 +-
>  10 files changed, 287 insertions(+), 271 deletions(-)
>  copy OvmfPkg/{Library/BaseMemEncryptSevLib/X64/VirtualMemory.h => Include/IndustryStandard/PageTable.h} (60%)
>