From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io
Cc: Sami Mujawar <sami.mujawar@arm.com>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Rebecca Cran <rebecca@bsdio.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Jiewen Yao <jiewen.yao@intel.com>,
Jian J Wang <jian.j.wang@intel.com>
Subject: [PATCH v8 03/19] ArmPkg/ArmMonitorLib: Add ArmMonitorLib
Date: Tue, 18 Oct 2022 15:20:36 +0200 [thread overview]
Message-ID: <20221018132052.1359530-4-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20221018132052.1359530-1-Pierre.Gondois@arm.com>
From: Pierre Gondois <Pierre.Gondois@arm.com>
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>
---
ArmPkg/ArmPkg.dsc | 1 +
ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c | 34 +++++++++++++++++++
.../Library/ArmMonitorLib/ArmMonitorLib.inf | 29 ++++++++++++++++
3 files changed, 64 insertions(+)
create mode 100644 ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c
create mode 100644 ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 59fd8f295d4f..3afd212f472b 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -135,6 +135,7 @@ [Components.common]
ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf
ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf
+ ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
ArmPkg/Library/OpteeLib/OpteeLib.inf
ArmPkg/Filesystem/SemihostFs/SemihostFs.inf
diff --git a/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c
new file mode 100644
index 000000000000..741f5c615744
--- /dev/null
+++ b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c
@@ -0,0 +1,34 @@
+/** @file
+ Arm Monitor Library.
+
+ Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/ArmHvcLib.h>
+#include <Library/ArmMonitorLib.h>
+#include <Library/ArmSmcLib.h>
+#include <Library/PcdLib.h>
+
+/** Monitor call.
+
+ An HyperVisor Call (HVC) or System Monitor Call (SMC) will be issued
+ depending on the default conduit. PcdMonitorConduitHvc determines the type
+ of the call: if true, do an HVC.
+
+ @param [in,out] Args Arguments for the HVC/SMC.
+**/
+VOID
+EFIAPI
+ArmMonitorCall (
+ IN OUT ARM_MONITOR_ARGS *Args
+ )
+{
+ if (FeaturePcdGet (PcdMonitorConduitHvc)) {
+ ArmCallHvc ((ARM_HVC_ARGS *)Args);
+ } else {
+ ArmCallSmc ((ARM_SMC_ARGS *)Args);
+ }
+}
diff --git a/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
new file mode 100644
index 000000000000..f504cb80f1fc
--- /dev/null
+++ b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf
@@ -0,0 +1,29 @@
+## @file
+# Arm Monitor Library
+#
+# Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.29
+ BASE_NAME = ArmMonitorLib
+ FILE_GUID = F918DACB-FBB8-4CB6-A61D-08E75AF0E7CD
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmMonitorLib
+
+[Sources]
+ ArmMonitorLib.c
+
+[Packages]
+ ArmPkg/ArmPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ ArmHvcLib
+ ArmSmcLib
+
+[Pcd]
+ gArmTokenSpaceGuid.PcdMonitorConduitHvc
--
2.25.1
next prev parent reply other threads:[~2022-10-18 13:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 13:20 [PATCH v8 00/19] Add Raw algorithm support using Arm FW-TRNG interface PierreGondois
2022-10-18 13:20 ` [PATCH v8 01/19] ArmPkg: PCD to select conduit for monitor calls PierreGondois
2022-10-18 13:20 ` [PATCH v8 02/19] ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class PierreGondois
2022-10-18 13:20 ` PierreGondois [this message]
2022-10-18 13:20 ` [PATCH v8 04/19] ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc PierreGondois
2022-10-18 13:20 ` [PATCH v8 05/19] ArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLib PierreGondois
2022-10-18 13:20 ` [PATCH v8 06/19] MdePkg/TrngLib: Definition for TRNG library class interface PierreGondois
2022-10-26 13:25 ` [edk2-devel] " Yao, Jiewen
2022-10-26 13:56 ` Leif Lindholm
2022-10-26 14:06 ` Yao, Jiewen
2022-10-26 15:44 ` Leif Lindholm
2022-10-18 13:20 ` [PATCH v8 07/19] MdePkg/TrngLib: Add NULL instance of TRNG Library PierreGondois
2022-10-18 13:20 ` [PATCH v8 08/19] ArmPkg: Add FID definitions for Firmware TRNG PierreGondois
2022-10-20 8:55 ` Leif Lindholm
2022-10-18 13:20 ` [PATCH v8 09/19] ArmPkg/TrngLib: Add Arm Firmware TRNG library PierreGondois
2022-10-18 13:20 ` [PATCH v8 10/19] SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name PierreGondois
2022-10-18 13:20 ` [PATCH v8 11/19] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid PierreGondois
2022-10-18 13:20 ` [PATCH v8 12/19] SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms() PierreGondois
2022-10-18 13:20 ` [PATCH v8 13/19] SecurityPkg/RngDxe: Documentation/include/parameter cleanup PierreGondois
2022-10-18 13:20 ` [PATCH v8 14/19] SecurityPkg/RngDxe: Check before advertising Cpu Rng algo PierreGondois
2022-10-18 13:20 ` [PATCH v8 15/19] SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through TrngLib PierreGondois
2022-10-18 13:20 ` [PATCH v8 16/19] SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm PierreGondois
2022-10-18 13:20 ` [PATCH v8 17/19] SecurityPkg/RngDxe: Rename AArch64/RngDxe.c PierreGondois
2022-10-18 13:20 ` [PATCH v8 18/19] SecurityPkg/RngDxe: Add Arm support of RngDxe PierreGondois
2022-10-18 13:20 ` [PATCH v8 19/19] ArmVirtPkg: Kvmtool: Add RNG support using FW-TRNG interface PierreGondois
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221018132052.1359530-4-Pierre.Gondois@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox