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

Arm virt psci on armmonitorlib #5933

Merged

Conversation

ardbiesheuvel
Copy link
Member

@ardbiesheuvel ardbiesheuvel commented Jul 21, 2024

Related to #5922

  • Reimplement ArmPsciResetSystemLib as a version of ResetSystemLib (rather than EfiResetSystemLib which will be made obsolete), based on ArmMonitorLib to select between HVC and SMC calls.
  • Wire it up for ArmVirtQemu et al so that the selection is based on the arm,psci DT node

The first patch was taken from #5922 but should not be merged as part of this PR.

@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch 2 times, most recently from 9f423b9 to be18c2c Compare July 21, 2024 21:05
@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch from be18c2c to a34e797 Compare July 22, 2024 09:02
@os-d
Copy link
Contributor

os-d commented Jul 22, 2024

This looks reasonable to me, but is it possible to have a single ArmResetSystemLib, since this new version just depends on a feature PCD to determine whether to make SMC or HVC calls, we could do away with the SMC only version?

@ardbiesheuvel
Copy link
Member Author

This looks reasonable to me, but is it possible to have a single ArmResetSystemLib, since this new version just depends on a feature PCD to determine whether to make SMC or HVC calls, we could do away with the SMC only version?

Yes, we could remove ArmSmcPsciResetSystemLib after this change, but we'd have to update the users in edk2-platforms first.

@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch from a08ce8a to c4d9fce Compare July 22, 2024 22:20
@os-d
Copy link
Contributor

os-d commented Jul 22, 2024

Sounds good. I can queue that up after this change, I think it is worthwhile to only have one lib to maintain.

@ardbiesheuvel
Copy link
Member Author

ardbiesheuvel commented Jul 23, 2024

@makubacki @mdkinney This PR failswas failing the uncrustify checks but the attachments are missing from the test results.

Please advise how to determine why these checks failed from the CI web UI.

@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch 2 times, most recently from bdad961 to 46d2cc1 Compare July 23, 2024 16:16
@makubacki
Copy link
Member

@makubacki @mdkinney This PR failswas failing the uncrustify checks but the attachments are missing from the test results.

Please advise how to determine why these checks failed from the CI web UI.

I'm not 100% sure why the attachment is not in the test results, it might be related to audit mode being enabled for uncrustify in ArmPkg. Which means the test was skipped and therefore it may not be shown. I see it in test results UI for other packages that do not have Uncrustify in audit mode. Audit mode also means Uncrustify didn't contribute to the CI failure, it was EccCheck from the ECC errors.

