[edk2-devel] [PATCH v3 1/3] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h

Rebecca Cran posted 3 patches 5 years, 3 months ago
Only 2 patches received!
[edk2-devel] [PATCH v3 1/3] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h
Posted by Rebecca Cran 5 years, 3 months ago
The ARM SMC Architecture functions were missing from ArmStdSmc.h.
Add them, based on the SMC Calling Convention version 1.2 specification.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
---
 ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 3509eb680f18..90f32c2249cd 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -1,5 +1,6 @@
 /** @file
 *
+*  Copyright (c) 2020, NUVIA Inc. All rights reserved.
 *  Copyright (c) 2012-2017, ARM Limited. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -52,6 +53,18 @@
 #define ARM_SMC_MM_RET_DENIED              -3
 #define ARM_SMC_MM_RET_NO_MEMORY           -4
 
+// ARM Architecture Calls
+#define ARM_SMC_ID_ARCH_VERSION      0x80000000
+#define ARM_SMC_ID_ARCH_FEATURES     0x80000001
+#define ARM_SMC_ID_ARCH_SOC_ID       0x80000002
+#define ARM_SMC_ID_ARCH_WORKAROUND_1 0x80008000
+#define ARM_SMC_ID_ARCH_WORKAROUND_2 0x80007FFF
+
+#define ARM_SMC_ARCH_RET_SUCCESS            0
+#define ARM_SMC_ARCH_RET_NOT_SUPPORTED     -1
+#define ARM_SMC_ARCH_RET_NOT_REQUIRED      -2
+#define ARM_SMC_ARCH_RET_INVALID_PARAMETER -3
+
 /*
  * Power State Coordination Interface (PSCI) calls cover a subset of the
  * Standard Service Call range.
-- 
2.26.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67256): https://edk2.groups.io/g/devel/message/67256
Mute This Topic: https://groups.io/mt/78172730/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v3 1/3] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h
Posted by Leif Lindholm 5 years, 2 months ago
On Tue, Nov 10, 2020 at 17:17:46 -0700, Rebecca Cran wrote:
> The ARM SMC Architecture functions were missing from ArmStdSmc.h.
> Add them, based on the SMC Calling Convention version 1.2 specification.
> 
> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
> ---
>  ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> index 3509eb680f18..90f32c2249cd 100644
> --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
> @@ -1,5 +1,6 @@
>  /** @file
>  *
> +*  Copyright (c) 2020, NUVIA Inc. All rights reserved.
>  *  Copyright (c) 2012-2017, ARM Limited. All rights reserved.
>  *
>  *  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -52,6 +53,18 @@
>  #define ARM_SMC_MM_RET_DENIED              -3
>  #define ARM_SMC_MM_RET_NO_MEMORY           -4
>  
> +// ARM Architecture Calls
> +#define ARM_SMC_ID_ARCH_VERSION      0x80000000

This one does not actually contain "ARCH" in the spec, and it
references SMCCC version speficically.

> +#define ARM_SMC_ID_ARCH_FEATURES     0x80000001
> +#define ARM_SMC_ID_ARCH_SOC_ID       0x80000002
> +#define ARM_SMC_ID_ARCH_WORKAROUND_1 0x80008000
> +#define ARM_SMC_ID_ARCH_WORKAROUND_2 0x80007FFF

TF-A defines this whole block as:

#define SMCCC_VERSION                   U(0x80000000)
#define SMCCC_ARCH_FEATURES             U(0x80000001)
#define SMCCC_ARCH_SOC_ID               U(0x80000002)
#define SMCCC_ARCH_WORKAROUND_1         U(0x80008000)
#define SMCCC_ARCH_WORKAROUND_2         U(0x80007FFF)

I think I prefer these shorter versions, which also addresses the
abovementioned comment. (Not the U() bit, that's TF-A idiom.)

> +#define ARM_SMC_ARCH_RET_SUCCESS            0
> +#define ARM_SMC_ARCH_RET_NOT_SUPPORTED     -1
> +#define ARM_SMC_ARCH_RET_NOT_REQUIRED      -2
> +#define ARM_SMC_ARCH_RET_INVALID_PARAMETER -3

And these as:

#define SMC_ARCH_CALL_SUCCESS           0
#define SMC_ARCH_CALL_NOT_SUPPORTED     -1
#define SMC_ARCH_CALL_NOT_REQUIRED      -2
#define SMC_ARCH_CALL_INVAL_PARAM       -3

Not sure I prefer these, but I think we cold drop the ARM_ prefix.

/
    Leif


> +
>  /*
>   * Power State Coordination Interface (PSCI) calls cover a subset of the
>   * Standard Service Call range.
> -- 
> 2.26.2
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67712): https://edk2.groups.io/g/devel/message/67712
Mute This Topic: https://groups.io/mt/78172730/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v3 1/3] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h
Posted by Sami Mujawar 5 years, 2 months ago
Hi Rebecca,

Thank you for this patch.

Please find my response inline marked [SAMI].

Otherwise this patch looks good to me.

Regards,

Sami Mujawar

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Rebecca Cran via groups.io
Sent: 11 November 2020 12:18 AM
To: devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>; Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <Ard.Biesheuvel@arm.com>; Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>
Subject: [edk2-devel] [PATCH v3 1/3] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h

The ARM SMC Architecture functions were missing from ArmStdSmc.h.
Add them, based on the SMC Calling Convention version 1.2 specification.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
---
 ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 3509eb680f18..90f32c2249cd 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -1,5 +1,6 @@
 /** @file
 *
+*  Copyright (c) 2020, NUVIA Inc. All rights reserved.
 *  Copyright (c) 2012-2017, ARM Limited. All rights reserved.
 *
 *  SPDX-License-Identifier: BSD-2-Clause-Patent

[SAMI] Can you add a reference to the SMCCC 1.2 spec in the file header, please?  Something like:

@par Revision Reference:
  - SMC Calling Convention version 1.2
    (https://developer.arm.com/documentation/den0028/latest)

[/SAMI]

@@ -52,6 +53,18 @@
 #define ARM_SMC_MM_RET_DENIED              -3
 #define ARM_SMC_MM_RET_NO_MEMORY           -4

+// ARM Architecture Calls
+#define ARM_SMC_ID_ARCH_VERSION      0x80000000
+#define ARM_SMC_ID_ARCH_FEATURES     0x80000001
+#define ARM_SMC_ID_ARCH_SOC_ID       0x80000002
+#define ARM_SMC_ID_ARCH_WORKAROUND_1 0x80008000
+#define ARM_SMC_ID_ARCH_WORKAROUND_2 0x80007FFF
+
+#define ARM_SMC_ARCH_RET_SUCCESS            0
+#define ARM_SMC_ARCH_RET_NOT_SUPPORTED     -1
+#define ARM_SMC_ARCH_RET_NOT_REQUIRED      -2
+#define ARM_SMC_ARCH_RET_INVALID_PARAMETER -3
+
 /*
  * Power State Coordination Interface (PSCI) calls cover a subset of the
  * Standard Service Call range.
--
2.26.2






IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67400): https://edk2.groups.io/g/devel/message/67400
Mute This Topic: https://groups.io/mt/78172730/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-