From 94e7cb181ad6bd25d36a11c58e0df64e9f815888 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 24 Jul 2023 19:51:05 -0400 Subject: Revert "Merge branch '2023-07-24-introduce-FF-A-suppport'" This reverts commit d927d1a80843e1c3e2a3f0b8f6150790bef83da1, reversing changes made to c07ad9520c6190070513016fdb495d4703a4a853. These changes do not pass CI currently. Signed-off-by: Tom Rini --- include/arm_ffa.h | 213 --------------------------------------- include/arm_ffa_priv.h | 246 --------------------------------------------- include/dm/uclass-id.h | 7 -- include/linux/arm-smccc.h | 45 --------- include/mm_communication.h | 13 --- include/uuid.h | 15 --- 6 files changed, 539 deletions(-) delete mode 100644 include/arm_ffa.h delete mode 100644 include/arm_ffa_priv.h (limited to 'include') diff --git a/include/arm_ffa.h b/include/arm_ffa.h deleted file mode 100644 index db9b1be995e..00000000000 --- a/include/arm_ffa.h +++ /dev/null @@ -1,213 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright 2022-2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi - */ - -#ifndef __ARM_FFA_H -#define __ARM_FFA_H - -#include - -/* - * This header is public. It can be used by clients to access - * data structures and definitions they need - */ - -/* - * struct ffa_partition_info - Partition information descriptor - * @id: Partition ID - * @exec_ctxt: Execution context count - * @properties: Partition properties - * - * Data structure containing information about partitions instantiated in the system - * This structure is filled with the data queried by FFA_PARTITION_INFO_GET - */ -struct ffa_partition_info { - u16 id; - u16 exec_ctxt; -/* partition supports receipt of direct requests */ -#define FFA_PARTITION_DIRECT_RECV BIT(0) -/* partition can send direct requests. */ -#define FFA_PARTITION_DIRECT_SEND BIT(1) -/* partition can send and receive indirect messages. */ -#define FFA_PARTITION_INDIRECT_MSG BIT(2) - u32 properties; -}; - -/* - * struct ffa_partition_uuid - 16 bytes UUID transmitted by FFA_PARTITION_INFO_GET - * @a1-4: 32-bit words access to the UUID data - * - */ -struct ffa_partition_uuid { - u32 a1; /* w1 */ - u32 a2; /* w2 */ - u32 a3; /* w3 */ - u32 a4; /* w4 */ -}; - -/** - * struct ffa_partition_desc - the secure partition descriptor - * @info: partition information - * @sp_uuid: the secure partition UUID - * - * Each partition has its descriptor containing the partitions information and the UUID - */ -struct ffa_partition_desc { - struct ffa_partition_info info; - struct ffa_partition_uuid sp_uuid; -}; - -/* - * struct ffa_send_direct_data - Data structure hosting the data - * used by FFA_MSG_SEND_DIRECT_{REQ,RESP} - * @data0-4: Data read/written from/to x3-x7 registers - * - * Data structure containing the data to be sent by FFA_MSG_SEND_DIRECT_REQ - * or read from FFA_MSG_SEND_DIRECT_RESP - */ - -/* For use with FFA_MSG_SEND_DIRECT_{REQ,RESP} which pass data via registers */ -struct ffa_send_direct_data { - ulong data0; /* w3/x3 */ - ulong data1; /* w4/x4 */ - ulong data2; /* w5/x5 */ - ulong data3; /* w6/x6 */ - ulong data4; /* w7/x7 */ -}; - -struct udevice; - -/** - * struct ffa_bus_ops - Operations for FF-A - * @partition_info_get: callback for the FFA_PARTITION_INFO_GET - * @sync_send_receive: callback for the FFA_MSG_SEND_DIRECT_REQ - * @rxtx_unmap: callback for the FFA_RXTX_UNMAP - * - * The data structure providing all the operations supported by the driver. - * This structure is EFI runtime resident. - */ -struct ffa_bus_ops { - int (*partition_info_get)(struct udevice *dev, const char *uuid_str, - u32 *sp_count, struct ffa_partition_desc **sp_descs); - int (*sync_send_receive)(struct udevice *dev, u16 dst_part_id, - struct ffa_send_direct_data *msg, - bool is_smc64); - int (*rxtx_unmap)(struct udevice *dev); -}; - -#define ffa_get_ops(dev) ((struct ffa_bus_ops *)(dev)->driver->ops) - -/** - * ffa_rxtx_unmap() - FFA_RXTX_UNMAP driver operation - * Please see ffa_unmap_rxtx_buffers_hdlr() description for more details. - */ -int ffa_rxtx_unmap(struct udevice *dev); - -/** - * ffa_unmap_rxtx_buffers_hdlr() - FFA_RXTX_UNMAP handler function - * @dev: The arm_ffa bus device - * - * This function implements FFA_RXTX_UNMAP FF-A function - * to unmap the RX/TX buffers - * - * Return: - * - * 0 on success. Otherwise, failure - */ -int ffa_unmap_rxtx_buffers_hdlr(struct udevice *dev); - -/** - * ffa_sync_send_receive() - FFA_MSG_SEND_DIRECT_{REQ,RESP} driver operation - * Please see ffa_msg_send_direct_req_hdlr() description for more details. - */ -int ffa_sync_send_receive(struct udevice *dev, u16 dst_part_id, - struct ffa_send_direct_data *msg, bool is_smc64); - -/** - * ffa_msg_send_direct_req_hdlr() - FFA_MSG_SEND_DIRECT_{REQ,RESP} handler function - * @dev: The arm_ffa bus device - * @dst_part_id: destination partition ID - * @msg: pointer to the message data preallocated by the client (in/out) - * @is_smc64: select 64-bit or 32-bit FF-A ABI - * - * This function implements FFA_MSG_SEND_DIRECT_{REQ,RESP} - * FF-A functions. - * - * FFA_MSG_SEND_DIRECT_REQ is used to send the data to the secure partition. - * The response from the secure partition is handled by reading the - * FFA_MSG_SEND_DIRECT_RESP arguments. - * - * The maximum size of the data that can be exchanged is 40 bytes which is - * sizeof(struct ffa_send_direct_data) as defined by the FF-A specification 1.0 - * in the section relevant to FFA_MSG_SEND_DIRECT_{REQ,RESP} - * - * Return: - * - * 0 on success. Otherwise, failure - */ -int ffa_msg_send_direct_req_hdlr(struct udevice *dev, u16 dst_part_id, - struct ffa_send_direct_data *msg, bool is_smc64); - -/** - * ffa_partition_info_get() - FFA_PARTITION_INFO_GET driver operation - * Please see ffa_get_partitions_info_hdlr() description for more details. - */ -int ffa_partition_info_get(struct udevice *dev, const char *uuid_str, - u32 *sp_count, struct ffa_partition_desc **sp_descs); - -/** - * ffa_get_partitions_info_hdlr() - FFA_PARTITION_INFO_GET handler function - * @uuid_str: pointer to the UUID string - * @sp_count: address of the variable containing the number of partitions matching the UUID - * The variable is set by the driver - * @sp_descs: address of the descriptors of the partitions matching the UUID - * The address is set by the driver - * - * Return the number of partitions and their descriptors matching the UUID - * - * Query the secure partition data from uc_priv. - * If not found, invoke FFA_PARTITION_INFO_GET - * FF-A function to query the partition information from secure world. - * - * A client of the FF-A driver should know the UUID of the service it wants to - * access. It should use the UUID to request the FF-A driver to provide the - * partition(s) information of the service. The FF-A driver uses - * PARTITION_INFO_GET to obtain this information. This is implemented through - * ffa_get_partitions_info_hdlr() function. - * A new FFA_PARTITION_INFO_GET call is issued (first one performed through - * ffa_cache_partitions_info) allowing to retrieve the partition(s) information. - * They are not saved (already done). We only update the UUID in the cached area. - * This assumes that partitions data does not change in the secure world. - * Otherwise u-boot will have an outdated partition data. The benefit of caching - * the information in the FF-A driver is to accommodate discovery after - * ExitBootServices(). - * - * Return: - * - * @sp_count: the number of partitions - * @sp_descs: address of the partitions descriptors - * - * On success 0 is returned. Otherwise, failure - */ -int ffa_get_partitions_info_hdlr(struct udevice *dev, const char *uuid_str, - u32 *sp_count, struct ffa_partition_desc **sp_descs); - -struct ffa_priv; - -/** - * ffa_set_smc_conduit() - Set the SMC conduit - * @dev: The FF-A bus device - * - * Selects the SMC conduit by setting the FF-A ABI invoke function. - * - * Return: - * - * 0 on success. Otherwise, failure - */ -int ffa_set_smc_conduit(struct udevice *dev); - -#endif diff --git a/include/arm_ffa_priv.h b/include/arm_ffa_priv.h deleted file mode 100644 index d564c33c647..00000000000 --- a/include/arm_ffa_priv.h +++ /dev/null @@ -1,246 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright 2022-2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi - */ - -#ifndef __ARM_FFA_PRV_H -#define __ARM_FFA_PRV_H - -#include -#include -#include - -/* This header is exclusively used by the FF-A Uclass and FF-A driver(s) */ - -/* Arm FF-A driver name */ -#define FFA_DRV_NAME "arm_ffa" - -/* The FF-A SMC function definitions */ - -#if CONFIG_IS_ENABLED(SANDBOX) - -/* Providing Arm SMCCC declarations to sandbox */ - -/** - * struct sandbox_smccc_1_2_regs - emulated SMC call arguments or results - * @a0-a17 argument values from registers 0 to 17 - */ -struct sandbox_smccc_1_2_regs { - ulong a0; - ulong a1; - ulong a2; - ulong a3; - ulong a4; - ulong a5; - ulong a6; - ulong a7; - ulong a8; - ulong a9; - ulong a10; - ulong a11; - ulong a12; - ulong a13; - ulong a14; - ulong a15; - ulong a16; - ulong a17; -}; - -typedef struct sandbox_smccc_1_2_regs ffa_value_t; - -#define ARM_SMCCC_FAST_CALL 1UL -#define ARM_SMCCC_OWNER_STANDARD 4 -#define ARM_SMCCC_SMC_32 0 -#define ARM_SMCCC_SMC_64 1 -#define ARM_SMCCC_TYPE_SHIFT 31 -#define ARM_SMCCC_CALL_CONV_SHIFT 30 -#define ARM_SMCCC_OWNER_MASK 0x3f -#define ARM_SMCCC_OWNER_SHIFT 24 -#define ARM_SMCCC_FUNC_MASK 0xffff - -#define ARM_SMCCC_CALL_VAL(type, calling_convention, owner, func_num) \ - (((type) << ARM_SMCCC_TYPE_SHIFT) | \ - ((calling_convention) << ARM_SMCCC_CALL_CONV_SHIFT) | \ - (((owner) & ARM_SMCCC_OWNER_MASK) << ARM_SMCCC_OWNER_SHIFT) | \ - ((func_num) & ARM_SMCCC_FUNC_MASK)) - -#else -/* CONFIG_ARM64 */ -#include -typedef struct arm_smccc_1_2_regs ffa_value_t; -#endif - -/* Defining the function pointer type for the function executing the FF-A ABIs */ -typedef void (*invoke_ffa_fn_t)(ffa_value_t args, ffa_value_t *res); - -/* FF-A driver version definitions */ - -#define MAJOR_VERSION_MASK GENMASK(30, 16) -#define MINOR_VERSION_MASK GENMASK(15, 0) -#define GET_FFA_MAJOR_VERSION(x) \ - ((u16)(FIELD_GET(MAJOR_VERSION_MASK, (x)))) -#define GET_FFA_MINOR_VERSION(x) \ - ((u16)(FIELD_GET(MINOR_VERSION_MASK, (x)))) -#define PACK_VERSION_INFO(major, minor) \ - (FIELD_PREP(MAJOR_VERSION_MASK, (major)) | \ - FIELD_PREP(MINOR_VERSION_MASK, (minor))) - -#define FFA_MAJOR_VERSION (1) -#define FFA_MINOR_VERSION (0) -#define FFA_VERSION_1_0 \ - PACK_VERSION_INFO(FFA_MAJOR_VERSION, FFA_MINOR_VERSION) - -/* Endpoint ID mask (u-boot endpoint ID) */ - -#define GET_SELF_ENDPOINT_ID_MASK GENMASK(15, 0) -#define GET_SELF_ENDPOINT_ID(x) \ - ((u16)(FIELD_GET(GET_SELF_ENDPOINT_ID_MASK, (x)))) - -#define PREP_SELF_ENDPOINT_ID_MASK GENMASK(31, 16) -#define PREP_SELF_ENDPOINT_ID(x) \ - (FIELD_PREP(PREP_SELF_ENDPOINT_ID_MASK, (x))) - -/* Partition endpoint ID mask (partition with which u-boot communicates with) */ - -#define PREP_PART_ENDPOINT_ID_MASK GENMASK(15, 0) -#define PREP_PART_ENDPOINT_ID(x) \ - (FIELD_PREP(PREP_PART_ENDPOINT_ID_MASK, (x))) - -/* Definitions of the Arm FF-A interfaces supported by the Arm FF-A driver */ - -#define FFA_SMC(calling_convention, func_num) \ - ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, (calling_convention), \ - ARM_SMCCC_OWNER_STANDARD, (func_num)) - -#define FFA_SMC_32(func_num) FFA_SMC(ARM_SMCCC_SMC_32, (func_num)) -#define FFA_SMC_64(func_num) FFA_SMC(ARM_SMCCC_SMC_64, (func_num)) - -enum ffa_abis { - FFA_ERROR = 0x60, - FFA_SUCCESS = 0x61, - FFA_INTERRUPT = 0x62, - FFA_VERSION = 0x63, - FFA_FEATURES = 0x64, - FFA_RX_RELEASE = 0x65, - FFA_RXTX_MAP = 0x66, - FFA_RXTX_UNMAP = 0x67, - FFA_PARTITION_INFO_GET = 0x68, - FFA_ID_GET = 0x69, - FFA_RUN = 0x6d, - FFA_MSG_SEND_DIRECT_REQ = 0x6f, - FFA_MSG_SEND_DIRECT_RESP = 0x70, - - /* To be updated when adding new FFA IDs */ - FFA_FIRST_ID = FFA_ERROR, /* Lowest number ID */ - FFA_LAST_ID = FFA_MSG_SEND_DIRECT_RESP, /* Highest number ID */ -}; - -enum ffa_abi_errcode { - NOT_SUPPORTED = 1, - INVALID_PARAMETERS, - NO_MEMORY, - BUSY, - INTERRUPTED, - DENIED, - RETRY, - ABORTED, - MAX_NUMBER_FFA_ERR -}; - -extern int ffa_to_std_errmap[MAX_NUMBER_FFA_ERR]; - -/* Container structure and helper macros to map between an FF-A error and relevant error log */ -struct ffa_abi_errmap { - char *err_str[MAX_NUMBER_FFA_ERR]; -}; - -#define FFA_ERRMAP_COUNT (FFA_LAST_ID - FFA_FIRST_ID + 1) -#define FFA_ID_TO_ERRMAP_ID(ffa_id) ((ffa_id) - FFA_FIRST_ID) - -/** - * enum ffa_rxtx_buf_sizes - minimum sizes supported - * for the RX/TX buffers - */ -enum ffa_rxtx_buf_sizes { - RXTX_4K, - RXTX_64K, - RXTX_16K -}; - -/** - * struct ffa_rxtxpair - Hosts the RX/TX buffers virtual addresses - * @rxbuf: virtual address of the RX buffer - * @txbuf: virtual address of the TX buffer - * @rxtx_min_pages: RX/TX buffers minimum size in pages - * - * Hosts the virtual addresses of the mapped RX/TX buffers - * These addresses are used by the FF-A functions that use the RX/TX buffers - */ -struct ffa_rxtxpair { - void *rxbuf; /* Virtual address returned by memalign */ - void *txbuf; /* Virtual address returned by memalign */ - size_t rxtx_min_pages; /* Minimum number of pages in each of the RX/TX buffers */ -}; - -struct ffa_partition_desc; - -/** - * struct ffa_partitions - descriptors for all secure partitions - * @count: The number of partitions descriptors - * @descs The partitions descriptors table - * - * Contains the partitions descriptors table - */ -struct ffa_partitions { - u32 count; - struct ffa_partition_desc *descs; /* Virtual address */ -}; - -/** - * struct ffa_priv - the driver private data structure - * - * @fwk_version: FF-A framework version - * @emul: FF-A sandbox emulator - * @id: u-boot endpoint ID - * @partitions: The partitions descriptors structure - * @pair: The RX/TX buffers pair - * - * The device private data structure containing all the - * data read from secure world. - */ -struct ffa_priv { - u32 fwk_version; - struct udevice *emul; - u16 id; - struct ffa_partitions partitions; - struct ffa_rxtxpair pair; -}; - -/** - * ffa_get_version_hdlr() - FFA_VERSION handler function - * @dev: The FF-A bus device - * - * Implement FFA_VERSION FF-A function - * to get from the secure world the FF-A framework version - * FFA_VERSION is used to discover the FF-A framework. - * - * Return: - * - * 0 on success. Otherwise, failure - */ -int ffa_get_version_hdlr(struct udevice *dev); - -/** - * invoke_ffa_fn() - SMC wrapper - * @args: FF-A ABI arguments to be copied to Xn registers - * @res: FF-A ABI return data to be copied from Xn registers - * - * Calls low level SMC implementation. - * This function should be implemented by the user driver. - */ -void invoke_ffa_fn(ffa_value_t args, ffa_value_t *res); - -#endif diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 0432c95c9ed..307ad6931ca 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -4,11 +4,6 @@ * * (C) Copyright 2012 * Pavel Herrmann - * - * Copyright 2022-2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi */ #ifndef _DM_UCLASS_ID_H @@ -62,8 +57,6 @@ enum uclass_id { UCLASS_ETH, /* Ethernet device */ UCLASS_ETH_PHY, /* Ethernet PHY device */ UCLASS_EXTCON, /* External Connector Class */ - UCLASS_FFA, /* Arm Firmware Framework for Armv8-A */ - UCLASS_FFA_EMUL, /* sandbox FF-A device emulator */ UCLASS_FIRMWARE, /* Firmware */ UCLASS_FPGA, /* FPGA device */ UCLASS_FUZZING_ENGINE, /* Fuzzing engine */ diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h index f44e9e8f930..e1d09884a1c 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -1,10 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015, Linaro Limited - * Copyright 2022-2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi */ #ifndef __LINUX_ARM_SMCCC_H #define __LINUX_ARM_SMCCC_H @@ -74,47 +70,6 @@ struct arm_smccc_res { unsigned long a3; }; -#ifdef CONFIG_ARM64 -/** - * struct arm_smccc_1_2_regs - Arguments for or Results from SMC call - * @a0-a17 argument values from registers 0 to 17 - */ -struct arm_smccc_1_2_regs { - unsigned long a0; - unsigned long a1; - unsigned long a2; - unsigned long a3; - unsigned long a4; - unsigned long a5; - unsigned long a6; - unsigned long a7; - unsigned long a8; - unsigned long a9; - unsigned long a10; - unsigned long a11; - unsigned long a12; - unsigned long a13; - unsigned long a14; - unsigned long a15; - unsigned long a16; - unsigned long a17; -}; - -/** - * arm_smccc_1_2_smc() - make SMC calls - * @args: arguments passed via struct arm_smccc_1_2_regs - * @res: result values via struct arm_smccc_1_2_regs - * - * This function is used to make SMC calls following SMC Calling Convention - * v1.2 or above. The content of the supplied param are copied from the - * structure to registers prior to the SMC instruction. The return values - * are updated with the content from registers on return from the SMC - * instruction. - */ -asmlinkage void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args, - struct arm_smccc_1_2_regs *res); -#endif - /** * struct arm_smccc_quirk - Contains quirk information * @id: quirk identification diff --git a/include/mm_communication.h b/include/mm_communication.h index f17847583b2..e65fbde60d0 100644 --- a/include/mm_communication.h +++ b/include/mm_communication.h @@ -6,9 +6,6 @@ * Copyright (c) 2017, Intel Corporation. All rights reserved. * Copyright (C) 2020 Linaro Ltd. * Copyright (C) 2020 Linaro Ltd. - * Copyright 2022-2023 Arm Limited and/or its affiliates - * Authors: - * Abdellatif El Khlifi */ #ifndef _MM_COMMUNICATION_H_ @@ -16,9 +13,6 @@ #include -/* MM service UUID string (big-endian format). This UUID is common across all MM SPs */ -#define MM_SP_UUID "33d532ed-e699-0942-c09c-a798d9cd722d" - /* * Interface to the pseudo Trusted Application (TA), which provides a * communication channel with the Standalone MM (Management Mode) @@ -254,11 +248,4 @@ struct smm_variable_var_check_property { u16 name[]; }; -/* supported MM transports */ -enum mm_comms_select { - MM_COMMS_UNDEFINED, - MM_COMMS_FFA, - MM_COMMS_OPTEE -}; - #endif /* _MM_COMMUNICATION_H_ */ diff --git a/include/uuid.h b/include/uuid.h index 89b93e642b7..4a4883d3b5b 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -2,10 +2,6 @@ /* * Copyright (C) 2014 Samsung Electronics * Przemyslaw Marczak - * Copyright 2022-2023 Arm Limited and/or its affiliates - * - * Authors: - * Abdellatif El Khlifi */ #ifndef __UUID_H__ #define __UUID_H__ @@ -48,15 +44,4 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin); const char *uuid_guid_get_str(const unsigned char *guid_bin); void gen_rand_uuid(unsigned char *uuid_bin); void gen_rand_uuid_str(char *uuid_str, int str_format); - -/** - * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. - * @uuid_str: pointer to UUID string - * @uuid_bin: pointer to allocated array for little endian output [16B] - * Return: - * uuid_bin filled with little endian UUID data - * On success 0 is returned. Otherwise, failure code. - */ -int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin); - #endif -- cgit v1.2.3