To find it in this case, in the published artifacts, if you download the TARGET_ARM_ARMPLATFORM zip file, you can open TestSuites.xml and see the result that would be in the test UI:

 Formatting errors in Library\ArmMonitorLib\ArmMonitorLib.c
 --- D:\a\1\s\ArmPkg\Library\ArmMonitorLib\ArmMonitorLib.c
 +++ D:\a\1\s\ArmPkg\Library\ArmMonitorLib\ArmMonitorLib.c.uncrustify_plugin
 @@ -26,7 +26,7 @@
 IN OUT ARM_MONITOR_ARGS  *Args
 )
 {
 -  if (FeaturePcdGet  (PcdMonitorConduitHvc)) {
 +  if (FeaturePcdGet (PcdMonitorConduitHvc)) {
 ArmCallHvc ((ARM_HVC_ARGS *)Args);
 } else {
 ArmCallSmc ((ARM_SMC_ARGS *)Args);
 
 Formatting errors in Library\DebugPeCoffExtraActionLib\DebugPeCoffExtraActionLib.c
 --- D:\a\1\s\ArmPkg\Library\DebugPeCoffExtraActionLib\DebugPeCoffExtraActionLib.c
 +++ D:\a\1\s\ArmPkg\Library\DebugPeCoffExtraActionLib\DebugPeCoffExtraActionLib.c.uncrustify_plugin
 @@ -32,7 +32,7 @@
 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
 )
 {
 -#ifdef __GNUC__
 + #ifdef __GNUC__
 if (ImageContext->PdbPointer) {
 DEBUG ((
 DEBUG_LOAD | DEBUG_INFO,
 @@ -42,7 +42,8 @@
 ));
 return;
 }
 -#endif
 +
 + #endif
 
 DEBUG ((
 DEBUG_LOAD | DEBUG_INFO,
 @@ -68,7 +69,7 @@
 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
 )
 {
 -#ifdef __GNUC__
 + #ifdef __GNUC__
 if (ImageContext->PdbPointer) {
 DEBUG ((
 DEBUG_LOAD | DEBUG_INFO,
 @@ -78,7 +79,8 @@
 ));
 return;
 }
 -#endif
 +
 + #endif
 
 DEBUG ((
 DEBUG_LOAD | DEBUG_INFO,

The build log (from the zip file) will also list the files that need formatting:

INFO - Formatting errors in Library\ArmMonitorLib\ArmMonitorLib.c
INFO - Formatting errors in Library\DebugPeCoffExtraActionLib\DebugPeCoffExtraActionLib.c
INFO - Setting test as skipped since AuditOnly is enabled
WARNING - --->Test Skipped: in plugin! Uncrustify Coding Standard Test NO-TARGET

Running Uncrustify on those files will make the changes needed.

@ardbiesheuvel
Copy link
Member Author

@makubacki @mdkinney This PR failswas failing the uncrustify checks but the attachments are missing from the test results.
Please advise how to determine why these checks failed from the CI web UI.

I'm not 100% sure why the attachment is not in the test results, it might be related to audit mode being enabled for uncrustify in ArmPkg. Which means the test was skipped and therefore it may not be shown. I see it in test results UI for other packages that do not have Uncrustify in audit mode. Audit mode also means Uncrustify didn't contribute to the CI failure, it was EccCheck from the ECC errors.

No, this is not the case. Both EccCheck and Uncrustify failed, but not on a file in ArmPkg so the AuditMode has not bearing on this.

To find it in this case, in the published artifacts, if you download the TARGET_ARM_ARMPLATFORM zip file, you can open TestSuites.xml and see the result that would be in the test UI:

Thanks, this is useful. But could we please fix the CI so the attachments are accessible again? If needed, I can create a dummy PR against ArmVirtPkg (which has AuditMode disabled for Uncrustify) to illustrate the issue.

@makubacki
Copy link
Member

@makubacki @mdkinney This PR failswas failing the uncrustify checks but the attachments are missing from the test results.
Please advise how to determine why these checks failed from the CI web UI.

I'm not 100% sure why the attachment is not in the test results, it might be related to audit mode being enabled for uncrustify in ArmPkg. Which means the test was skipped and therefore it may not be shown. I see it in test results UI for other packages that do not have Uncrustify in audit mode. Audit mode also means Uncrustify didn't contribute to the CI failure, it was EccCheck from the ECC errors.

No, this is not the case. Both EccCheck and Uncrustify failed, but not on a file in ArmPkg so the AuditMode has not bearing on this.

Can you please clarify? Are you saying you don't think AuditMode impacted the test results being shown in the UI? I will look at that in more detail, I just can't do so today.

EccCheck failed with two errors in ArmPkg:

ERROR - EFI coding style error
ERROR - *Error code: 9001
ERROR - *The file headers should follow Doxygen special documentation blocks in section 2.3.5
ERROR - *file: D:\a\1\s\Build\.pytool\Plugin\EccCheck\ArmPkg\Library\ArmPsciResetSystemLib\ArmPsciResetSystemLib.inf
ERROR - *Line number: 1
ERROR - *Header comment section must have copyright information
ERROR - 
ERROR - EFI coding style error
ERROR - *Error code: 9001
ERROR - *The file headers should follow Doxygen special documentation blocks in section 2.3.5
ERROR - *file: D:\a\1\s\Build\.pytool\Plugin\EccCheck\ArmPkg\Library\ArmPsciResetSystemLib\ArmPsciResetSystemLib.inf
ERROR - *Line number: 1
ERROR - *Header comment section must have Abstract information.
ERROR - --->Test Failed: EccCheck Test NO-TARGET returned 1
PROGRESS - --Running ArmPkg: Guid Check Test NO-TARGET --

Uncrustify was skipped for two files in ArmPkg:

INFO - Formatting errors in Library\ArmMonitorLib\ArmMonitorLib.c
INFO - Formatting errors in Library\DebugPeCoffExtraActionLib\DebugPeCoffExtraActionLib.c
INFO - Setting test as skipped since AuditOnly is enabled
WARNING - --->Test Skipped: in plugin! Uncrustify Coding Standard Test NO-TARGET

The total run had 1 failure (the one from ECC, which was a failure and not a skip):

ERROR - Overall Build Status: Error
PROGRESS - There were 1 failures out of 13 attempts

@ardbiesheuvel
Copy link
Member Author

@makubacki @mdkinney This PR failswas failing the uncrustify checks but the attachments are missing from the test results.
Please advise how to determine why these checks failed from the CI web UI.

I'm not 100% sure why the attachment is not in the test results, it might be related to audit mode being enabled for uncrustify in ArmPkg. Which means the test was skipped and therefore it may not be shown. I see it in test results UI for other packages that do not have Uncrustify in audit mode. Audit mode also means Uncrustify didn't contribute to the CI failure, it was EccCheck from the ECC errors.

No, this is not the case. Both EccCheck and Uncrustify failed, but not on a file in ArmPkg so the AuditMode has not bearing on this.

Can you please clarify? Are you saying you don't think AuditMode impacted the test results being shown in the UI?

Yes, because the example I am referring to was about a file in ArmVirtPkg not ArmPkg. If you look at the conversation log, you will notice that after the comment about the missing attachment I rebased the branch but also updated it.

I will look at that in more detail, I just can't do so today.

Sure, no rush as far as I am concerned. I figured out in the mean time what the issue was with those particular files. But it would be nice to have that functionality restored.

I created a test PR here:
#5956

@ardbiesheuvel
Copy link
Member Author

The below looks like a separate anomaly:

EccCheck failed with two errors in ArmPkg:

ERROR - EFI coding style error
ERROR - *Error code: 9001
ERROR - *The file headers should follow Doxygen special documentation blocks in section 2.3.5
ERROR - *file: D:\a\1\s\Build\.pytool\Plugin\EccCheck\ArmPkg\Library\ArmPsciResetSystemLib\ArmPsciResetSystemLib.inf
ERROR - *Line number: 1
ERROR - *Header comment section must have copyright information
ERROR - 
ERROR - EFI coding style error
ERROR - *Error code: 9001
ERROR - *The file headers should follow Doxygen special documentation blocks in section 2.3.5
ERROR - *file: D:\a\1\s\Build\.pytool\Plugin\EccCheck\ArmPkg\Library\ArmPsciResetSystemLib\ArmPsciResetSystemLib.inf
ERROR - *Line number: 1
ERROR - *Header comment section must have Abstract information.
ERROR - --->Test Failed: EccCheck Test NO-TARGET returned 1
PROGRESS - --Running ArmPkg: Guid Check Test NO-TARGET --

The file has this

## @file
#  Arm Monitor Library that chooses the conduit based on the PSCI node in the
#  device tree provided by QEMU.
#
#  Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
#  Copyright (c) 2024, Google LLC. All rights reserved.<BR>
#
#  SPDX-License-Identifier: BSD-2-Clause-Patent
##

and the same PR was tested multiple times, and this is the first time this bit is flagged as an error. The patch in question is identical, but I did rebase it in the mean time.

Any clue what is going on here? I created another test PR #5958 which has the patch in question in isolation. The tests are still running but I wonder if EccCheck will produce the same error, as the patch is identical to the one in this series.

Copy link

mergify bot commented Jul 24, 2024

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

@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch from 46d2cc1 to 3c433e6 Compare July 24, 2024 20:00
@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jul 25, 2024
@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch 4 times, most recently from dceab98 to a2cab48 Compare July 25, 2024 21:26
@ardbiesheuvel ardbiesheuvel added push Auto push patch series in PR if all checks pass and removed push Auto push patch series in PR if all checks pass labels Jul 25, 2024
@ardbiesheuvel ardbiesheuvel removed the push Auto push patch series in PR if all checks pass label Jul 25, 2024
@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jul 26, 2024
@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch 2 times, most recently from 171bd28 to fdfcce9 Compare July 26, 2024 14:17
@ardbiesheuvel ardbiesheuvel removed the push Auto push patch series in PR if all checks pass label Jul 27, 2024
Switch to the new, generic ArmPsciResetSystemLib implementation that
obtains the conduit using ArmMonitorLib, of which a version already
exists that determines the conduit by looking up the PSCI DT node.
This permits the removal of the ArmVirtPkg specific implementation of
ResetSystemLib, which essentially does the exact same thing, but in a
single library.

Signed-off-by: Ard Biesheuvel <[email protected]>
The TPM2 related PEIMs depend on ResetSystemLib too, and so in order to
be able to switch to the generic ArmPkg implementation which relies on
ArmMonitorLib, the latter library class requires a PEIM-compatible
implementation too.

Signed-off-by: Ard Biesheuvel <[email protected]>
Retire the special ResetSystemLib implementation for the PEI phase on
virtual platforms, which has been superseded by the generic version
combined with a PEI-compatible implementation of ArmMonitorLib.

Signed-off-by: Ard Biesheuvel <[email protected]>
@ardbiesheuvel ardbiesheuvel force-pushed the arm-virt-psci-on-armmonitorlib branch from fdfcce9 to 7776ffd Compare July 27, 2024 15:16
@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jul 27, 2024
@mergify mergify bot merged commit 52eb643 into tianocore:master Jul 27, 2024
126 checks passed
@ardbiesheuvel ardbiesheuvel deleted the arm-virt-psci-on-armmonitorlib branch July 27, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants