Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename EDKII_PEI_MP_SERVICES2_PPI to EFI_PEI_MP_SERVICES2_PPI #10775

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sachinami
Copy link
Contributor

@sachinami sachinami commented Feb 20, 2025

Description

EDKII_PEI_MP_SERVICES2_PPI was introduced in https://mantis.uefi.org/mantis/view.php?id=2160

As per the naming conventions of the PI specification, it should be renamed to EFI_PEI_MP_SERVICES2_PPI.

The PI specification correction has been submitted in this mantis ticket: https://mantis.uefi.org/mantis/view.php?id=2500

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behaviour?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Integration Instructions

Multi Processor Services 2 PPI consumers have to use the PPI structure EFI_PEI_MP_SERVICES2_PPI present in MdePkg/Include/Ppi/MpServices2.h and PPI GUID gEfiPeiMpServices2PpiGuid from MdePkg.

@github-actions github-actions bot added the impact:breaking-change This change breaks existing APIs impacting build or boot. label Feb 20, 2025
Copy link

mergify bot commented Feb 20, 2025

PR can not be merged due to conflict. Please rebase and resubmit

@sachinami sachinami force-pushed the Sachin/MpServices2Update branch 5 times, most recently from e6b9dad to 55550fd Compare February 20, 2025 15:51
@mdkinney
Copy link
Member

Thank you for starting this cleanup. I am wondering if we should keep an alias of the EDK II PPI structure and EDK II GUID to allow downstream consumers time to migrate from the EDK II names to the EFI names.

@sachinami
Copy link
Contributor Author

Thank you for starting this cleanup. I am wondering if we should keep an alias of the EDK II PPI structure and EDK II GUID to allow downstream consumers time to migrate from the EDK II names to the EFI names.

@mdkinney Sure, the header and the PPI GUID have now been retained for backwards compatibility.

@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from 96a8469 to 3e87d0b Compare March 17, 2025 10:07
@@ -151,8 +151,6 @@
#

[Ppis]
gEdkiiPeiMpServices2PpiGuid = { 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is removed, how could it maintain backwards compatibility for the code still consuming this GUID ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, since the PPI GUID has been moved to MdePkg.dec as gEfiPeiMpServices2PpiGuid.
Having the same GUID here with a diffrent name will lead to a build error.

I don't believe it is possible to have an alias or Conditional Processing in DEC.

Is there a way around this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is removed, how could it maintain backwards compatibility for the code still consuming this GUID ?

The PR changed the PPI name which already breaks the backward compatibility:)
I thought we would maintain it through typedef and two Guid Name pointing to same GUID value for a while.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EDK II GUID and the EFI GUID should never have used the same GUID value. I think that is a bug in the PI Spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GUID has existed in PI Spec since the 1.8 version (Released on Mar 03, 2023) and in edk2 since the edk2-stable201908 tag.

We would have to sacrifice backwards compatibility in either PI Spec or edk2. Or find a way to have two GUID Names pointing to the same GUID value in DEC files.

CC: @felixpgithub

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to generate a build warning for builds that are using the EDK II prefixed names so all consumers know to update and we can remove the EDK II names as quickly as possible?

Given that build warnings are fatal these days anyway, this will break the build for those consumers.

So what we might do instead is declare the EDKII aliases conditionally, based on a pre-processor #define. That gives out-of-tree platforms an easy way to fix the broken build (adding the -D option to the compiler command line) when they upgrade, and this also serves as a natural opt-in to the deprecation and subsequent removal of those definitions. (i.e., setting the -D option implies an acknowledgement of the deprecation).

