Sync with DebugFS driver API v2

The DebugFS driver now supports handling multiple SPs, which caused
changes in the API. This commit is to get in sync with those.

Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I6481460b78ef977204c77480ed1798737469b990
diff --git a/components/rpc/ffarpc/caller/linux/ffarpc_caller.c b/components/rpc/ffarpc/caller/linux/ffarpc_caller.c
index 3ce80ff..d5db2c9 100644
--- a/components/rpc/ffarpc/caller/linux/ffarpc_caller.c
+++ b/components/rpc/ffarpc/caller/linux/ffarpc_caller.c
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define KERNEL_MOD_REQ_VER_MAJOR 1
+#define KERNEL_MOD_REQ_VER_MAJOR 2
 #define KERNEL_MOD_REQ_VER_MINOR 0
 #define KERNEL_MOD_REQ_VER_PATCH 0
 
@@ -163,6 +163,7 @@
 int ffarpc_caller_open(struct ffarpc_caller *s, uint16_t dest_partition_id, uint16_t dest_iface_id)
 {
 	int ioctl_status = -1;
+	struct ffa_ioctl_shm_desc shm_desc = {.dst_id = dest_partition_id};
 
 	if (s->device_path) {
 
@@ -170,12 +171,13 @@
 
 		if (s->fd >= 0) {
 			/* Allocate resource for session */
-			ioctl_status = ioctl(s->fd, FFA_IOC_SHM_INIT, &s->shared_mem_handle);
+			ioctl_status = ioctl(s->fd, FFA_IOC_SHM_INIT, &shm_desc);
 
 			if (ioctl_status == 0) {
 				/* Session successfully opened */
 				s->dest_partition_id = dest_partition_id;
 				s->dest_iface_id = dest_iface_id;
+				s->shared_mem_handle = shm_desc.handle;
 				ioctl_status = share_mem_with_partition(s);
 			}
 
@@ -193,11 +195,15 @@
 int ffarpc_caller_close(struct ffarpc_caller *s)
 {
 	int ioctl_status = -1;
+	struct ffa_ioctl_shm_desc shm_desc = {
+		.dst_id = s->dest_partition_id,
+		.handle = s->shared_mem_handle,
+	};
 
 	if (s->fd >= 0) {
 
 		unshare_mem_with_partition(s);
-		ioctl_status = ioctl(s->fd, FFA_IOC_SHM_DEINIT);
+		ioctl_status = ioctl(s->fd, FFA_IOC_SHM_DEINIT, &shm_desc);
 		close(s->fd);
 		s->fd = -1;
 		s->dest_partition_id = 0;
@@ -337,6 +343,7 @@
 
 	req_descr.buf_ptr = (uintptr_t)s->req_buf;
 	req_descr.buf_len = s->req_len;
+	req_descr.dst_id = s->dest_partition_id;
 	ioctl_status = ioctl(s->fd, FFA_IOC_SHM_WRITE, &req_descr);
 
 	return ioctl_status;
@@ -350,6 +357,7 @@
 
 	resp_descr.buf_ptr = (uintptr_t)s->resp_buf;
 	resp_descr.buf_len = s->resp_len;
+	resp_descr.dst_id = s->dest_partition_id;
 	ioctl_status = ioctl(s->fd, FFA_IOC_SHM_READ, &resp_descr);
 
 	return ioctl_status;
diff --git a/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
index 7deaf69..0abdd47 100644
--- a/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
+++ b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
@@ -18,7 +18,7 @@
 	else()
 		set(LINUX_FFA_USER_SHIM_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
 				CACHE STRING "Linux FF-A user space shim repository URL")
-		set(LINUX_FFA_USER_SHIM_REFSPEC "v1.0.0"
+		set(LINUX_FFA_USER_SHIM_REFSPEC "v2.1.0"
 				CACHE STRING "Linux FF-A user space shim git refspec")
 
 		find_program(GIT_COMMAND "git")