Re: [edk2-devel] [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

2021-11-23 Thread Gerd Hoffmann
  Hi,

> > 2. Can SourceLevelDebug (rely on Local APIC timer) work if this driver is
> > chosen as DXE timer driver?
> After checking the code and running the PoC (enable SourceLevelDebug and 
> LocalApicTimerDxe),  I find this driver doesn't work anymore. 
> Actually it asserts in 
> https://github.com/mxu9/edk2/blob/ovmf_lapic_timer.v3/UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c#L334

Hmm, I guess this makes LocalApicTimerDxe alot less useful on physical
hardware.  So keep it in OvmdPkg?

For virtual machines there are other debugging options, using qemu's
builtin gdb server for example, so SourceLevelDebug not being available
isn't a big issue IMHO.

> For TDVF we assume SourceLevelDebug is not supported. So LocalApicTimerDxe is 
> still working for TDVF.
> 
> For other VM guests in OvmfPkg, can we assume SourceLevelDebug is NOT 
> supported after LocalApicTimer is used (the older timer is 8254)?
> @ Gerd Hoffmann (OvmfPkg)

Fine with me.

> @ Anthony Perard , Julien Grall (Xen) 

Xen already uses the apic timer today, so that shouldn't be a problem
either ;)

take care,
  Gerd



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




Re: [edk2-devel] [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

2021-11-23 Thread Min Xu
On November 22, 2021 11:05 AM, Ni Ray wrote:
> Min,
> What's the reason of moving this driver to UefiCpuPkg?
Please refer to the discussion in 
https://edk2.groups.io/g/devel/topic/86735078#83126
Because localApicTimerDxe is hardware feature. There is no specific OVMF or 
QEMU related thing there. It does not make sense to keep it to OvmfPkg.
> 
> When the LocalApicTimerDxe is in OvmfPkg, it's clear that this driver is only
> used by OVMF/QEMU platform.
> Now since the patch moves the driver to UefiCpuPkg, it's possible that other
> platforms may choose this driver as the timer driver in DXE phase.
> 
> So, we need to make sure the quality of this driver is good enough for a
> broad scope of platforms.
> 
> 1. What's the issue when this driver still stays in OvmfPkg? If it's a must 
> that
> this driver stays in UefiCpuPkg, please help to address following questions:
> 
> 2. Can SourceLevelDebug (rely on Local APIC timer) work if this driver is
> chosen as DXE timer driver?
After checking the code and running the PoC (enable SourceLevelDebug and 
LocalApicTimerDxe),  I find this driver doesn't work anymore. 
Actually it asserts in 
https://github.com/mxu9/edk2/blob/ovmf_lapic_timer.v3/UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.c#L334

For TDVF we assume SourceLevelDebug is not supported. So LocalApicTimerDxe is 
still working for TDVF.

For other VM guests in OvmfPkg, can we assume SourceLevelDebug is NOT supported 
after LocalApicTimer is used (the older timer is 8254)?
@Gerd Hoffmann (OvmfPkg)
@ Rebecca Cran, @ Peter Grehan  (Bhyve)
@ Tom Lendacky, @Brijesh Singh (Sev)
@ Anthony Perard , Julien Grall (Xen) 

This limitation will be documented in LocalApicTimerDxe.inf so that the user of 
this timer driver is aware of it.

> 3. Can detailed comments be added for " @bug : This does not handle
> missed timer interrupts" in TimerInterruptHandler()?
Sure. More comments will be added.
> 4. Can detailed comments be added for " DisableInterrupts ();" in
> TimerInterruptHandler()?
Sure. More comments will be added.
> 5. In general what kinds of platforms are capable of using this driver as 
> Timer
> driver?
Platforms that support local Apic are capable of using this driver.
> 

Thanks
Min


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




Re: [edk2-devel] [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

2021-11-21 Thread Yao, Jiewen
Thanks Ray.

I prefer to put the LocalApicTimerDxe to UefiCpuPkg, because it is hardware 
feature.
There is no specific OVMF or QEMU related thing there. It does not make sense 
to keep it to OvmfPkg.

Your quality concern is valid. I think the quality expectation for 
LocalApicTimerDxe should be same, no matter it is in OvmfPkg or UefiCpuPkg.
I don't think the expectation is that the quality can be lower if it is in 
OvmfPkg and it must be higher if it is in UefiCpuPkg.

All quality issues of LocalApicTimerDxe should be resolved, no matter where it 
is finally located.

Thank you
Yao Jiewen


> -Original Message-
> From: Ni, Ray 
> Sent: Monday, November 22, 2021 11:05 AM
> To: Xu, Min M ; devel@edk2.groups.io
> Cc: Yao, Jiewen ; Gerd Hoffmann
> ; Anthony Perard ; Julien
> Grall ; Dong, Eric 
> Subject: RE: [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg
> 
> Min,
> What's the reason of moving this driver to UefiCpuPkg?
> 
> When the LocalApicTimerDxe is in OvmfPkg, it's clear that this driver is only 
> used
> by OVMF/QEMU platform.
> Now since the patch moves the driver to UefiCpuPkg, it's possible that other
> platforms may choose this driver as the timer driver in DXE phase.
> 
> So, we need to make sure the quality of this driver is good enough for a broad
> scope of platforms.
> 
> 1. What's the issue when this driver still stays in OvmfPkg? If it's a must 
> that this
> driver stays in UefiCpuPkg, please help to address following questions:
> 
> 2. Can SourceLevelDebug (rely on Local APIC timer) work if this driver is 
> chosen
> as DXE timer driver?
> 3. Can detailed comments be added for " @bug : This does not handle missed
> timer interrupts" in TimerInterruptHandler()?
> 4. Can detailed comments be added for " DisableInterrupts ();" in
> TimerInterruptHandler()?
> 5. In general what kinds of platforms are capable of using this driver as 
> Timer
> driver?
> 
> Thanks,
> Ray
> 
> -Original Message-
> From: Xu, Min M 
> Sent: Monday, November 8, 2021 2:08 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M ; Yao, Jiewen ;
> Gerd Hoffmann ; Anthony Perard
> ; Julien Grall ; Dong, Eric
> ; Ni, Ray 
> Subject: [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3711
> 
> OvmfPkg.dec is removed from [Packages] because it doesn't depend
> on OvmfPkg. LocalApicTimerDxe is moved to UefiCpuPkg.
> 
> Cc: Jiewen Yao 
> Cc: Gerd Hoffmann 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Signed-off-by: Min Xu 
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc| 2 +-
>  OvmfPkg/AmdSev/AmdSevX64.fdf| 2 +-
>  OvmfPkg/Microvm/MicrovmX64.dsc  | 2 +-
>  OvmfPkg/Microvm/MicrovmX64.fdf  | 2 +-
>  OvmfPkg/OvmfPkgIa32.dsc | 2 +-
>  OvmfPkg/OvmfPkgIa32.fdf | 2 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc  | 2 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf  | 2 +-
>  OvmfPkg/OvmfPkgX64.dsc  | 2 +-
>  OvmfPkg/OvmfPkgX64.fdf  | 2 +-
>  OvmfPkg/OvmfXen.dsc | 2 +-
>  OvmfPkg/OvmfXen.fdf | 2 +-
>  .../LocalApicTimerDxe/LocalApicTimerDxe.c   | 0
>  .../LocalApicTimerDxe/LocalApicTimerDxe.h   | 0
>  .../LocalApicTimerDxe/LocalApicTimerDxe.inf | 6 --
>  15 files changed, 16 insertions(+), 14 deletions(-)
>  rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.c
> (100%)
>  rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.h
> (100%)
>  rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.inf
> (79%)
> 
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc
> b/OvmfPkg/AmdSev/AmdSevX64.dsc
> index 88c51dfe8337..888fc24f1b58 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc
> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
> @@ -674,7 +674,7 @@
>MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
>UefiCpuPkg/CpuDxe/CpuDxe.inf
> -  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
> +  UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
> 
> OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
>OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf
> b/OvmfPkg/AmdSev/AmdSevX64.fdf
> index 7489b04198fe..659810f96bec 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.fdf
> +++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
> @@ -208,7 +208,7 @@ INF
> MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>  INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>  INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
>  INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
> -INF  OvmfPkg/LocalApicTimer

Re: [edk2-devel] [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

2021-11-21 Thread Ni, Ray
Min,
What's the reason of moving this driver to UefiCpuPkg?

When the LocalApicTimerDxe is in OvmfPkg, it's clear that this driver is only 
used by OVMF/QEMU platform.
Now since the patch moves the driver to UefiCpuPkg, it's possible that other 
platforms may choose this driver as the timer driver in DXE phase.

So, we need to make sure the quality of this driver is good enough for a broad 
scope of platforms.

1. What's the issue when this driver still stays in OvmfPkg? If it's a must 
that this driver stays in UefiCpuPkg, please help to address following 
questions:

2. Can SourceLevelDebug (rely on Local APIC timer) work if this driver is 
chosen as DXE timer driver?
3. Can detailed comments be added for " @bug : This does not handle missed 
timer interrupts" in TimerInterruptHandler()?
4. Can detailed comments be added for " DisableInterrupts ();" in 
TimerInterruptHandler()?
5. In general what kinds of platforms are capable of using this driver as Timer 
driver?

Thanks,
Ray

-Original Message-
From: Xu, Min M  
Sent: Monday, November 8, 2021 2:08 PM
To: devel@edk2.groups.io
Cc: Xu, Min M ; Yao, Jiewen ; Gerd 
Hoffmann ; Anthony Perard ; 
Julien Grall ; Dong, Eric ; Ni, Ray 

Subject: [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3711

OvmfPkg.dec is removed from [Packages] because it doesn't depend
on OvmfPkg. LocalApicTimerDxe is moved to UefiCpuPkg.

Cc: Jiewen Yao 
Cc: Gerd Hoffmann 
Cc: Anthony Perard 
Cc: Julien Grall 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Min Xu 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc| 2 +-
 OvmfPkg/AmdSev/AmdSevX64.fdf| 2 +-
 OvmfPkg/Microvm/MicrovmX64.dsc  | 2 +-
 OvmfPkg/Microvm/MicrovmX64.fdf  | 2 +-
 OvmfPkg/OvmfPkgIa32.dsc | 2 +-
 OvmfPkg/OvmfPkgIa32.fdf | 2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc  | 2 +-
 OvmfPkg/OvmfPkgIa32X64.fdf  | 2 +-
 OvmfPkg/OvmfPkgX64.dsc  | 2 +-
 OvmfPkg/OvmfPkgX64.fdf  | 2 +-
 OvmfPkg/OvmfXen.dsc | 2 +-
 OvmfPkg/OvmfXen.fdf | 2 +-
 .../LocalApicTimerDxe/LocalApicTimerDxe.c   | 0
 .../LocalApicTimerDxe/LocalApicTimerDxe.h   | 0
 .../LocalApicTimerDxe/LocalApicTimerDxe.inf | 6 --
 15 files changed, 16 insertions(+), 14 deletions(-)
 rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.c (100%)
 rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.h (100%)
 rename {OvmfPkg => UefiCpuPkg}/LocalApicTimerDxe/LocalApicTimerDxe.inf (79%)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 88c51dfe8337..888fc24f1b58 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -674,7 +674,7 @@
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
-  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+  UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index 7489b04198fe..659810f96bec 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -208,7 +208,7 @@ INF  
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
-INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+INF  UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 1a0e848f8356..fcb8b571a041 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -656,7 +656,7 @@
 
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
-  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+  UefiCpuPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf
index ac9efba26811..d02e88e2a48e 100644
--- a/OvmfPkg/Microvm/MicrovmX64.fdf
+++ b/OvmfPkg/Microvm/MicrovmX64.fdf
@@ -215,7 +215,7 @@ INF  MdeModulePkg/Univer

Re: [edk2-devel] [PATCH V3 3/3] OvmfPkg: Move LocalApicTimerDxe to UefiCpuPkg

2021-11-11 Thread Anthony PERARD via groups.io
On Mon, Nov 08, 2021 at 02:08:00PM +0800, Min Xu wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3711
> 
> OvmfPkg.dec is removed from [Packages] because it doesn't depend
> on OvmfPkg. LocalApicTimerDxe is moved to UefiCpuPkg.
> 
> Cc: Jiewen Yao 
> Cc: Gerd Hoffmann 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Signed-off-by: Min Xu 

Reviewed-by: Anthony PERARD 

Thanks,

-- 
Anthony PERARD


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