From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: dandan.bi@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Wed, 18 Sep 2019 18:47:54 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 18:47:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="387103277" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 18 Sep 2019 18:47:53 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 18:47:53 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Sep 2019 18:47:52 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Sep 2019 18:47:52 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.53]) with mapi id 14.03.0439.000; Thu, 19 Sep 2019 09:47:51 +0800 From: "Dandan Bi" To: Laszlo Ersek , edk2-devel-groups-io CC: "Wu, Hao A" , "Wang, Jian J" , "Gao, Liming" Subject: Re: [PATCH 11/35] MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug Thread-Topic: [PATCH 11/35] MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug Thread-Index: AQHVbZExJFk19VLgGE+71ZyfR9L+QqcyPUdA Date: Thu, 19 Sep 2019 01:47:50 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40C5DA19@SHSMSX104.ccr.corp.intel.com> References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-12-lersek@redhat.com> In-Reply-To: <20190917194935.24322-12-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: dandan.bi@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Dandan Bi Thanks, Dandan > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, September 18, 2019 3:49 AM > To: edk2-devel-groups-io > Cc: Bi, Dandan ; Wu, Hao A ; > Wang, Jian J ; Gao, Liming > Subject: [PATCH 11/35] MdeModulePkg: document workaround for > EFI_RUNTIME_EVENT_ENTRY PI spec bug >=20 > The PI spec (v1.7) correctly specifies "EFI_RUNTIME_EVENT_ENTRY.Event" in > natural language, but the field type in the structure definition itself i= s wrong - > - it should be EFI_EVENT, not (EFI_EVENT*). >=20 > This spec bug is likely unfixable for compatibility reasons, and so edk2 = works > it around already. We should clearly document the workaround. >=20 > Functionally, this patch is a no-op. >=20 > (I've also requested a non-normative (informative) clarification for the = PI > spec: .) >=20 > Cc: Dandan Bi > Cc: Hao A Wu > Cc: Jian J Wang > Cc: Liming Gao > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > lightly tested, as these modules are part of the ArmVirt and/or OVMF > platforms >=20 > MdeModulePkg/Core/Dxe/Event/Event.c | 8 ++++++++ > MdeModulePkg/Core/RuntimeDxe/Runtime.c | 10 +++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c > b/MdeModulePkg/Core/Dxe/Event/Event.c > index 21db38aaf037..c83c572c8f84 100644 > --- a/MdeModulePkg/Core/Dxe/Event/Event.c > +++ b/MdeModulePkg/Core/Dxe/Event/Event.c > @@ -485,6 +485,14 @@ CoreCreateEventInternal ( > IEvent->RuntimeData.NotifyTpl =3D NotifyTpl; > IEvent->RuntimeData.NotifyFunction =3D NotifyFunction; > IEvent->RuntimeData.NotifyContext =3D (VOID *) NotifyContext; > + // > + // Work around the bug in the Platform Init specification (v1.7), re= ported > + // as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have > type > + // EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field > correctly > + // as "The EFI_EVENT returned by CreateEvent()", but the type of the > field > + // doesn't match the natural language description. Therefore we need= an > + // explicit cast here. > + // > IEvent->RuntimeData.Event =3D (EFI_EVENT *) IEvent; > InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link); > } > diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c > b/MdeModulePkg/Core/RuntimeDxe/Runtime.c > index c52b2b7ecf68..f7220a205d1e 100644 > --- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c > +++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c > @@ -285,8 +285,16 @@ RuntimeDriverSetVirtualAddressMap ( > for (Link =3D mRuntime.EventHead.ForwardLink; Link !=3D > &mRuntime.EventHead; Link =3D Link->ForwardLink) { > RuntimeEvent =3D BASE_CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link); > if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) =3D=3D > EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) { > + // > + // Work around the bug in the Platform Init specification (v1.7), > + // reported as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" > should have > + // type EFI_EVENT, not (EFI_EVENT*). The PI spec documents the fie= ld > + // correctly as "The EFI_EVENT returned by CreateEvent()", but the= type > + // of the field doesn't match the natural language description. Th= erefore > + // we need an explicit cast here. > + // > RuntimeEvent->NotifyFunction ( > - RuntimeEvent->Event, > + (EFI_EVENT) RuntimeEvent->Event, > RuntimeEvent->NotifyContext > ); > } > -- > 2.19.1.3.g30247aa5d201 >=20