Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-09 Thread Benjamin Doron
Hi Nate,
Ah, that makes sense. Thanks!

Best regards,
Benjamin

On January 9, 2024 8:28:08 p.m. EST, "Desimone, Nathaniel L" 
 wrote:
>Hi Benjamin,
>
>We consider using the LAPIC as a timer to be technically superior because it 
>is closer to the CPU. The HPET is a PCH device, which means all access to the 
>timer needs go from CPU -> Home Agent -> Fabric/IO Ring -> DMI Controller -> 
>PCH. Using the LAPIC cuts this path to just the Home Agent. That reduces 
>access latency, which for a timer means higher resolution.
>
>Hope that helps,
>Nate
>
>From: devel@edk2.groups.io  on behalf of Benjamin Doron 
>
>Date: Tuesday, January 9, 2024 at 3:48 PM
>To: Ma <>, Ma, Hua , devel@edk2.groups.io 
>
>Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable 
>selection of timer
>Hi,
>Are there platforms that will use this? What advantages does using the LAPIC 
>as a timer offer? Thanks.
>
>Regards,
>Benjamin
>


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-09 Thread Nate DeSimone
Hi Benjamin,

We consider using the LAPIC as a timer to be technically superior because it is 
closer to the CPU. The HPET is a PCH device, which means all access to the 
timer needs go from CPU -> Home Agent -> Fabric/IO Ring -> DMI Controller -> 
PCH. Using the LAPIC cuts this path to just the Home Agent. That reduces access 
latency, which for a timer means higher resolution.

Hope that helps,
Nate

From: devel@edk2.groups.io  on behalf of Benjamin Doron 

Date: Tuesday, January 9, 2024 at 3:48 PM
To: Ma <>, Ma, Hua , devel@edk2.groups.io 

Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection 
of timer
Hi,
Are there platforms that will use this? What advantages does using the LAPIC as 
a timer offer? Thanks.

Regards,
Benjamin



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-09 Thread Nate DeSimone
Hi Hua,

Please make TIMER_SUPPORT a FixedAtBuiildPcd instead of a build flag. Something 
like PcdDxeTimerSelection or similar.

Thanks,
Nate

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Ma, Hua
> Sent: Thursday, January 4, 2024 9:39 PM
> To: devel@edk2.groups.io
> Cc: Ma, Hua 
> Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection
> of timer
> 
> Add macro to enable selection of timer
> 
> - HPET:  UEFI Payload will use HPET timer
> - LAPIC: UEFI Payload will use local APIC timer
> 
> Signed-off-by: Hua Ma 
> ---
>  UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
> UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
>  2 files changed, 20 insertions(+)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index b8b13ad201..4f195c1e52 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -139,6 +139,12 @@
># Note: for emulation platform such as QEMU, this may not work and should
> set it as FALSE
>DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
> 
> +  #
> +  # HPET:  UEFI Payload will use HPET timer  # LAPIC: UEFI Payload will
> + use local APIC timer  #
> +  DEFINE TIMER_SUPPORT  = HPET
> +
>DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
> 
>  [BuildOptions]
> @@ -676,7 +682,17 @@
> 
> MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuAp
> p.inf
> 
> 
> +!if $(TIMER_SUPPORT) == "HPET"
>PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf {
> +
> +
> +NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInter
> +ruptTplLib.inf
> +  }
> +!else
> +  !error "Invalid TIMER_SUPPORT"
> +!endif
> +
>MdeModulePkg/Universal/Metronome/Metronome.inf
>MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index 835798be1c..7d04a8cffd 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -161,7 +161,11 @@ INF
> MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>  !endif
>  INF UefiCpuPkg/CpuDxe/CpuDxe.inf
> 
> +!if $(TIMER_SUPPORT) == "HPET"
>  INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
> +!endif
>  INF MdeModulePkg/Universal/Metronome/Metronome.inf
>  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-09 Thread Benjamin Doron
Hi,
Are there platforms that will use this? What advantages does using the LAPIC as 
a timer offer? Thanks.

Regards,
Benjamin


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-05 Thread Guo, Gua
Reviewed-by: Gua Guo 

-Original Message-
From: Ma, Hua  
Sent: Friday, January 5, 2024 2:19 PM
To: devel@edk2.groups.io; Guo, Gua ; Dong, Guo 
; Lu, James ; Rhodes, Sean 

Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection 
of timer

Add maintainers to help review the patch,

thank you,
Ma Hua

On 1/5/2024 1:38 PM, Ma, Hua wrote:
> Add macro to enable selection of timer
> 
> - HPET:  UEFI Payload will use HPET timer
> - LAPIC: UEFI Payload will use local APIC timer
> 
> Signed-off-by: Hua Ma 
> ---
>   UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
>   UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
>   2 files changed, 20 insertions(+)
> 
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
> b/UefiPayloadPkg/UefiPayloadPkg.dsc
> index b8b13ad201..4f195c1e52 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.dsc
> +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
> @@ -139,6 +139,12 @@
> # Note: for emulation platform such as QEMU, this may not work and should 
> set it as FALSE
> DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
>   
> +  #
> +  # HPET:  UEFI Payload will use HPET timer  # LAPIC: UEFI Payload 
> + will use local APIC timer  #
> +  DEFINE TIMER_SUPPORT  = HPET
> +
> DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
>   
>   [BuildOptions]
> @@ -676,7 +682,17 @@
> MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
>   
>   
> +!if $(TIMER_SUPPORT) == "HPET"
> PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf {
> +
> +  
> +NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInt
> +erruptTplLib.inf
> +  }
> +!else
> +  !error "Invalid TIMER_SUPPORT"
> +!endif
> +
> MdeModulePkg/Universal/Metronome/Metronome.inf
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
> b/UefiPayloadPkg/UefiPayloadPkg.fdf
> index 835798be1c..7d04a8cffd 100644
> --- a/UefiPayloadPkg/UefiPayloadPkg.fdf
> +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
> @@ -161,7 +161,11 @@ INF 
> MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>   !endif
>   INF UefiCpuPkg/CpuDxe/CpuDxe.inf
>   
> +!if $(TIMER_SUPPORT) == "HPET"
>   INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +!elseif $(TIMER_SUPPORT) == "LAPIC"
> +INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
> +!endif
>   INF MdeModulePkg/Universal/Metronome/Metronome.inf
>   INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>   INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf


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




Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-04 Thread Ma, Hua

Add maintainers to help review the patch,

thank you,
Ma Hua

On 1/5/2024 1:38 PM, Ma, Hua wrote:

Add macro to enable selection of timer

- HPET:  UEFI Payload will use HPET timer
- LAPIC: UEFI Payload will use local APIC timer

Signed-off-by: Hua Ma 
---
  UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
  UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
  2 files changed, 20 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index b8b13ad201..4f195c1e52 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -139,6 +139,12 @@
# Note: for emulation platform such as QEMU, this may not work and should 
set it as FALSE
DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
  
+  #

+  # HPET:  UEFI Payload will use HPET timer
+  # LAPIC: UEFI Payload will use local APIC timer
+  #
+  DEFINE TIMER_SUPPORT  = HPET
+
DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
  
  [BuildOptions]

@@ -676,7 +682,17 @@
MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
  
  
+!if $(TIMER_SUPPORT) == "HPET"

PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!elseif $(TIMER_SUPPORT) == "LAPIC"
+  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf {
+
+  
NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf
+  }
+!else
+  !error "Invalid TIMER_SUPPORT"
+!endif
+
MdeModulePkg/Universal/Metronome/Metronome.inf
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 835798be1c..7d04a8cffd 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -161,7 +161,11 @@ INF 
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
  !endif
  INF UefiCpuPkg/CpuDxe/CpuDxe.inf
  
+!if $(TIMER_SUPPORT) == "HPET"

  INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!elseif $(TIMER_SUPPORT) == "LAPIC"
+INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+!endif
  INF MdeModulePkg/Universal/Metronome/Metronome.inf
  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf



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




[edk2-devel] [PATCH] UefiPayloadPkg: Add macro to enable selection of timer

2024-01-04 Thread Ma, Hua
Add macro to enable selection of timer

- HPET:  UEFI Payload will use HPET timer
- LAPIC: UEFI Payload will use local APIC timer

Signed-off-by: Hua Ma 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 16 
 UefiPayloadPkg/UefiPayloadPkg.fdf |  4 
 2 files changed, 20 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index b8b13ad201..4f195c1e52 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -139,6 +139,12 @@
   # Note: for emulation platform such as QEMU, this may not work and should 
set it as FALSE
   DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
 
+  #
+  # HPET:  UEFI Payload will use HPET timer
+  # LAPIC: UEFI Payload will use local APIC timer
+  #
+  DEFINE TIMER_SUPPORT  = HPET
+
   DEFINE MULTIPLE_DEBUG_PORT_SUPPORT = FALSE
 
 [BuildOptions]
@@ -676,7 +682,17 @@
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
 
 
+!if $(TIMER_SUPPORT) == "HPET"
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!elseif $(TIMER_SUPPORT) == "LAPIC"
+  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf {
+
+  
NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf
+  }
+!else
+  !error "Invalid TIMER_SUPPORT"
+!endif
+
   MdeModulePkg/Universal/Metronome/Metronome.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 835798be1c..7d04a8cffd 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -161,7 +161,11 @@ INF 
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 !endif
 INF UefiCpuPkg/CpuDxe/CpuDxe.inf
 
+!if $(TIMER_SUPPORT) == "HPET"
 INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
+!elseif $(TIMER_SUPPORT) == "LAPIC"
+INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+!endif
 INF MdeModulePkg/Universal/Metronome/Metronome.inf
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
-- 
2.39.1.windows.1



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