[edk2-devel] [PATCH 0/3] MdePkg/MdeModulePkg: Introduce a pcd to control runtime services

Gao, Zhichao posted 3 patches 4 years, 9 months ago
Failed in applying to current master (apply log)
.../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf   |   3 +
.../CapsuleRuntimeDxe/CapsuleService.c        | 129 ++++++++++++++++++
MdePkg/Include/Uefi/UefiSpec.h                |  15 ++
MdePkg/MdePkg.dec                             |  19 +++
MdePkg/MdePkg.uni                             |  19 +++
5 files changed, 185 insertions(+)
[edk2-devel] [PATCH 0/3] MdePkg/MdeModulePkg: Introduce a pcd to control runtime services
Posted by Gao, Zhichao 4 years, 9 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1907

UEFI spec 2.8 introduce a new variable L"RuntimeServicesSupported".
If some runtime sevices is not supported at runtime phase, the variable
should present at boot services. It is a bitmask value, the bit value of
zero indicate the related runtime services is not supported at runtime
phase.
Add the difinition and use it to control Capsule runtime services.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
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: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>

Zhichao Gao (3):
  MdePkg/UefiSpec.h: Add define of runtime services support
  MdePkg: Indicate new pcd PcdRuntimeServicesSupport
  MdeModulePkg/CapsuleRuntimeDxe: Control runtime services supported

 .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf   |   3 +
 .../CapsuleRuntimeDxe/CapsuleService.c        | 129 ++++++++++++++++++
 MdePkg/Include/Uefi/UefiSpec.h                |  15 ++
 MdePkg/MdePkg.dec                             |  19 +++
 MdePkg/MdePkg.uni                             |  19 +++
 5 files changed, 185 insertions(+)

-- 
2.21.0.windows.1


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

View/Reply Online (#43848): https://edk2.groups.io/g/devel/message/43848
Mute This Topic: https://groups.io/mt/32500925/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/3] MdePkg/MdeModulePkg: Introduce a pcd to control runtime services
Posted by Laszlo Ersek 4 years, 9 months ago
Hello Zhichao,

On 07/17/19 09:37, Gao, Zhichao wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1907
> 
> UEFI spec 2.8 introduce a new variable L"RuntimeServicesSupported".
> If some runtime sevices is not supported at runtime phase, the variable
> should present at boot services. It is a bitmask value, the bit value of
> zero indicate the related runtime services is not supported at runtime
> phase.
> Add the difinition and use it to control Capsule runtime services.
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 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: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> 
> Zhichao Gao (3):
>   MdePkg/UefiSpec.h: Add define of runtime services support
>   MdePkg: Indicate new pcd PcdRuntimeServicesSupport
>   MdeModulePkg/CapsuleRuntimeDxe: Control runtime services supported

Is a given platform expected to set the new PCD in accordance with other
platform settings?

Here's why I'm asking. OVMF does not support capsule services, as shown
by the following library class resolution in the OVMF DSC files:

  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf

OVMF will return EFI_UNSUPPORTED when the capsule runtime services are
invoked.

I'm not sure if the new PCD (and new UEFI variable,
"RuntimeServicesSupported") place new requirements on OVMF. It looks
like they do.

(1) If you agree, can you please include a new patch for OvmfPkg that
clears the EFI_RT_SUPPORTED_UPDATE_CAPSULE and
RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES bits in the PCD, in all three
DSC files?

(2) And, the same applies to all three ArmVirtPkg platforms:
ArmVirtQemu, ArmVirtQemuKernel, and ArmVirtXen.

(3) Furthermore, we already seem to have a related (generic) PCD, namely
PcdCapsuleInRamSupport. If that PCD is set to FALSE, then
UpdateCapsule() in
"MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c" will return
EFI_UNSUPPORTED.

Should we introduce a consistency check somewhere, between the
capsule-related bits of the PcdRuntimeServicesSupport bitmask, and
PcdCapsuleInRamSupport?


I'm getting confused by the possible interactions between:
- PcdRuntimeServicesSupport
- PcdCapsuleInRamSupport
- and the CapsuleLib class resolution.

Thanks!
Laszlo

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