[For the GUID in particular, we could force a build error if the -D option is not set by conditionally emitting a declaration of gEdkiiPeiMpServices2PpiGuid into the PPI header with a conflicting type, considering that #ifdefs don't work in .DEC files]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That matches what we have done in the past for the unsafe string functions using the define DISABLE_NEW_DEPRECATED_INTERFACES. Though I notice that has been removed from code but is still in many DSC files.

So suggestion is to remove MpServices.h from UefiCpuPkg. Add MpServices.h to MdePkg following PI spec and add something like #ifdef ENABLE_DEPRECATED_EDKII_MP_SERVICES around EDK II typedef and GUID.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ardbiesheuvel @mdkinney Thank you for your comments.

MpServices2.h has been removed from UefiCpuPkg and the instance in MdePkg has been modified for conditional backwards compatibility.

Also I believe it will be worth it to leave DISABLE_NEW_DEPRECATED_INTERFACES in the DSC files for now.
In UEFI 2.10A specification there are a bunch of items which were removed. These are definitions and interfaces which were deprecated in earlier versions of the spec and have been removed now.

Some of them are :

  • gEfiDeviceIoProtocolGuid
  • gEfiUgaIoProtocolGuid
  • gEfiUgaDrawProtocolGuid
  • gEfiScsiPassThruProtocolGuid
  • EFI_VARIABLE_AUTHENTICATION
  • EFI_IP4_CONFIG_PROTOCOL
  • EFI_DRIVER_CONFIGURATION_PROTOCOL
  • EFI_DRIVER_DIAGNOSTICS_PROTOCOL
  • EFI_COMPONENT_NAME_PROTOCOL

I was thinking of creating a PR which will remove some of these and wrap up the others in DISABLE_NEW_DEPRECATED_INTERFACES.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend a new define name be used for this and the define name should include the name/version of the spec the items were deprecated. That way, a platform can choose which deprecated items to keep or not based in spec name/version. This also makes it easier to review platform DSC file for these types of defines.

For example, for UEFI 2.10, we could use a define name such as ENABLE_UEFI_2_10_DEPRECATED_INTERFACES

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it @mdkinney. Thank you!

@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from 3e87d0b to aaa2788 Compare March 17, 2025 13:50
@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from aaa2788 to a848e25 Compare March 17, 2025 14:14
@sachinami sachinami changed the title Rename EDKII_PEI_MP_SERVICES2_PPI as EFI_PEI_MP_SERVICES2_PPI Rename EDKII_PEI_MP_SERVICES2_PPI to EFI_PEI_MP_SERVICES2_PPI Mar 17, 2025
@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from a848e25 to 2af0bb6 Compare March 18, 2025 00:08
@mdkinney mdkinney requested review from ajfish, makubacki and leiflindholm and removed request for mdkinney and zhangbaoqi-ls March 19, 2025 16:21
@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from 2af0bb6 to 5fac6c9 Compare March 21, 2025 09:41
@ardbiesheuvel
Copy link
Member

Please ensure that no platform gets broken even temporarily when only some of the patches are applied in the order you are presenting them here.

Generally, that means the following when renaming and/or moving something

  • create the new version
  • move all users to the new version
  • remove the old version

@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from 5fac6c9 to 29d5949 Compare March 21, 2025 12:58
@sachinami
Copy link
Contributor Author

@ardbiesheuvel The commits have been re-ordered.

#define gEdkiiPeiMpServices2PpiGuid gEfiPeiMpServices2PpiGuid

#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for this series to be bisectable, these declarations should be combined with the first patch, and the same patch should remove the original header file from UefiCpuPkg. Only the #ifdef/#endif should be added at the very end of the series.

Otherwise, there will be ambiguity around which set of declarations are visible when compiling code that depends on both MdePkg and UefiCpuPkg.

Doing so will break code that relies on UefiCpuPkg but not on MdePkg, but the assumption is that such code does not exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that these declarations should be combined with the first patch. But if the same patch should remove the original header file from UefiCpuPkg, that would mean that MdePkg changes and UefiCpuPkg would be going into the same commit.

And I believe cross-package commits are not permitted in edk2.

We could avoid this, if we bank on the assumption there there would be no code that relies on UefiCpuPkg but not on MdePkg.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that these declarations should be combined with the first patch. But if the same patch should remove the original header file from UefiCpuPkg, that would mean that MdePkg changes and UefiCpuPkg would be going into the same commit.

And I believe cross-package commits are not permitted in edk2.

It is permitted in exceptional cases.

We could avoid this, if we bank on the assumption there there would be no code that relies on UefiCpuPkg but not on MdePkg.

That still means that the new header file that you introduce, which has the same base name, must provide both the old and the new PPI, without relying on any #defines.

So

  • patch #1 adds the new header in MdePkg, with backward-compatible aliases defined unconditionally
  • patch #2 removes the old header
  • patches #3 - #(n-1) update the in-tree users
  • patch #n adds the #ifdef conditionals around the backward-compatible aliases.

How does that sound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds Good @ardbiesheuvel. The commits have been changed accordingly.

EFI_PEI_MP_SERVICES2_PPI has been added to MdePkg.

This PPI earlier existed as EDKII_PEI_MP_SERVICES2_PPI in UefiCpuPkg.

EDKII_PEI_MP_SERVICES2_PPI structure and PPI GUID are provided as
references for backwards compatibility.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

The related header and PPI GUID has been removed from UefiCpuPkg

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg.

Relevant changes have been made here.

Signed-off-by: Sachin Ganesh <[email protected]>
EDKII_PEI_MP_SERVICES2_PPI has been renamed to EFI_PEI_MP_SERVICES2_PPI
and moved to MdePkg. EDKII_PEI_MP_SERVICES2_PPI structure and PPI GUID
are provided as backward compatible references.

These references have been wrapped under a conditional to aid with
its eventual removal.

To enable, define ENABLE_DEPRECATED_EDKII_MP_SERVICES2.

Signed-off-by: Sachin Ganesh <[email protected]>
@sachinami sachinami force-pushed the Sachin/MpServices2Update branch from 29d5949 to 2489b3a Compare March 24, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:breaking-change This change breaks existing APIs impacting build or boot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants