Remove TEE driver external component

The TSTEE driver has been merged to Linux kernel v6.10, which makes the
out-of-tree version deprecated. Remove the external component that was
downloading it. Also, the in-tree version doesn't have a module version
field defined, so the sanity check for reading the out-of-tree module's
version is removed too.

Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I57ee44293c5e940ee7fa944d1420ebcba624fc56
diff --git a/components/rpc/ts_rpc/caller/linux/component.cmake b/components/rpc/ts_rpc/caller/linux/component.cmake
index c9f439e..f8e4a52 100644
--- a/components/rpc/ts_rpc/caller/linux/component.cmake
+++ b/components/rpc/ts_rpc/caller/linux/component.cmake
@@ -8,8 +8,6 @@
 	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
 endif()
 
-include(${TS_ROOT}/external/LinuxFfaTeeDriver/LinuxFfaTeeDriver.cmake)
-
 set_property(TARGET ${TGT} APPEND PROPERTY PUBLIC_HEADER
 	"${CMAKE_CURRENT_LIST_DIR}/ts_rpc_caller_linux.h"
 	)
@@ -17,7 +15,3 @@
 target_sources(${TGT} PRIVATE
 	"${CMAKE_CURRENT_LIST_DIR}/ts_rpc_caller_linux.c"
 	)
-
-target_include_directories(${TGT} PRIVATE
-	"${LINUX_FFA_TEE_DRIVER_INCLUDE_DIR}"
-	)
diff --git a/components/rpc/ts_rpc/caller/linux/ts_rpc_caller_linux.c b/components/rpc/ts_rpc/caller/linux/ts_rpc_caller_linux.c
index 7c4606e..3402a9f 100644
--- a/components/rpc/ts_rpc/caller/linux/ts_rpc_caller_linux.c
+++ b/components/rpc/ts_rpc/caller/linux/ts_rpc_caller_linux.c
@@ -6,7 +6,6 @@
 
 #include "ts_rpc_caller_linux.h"
 
-#include <arm_tstee.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <linux/tee.h>
@@ -24,11 +23,16 @@
 
 #define INVALID_SESS_ID		  0
 #define MAX_TEE_DEV_NUM		  16
-#define TS_TEE_DRV_REQ_VER_MAJOR  2
-#define TS_TEE_DRV_REQ_VER_MINOR  0
-#define TS_TEE_DRV_REQ_VER_PATCH  0
 #define TS_TEE_DRV_INVALID_SHM_ID (0)
 
+/*
+ * This define is part of linux/tee.h starting from Linux v6.10
+ * Let's keep a copy here in case the kernel headers come from an older version
+ */
+#ifndef TEE_IMPL_ID_TSTEE
+#define TEE_IMPL_ID_TSTEE 3
+#endif
+
 struct ts_tee_dev {
 	uint16_t endpoint_id;
 	char path[16];
@@ -236,47 +240,6 @@
 	return RPC_SUCCESS;
 }
 
-static bool ts_tee_drv_check_version(void)
-{
-	unsigned int major = 0;
-	unsigned int minor = 0;
-	unsigned int patch = 0;
-	FILE *f = NULL;
-	int cnt = 0;
-
-	f = fopen("/sys/module/arm_tstee/version", "r");
-	if (f) {
-		cnt = fscanf(f, "%u.%u.%u", &major, &minor, &patch);
-		fclose(f);
-
-		if (cnt != 3) {
-			printf("error: cannot read TS TEE driver version\n");
-			return false;
-		}
-	} else {
-		printf("error: TS TEE driver not available\n");
-		return false;
-	}
-
-	if (major != TS_TEE_DRV_REQ_VER_MAJOR)
-		goto err;
-
-	if (minor < TS_TEE_DRV_REQ_VER_MINOR)
-		goto err;
-
-	if (minor == TS_TEE_DRV_REQ_VER_MINOR)
-		if (patch < TS_TEE_DRV_REQ_VER_PATCH)
-			goto err;
-
-	return true;
-
-err:
-	printf("error: TS TEE driver is v%u.%u.%u but required v%u.%u.%u\n", major, minor, patch,
-	       TS_TEE_DRV_REQ_VER_MAJOR, TS_TEE_DRV_REQ_VER_MINOR, TS_TEE_DRV_REQ_VER_PATCH);
-
-	return false;
-}
-
 static void ts_tee_drv_discover(struct ts_tee_dev *ts_tee_devs, size_t count)
 {
 	struct tee_ioctl_version_data vers = { 0 };
@@ -314,9 +277,6 @@
 	if (!rpc_caller || rpc_caller->context)
 		return RPC_ERROR_INVALID_VALUE;
 
-	if (!ts_tee_drv_check_version())
-		return RPC_ERROR_INTERNAL;
-
 	context = (struct ts_rpc_caller_linux_context *)calloc(
 		1, sizeof(struct ts_rpc_caller_linux_context));
 	if (!context)
diff --git a/docs/environments/secure-partitions/spm/optee/userspace-programs-on-fvp.rst b/docs/environments/secure-partitions/spm/optee/userspace-programs-on-fvp.rst
index f81e1df..aeb26fb 100644
--- a/docs/environments/secure-partitions/spm/optee/userspace-programs-on-fvp.rst
+++ b/docs/environments/secure-partitions/spm/optee/userspace-programs-on-fvp.rst
@@ -59,8 +59,7 @@
   # Install the shared library and executables
   cp -vat /usr out/ts-install/arm-linux/lib out/ts-install/arm-linux/bin
 
-  # Load the kernel modules
-  out/linux-arm-ffa-tee/load_module.sh
+  # Load the kernel module
   out/linux-arm-ffa-user/load_module.sh
 
   # Run the test application
diff --git a/docs/quickstart/optee-testing.rst b/docs/quickstart/optee-testing.rst
index 7eccf7a..9ff2421 100644
--- a/docs/quickstart/optee-testing.rst
+++ b/docs/quickstart/optee-testing.rst
@@ -47,7 +47,6 @@
 
   cd /mnt/host
   cp -vat /usr out/ts-install/arm-linux/lib out/ts-install/arm-linux/bin
-  out/linux-arm-ffa-tee/load_module.sh
   out/linux-arm-ffa-user/load_module.sh
   ts-service-test -v
 
diff --git a/external/LinuxFfaTeeDriver/LinuxFfaTeeDriver.cmake b/external/LinuxFfaTeeDriver/LinuxFfaTeeDriver.cmake
deleted file mode 100644
index da0a5b3..0000000
--- a/external/LinuxFfaTeeDriver/LinuxFfaTeeDriver.cmake
+++ /dev/null
@@ -1,54 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-# If the driver is already installed, try to find that
-find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR
-	NAMES arm_tstee.h
-	DOC "Linux FF-A TEE driver include directory"
-)
-
-# If not found, download it
-if(NOT LINUX_FFA_TEE_DRIVER_INCLUDE_DIR)
-	set(LINUX_FFA_TEE_DRIVER_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
-		CACHE STRING "Linux FF-A TEE driver repository URL")
-
-	# Note: the aim of this external component is to make the header file defining the IOCTL API
-	#        available. Fetching a moving reference is ok as long as API compatibility is guaranteed.
-	set(LINUX_FFA_TEE_DRIVER_REFSPEC "origin/tee-v2"
-		CACHE STRING "Linux FF-A TEE driver git refspec")
-
-	set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_tee_driver-src"
-		CACHE PATH "Location of Linux TEE driver source.")
-
-	if (DEFINED ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR})
-		set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR $ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR}
-			CACHE PATH "Location of Linux TEE driver source." FORCE)
-	endif()
-
-	set(GIT_OPTIONS
-		GIT_REPOSITORY ${LINUX_FFA_TEE_DRIVER_URL}
-		GIT_TAG ${LINUX_FFA_TEE_DRIVER_REFSPEC}
-		GIT_SHALLOW TRUE
-		)
-		include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
-		LazyFetch_MakeAvailable(
-			DEP_NAME linux_ffa_tee_driver
-			FETCH_OPTIONS "${GIT_OPTIONS}"
-			SOURCE_DIR ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR}
-		)
-
-	find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR
-		NAMES arm_tstee.h
-		PATHS ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR}/uapi
-		NO_DEFAULT_PATH
-		REQUIRED
-		DOC "Linux FF-A TEE driver include directory"
-	)
-endif()
-
-set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
-	"${LINUX_FFA_TEE_DRIVER_INCLUDE_DIR}/arm_tstee.h")