View/Reply Online (#43883): https://edk2.groups.io/g/devel/message/43883
Mute This Topic: https://groups.io/mt/32500925/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/3] MdePkg/MdeModulePkg: Introduce a pcd to control runtime services
Posted by Gao, Zhichao 4 years, 9 months ago

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Wednesday, July 17, 2019 9:15 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Sean Brogan <sean.brogan@microsoft.com>;
> Michael Turner <Michael.Turner@microsoft.com>; Bret Barkelew
> <Bret.Barkelew@microsoft.com>
> Subject: Re: [edk2-devel] [PATCH 0/3] MdePkg/MdeModulePkg: Introduce a
> pcd to control runtime services
> 
> Hello Zhichao,
> 
> On 07/17/19 09:37, Gao, Zhichao wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1907
> >
> > UEFI spec 2.8 introduce a new variable L"RuntimeServicesSupported".
> > If some runtime sevices is not supported at runtime phase, the
> > variable should present at boot services. It is a bitmask value, the
> > bit value of zero indicate the related runtime services is not
> > supported at runtime phase.
> > Add the difinition and use it to control Capsule runtime services.
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > 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: Sean Brogan <sean.brogan@microsoft.com>
> > Cc: Michael Turner <Michael.Turner@microsoft.com>
> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> >
> > Zhichao Gao (3):
> >   MdePkg/UefiSpec.h: Add define of runtime services support
> >   MdePkg: Indicate new pcd PcdRuntimeServicesSupport
> >   MdeModulePkg/CapsuleRuntimeDxe: Control runtime services supported
> 
> Is a given platform expected to set the new PCD in accordance with other
> platform settings?

No. I add the new pcd because some platforms want to disable the capsule services at runtime phase, but I don't know the specific platforms, and the pcd is consistence with the Uefi spec 2.8.

> 
> Here's why I'm asking. OVMF does not support capsule services, as shown by
> the following library class resolution in the OVMF DSC files:
> 
> 
> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.i
> nf
> 
> OVMF will return EFI_UNSUPPORTED when the capsule runtime services are
> invoked.
> 
> I'm not sure if the new PCD (and new UEFI variable,
> "RuntimeServicesSupported") place new requirements on OVMF. It looks
> like they do.
> 
> (1) If you agree, can you please include a new patch for OvmfPkg that clears
> the EFI_RT_SUPPORTED_UPDATE_CAPSULE and
> RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES bits in the PCD, in all three
> DSC files?
> 
> (2) And, the same applies to all three ArmVirtPkg platforms:
> ArmVirtQemu, ArmVirtQemuKernel, and ArmVirtXen.

This pcd is introduced for the platform to have a convenience way to disable their unwanted runtime services at runtime.
I am not sure which runtime services is unwanted in the above platforms. The new pcd should be set to a right value although disabling other runtime services is not implemented yet. If only capsule services are unwanted, I am fine to change it for them.

> 
> (3) Furthermore, we already seem to have a related (generic) PCD, namely
> PcdCapsuleInRamSupport. If that PCD is set to FALSE, then
> UpdateCapsule() in
> "MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c" will
> return EFI_UNSUPPORTED.
> 
> Should we introduce a consistency check somewhere, between the capsule-
> related bits of the PcdRuntimeServicesSupport bitmask, and
> PcdCapsuleInRamSupport?
> 
> 
> I'm getting confused by the possible interactions between:
> - PcdRuntimeServicesSupport

The new pcd PcdRuntimeServicesSupport is required because of the spec. And it only disable the unwanted runtime services at runtime without any effect on boot phase.
See the description above Uefi spec 2.8, Section 8.1.

> - PcdCapsuleInRamSupport

I didn't know the background of PcdCapsuleInRamSupport. But it only affects capsule services->CapsuleUpdate. It is introduced on https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Capsule-on-Disk-Introducation. And it affects both boot and runtime phase.

> - and the CapsuleLib class resolution.

The null-version may be added for build pass. And it disable capsule service in both boot and runtime phase. Those are just my thoughts.

Thanks,
Zhichao

> 
> Thanks!
> Laszlo
> 
> 


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

View/Reply Online (#43899): https://edk2.groups.io/g/devel/message/43899
Mute This Topic: https://groups.io/mt/32500925/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-