diff mbox

[Linaro-uefi,v2,01/24] D02/D03: workaround to fix timer interrupt issue

Message ID 1476796207-94336-2-git-send-email-heyi.guo@linaro.org
State Accepted
Commit 7fdfee32ee9c583a472b3ac307ea202bc492d485
Headers show

Commit Message

gary guo Oct. 18, 2016, 1:09 p.m. UTC
Timer interrupt cannot be reported after EDK2 commit 7989300, for GIC
on D02/D03 is not fully ARM GIC compliant. The issue has been fixed on
newer chips so we use a workaround for D02 and D03 only.
On D02 and D03, IRQ will be latched in GIC logic except virtual timer
interrupt IRQ #27, so we change to use virtual timer instead of physical
in UEFI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
---
 Platforms/Hisilicon/D02/Pv660D02.dsc | 10 ++++++++--
 Platforms/Hisilicon/D02/Pv660D02.fdf |  2 +-
 Platforms/Hisilicon/D03/D03.dsc      | 10 +++++++++-
 Platforms/Hisilicon/D03/D03.fdf      |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

Comments

Leif Lindholm Oct. 27, 2016, 11:33 a.m. UTC | #1
On Tue, Oct 18, 2016 at 09:09:45PM +0800, Heyi Guo wrote:
> Timer interrupt cannot be reported after EDK2 commit 7989300, for GIC
> on D02/D03 is not fully ARM GIC compliant. The issue has been fixed on
> newer chips so we use a workaround for D02 and D03 only.
> On D02 and D03, IRQ will be latched in GIC logic except virtual timer
> interrupt IRQ #27, so we change to use virtual timer instead of physical
> in UEFI.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Pushed as 7fdfee3.

> ---
>  Platforms/Hisilicon/D02/Pv660D02.dsc | 10 ++++++++--
>  Platforms/Hisilicon/D02/Pv660D02.fdf |  2 +-
>  Platforms/Hisilicon/D03/D03.dsc      | 10 +++++++++-
>  Platforms/Hisilicon/D03/D03.fdf      |  2 +-
>  4 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/Platforms/Hisilicon/D02/Pv660D02.dsc b/Platforms/Hisilicon/D02/Pv660D02.dsc
> index d025bdd..2228e51 100644
> --- a/Platforms/Hisilicon/D02/Pv660D02.dsc
> +++ b/Platforms/Hisilicon/D02/Pv660D02.dsc
> @@ -72,6 +72,13 @@
>    PlatformBdsLib|OpenPlatformPkg/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>  
> +## GIC on D02/D03 is not fully ARM GIC compatible: IRQ cannot be cancelled when
> +## input signal is de-asserted, except for virtual timer interrupt IRQ #27.
> +## So we choose to use virtual timer instead of physical one as a workaround.
> +## This library instance is to override the original define in LibraryClasses.AARCH64 in Pv660.dsc.inc.
> +[LibraryClasses.AARCH64]
> +  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
> +
>  [LibraryClasses.common.SEC]
>    ArmPlatformLib|OpenPlatformPkg/Chips/Hisilicon/Library/ArmPlatformLibPv660/ArmPlatformLibSec.inf
>  
> @@ -341,8 +348,7 @@
>  
>    ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>  
> -  #ArmPkg/Drivers/TimerDxe/TimerDxe
> -  ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>    ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
>  
>    IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
> diff --git a/Platforms/Hisilicon/D02/Pv660D02.fdf b/Platforms/Hisilicon/D02/Pv660D02.fdf
> index 69be1f1..fa0dc2d 100644
> --- a/Platforms/Hisilicon/D02/Pv660D02.fdf
> +++ b/Platforms/Hisilicon/D02/Pv660D02.fdf
> @@ -195,7 +195,7 @@ READ_LOCK_STATUS   = TRUE
>    #INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
>  
>    INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> -  INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>    INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
>  
>    #
> diff --git a/Platforms/Hisilicon/D03/D03.dsc b/Platforms/Hisilicon/D03/D03.dsc
> index 83a18b1..6d82627 100644
> --- a/Platforms/Hisilicon/D03/D03.dsc
> +++ b/Platforms/Hisilicon/D03/D03.dsc
> @@ -81,6 +81,14 @@
>  
>    LpcLib|OpenPlatformPkg/Chips/Hisilicon/Binary/Hi1610/Library/LpcLib/LpcLib.inf
>    SerialPortLib|OpenPlatformPkg/Chips/Hisilicon/Binary/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
> +
> +## GIC on D02/D03 is not fully ARM GIC compatible: IRQ cannot be cancelled when
> +## input signal is de-asserted, except for virtual timer interrupt IRQ #27.
> +## So we choose to use virtual timer instead of physical one as a workaround.
> +## This library instance is to override the original define in LibraryClasses.AARCH64 in Pv660.dsc.inc.
> +[LibraryClasses.AARCH64]
> +  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
> +
>  [LibraryClasses.common.SEC]
>    ArmPlatformLib|OpenPlatformPkg/Chips/Hisilicon/Library/ArmPlatformLibPv660/ArmPlatformLibSec.inf
>  
> @@ -396,7 +404,7 @@
>  
>    ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>  
> -  ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>  
>    ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
>    IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
> diff --git a/Platforms/Hisilicon/D03/D03.fdf b/Platforms/Hisilicon/D03/D03.fdf
> index 8144151..8ba3bd0 100644
> --- a/Platforms/Hisilicon/D03/D03.fdf
> +++ b/Platforms/Hisilicon/D03/D03.fdf
> @@ -187,7 +187,7 @@ READ_LOCK_STATUS   = TRUE
>    # Simple TextIn/TextOut for UEFI Terminal
>  
>    INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> -  INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>  
>    INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
>  
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/Platforms/Hisilicon/D02/Pv660D02.dsc b/Platforms/Hisilicon/D02/Pv660D02.dsc
index d025bdd..2228e51 100644
--- a/Platforms/Hisilicon/D02/Pv660D02.dsc
+++ b/Platforms/Hisilicon/D02/Pv660D02.dsc
@@ -72,6 +72,13 @@ 
   PlatformBdsLib|OpenPlatformPkg/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
 
