public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
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 v9 02/19] ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class
Date: Fri, 28 Oct 2022 17:32:42 +0200	[thread overview]
Message-ID: <20221028153259.397445-3-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20221028153259.397445-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.

The new library relies on the ArmHvcLib and ArmSmcLib libraries.
A Null instance of these libraries can be used for the unused conduit.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 ArmPkg/ArmPkg.dec                      |  5 +++
 ArmPkg/Include/Library/ArmMonitorLib.h | 42 ++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 ArmPkg/Include/Library/ArmMonitorLib.h

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 99cb024d0f93..f17ba913e6de 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -71,6 +71,11 @@ [LibraryClasses.common]
   #
   ArmSvcLib|Include/Library/ArmSvcLib.h
 
+  ##  @libraryclass  Provides a Monitor Call interface that will use the
+  #   default conduit (HVC or SMC).
+  #
+  ArmMonitorLib|Include/Library/ArmMonitorLib.h
+
   ##  @libraryclass  Provides a default exception handler.
   #
   DefaultExceptionHandlerLib|Include/Library/DefaultExceptionHandlerLib.h
diff --git a/ArmPkg/Include/Library/ArmMonitorLib.h b/ArmPkg/Include/Library/ArmMonitorLib.h
new file mode 100644
index 000000000000..d6e13b61d63d
--- /dev/null
+++ b/ArmPkg/Include/Library/ArmMonitorLib.h
@@ -0,0 +1,42 @@
+/** @file
+
+  Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef ARM_MONITOR_LIB_H_
+#define ARM_MONITOR_LIB_H_
+
+/** The size of the SMC arguments is different between AArch64 and AArch32.
+
+  The native size is used for the arguments.
+  It will be casted to either HVC or SMC args.
+*/
+typedef struct {
+  UINTN    Arg0;
+  UINTN    Arg1;
+  UINTN    Arg2;
+  UINTN    Arg3;
+  UINTN    Arg4;
+  UINTN    Arg5;
+  UINTN    Arg6;
+  UINTN    Arg7;
+} ARM_MONITOR_ARGS;
+
+/** 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
+  );
+
+#endif // ARM_MONITOR_LIB_H_
-- 
2.25.1


  parent reply	other threads:[~2022-10-28 15:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 15:32 [PATCH v9 00/19] Add Raw algorithm support using Arm TRNG interface PierreGondois
2022-10-28 15:32 ` [PATCH v9 01/19] ArmPkg: PCD to select conduit for monitor calls PierreGondois
2022-10-28 15:32 ` PierreGondois [this message]
2022-10-28 15:32 ` [PATCH v9 03/19] ArmPkg/ArmMonitorLib: Add ArmMonitorLib PierreGondois
2022-10-28 15:32 ` [PATCH v9 04/19] ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc PierreGondois
2022-10-28 15:32 ` [PATCH v9 05/19] ArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLib PierreGondois
2022-10-28 15:32 ` [PATCH v9 06/19] MdePkg/ArmTrngLib: Definition for Arm TRNG library class interface PierreGondois
2022-10-28 15:32 ` [PATCH v9 07/19] MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library PierreGondois
2022-10-28 15:32 ` [PATCH v9 08/19] ArmPkg: Add FID definitions for Arm TRNG PierreGondois
2022-10-28 15:32 ` [PATCH v9 09/19] ArmPkg/ArmTrngLib: Add Arm TRNG library PierreGondois
2022-10-28 15:32 ` [PATCH v9 10/19] SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name PierreGondois
2022-10-28 15:32 ` [PATCH v9 11/19] SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid PierreGondois
2022-10-28 15:32 ` [PATCH v9 12/19] SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms() PierreGondois
2022-10-28 15:32 ` [PATCH v9 13/19] SecurityPkg/RngDxe: Documentation/include/parameter cleanup PierreGondois
2022-10-28 15:32 ` [PATCH v9 14/19] SecurityPkg/RngDxe: Check before advertising Cpu Rng algo PierreGondois
2022-10-28 15:32 ` [PATCH v9 15/19] SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through ArmTrngLib PierreGondois
2022-10-28 15:32 ` [PATCH v9 16/19] SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm PierreGondois
2022-10-28 15:32 ` [PATCH v9 17/19] SecurityPkg/RngDxe: Rename AArch64/RngDxe.c PierreGondois
2022-10-28 15:32 ` [PATCH v9 18/19] SecurityPkg/RngDxe: Add Arm support of RngDxe PierreGondois
2022-10-28 15:32 ` [PATCH v9 19/19] ArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interface PierreGondois
2022-11-01  1:10 ` 回复: [PATCH v9 00/19] Add Raw algorithm " gaoliming
2022-11-01  8:55 ` Yao, Jiewen
2022-11-04  1:16   ` 回复: " gaoliming
2022-11-04 17:34     ` [edk2-devel] " Ard Biesheuvel
2022-11-06 16:57       ` Ard Biesheuvel

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=20221028153259.397445-3-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