[edk2-devel] [PATCH V2 0/4] Fix race condition and add event protocol

Gao, Zhichao zhichao.gao at intel.com
Tue Jul 9 08:39:52 UTC 2019


V1:
There is a race condition in CoreWaitForEvent function:
If an interrupt happens between CheckEvent and gIdleLoopEvent,
there would be a event pending during cpu sleep. 
So it is required to check the gEventPending with the interrupt
disabled.
Implement a gEfiCpu2ProtocolGuid to fix that. The protocol include
one interface to enable interrupt and put the cpu to sleep.

Add a event protocol gEdkiiCommonEventProtocolGuid to support
all TPL event. It is require for PI drivers that use HW interrput.

V2:
Move EnableInterruptsAndSleep to UefiCpuPkg/CpuDxe. It is inappropiate
to add it to MdePkg which should only contain code base on the UEFI spec.
Change the name gEfiCpu2ProtocolGuid to gEdkiiCpu2ProtocolGuid.

Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>
cc: Ray Ni <ray.ni at intel.com>
Cc: Star Zeng <star.zeng at intel.com>
Cc: Liming gao <liming.gao at intel.com>
Cc: Sean Brogan <sean.brogan at microsoft.com>
Cc: Michael Turner <Michael.Turner at microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew at microsoft.com>
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Eric Dong <eric.dong at intel.com>

Sean Brogan (3):
  MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file
  UefiCpuPkg/CpuDxe: Implement Cpu2 protocol
  MdeModulePkg/DxeMain: Implement common event protocol

Zhichao Gao (1):
  MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event

 MdeModulePkg/Core/Dxe/DxeMain.h               |  64 ++++++++++-
 MdeModulePkg/Core/Dxe/DxeMain.inf             |   2 +
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c       |  22 ++++
 .../Core/Dxe/DxeMain/DxeProtocolNotify.c      |   1 +
 MdeModulePkg/Core/Dxe/Event/Event.c           | 102 ++++++++++++++++--
 MdeModulePkg/Core/Dxe/Event/Event.h           |   2 +-
 MdeModulePkg/Include/Protocol/CommonEvent.h   |  18 ++++
 MdeModulePkg/Include/Protocol/Cpu2.h          |  43 ++++++++
 MdeModulePkg/MdeModulePkg.dec                 |   6 ++
 UefiCpuPkg/CpuDxe/CpuDxe.c                    |  38 +++++++
 UefiCpuPkg/CpuDxe/CpuDxe.h                    |  25 +++++
 UefiCpuPkg/CpuDxe/CpuDxe.inf                  |   3 +
 .../CpuDxe/Ia32/EnableInterruptsAndSleep.c    |  24 +++++
 .../CpuDxe/X64/EnableInterruptsAndSleep.nasm  |  31 ++++++
 14 files changed, 368 insertions(+), 13 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h
 create mode 100644 MdeModulePkg/Include/Protocol/Cpu2.h
 create mode 100644 UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
 create mode 100644 UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm

-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43426): https://edk2.groups.io/g/devel/message/43426
Mute This Topic: https://groups.io/mt/32403448/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list