Commit Graph

6 Commits

Author SHA1 Message Date
Ard Biesheuvel b1bce5e564 ArmPkg/ArmMonitorLib: Implement SMCCC protocol correctly and directly
The SMCCC protocol stipulates the following:
- on AARCH64, 18 arguments can be passed, and 18 values can be returned,
  via registers X0-x17;
- on ARM, 8 arguments can be passed, and 8 values can be returned.

This makes ArmSmcLib and ArmHvcLib as implemented currently unsuitable
for use with SMCCC services in general, although for PSCI in particular,
they work fine.

The dependency on both ArmSmcLib and ArmHvcLib is also impractical
because it requires every platform that consumes ArmMonitorLib to
provide resolutions for each, even though most platforms will only ever
need one of these (and the choice is made at compile time)

So let's drop these dependencies, and re-implement the asm helpers from
scratch. Note that the only difference is the actual instruction used
-HVC vs SMC- and so all other code can be shared.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-25 14:41:09 +00:00
Ard Biesheuvel 43130ae403 ArmPkg: Convert PcdMonitorConduitHvc to FixedAtBuild
Feature PCDs and fixed-at-build PCDs are identical in concept, but the
latter are accessible from assembler, whereas the former are not. So
convert the SMCCC conduit selection PCD to fixed-at-build so we can make
use of this in a subsequent patch.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-25 14:41:09 +00:00
Ard Biesheuvel a9c8c47d53 ArmPkg: Disable AuditOnly mode for uncrustify
Fix up a handful of uncrustify infractions and drop the AuditOnly
override for uncrustify so we get the same uncrustify CI coverage as
other packages.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-07-24 10:21:47 +00:00
Ard Biesheuvel 3dcc7b73df ArmPkg: Revert "Allow SMC/HVC monitor conduit to be specified at runtime"
This reverts commit 32460bb5b1, which is
no longer needed as ArmVirtQemu now has its own special implementation
for ArmMonitorLib.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-06-10 08:44:48 +00:00
Ard Biesheuvel 32460bb5b1 ArmPkg: Allow SMC/HVC monitor conduit to be specified at runtime
ArmVirtQemu may execute at EL2, in which case monitor calls are
generally made using SMC instructions instead of HVC instructions.

Whether or not this is the case can only be decided at runtime, and so
the associated PCD needs to be settable at runtime, if the platform
definition chooses so. This implies a boolean PCD, given that a feature
PCD is build-time configurable only.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2024-05-24 15:48:52 +00:00
Pierre Gondois aa0f522471 ArmPkg/ArmMonitorLib: Add ArmMonitorLib
The ArmMonitorLib provides an abstract interface to issue
an HyperVisor Call (HVC) or System Monitor Call (SMC) depending
on the default conduit.
The PcdMonitorConduitHvc PCD allows to select the default conduit.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2022-11-06 16:32:28 +00:00