+## GIC on D02/D03 is not fully ARM GIC compatible: IRQ cannot be cancelled when
+## input signal is de-asserted, except for virtual timer interrupt IRQ #27.
+## So we choose to use virtual timer instead of physical one as a workaround.
+## This library instance is to override the original define in LibraryClasses.AARCH64 in Pv660.dsc.inc.
+[LibraryClasses.AARCH64]
+  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
+
 [LibraryClasses.common.SEC]
   ArmPlatformLib|OpenPlatformPkg/Chips/Hisilicon/Library/ArmPlatformLibPv660/ArmPlatformLibSec.inf
 
@@ -341,8 +348,7 @@ 
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
 
-  #ArmPkg/Drivers/TimerDxe/TimerDxe
-  ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
 
   IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
diff --git a/Platforms/Hisilicon/D02/Pv660D02.fdf b/Platforms/Hisilicon/D02/Pv660D02.fdf
index 69be1f1..fa0dc2d 100644
--- a/Platforms/Hisilicon/D02/Pv660D02.fdf
+++ b/Platforms/Hisilicon/D02/Pv660D02.fdf
@@ -195,7 +195,7 @@  READ_LOCK_STATUS   = TRUE
   #INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf
 
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
+  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
 
   #
diff --git a/Platforms/Hisilicon/D03/D03.dsc b/Platforms/Hisilicon/D03/D03.dsc
index 83a18b1..6d82627 100644
--- a/Platforms/Hisilicon/D03/D03.dsc
+++ b/Platforms/Hisilicon/D03/D03.dsc
@@ -81,6 +81,14 @@ 
 
   LpcLib|OpenPlatformPkg/Chips/Hisilicon/Binary/Hi1610/Library/LpcLib/LpcLib.inf
   SerialPortLib|OpenPlatformPkg/Chips/Hisilicon/Binary/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
+
+## GIC on D02/D03 is not fully ARM GIC compatible: IRQ cannot be cancelled when
+## input signal is de-asserted, except for virtual timer interrupt IRQ #27.
+## So we choose to use virtual timer instead of physical one as a workaround.
+## This library instance is to override the original define in LibraryClasses.AARCH64 in Pv660.dsc.inc.
+[LibraryClasses.AARCH64]
+  ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
+
 [LibraryClasses.common.SEC]
   ArmPlatformLib|OpenPlatformPkg/Chips/Hisilicon/Library/ArmPlatformLibPv660/ArmPlatformLibSec.inf
 
@@ -396,7 +404,7 @@ 
 
   ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
 
-  ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf
 
   ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf
   IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
diff --git a/Platforms/Hisilicon/D03/D03.fdf b/Platforms/Hisilicon/D03/D03.fdf
index 8144151..8ba3bd0 100644
--- a/Platforms/Hisilicon/D03/D03.fdf
+++ b/Platforms/Hisilicon/D03/D03.fdf
@@ -187,7 +187,7 @@  READ_LOCK_STATUS   = TRUE
   # Simple TextIn/TextOut for UEFI Terminal
 
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
-  INF ArmPlatformPkg/Drivers/SP804TimerDxe/SP804TimerDxe.inf
+  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
 
   INF ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805WatchdogDxe.inf