public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>,
	Star Zeng <star.zeng@intel.com>,
	Liming gao <liming.gao@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Turner <Michael.Turner@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Eric Dong <eric.dong@intel.com>
Subject: [PATCH V2 0/4] Fix race condition and add event protocol
Date: Tue,  9 Jul 2019 16:39:52 +0800	[thread overview]
Message-ID: <20190709083956.13024-1-zhichao.gao@intel.com> (raw)

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@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@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


             reply	other threads:[~2019-07-09  8:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09  8:39 Gao, Zhichao [this message]
2019-07-09  8:39 ` [PATCH V2 1/4] MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file Gao, Zhichao
2019-07-09  8:39 ` [PATCH V2 2/4] UefiCpuPkg/CpuDxe: Implement Cpu2 protocol Gao, Zhichao
2019-07-11  2:22   ` Dong, Eric
2019-07-11  2:36     ` Gao, Zhichao
2019-07-11 10:24       ` Laszlo Ersek
2019-07-11 10:48         ` Leif Lindholm
2019-07-09  8:39 ` [PATCH V2 3/4] MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event Gao, Zhichao
2019-07-09  8:39 ` [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol Gao, Zhichao
2019-07-09  9:23   ` Wang, Jian J
2019-07-10  0:24     ` Gao, Zhichao
2019-07-10  8:46       ` Wang, Jian J
2019-07-11  0:20         ` Gao, Zhichao
2019-07-11  1:26           ` Wang, Jian J
2019-07-10 12:20 ` [edk2-devel] [PATCH V2 0/4] Fix race condition and add " Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190709083956.13024-1-zhichao.gao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox