subtree updates

meta-arm: 0164b4ca7a..13199c55c0:
  Adam Johnston (1):
        arm-bsp/linux-yocto: Upgrade kernel to v5.19 for N1SDP

  Anton Antonov (4):
        meta-arm/trusted-services: Use GCC toolchain for specific TS recipes only.
        arm/trusted-services: Remove patches merged upstream
        arm/trusted-services: Remove remaining patches merged upstream
        arm/trusted-services: include documentation

  Davidson K (1):
        arm-bsp/linux-arm64-ack: make it compatible with gcc-12 for TC

  Emekcan (2):
        arm-bsp/linux-yocto: update RPMSG_CTRL config for corstone1000
        arm-bsp/kernel: Fix TEE driver bug for corstone1000

  Jon Mason (3):
        CI: trusted services as a feature instead of a machine
        CI: cleanups for targets and removed tests
        arm-bsp: zephyr removal

  Peter Hoyes (1):
        arm/lib: Do not log FVP return codes < 0

  Ross Burton (2):
        arm/optee-spdevkit: remove
        CI: restrict compression threading

  Rui Miguel Silva (1):
        arm-bsp/corstone1000: bump kernel version to 5.19

  Rupinderjit Singh (1):
        arm: update Android common kernel

  Satish Kumar (4):
        arm-bsp/u-boot: corstone1000: esrt support
        arm-bsp/trusted-firmware-m: corstone1000: bump tfm SHA
        arm-bsp/trusted-firmware-m: corstone1000: fix sournce dir of libmetal and openamp
        arm-bsp/trusted-firmware-m: corstone1000: secure debug code checkout from yocto

  Sumit Garg (2):
        arm-toolchain: update Arm GCC to 11.3
        external-arm-toolchain: Enable 11.3.rel1 support

  Vishnu Banavath (1):
        arm-bsp/corstone500: upgrade kernel to v5.19

meta-raspberrypi: 45d56d82b7..fc5f80a47e:
  Devendra Tewari (3):
        rpi-cmdline: Leave cma value to kernel default
        libcamera: Tweak to build for Raspberry Pi
        rpi-libcamera-apps: add new recipe

  Martin Jansa (1):
        lirc: rename bbappend to match 0.10.%

  Zygmunt Krynicki (2):
        ci: fix typo: unconditionally
        ci: fix apparent typo in file patterns

meta-openembedded: ce0b93fc12..6529e5f963:
  Alexander Kanavin (3):
        python3-cchardet: depend on cython
        python3-gevent: make compatible with python 3.11
        python3-pybluez: add python 3.11 patch

  Anuj Mittal (1):
        opencv: fix reproducibility issues

  Devendra Tewari (2):
        libcamera: Bump SRCREV and add libyaml to DEPENDS
        libcamera: Remove boost from DEPENDS

  Fabio Estevam (1):
        spice: Include aarch64 to COMPATIBLE_HOST

  Federico Pellegrin (2):
        chrony: add pkgconfig class as pkg-config is explicitly searched for
        chrony: correct parameter to configure to disable readline usage

  Hao Jiang (1):
        mctp: install the .target files

  Jiaqing Zhao (1):
        openldap: Upgrade 2.5.12 -> 2.5.13

  Khem Raj (2):
        open62541: Disable lto on riscv/clang
        python3-gevent: Upgrade to 22.8.0

  Leon Anavi (10):
        python3-networkx: Upgrade 2.8.6 -> 2.8.7
        python3-coverage: Upgrade 6.4.4 -> 6.5.0
        python3-rdflib: Upgrade 6.1.1 -> 6.2.0
        python3-tabulate: Upgrade 0.8.10 -> 0.9.0
        python3-imageio: Upgrade 2.22.0 -> 2.22.1
        python3-astroid: Upgrade 2.12.10 -> 2.12.11
        python3-jsonref: Upgrade 0.2 -> 0.3.0
        python3-sentry-sdk: Upgrade 1.5.12 -> 1.9.10
        python3-greenlet: Upgrade 1.1.3 -> 1.1.3.post0
        python3-xmltodict: Upgrade 0.12.0 -> 0.13.0

  Markus Volk (2):
        blueman: upgrade 2.2.4 -> 2.3.2
        gtkmm3: upgrade 3.24.5 -> 3.24.7

  Martin Jansa (2):
        re2: fix branch name from master to main
        jack: fix compatibility with python-3.11

  Mathieu Dubois-Briand (3):
        mbedtls: Fix CVE product name
        mbedtls: Update to 2.28.1 version
        mbedtls: Whitelist CVE-2021-43666, CVE-2021-45451

  Matthias Klein (1):
        paho-mqtt-c: upgrade 1.3.10 -> 1.3.11

  Michael Opdenacker (1):
        tio: correct license information

  Mingli Yu (1):
        mariadb: not use qemu to run cross-compiled binaries

  S. Lockwood-Childs (1):
        x265: support aarch64

  Thomas Perrot (1):
        spitools: remove unused BPV variable

  Vyacheslav Yurkov (1):
        opcua: Add new recipe

  Wang Mingyu (20):
        ctags: upgrade 5.9.20220925.0 -> 5.9.20221002.0
        dnfdragora: upgrade 2.1.2 -> 2.1.3
        dool: upgrade 1.0.0 -> 1.1.0
        freeglut: upgrade 3.2.1 -> 3.4.0
        gspell: upgrade 1.11.1 -> 1.12.0
        hwdata: upgrade 0.362 -> 0.363
        iperf3: upgrade 3.11 -> 3.12
        libnet-dns-perl: upgrade 1.34 -> 1.35
        lirc: upgrade 0.10.1 -> 0.10.2
        metacity: upgrade 3.44.0 -> 3.46.0
        flatbuffers: upgrade 2.0.8 -> 22.9.29
        opencl-headers: upgrade 2022.09.23 -> 2022.09.30
        php: upgrade 8.1.10 -> 8.1.11
        poppler: upgrade 22.09.0 -> 22.10.0
        xfstests: upgrade 2022.09.04 -> 2022.09.25
        links: upgrade 2.27 -> 2.28
        st: upgrade 0.8.5 -> 0.9
        python3-requests-toolbelt: upgrade 0.9.1 -> 0.10.0
        Add nativesdk-systemd-systemctl as dependency of dnf-plugin-tui
        dnf-plugin-tui: Add nativesdk

  Yi Zhao (4):
        strongswan: upgrade 5.9.7 -> 5.9.8
        open-vm-tools: upgrade 11.3.5 -> 12.1.0
        dhcp-relay: upgrade 4.4.3 -> 4.4.3-P1
        frr: Security fix CVE-2022-37032

  zhengrq.fnst (5):
        python3-protobuf: upgrade 4.21.6 -> 4.21.7
        stunnel: upgrade 5.65 -> 5.66
        python3-web3: upgrade 5.31.0 -> 5.31.1
        wolfssl: upgrade 5.5.0 -> 5.5.1
        python3-xmlschema: upgrade 2.1.0 -> 2.1.1

meta-security: 824d2762f6..e8e7318189:
  Armin Kuster (3):
        apparmor: update to 3.0.7
        libgssglue: update to 0.7
        cryptmount: update to 6.0

  Michael Haener (1):
        tpm: update the linux-yocto rule with the one from sanity-meta-tpm class

poky: 5200799866..3e5faccfaf:
  Johan Korsnes (1):
        migration guides: 3.4: remove spurious space in example

  Lee Chee Yang (1):
        migration guides: add release notes for 4.0.4

  Michael Opdenacker (35):
        manuals: improve initramfs details
        manuals: add references to the "do_fetch" task
        manuals: add reference to the "do_install" task
        manuals: add references to the "do_build" task
        manuals: add reference to "do_configure" task
        manuals: add reference to the "do_compile" task
        manuals: add references to the "do_deploy" task
        manuals: add references to the "do_image" task
        manuals: add references to the "do_package" task
        manuals: add references to the "do_package_qa" task
        overview-manual: concepts.rst: add reference to "do_packagedata" task
        manuals: add references to the "do_patch" task
        manuals: add references to "do_package_write_*" tasks
        ref-manual: variables.rst: add reference to "do_populate_lic" task
        manuals: add reference to the "do_populate_sdk" task
        overview-manual: concepts.rst: add reference to "do_populate_sdk_ext" task
        manuals: add references to "do_populate_sysroot" task
        manuals: add references to the "do_unpack" task
        dev-manual: common-tasks.rst: add reference to "do_clean" task
        manuals: add references to the "do_cleanall" task
        ref-manual: tasks.rst: add references to the "do_cleansstate" task
        manuals: add references to the "do_devshell" task
        dev-manual: common-tasks.rst: add reference to "do_listtasks" task
        manuals: add references to the "do_bundle_initramfs" task
        manuals: add references to the "do_rootfs" task
        ref-manual: tasks.rst: add reference to the "do_kernel_checkout" task
        manuals: add reference to the "do_kernel_configcheck" task
        manuals: add references to the "do_kernel_configme" task
        ref-manual: tasks.rst: add reference to the "do_kernel_metadata" task
        migration-guides: add reference to the "do_shared_workdir" task
        ref-manual: tasks.rst: add reference to the "do_validate_branches" task
        ref-manual: tasks.rst: add reference to the "do_image_complete" task
        ref-manual: system-requirements: Ubuntu 22.04 now supported
        overview-manual: concepts.rst: fix formating and add references
        ref-manual/faq.rst: update references to products built with OE / Yocto Project

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I14d679e25bd1c7545bc2d0f545f876aeb0a333b4
diff --git a/meta-arm/.gitlab-ci.yml b/meta-arm/.gitlab-ci.yml
index 7474e24..60c6ed9 100644
--- a/meta-arm/.gitlab-ci.yml
+++ b/meta-arm/.gitlab-ci.yml
@@ -151,13 +151,7 @@
     matrix:
       - TOOLCHAINS: [gcc, clang]
         TCLIBC: [glibc, musl]
-        TESTING: testimage
-
-qemuarm64-secureboot-ts:
-  extends: .build
-  parallel:
-    matrix:
-      - TCLIBC: [glibc, musl]
+        TS: [none, trusted-services]
         TESTING: testimage
 
 qemuarm64:
diff --git a/meta-arm/ci/armgcc.yml b/meta-arm/ci/armgcc.yml
index d46f0b3..a797172 100644
--- a/meta-arm/ci/armgcc.yml
+++ b/meta-arm/ci/armgcc.yml
@@ -3,4 +3,4 @@
 
 local_conf_header:
   cc: |
-    GCCVERSION = "arm-11.2"
+    GCCVERSION = "arm-11.3"
diff --git a/meta-arm/ci/base.yml b/meta-arm/ci/base.yml
index 3f644c1..3619b8f 100644
--- a/meta-arm/ci/base.yml
+++ b/meta-arm/ci/base.yml
@@ -30,6 +30,9 @@
     CONF_VERSION = "2"
     BB_NUMBER_THREADS = "16"
     PARALLEL_MAKE = "-j16"
+    XZ_MEMLIMIT = "25%"
+    XZ_THREADS = "16"
+    ZSTD_THREADS = "16"
     LICENSE_FLAGS_ACCEPTED += "Arm-FVP-EULA"
   setup: |
     PACKAGE_CLASSES = "package_ipk"
diff --git a/meta-arm/ci/clang.yml b/meta-arm/ci/clang.yml
index 80b9a4e..a2063f1 100644
--- a/meta-arm/ci/clang.yml
+++ b/meta-arm/ci/clang.yml
@@ -8,9 +8,3 @@
 local_conf_header:
   clang: |
     TOOLCHAIN = "clang"
-    # Clang causes more binaries to have buildpaths in the debug symbols
-    # https://github.com/llvm/llvm-project/issues/56609
-    WARN_QA:remove = "buildpaths"
-
-target:
-  - core-image-base
diff --git a/meta-arm/ci/corstone1000-common.yml b/meta-arm/ci/corstone1000-common.yml
index 6599d97..970a87c 100644
--- a/meta-arm/ci/corstone1000-common.yml
+++ b/meta-arm/ci/corstone1000-common.yml
@@ -3,11 +3,13 @@
   includes:
     - ci/base.yml
     - ci/meta-openembedded.yml
+
 local_conf_header:
     perf: |
+    # Intentionally blank to prevent perf from being added to the image in base.yml
 
 distro: poky-tiny
 
 target:
-  - perf
   - corstone1000-image
+  - perf
diff --git a/meta-arm/ci/corstone500.yml b/meta-arm/ci/corstone500.yml
index ef78cac..d51d45f 100644
--- a/meta-arm/ci/corstone500.yml
+++ b/meta-arm/ci/corstone500.yml
@@ -8,6 +8,7 @@
     INHERIT += "fvpboot"
     IMAGE_FEATURES:remove = " ssh-server-dropbear"
   perf: |
+    # Intentionally blank to prevent perf from being added to the image in base.yml
 
 machine: corstone500
 
diff --git a/meta-arm/ci/get-binary-toolchains b/meta-arm/ci/get-binary-toolchains
index bfdd8c5..ed334bf 100755
--- a/meta-arm/ci/get-binary-toolchains
+++ b/meta-arm/ci/get-binary-toolchains
@@ -2,7 +2,7 @@
 set -u
 
 HOST_ARCH=$(uname -m)
-VER="11.2-2022.02"
+VER="11.3.rel1"
 
 DOWNLOAD_DIR=$1
 TOOLCHAIN_DIR=$2
@@ -15,32 +15,32 @@
 	#AArch64 Linux hosted cross compilers
 
 	#AArch32 target with hard float (arm-none-linux-gnueabihf)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
 elif [ $HOST_ARCH = "x86_64" ]; then
 	#x86_64 Linux hosted cross compilers
 
 	#AArch32 target with hard float (arm-linux-none-gnueabihf)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
 
 	#AArch64 GNU/Linux target (aarch64-none-linux-gnu)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz
 
 	#AArch64 GNU/Linux target (aarch64_be-none-linux-gnu)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz
 else
 	echo "ERROR - Unknown build arch of $HOST_ARCH"
 	exit 1
 fi
 
 for i in arm aarch64 aarch64_be; do
-	if [ ! -d $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then
-		if [ ! -f $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then
+	if [ ! -d $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then
+		if [ ! -f $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then
 			continue
 		fi
 
-		tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz
+		tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz
 	fi
 
 	# Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location)
-	ln -s $TOOLCHAIN_DIR/gcc-arm-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i
+	ln -s $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i
 done
diff --git a/meta-arm/ci/meta-zephyr.yml b/meta-arm/ci/meta-zephyr.yml
deleted file mode 100644
index bdd0e2b..0000000
--- a/meta-arm/ci/meta-zephyr.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-header:
-  version: 11
-  includes:
-    - ci/meta-openembedded.yml
-
-repos:
-  meta-zephyr:
-    url: https://git.yoctoproject.org/git/meta-zephyr
-    layers:
-      meta-zephyr-core:
-
-target:
-  - zephyr-kernel-test-all
diff --git a/meta-arm/ci/musca-b1.yml b/meta-arm/ci/musca-b1.yml
index dc9814d..b38dd1e 100644
--- a/meta-arm/ci/musca-b1.yml
+++ b/meta-arm/ci/musca-b1.yml
@@ -2,14 +2,9 @@
   version: 11
   includes:
     - ci/base.yml
-    - ci/meta-zephyr.yml
-
-local_conf_header:
-  nonbuilding_tests: |
-    ZEPHYRTESTS:remove = "common sleep poll device queue"
+    - ci/meta-openembedded.yml
 
 machine: musca-b1
 
 target:
   - trusted-firmware-m
-  - zephyr-kernel-test-all
diff --git a/meta-arm/ci/musca-s1.yml b/meta-arm/ci/musca-s1.yml
index 80a59c4..29f289a 100644
--- a/meta-arm/ci/musca-s1.yml
+++ b/meta-arm/ci/musca-s1.yml
@@ -2,14 +2,9 @@
   version: 11
   includes:
     - ci/base.yml
-    - ci/meta-zephyr.yml
-
-local_conf_header:
-  nonbuilding_tests: |
-    ZEPHYRTESTS:remove = "common sleep poll device queue"
+    - ci/meta-openembedded.yml
 
 machine: musca-s1
 
 target:
   - trusted-firmware-m
-  - zephyr-kernel-test-all
diff --git a/meta-arm/ci/qemu-generic-arm64.yml b/meta-arm/ci/qemu-generic-arm64.yml
index 87cbd2f..32c4b98 100644
--- a/meta-arm/ci/qemu-generic-arm64.yml
+++ b/meta-arm/ci/qemu-generic-arm64.yml
@@ -10,5 +10,5 @@
 machine: qemu-generic-arm64
 
 target:
-  - core-image-base
+  - core-image-sato
   - sbsa-acs
diff --git a/meta-arm/ci/qemuarm64-secureboot.yml b/meta-arm/ci/qemuarm64-secureboot.yml
index 7e15a76..f617dfc 100644
--- a/meta-arm/ci/qemuarm64-secureboot.yml
+++ b/meta-arm/ci/qemuarm64-secureboot.yml
@@ -5,14 +5,8 @@
 
 machine: qemuarm64-secureboot
 
-local_conf_header:
-  failing_tests: |
-    # software IO TLB: Cannot allocate buffer
-    DEFAULT_TEST_SUITES:remove = "parselogs"
-
 target:
   - core-image-base
   - optee-examples
   - optee-test
-  - optee-spdevkit
   - optee-os-tadevkit
diff --git a/meta-arm/ci/testimage-zephyr.yml b/meta-arm/ci/testimage-zephyr.yml
deleted file mode 100644
index 83e17a7..0000000
--- a/meta-arm/ci/testimage-zephyr.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-header:
-  version: 11
-
-local_conf_header:
-  testimage: |
-    IMAGE_CLASSES += "testimage"
-    TEST_TARGET = "QemuTargetZephyr"
-    TEST_SUITES = "zephyr"
-    TESTIMAGE_AUTO = "1"
diff --git a/meta-arm/ci/qemuarm64-secureboot-ts.yml b/meta-arm/ci/trusted-services.yml
similarity index 61%
rename from meta-arm/ci/qemuarm64-secureboot-ts.yml
rename to meta-arm/ci/trusted-services.yml
index 66a27c6..433ec78 100644
--- a/meta-arm/ci/qemuarm64-secureboot-ts.yml
+++ b/meta-arm/ci/trusted-services.yml
@@ -1,20 +1,9 @@
-# Build qemuarm64-secureboot machine with
-# Trusted Services secure partition included into optee-os image.
-#
-# Run Trustes Services OEQA tests.
-
 header:
   version: 11
   includes:
-    - ci/base.yml
     - ci/meta-openembedded.yml
 
-machine: qemuarm64-secureboot
-
 local_conf_header:
-  failing_tests: |
-    # software IO TLB: Cannot allocate buffer
-    DEFAULT_TEST_SUITES:remove = "parselogs"
   trusted_services: |
     TEST_SUITES:append = " trusted_services"
     # Include TS Crypto, Storage, ITS, Attestation and SMM-Gateway SPs into optee-os image
@@ -23,6 +12,3 @@
     IMAGE_INSTALL:append = " packagegroup-ts-tests"
     # Include TS PSA Arch tests into image
     IMAGE_INSTALL:append = " packagegroup-ts-tests-psa"
-
-target:
-  - core-image-base
diff --git a/meta-arm/ci/update-repos b/meta-arm/ci/update-repos
index a68257b..91ff197 100755
--- a/meta-arm/ci/update-repos
+++ b/meta-arm/ci/update-repos
@@ -22,7 +22,6 @@
     "https://git.yoctoproject.org/git/poky",
     "https://git.openembedded.org/meta-openembedded",
     "https://git.yoctoproject.org/git/meta-virtualization",
-    "https://git.yoctoproject.org/git/meta-zephyr",
     "https://github.com/kraj/meta-clang",
 )
 
diff --git a/meta-arm/documentation/trusted-services.md b/meta-arm/documentation/trusted-services.md
new file mode 100644
index 0000000..e3cee6b
--- /dev/null
+++ b/meta-arm/documentation/trusted-services.md
@@ -0,0 +1,53 @@
+# The Trusted Services: framework for developing root-of-trust services
+
+  meta-arm layer includes recipes for [Trusted Services][1] Secure Partitions and Normal World applications
+in `meta-arm/recipes-security/trusted-services`
+
+## Secure Partitions recipes
+
+We define dedicated recipes for all supported Trusted Services (TS) Secure Partitions.
+These recipes produce ELF and DTB files for SPs.
+These files are automatically included into optee-os image accordingly to defined MACHINE_FEATURES.
+
+### How to include TS SPs
+
+To include TS SPs into optee-os image you need to add into MACHINE_FEATURES
+features for each [Secure Partition][2] you would like to include:
+
+| Secure Partition  | MACHINE_FEATURE |
+| ----------------- | --------------- |
+| Attestation       | ts-attesation   |
+| Crypto            | ts-crypto       |
+| Internal Storage  | ts-its          |
+| Protected Storage | ts-storage      |
+| se-proxy          | ts-se-proxy     |
+| smm-gateway       | ts-smm-gateway  |
+
+Other steps depend on your machine/platform definition:
+
+1. For communications between Secure and Normal Words Linux kernel option `CONFIG_ARM_FFA_TRANSPORT=y`
+is required. If your platform doesn't include it already you can add `arm-ffa` into MACHINE_FEATURES.
+
+2. optee-os might require platform specific OP-TEE build parameters (for example what SEL the SPM Core is implemented at).
+You can find examples in `meta-arm/recipes-security/optee/optee-os_%.bbappend` for qemuarm64-secureboot machine
+and in `meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc` and `meta-arm-bsp/recipes-security/optee/optee-os-corstone1000-common.inc`
+for N1SDP and Corstone1000 platforms accordingly.
+
+3. trusted-firmware-a might require platform specific TF-A build parameters (SPD and SPMC details on the platform).
+See `meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend` for qemuarm64-secureboot machine
+and in `meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-n1sdp.inc` and
+`meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-corstone1000.inc` for N1SDP and Corstone1000 platforms.
+
+## Normal World applications
+
+  Optionally for testing purposes you can add `packagegroup-ts-tests` and `packagegroup-ts-tests-psa` package groups into your image.
+They include [Trusted Services test and demo tools][3]
+
+## OEQA Trusted Services tests
+
+  meta-arm also includes Trusted Service OEQA tests which can be used for automated testing.
+See `ci/trusted-services.yml` for an example how to include them into an image.
+
+[1] https://trusted-services.readthedocs.io/en/integration/overview/introduction.html
+[2] https://trusted-services.readthedocs.io/en/integration/developer/deployments/secure-partitions.html
+[3] https://trusted-services.readthedocs.io/en/integration/developer/deployments/test-executables.html
diff --git a/meta-arm/meta-arm-bsp/conf/machine/corstone500.conf b/meta-arm/meta-arm-bsp/conf/machine/corstone500.conf
index adcfddd..9db2ceb 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/corstone500.conf
+++ b/meta-arm/meta-arm-bsp/conf/machine/corstone500.conf
@@ -12,7 +12,7 @@
 # apply.
 #
 PREFERRED_PROVIDER_virtual/kernel:forcevariable = "linux-yocto"
-PREFERRED_VERSION_linux-yocto ?= "5.15%"
+PREFERRED_VERSION_linux-yocto ?= "5.19%"
 
 EXTRA_IMAGEDEPENDS += "trusted-firmware-a u-boot"
 
diff --git a/meta-arm/meta-arm-bsp/conf/machine/include/corstone1000.inc b/meta-arm/meta-arm-bsp/conf/machine/include/corstone1000.inc
index e4ef068..ff00e3f 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/include/corstone1000.inc
+++ b/meta-arm/meta-arm-bsp/conf/machine/include/corstone1000.inc
@@ -49,7 +49,7 @@
 
 # Linux kernel
 PREFERRED_PROVIDER_virtual/kernel:forcevariable = "linux-yocto"
-PREFERRED_VERSION_linux-yocto = "5.15%"
+PREFERRED_VERSION_linux-yocto = "5.19%"
 KERNEL_IMAGETYPE = "Image.gz"
 
 INITRAMFS_IMAGE_BUNDLE ?= "1"
diff --git a/meta-arm/meta-arm-bsp/conf/machine/include/tc.inc b/meta-arm/meta-arm-bsp/conf/machine/include/tc.inc
index d1fe97d..f51497d 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/include/tc.inc
+++ b/meta-arm/meta-arm-bsp/conf/machine/include/tc.inc
@@ -23,7 +23,6 @@
 FIT_GENERATE_KEYS = "1"
 
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-arm64-ack"
-PREFERRED_VERSION_linux-arm64-ack ?= "5.10"
 
 # OP-TEE
 PREFERRED_VERSION_optee-os ?= "3.18%"
diff --git a/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf b/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf
index a7895b8..c5ef323 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf
+++ b/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf
@@ -20,9 +20,4 @@
 QB_MEM = "512k"
 QB_RNG = ""
 
-# Zephyr RTOS settings
-ZEPHYR_BOARD = "v2m_musca_b1"
-ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
-ARCH:musca-b1 = "arm"
-
 TFM_PLATFORM = "arm/musca_b1/sse_200"
diff --git a/meta-arm/meta-arm-bsp/conf/machine/musca-s1.conf b/meta-arm/meta-arm-bsp/conf/machine/musca-s1.conf
index 0cfd56e..3d3bc4d 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/musca-s1.conf
+++ b/meta-arm/meta-arm-bsp/conf/machine/musca-s1.conf
@@ -19,9 +19,4 @@
 QB_MEM = "512k"
 QB_RNG = ""
 
-# Zephyr RTOS settings
-ZEPHYR_BOARD = "v2m_musca_s1"
-ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
-ARCH:musca-s1 = "arm"
-
 TFM_PLATFORM = "arm/musca_s1"
diff --git a/meta-arm/meta-arm-bsp/conf/machine/n1sdp.conf b/meta-arm/meta-arm-bsp/conf/machine/n1sdp.conf
index 5d1be82..581e6af 100644
--- a/meta-arm/meta-arm-bsp/conf/machine/n1sdp.conf
+++ b/meta-arm/meta-arm-bsp/conf/machine/n1sdp.conf
@@ -19,7 +19,7 @@
 
 # Use kernel provided by yocto
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
-PREFERRED_VERSION_linux-yocto ?= "5.15%"
+PREFERRED_VERSION_linux-yocto ?= "5.19%"
 
 # RTL8168E Gigabit Ethernet Controller is attached to the PCIe interface
 MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "linux-firmware-rtl8168"
diff --git a/meta-arm/meta-arm-bsp/documentation/musca-b1.md b/meta-arm/meta-arm-bsp/documentation/musca-b1.md
index a9af03f..a7439e5 100644
--- a/meta-arm/meta-arm-bsp/documentation/musca-b1.md
+++ b/meta-arm/meta-arm-bsp/documentation/musca-b1.md
@@ -4,9 +4,6 @@
 For a description of the hardware, go to
 https://developer.arm.com/tools-and-software/development-boards/iot-test-chips-and-boards/musca-b-test-chip-board
 
-For current supported hardware by Zephyr, go to
-https://docs.zephyrproject.org/2.3.0/boards/arm/v2m_musca/doc/index.html
-
 For emulated hardware, go to
 https://www.qemu.org/docs/master/system/arm/musca.html
 
@@ -14,13 +11,5 @@
 In the local.conf file, MACHINE should be set as follows:
 MACHINE ?= "musca-b1"
 
-To build for Zephyr:
-```bash$ bitbake-layers layerindex-fetch meta-zephyr```
-```bash$ bitbake zephyr-philosophers```
-
-To build the trusted firmware-m (and not Zephyr):
+To build the trusted firmware-m:
 ```bash$ bitbake trusted-firmware-m```
-
-## Running
-To run Zephyr on the QEMU based machine, execute the following command
-```bash$ runqemu qemu-musca-b1```
diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
index 95c49d0..dc57eac 100644
--- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
+++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
@@ -11,19 +11,46 @@
 EXTRA_OECMAKE += "-DPLATFORM_IS_FVP=${TFM_PLATFORM_IS_FVP}"
 EXTRA_OECMAKE += "-DCC312_LEGACY_DRIVER_API_ENABLED=OFF"
 
+SRCBRANCH_tfm = "master"
+SRC_URI  = "git://git.trustedfirmware.org/TF-M/trusted-firmware-m.git;protocol=https;branch=${SRCBRANCH_tfm};name=tfm;destsuffix=git/tfm \
+            git://git.trustedfirmware.org/TF-M/tf-m-tests.git;protocol=https;branch=master;name=tfm-tests;destsuffix=git/tf-m-tests \
+            git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=master;name=mbedtls;destsuffix=git/mbedtls \
+            git://github.com/mcu-tools/mcuboot.git;protocol=https;branch=main;name=mcuboot;destsuffix=git/mcuboot \
+            "
+
+# Bumping the SHA of TFM is required as multiple changes are needed in the TFM to support the ESRT 
+# The most crucial change needed is TFM support for UEFI FMP Image Information 
+SRCREV_tfm = "b065a6b28cc6c692b99e4f7e9387d96f51bf4d07"
+SRCREV_mbedtls = "869298bffeea13b205343361b7a7daf2b210e33d"
+SRCREV_mcuboot = "c657cbea75f2bb1faf1fceacf972a0537a8d26dd"
+SRCREV_tfm-tests = "3e6c52b4b255e4b1343ba6a257a77fa7a976e8fb"
+PV .= "+git${SRCPV}"
+SRCREV_FORMAT ?= "tfm"
+
 # libmetal
 LICENSE += "& BSD-3-Clause"
 LIC_FILES_CHKSUM += "file://../libmetal/LICENSE.md;md5=fe0b8a4beea8f0813b606d15a3df3d3c"
 SRC_URI += "git://github.com/OpenAMP/libmetal.git;protocol=https;branch=main;name=libmetal;destsuffix=git/libmetal"
 SRCREV_libmetal = "f252f0e007fbfb8b3a52b1d5901250ddac96baad"
-EXTRA_OECMAKE += "-DLIBMETAL_SRC_PATH=${WORKDIR}/git/libmetal -DLIBMETAL_BIN_PATH=${B}/libmetal-build"
+EXTRA_OECMAKE += "-DLIBMETAL_SRC_PATH=${S}/../libmetal -DLIBMETAL_BIN_PATH=${B}/libmetal-build"
 
 # OpenAMP
 LICENSE += "& BSD-2-Clause & BSD-3-Clause"
 LIC_FILES_CHKSUM += "file://../openamp/LICENSE.md;md5=a8d8cf662ef6bf9936a1e1413585ecbf"
 SRC_URI += "git://github.com/OpenAMP/open-amp.git;protocol=https;branch=main;name=openamp;destsuffix=git/openamp"
 SRCREV_openamp = "347397decaa43372fc4d00f965640ebde042966d"
-EXTRA_OECMAKE += "-DLIBOPENAMP_SRC_PATH=${WORKDIR}/git/openamp -DLIBOPENAMP_BIN_PATH=${B}/libopenamp-build"
+EXTRA_OECMAKE += "-DLIBOPENAMP_SRC_PATH=${S}/../openamp -DLIBOPENAMP_BIN_PATH=${B}/libopenamp-build"
+
+# Secure Debug ADAC
+LICENSE += "& BSD-3-Clause"
+LIC_FILES_CHKSUM += "file://../psa-adac/license.rst;md5=07f368487da347f3c7bd0fc3085f3afa"
+SRC_URI += "git://git.trustedfirmware.org/shared/psa-adac.git;protocol=https;branch=master;name=psa-adac;destsuffix=git/psa-adac"
+SRCREV_psa-adac = "427923cc0152578d536fb2065154d5d0dd874910"
+# Secure debug is disabled by default
+EXTRA_OECMAKE += "-DPLATFORM_PSA_ADAC_SECURE_DEBUG=OFF"
+EXTRA_OECMAKE += "-DPLATFORM_PSA_ADAC_SOURCE_PATH=${S}/../psa-adac -DPLATFORM_PSA_ADAC_BUILD_PATH=${B}/libpsa-adac-build"
+
+DEPENDS += "trusted-firmware-a"
 
 do_install() {
   install -D -p -m 0644 ${B}/install/outputs/tfm_s_signed.bin ${D}/firmware/tfm_s_signed.bin
diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-arm-corstone1000-esrt-support.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-arm-corstone1000-esrt-support.patch
new file mode 100644
index 0000000..2db5c2a
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-arm-corstone1000-esrt-support.patch
@@ -0,0 +1,223 @@
+From d8fca6ebd5917df9a12dbf1da6a97f99af06eee9 Mon Sep 17 00:00:00 2001
+From: Satish Kumar <satish.kumar01@arm.com>
+Date: Fri, 19 Aug 2022 09:18:33 +0100
+Subject: [PATCH] arm/corstone1000: esrt support
+
+The implementation is platform specific and would require
+change in future.
+
+The patch should not be upstreamed as it is to the u-boot.
+Redesign of FMP protocol for ESRT and Capsule Update interface
+is to be considered in the future.
+
+Signed-off-by: Satish Kumar <satish.kumar01@arm.com>
+Upstream-Status: Inappropriate [Redesign of FMP protocol for ESRT and Capsule update interface is required]
+---
+ include/efi_api.h             |   2 +-
+ lib/efi_loader/efi_firmware.c | 133 ++++++++++++++++++++++++++++++++++
+ lib/efi_loader/efi_setup.c    |  16 ++--
+ 3 files changed, 142 insertions(+), 9 deletions(-)
+
+diff --git a/include/efi_api.h b/include/efi_api.h
+index 83c01085fd..26899afd01 100644
+--- a/include/efi_api.h
++++ b/include/efi_api.h
+@@ -2014,7 +2014,7 @@ struct efi_firmware_image_descriptor {
+ 	u32 last_attempt_status;
+ 	u64 hardware_instance;
+ 	efi_firmware_image_dep_t *dependencies;
+-};
++} __packed;
+ 
+ struct efi_firmware_management_protocol {
+ 	efi_status_t (EFIAPI *get_image_info)(
+diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
+index 28d9a19edb..aa4af8036b 100644
+--- a/lib/efi_loader/efi_firmware.c
++++ b/lib/efi_loader/efi_firmware.c
+@@ -14,6 +14,7 @@
+ #include <signatures.h>
+ 
+ #include <linux/list.h>
++#include <efi_variable.h>
+ 
+ #define FMP_PAYLOAD_HDR_SIGNATURE	SIGNATURE_32('M', 'S', 'S', '1')
+ 
+@@ -416,8 +417,140 @@ efi_status_t EFIAPI efi_firmware_fit_set_image(
+ 	return EFI_EXIT(EFI_SUCCESS);
+ }
+ 
++#if CONFIG_IS_ENABLED(TARGET_CORSTONE1000)
++
++/**
++ * efi_firmware_corstone1000_get_image_info - return information about the current
++                                    firmware image
++ * @this:                      Protocol instance
++ * @image_info_size:           Size of @image_info
++ * @image_info:                        Image information
++ * @descriptor_version:                Pointer to version number
++ * @descriptor_count:          Pointer to number of descriptors
++ * @descriptor_size:           Pointer to descriptor size
++ * package_version:            Package version
++ * package_version_name:       Package version's name
++ *
++ * Return information bout the current firmware image in @image_info.
++ * @image_info will consist of a number of descriptors.
++ * Each descriptor will be created based on efi fetched variable.
++ *
++ * Return              status code
++ */
++static
++efi_status_t EFIAPI efi_firmware_corstone1000_get_image_info(
++       struct efi_firmware_management_protocol *this,
++       efi_uintn_t *image_info_size,
++       struct efi_firmware_image_descriptor *image_info,
++       u32 *descriptor_version,
++       u8 *descriptor_count,
++       efi_uintn_t *descriptor_size,
++       u32 *package_version,
++       u16 **package_version_name)
++{
++	efi_uintn_t var_size;
++	efi_status_t ret = EFI_SUCCESS;
++	efi_uintn_t image_info_size_var = 0;
++	efi_uintn_t image_info_name_size_var;
++	efi_uintn_t image_info_version_size_var;
++	u8 *runner = (u8 *)image_info;
++	u16 fmp_image_name[14] = {'F', 'm', 'p', 'I', 'm', 'a', 'g', 'e', 'N', 'a', 'm', 'e', '1', '\0'};
++	u16 fmp_version_name[16] = {'F', 'm', 'p', 'V', 'e', 'r', 's', 'i', 'o', 'n', 'N', 'a', 'm', 'e', '1', '\0'};
++
++	EFI_ENTRY("%p %p %p %p %p %p %p %p\n", this,
++	          image_info_size, image_info,
++	          descriptor_version, descriptor_count, descriptor_size,
++	          package_version, package_version_name);
++
++	if (!image_info_size)
++	        return EFI_EXIT(EFI_INVALID_PARAMETER);
++
++	if (*image_info_size &&
++	    (!image_info || !descriptor_version || !descriptor_count ||
++	     !descriptor_size || !package_version || !package_version_name))
++	        return EFI_EXIT(EFI_INVALID_PARAMETER);
++
++	var_size = sizeof(*descriptor_version);
++	ret = efi_get_variable(u"FmpDescriptorVersion",
++	                           &efi_guid_firmware_management_protocol, NULL,
++	                           &var_size, descriptor_version);
++	if (ret != EFI_SUCCESS)
++	        return EFI_EXIT(ret);
++
++	if (*descriptor_version != EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION)
++	        return EFI_EXIT(EFI_UNSUPPORTED);
++
++	var_size = sizeof(image_info_size_var);
++	ret = efi_get_variable(u"FmpImageInfoSize",
++	                           &efi_guid_firmware_management_protocol, NULL,
++	                           &var_size, &image_info_size_var);
++	if (ret != EFI_SUCCESS)
++	        return EFI_EXIT(ret);
++
++	if (*image_info_size < image_info_size_var) {
++	        *image_info_size = image_info_size_var;
++	        return EFI_EXIT(EFI_BUFFER_TOO_SMALL);
++	}
++
++	image_info_name_size_var = image_info_size_var;
++
++	var_size = sizeof(*descriptor_count);
++	ret = efi_get_variable(u"FmpDescriptorCount",
++	                           &efi_guid_firmware_management_protocol, NULL,
++	                           &var_size, descriptor_count);
++	if (ret != EFI_SUCCESS) {
++	        return EFI_EXIT(ret);
++	}
++
++	ret = efi_get_variable(u"FmpImageInfo",
++	                           &efi_guid_firmware_management_protocol, NULL,
++	                           &image_info_size_var, image_info);
++	if (ret != EFI_SUCCESS)
++	        return EFI_EXIT(ret);
++
++	runner += image_info_size_var;
++
++	image_info_name_size_var -= image_info_size_var;
++	image_info_version_size_var = image_info_name_size_var;
++
++        /* Consider changing the string modfication logic */
++	fmp_image_name[12] = '0' + (u16)image_info->image_id;
++	ret = efi_get_variable(fmp_image_name,
++	                      &efi_guid_firmware_management_protocol, NULL,
++	                      &image_info_name_size_var, runner);
++	if (ret != EFI_SUCCESS)
++	       return EFI_EXIT(ret);
++
++	image_info_version_size_var -= image_info_name_size_var;
++	image_info->image_id_name = runner;
++	runner += image_info_name_size_var;
++
++        /* Consider changing the string modfication logic */
++	fmp_version_name[14] = '0' + (u16)image_info->image_id;
++	ret = efi_get_variable(fmp_version_name,
++	                       &efi_guid_firmware_management_protocol, NULL,
++	                       &image_info_version_size_var, runner);
++	if (ret != EFI_SUCCESS)
++	        return EFI_EXIT(ret);
++
++	image_info->version_name = runner;
++
++	*image_info_size = image_info_size_var;
++
++	*package_version = 0xffffffff; /* not supported */
++	*package_version_name = NULL; /* not supported */
++
++	return EFI_EXIT(ret);
++}
++
++#endif
++
+ const struct efi_firmware_management_protocol efi_fmp_fit = {
++#if CONFIG_IS_ENABLED(TARGET_CORSTONE1000)
++	.get_image_info = efi_firmware_corstone1000_get_image_info,
++#else
+ 	.get_image_info = efi_firmware_get_image_info,
++#endif
+ 	.get_image = efi_firmware_get_image_unsupported,
+ 	.set_image = efi_firmware_fit_set_image,
+ 	.check_image = efi_firmware_check_image_unsupported,
+diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
+index 6c9e14c37e..6ccda175ff 100644
+--- a/lib/efi_loader/efi_setup.c
++++ b/lib/efi_loader/efi_setup.c
+@@ -168,13 +168,6 @@ static efi_status_t efi_init_capsule(void)
+ 
+ #if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
+ 	int ffa_ret;
+-
+-	ffa_ret = efi_corstone1000_uboot_efi_started_event();
+-	if (ffa_ret)
+-		debug("[efi_boottime][ERROR]: Failure to notify SE Proxy FW update service\n");
+-	else
+-		debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
+-
+ 	ret = efi_corstone1000_alloc_capsule_shared_buf();
+ 	if (ret != EFI_SUCCESS) {
+ 		printf("EFI: Corstone-1000: cannot allocate caspsule shared buffer\n");
+@@ -306,7 +299,14 @@ efi_status_t efi_init_obj_list(void)
+ 		if (ret != EFI_SUCCESS)
+ 			goto out;
+ 	}
+-
++#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
++		int ffa_ret;
++		ffa_ret = efi_corstone1000_uboot_efi_started_event();
++		if (ffa_ret)
++			debug("[efi_boottime][ERROR]: Failure to notify SE Proxy FW update service\n");
++		else
++			debug("[efi_boottime][INFO]: SE Proxy FW update service notified\n");
++#endif
+ 	/* Initialize variable services */
+ 	ret = efi_init_variables();
+ 	if (ret != EFI_SUCCESS)
+-- 
+2.25.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend
index 420cee6..465f034 100644
--- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -47,7 +47,8 @@
         file://0027-corstone1000-use-a-compressed-kernel.patch \
         file://0028-Introduce-external-sys-driver-to-device-tree.patch \
         file://0029-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \
-        "
+        file://0030-arm-corstone1000-esrt-support.patch \
+      "
 
 #
 # FVP BASE
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc.scc b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc.scc
index 43d2153..6542e6b 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc.scc
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc.scc
@@ -3,7 +3,11 @@
 kconf non-hardware tc/devtmpfs.cfg
 kconf non-hardware tc/gralloc.cfg
 kconf non-hardware tc/mali.cfg
-kconf non-hardware tc/tee.cfg
+kconf non-hardware tc/ffa.cfg
+kconf non-hardware tc/optee.cfg
 kconf non-hardware tc/virtio.cfg
+kconf non-hardware tc/autofdo.cfg
 kconf non-hardware tc/ci700.cfg
 kconf non-hardware tc/trusty.cfg
+kconf non-hardware tc/disable_mpam.cfg
+kconf non-hardware tc/disable_btf.cfg
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_btf.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_btf.cfg
new file mode 100644
index 0000000..2743382
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_btf.cfg
@@ -0,0 +1 @@
+CONFIG_DEBUG_INFO_BTF=n
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_mpam.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_mpam.cfg
new file mode 100644
index 0000000..2dceb6c
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/disable_mpam.cfg
@@ -0,0 +1 @@
+CONFIG_ARM64_MPAM=n
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/ffa.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/ffa.cfg
new file mode 100644
index 0000000..34de78e
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/ffa.cfg
@@ -0,0 +1 @@
+CONFIG_ARM_FFA_TRANSPORT=y
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/optee.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/optee.cfg
new file mode 100644
index 0000000..07554cf
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/optee.cfg
@@ -0,0 +1,2 @@
+CONFIG_TEE=y
+CONFIG_OPTEE=y
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/tee.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/tee.cfg
deleted file mode 100644
index 4b9cbd8..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/arm-platforms-kmeta/bsp/arm-platforms/tc/tee.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_TEE=y
-CONFIG_OPTEE=y
-CONFIG_ARM_FFA_TRANSPORT=y
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0001-UPSTREAM-firmware-arm_ffa-Handle-compatibility-with-.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0001-UPSTREAM-firmware-arm_ffa-Handle-compatibility-with-.patch
deleted file mode 100644
index a4fd673..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0001-UPSTREAM-firmware-arm_ffa-Handle-compatibility-with-.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e3f9da608f14cfebac2659d8dd8737b79d01308]
-Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
-
-From a8f3e351c07c48774be2a45e184b9f08dc92f1db Mon Sep 17 00:00:00 2001
-From: Sudeep Holla <sudeep.holla@arm.com>
-Date: Wed, 13 Apr 2022 15:43:19 +0100
-Subject: [PATCH] UPSTREAM: firmware: arm_ffa: Handle compatibility with
- different firmware versions
-
-The driver currently just support v1.0 of Arm FFA specification. It also
-expects the firmware implementation to match the same and bail out if it
-doesn't match. This is causing issue when running with higher version of
-firmware implementation(e.g. v1.1 which will released soon).
-
-In order to support compatibility with different firmware versions, let
-us add additional checks and find the compatible version the driver can
-work with.
-
-Link: https://lore.kernel.org/r/20211013091127.990992-1-sudeep.holla@arm.com
-Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
-Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
-(cherry picked from commit 8e3f9da608f14cfebac2659d8dd8737b79d01308)
-Change-Id: I7bc9a3b172a9067bfd4e9bb9d50b4729e915b5a5
-Bug: 168585974
----
- drivers/firmware/arm_ffa/driver.c | 37 ++++++++++++++++++++++++++-----
- 1 file changed, 32 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
-index c9fb56afbcb4..6e0c883ab708 100644
---- a/drivers/firmware/arm_ffa/driver.c
-+++ b/drivers/firmware/arm_ffa/driver.c
-@@ -167,6 +167,28 @@ struct ffa_drv_info {
- 
- static struct ffa_drv_info *drv_info;
- 
-+/*
-+ * The driver must be able to support all the versions from the earliest
-+ * supported FFA_MIN_VERSION to the latest supported FFA_DRIVER_VERSION.
-+ * The specification states that if firmware supports a FFA implementation
-+ * that is incompatible with and at a greater version number than specified
-+ * by the caller(FFA_DRIVER_VERSION passed as parameter to FFA_VERSION),
-+ * it must return the NOT_SUPPORTED error code.
-+ */
-+static u32 ffa_compatible_version_find(u32 version)
-+{
-+	u32 compat_version;
-+	u16 major = MAJOR_VERSION(version), minor = MINOR_VERSION(version);
-+	u16 drv_major = MAJOR_VERSION(FFA_DRIVER_VERSION);
-+	u16 drv_minor = MINOR_VERSION(FFA_DRIVER_VERSION);
-+
-+	if ((major < drv_major) || (major == drv_major && minor <= drv_minor))
-+		return version;
-+
-+	pr_info("Firmware version higher than driver version, downgrading\n");
-+	return FFA_DRIVER_VERSION;
-+}
-+
- static int ffa_version_check(u32 *version)
- {
- 	ffa_value_t ver;
-@@ -180,15 +202,20 @@ static int ffa_version_check(u32 *version)
- 		return -EOPNOTSUPP;
- 	}
- 
--	if (ver.a0 < FFA_MIN_VERSION || ver.a0 > FFA_DRIVER_VERSION) {
--		pr_err("Incompatible version %d.%d found\n",
--		       MAJOR_VERSION(ver.a0), MINOR_VERSION(ver.a0));
-+	if (ver.a0 < FFA_MIN_VERSION) {
-+		pr_err("Incompatible v%d.%d! Earliest supported v%d.%d\n",
-+		       MAJOR_VERSION(ver.a0), MINOR_VERSION(ver.a0),
-+		       MAJOR_VERSION(FFA_MIN_VERSION),
-+		       MINOR_VERSION(FFA_MIN_VERSION));
- 		return -EINVAL;
- 	}
- 
--	*version = ver.a0;
--	pr_info("Version %d.%d found\n", MAJOR_VERSION(ver.a0),
-+	pr_info("Driver version %d.%d\n", MAJOR_VERSION(FFA_DRIVER_VERSION),
-+		MINOR_VERSION(FFA_DRIVER_VERSION));
-+	pr_info("Firmware version %d.%d found\n", MAJOR_VERSION(ver.a0),
- 		MINOR_VERSION(ver.a0));
-+	*version = ffa_compatible_version_find(ver.a0);
-+
- 	return 0;
- }
- 
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpsmg-driver-for-corstone1000.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpmsg-driver-for-corstone1000.patch
similarity index 98%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpsmg-driver-for-corstone1000.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpmsg-driver-for-corstone1000.patch
index d88acfc..8096614 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpsmg-driver-for-corstone1000.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0003-Add-rpmsg-driver-for-corstone1000.patch
@@ -4,9 +4,9 @@
 From e683c37ee51717e625c8a598056cf4bb1bdadcbc Mon Sep 17 00:00:00 2001
 From: Emekcan <emekcan.aras@arm.com>
 Date: Wed, 17 Aug 2022 14:21:42 +0100
-Subject: [PATCH] Add rpsmg driver for corstone1000
+Subject: [PATCH] Add rpmsg driver for corstone1000
 
-Adds rpsmg driver to communicate with external
+Adds rpmsg driver to communicate with external
 system in corstone1000 platform.
 
 Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0004-rpmsg-arm-fix-return-value.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0004-rpmsg-arm-fix-return-value.patch
new file mode 100644
index 0000000..2074768
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0004-rpmsg-arm-fix-return-value.patch
@@ -0,0 +1,35 @@
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rui Miguel Silva <rui.silva@arm.com>
+
+From 1426dd2b541cb51741bffbd95191ae5593e1749d Mon Sep 17 00:00:00 2001
+From: Rui Miguel Silva <rui.silva@linaro.org>
+Date: Tue, 27 Sep 2022 10:05:27 +0100
+Subject: [PATCH 1/2] rpmsg: arm: fix return value
+
+The creation of and endpoint returns a pointer, fix the return
+value to the right type.
+
+Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
+---
+ drivers/rpmsg/rpmsg_arm_mailbox.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/rpmsg/rpmsg_arm_mailbox.c b/drivers/rpmsg/rpmsg_arm_mailbox.c
+index 4a80102669f6..5c0dcc8e353d 100644
+--- a/drivers/rpmsg/rpmsg_arm_mailbox.c
++++ b/drivers/rpmsg/rpmsg_arm_mailbox.c
+@@ -103,8 +103,9 @@ static struct rpmsg_endpoint *arm_create_ept(struct rpmsg_device *rpdev,
+ 
+ 	channel->mbox = mbox_request_channel_byname(&channel->cl, chinfo.name);
+ 	if (IS_ERR_OR_NULL(channel->mbox)) {
+-		printk("RPMsg ARM: Cannot get channel by name: '%s'\n", chinfo.name);
+-		return -1;
++		printk("RPMsg ARM: Cannot get channel by name: %s\n",
++		       chinfo.name);
++		return ERR_PTR(-ENOENT);
+ 	}
+ 
+ 	return &channel->ept;
+-- 
+2.37.3
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0005-rpmsg-arm-update-chrdev-to-ctrldev-registration.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0005-rpmsg-arm-update-chrdev-to-ctrldev-registration.patch
new file mode 100644
index 0000000..504fa67
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0005-rpmsg-arm-update-chrdev-to-ctrldev-registration.patch
@@ -0,0 +1,33 @@
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rui Miguel Silva <rui.silva@arm.com>
+
+From 20cd41fee8e4638eb47072b91d9a9f985730583b Mon Sep 17 00:00:00 2001
+From: Rui Miguel Silva <rui.silva@linaro.org>
+Date: Tue, 27 Sep 2022 10:07:21 +0100
+Subject: [PATCH 2/2] rpmsg: arm: update chrdev to ctrldev registration
+
+Since "rpmsg: Update rpmsg_chrdev_register_device function",
+there was a replacement of the chrdev driver to ctrldev
+driver. Fix the registration.
+
+Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
+---
+ drivers/rpmsg/rpmsg_arm_mailbox.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/rpmsg/rpmsg_arm_mailbox.c b/drivers/rpmsg/rpmsg_arm_mailbox.c
+index 5c0dcc8e353d..90bc8df90885 100644
+--- a/drivers/rpmsg/rpmsg_arm_mailbox.c
++++ b/drivers/rpmsg/rpmsg_arm_mailbox.c
+@@ -142,7 +142,7 @@ static int client_probe(struct platform_device *pdev)
+ 	rpdev->dev.parent = dev;
+ 	rpdev->dev.release = arm_release_device;
+ 
+-	return rpmsg_chrdev_register_device(rpdev);
++	return rpmsg_ctrldev_register_device(rpdev);
+ }
+ 
+ static const struct of_device_id client_of_match[] = {
+-- 
+2.37.3
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0006-Adds-workaround-for-cs1k-specific-bug.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0006-Adds-workaround-for-cs1k-specific-bug.patch
new file mode 100644
index 0000000..5cd8e4b
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/0006-Adds-workaround-for-cs1k-specific-bug.patch
@@ -0,0 +1,41 @@
+Upstream-Status: Inappropriate[Temporary bugfix]
+Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
+
+From f1a869ea986305a6fb20f3c770c11778a898b86d Mon Sep 17 00:00:00 2001
+From: Emekcan <emekcan.aras@arm.com>
+Date: Thu, 13 Oct 2022 20:53:42 +0100
+Subject: [PATCH] Adds workaround for cs1k specific bug
+
+Adds a temporary workaround to solve a possible
+race-conditioning issue in the tee driver
+for corstone1000.
+
+Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
+---
+ drivers/firmware/arm_ffa/driver.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
+index ec731e9e942b..2a3ef649935e 100644
+--- a/drivers/firmware/arm_ffa/driver.c
++++ b/drivers/firmware/arm_ffa/driver.c
+@@ -32,6 +32,7 @@
+ #include <linux/scatterlist.h>
+ #include <linux/slab.h>
+ #include <linux/uuid.h>
++#include <linux/delay.h>
+ 
+ #include "common.h"
+ 
+@@ -344,7 +345,7 @@ static int ffa_msg_send_direct_req(u16 src_id, u16 dst_id, bool mode_32bit,
+ {
+ 	u32 req_id, resp_id, src_dst_ids = PACK_TARGET_INFO(src_id, dst_id);
+ 	ffa_value_t ret;
+-
++	msleep(1);
+ 	if (mode_32bit) {
+ 		req_id = FFA_MSG_SEND_DIRECT_REQ;
+ 		resp_id = FFA_MSG_SEND_DIRECT_RESP;
+-- 
+2.17.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
index 3fe7a03..f6e6409 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
@@ -97,3 +97,4 @@
 CONFIG_RPMSG=y
 CONFIG_RPMSG_CHAR=y
 CONFIG_RPMSG_ARM=y
+CONFIG_RPMSG_CTRL=y
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone500/0001-arm-defconfig-drop-CONFIG_SND_SOC_AC97-from-multi_v7.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone500/0001-arm-defconfig-drop-CONFIG_SND_SOC_AC97-from-multi_v7.patch
new file mode 100644
index 0000000..68c9ca0
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone500/0001-arm-defconfig-drop-CONFIG_SND_SOC_AC97-from-multi_v7.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+
+From 7ee0e1c0a6498d376b38679c908f01a1528a1450 Mon Sep 17 00:00:00 2001
+From: Vishnu Banavath <vishnu.banavath@arm.com>
+Date: Thu, 29 Sep 2022 17:16:45 +0100
+Subject: [PATCH] arm: defconfig: drop CONFIG_SND_SOC_AC97 from
+ multi_v7_defconfig
+
+The CONFIG_SND_SOC_AC97 symbol was recently enabled but does not
+actually exist. This change is to remove it to fix warnings when
+used some of the build tools like yocto.
+
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+
+diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
+index ce9826bce29b..b3662f126efa 100644
+--- a/arch/arm/configs/multi_v7_defconfig
++++ b/arch/arm/configs/multi_v7_defconfig
+@@ -817,7 +817,6 @@ CONFIG_SND_SOC_TEGRA_TRIMSLICE=m
+ CONFIG_SND_SOC_TEGRA_ALC5632=m
+ CONFIG_SND_SOC_TEGRA_MAX98090=m
+ CONFIG_SND_SOC_DAVINCI_MCASP=m
+-CONFIG_SND_SOC_AC97=m
+ CONFIG_SND_SOC_AK4642=m
+ CONFIG_SND_SOC_CPCAP=m
+ CONFIG_SND_SOC_CS42L51_I2C=m
+-- 
+2.17.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm-platforms.inc b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm-platforms.inc
index 0d1017a..34a4090 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm-platforms.inc
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm-platforms.inc
@@ -27,6 +27,10 @@
 COMPATIBLE_MACHINE:corstone500 = "corstone500"
 KBUILD_DEFCONFIG:corstone500  = "multi_v7_defconfig"
 KCONFIG_MODE:corstone500 = "--alldefconfig"
+FILESEXTRAPATHS:prepend:corstone500 := "${ARMBSPFILESPATHS}"
+SRC_URI:append:corstone500 = " \
+           file://0001-arm-defconfig-drop-CONFIG_SND_SOC_AC97-from-multi_v7.patch \
+           "
 
 #
 # Corstone1000 KMACHINE
@@ -41,9 +45,11 @@
 KERNEL_EXTRA_ARGS:corstone1000 += "CONFIG_INITRAMFS_COMPRESSION_NONE=y"
 SRC_URI:append:corstone1000 = " \
            file://defconfig  \
-           file://0001-UPSTREAM-firmware-arm_ffa-Handle-compatibility-with-.patch  \
            file://0002-Add-external-system-driver.patch \
-           file://0003-Add-rpsmg-driver-for-corstone1000.patch \
+           file://0003-Add-rpmsg-driver-for-corstone1000.patch \
+           file://0004-rpmsg-arm-fix-return-value.patch \
+           file://0005-rpmsg-arm-update-chrdev-to-ctrldev-registration.patch \
+           file://0006-Adds-workaround-for-cs1k-specific-bug.patch \
         "
 
 SRC_URI:append:corstone1000 = " ${@bb.utils.contains('MACHINE_FEATURES', \
@@ -104,7 +110,7 @@
 #
 # N1SDP KMACHINE
 #
-FILESEXTRAPATHS:prepend:n1sdp := "${THISDIR}/linux-yocto-5.15/n1sdp:"
+FILESEXTRAPATHS:prepend:n1sdp := "${THISDIR}/linux-yocto-5.19/n1sdp:"
 COMPATIBLE_MACHINE:n1sdp = "n1sdp"
 KBUILD_DEFCONFIG:n1sdp = "defconfig"
 KCONFIG_MODE:n1sdp = "--alldefconfig"
@@ -115,6 +121,7 @@
     file://0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch \
     file://0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch \
     file://0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch \
+    file://0006-arm64-defconfig-disable-config-options-that-does-not.patch \
     file://enable-realtek-R8169.cfg \
     file://enable-usb_conn_gpio.cfg \
     file://usb_xhci_pci_renesas.cfg \
@@ -135,54 +142,53 @@
 #
 COMPATIBLE_MACHINE:tc = "(tc0|tc1)"
 KCONFIG_MODE:tc = "--alldefconfig"
-FILESEXTRAPATHS:prepend:tc := "${ARMBSPFILESPATHS}:${THISDIR}/linux-arm64-ack-5.10/tc:"
+FILESEXTRAPATHS:prepend:tc := "${ARMBSPFILESPATHS}:${THISDIR}/linux-arm64-ack-5.15/tc:"
 SRC_URI:append:tc = " \
     file://gki_defconfig \
     file://0001-drm-Add-component-aware-simple-encoder.patch \
+    file://0001-drm-komeda-Fix-handling-of-atomic-commits-in-the-ato.patch \
     file://0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch \
-    file://0003-dt-bindings-mailbox-arm-mhuv2-Add-bindings.patch \
-    file://0004-mailbox-arm_mhuv2-Add-driver.patch \
-    file://0005-mailbox-arm_mhuv2-Fix-sparse-warnings.patch \
-    file://0006-mailbox-arm_mhuv2-make-remove-callback-return-void.patch \
-    file://0007-mailbox-arm_mhuv2-Skip-calling-kfree-with-invalid-po.patch \
-    file://0008-firmware-arm_ffa-Backport-of-arm_ffa-driver.patch \
-    file://0009-tee-add-sec_world_id-to-struct-tee_shm.patch \
-    file://0010-optee-simplify-optee_release.patch \
-    file://0011-optee-sync-OP-TEE-headers.patch \
-    file://0012-optee-refactor-driver-with-internal-callbacks.patch \
-    file://0013-optee-add-a-FF-A-memory-pool.patch \
-    file://0014-optee-add-FF-A-support.patch \
-    file://0015-coresight-etm4x-Save-restore-TRFCR_EL1.patch \
-    file://0016-coresight-etm4x-Use-Trace-Filtering-controls-dynamic.patch \
-    file://0017-perf-arm-cmn-Use-irq_set_affinity.patch \
-    file://0018-perf-arm-cmn-Fix-CPU-hotplug-unregistration.patch \
-    file://0019-perf-arm-cmn-Account-for-NUMA-affinity.patch \
-    file://0020-perf-arm-cmn-Drop-compile-test-restriction.patch \
-    file://0021-perf-arm-cmn-Refactor-node-ID-handling.patch \
-    file://0022-perf-arm-cmn-Streamline-node-iteration.patch \
-    file://0023-drivers-perf-arm-cmn-Add-space-after.patch \
-    file://0024-perf-arm-cmn-Refactor-DTM-handling.patch \
-    file://0025-perf-arm-cmn-Optimise-DTM-counter-reads.patch \
-    file://0026-perf-arm-cmn-Optimise-DTC-counter-accesses.patch \
-    file://0027-perf-arm-cmn-Move-group-validation-data-off-stack.patch \
-    file://0028-perf-arm-cmn-Demarcate-CMN-600-specifics.patch \
-    file://0029-perf-arm-cmn-Support-new-IP-features.patch \
-    file://0030-perf-arm-cmn-Add-CI-700-Support.patch \
-    file://0031-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch \
-    file://0032-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch \
-    file://0033-firmware-arm_ffa-extern-ffa_bus_type.patch \
-    file://0034-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch \
-    file://0035-ANDROID-trusty-Backport-of-trusty-driver.patch \
-    file://0036-ANDROID-trusty-Remove-FFA-specific-initilization.patch \
-    file://0037-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch \
-    file://0038-ANDROID-trusty-Separate-out-SMC-based-transport.patch \
-    file://0039-ANDROID-trusty-Modify-device-compatible-string.patch \
-    file://0040-ANDROID-trusty-Add-transport-descriptor.patch \
-    file://0041-ANDROID-trusty-Add-trusty-ffa-driver.patch \
-    file://0042-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch \
-    file://0043-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch \
-    file://0044-ANDROID-trusty-Make-trusty-transports-configurable.patch \
+    file://0003-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch \
+    file://0004-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch \
+    file://0005-firmware-arm_ffa-extern-ffa_bus_type.patch \
+    file://0006-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch \
+    file://0007-Revert-optee-use-driver-internal-tee_context-for-som.patch \
+    file://0008-tee-add-sec_world_id-to-struct-tee_shm.patch \
+    file://0009-optee-simplify-optee_release.patch \
+    file://0010-optee-refactor-driver-with-internal-callbacks.patch \
+    file://0011-optee-isolate-smc-abi.patch \
+    file://0012-optee-add-FF-A-support.patch \
+    file://0013-optee-smc_abi.c-add-missing-include-linux-mm.h.patch \
+    file://0014-optee-Fix-spelling-mistake-reclain-reclaim.patch \
+    file://0015-optee-fix-kfree-NULL-pointer.patch \
+    file://0016-perf-arm-cmn-Account-for-NUMA-affinity.patch \
+    file://0017-perf-arm-cmn-Drop-compile-test-restriction.patch \
+    file://0018-perf-arm-cmn-Refactor-node-ID-handling.patch \
+    file://0019-perf-arm-cmn-Streamline-node-iteration.patch \
+    file://0020-perf-arm-cmn-Refactor-DTM-handling.patch \
+    file://0021-perf-arm-cmn-Optimise-DTM-counter-reads.patch \
+    file://0022-perf-arm-cmn-Optimise-DTC-counter-accesses.patch \
+    file://0023-perf-arm-cmn-Move-group-validation-data-off-stack.patch \
+    file://0024-perf-arm-cmn-Demarcate-CMN-600-specifics.patch \
+    file://0025-perf-arm-cmn-Support-new-IP-features.patch \
+    file://0026-perf-arm-cmn-Add-CI-700-Support.patch \
+    file://0027-ANDROID-trusty-Backport-of-trusty-driver.patch \
+    file://0028-ANDROID-trusty-Remove-FFA-specific-initilization.patch \
+    file://0029-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch \
+    file://0030-ANDROID-trusty-Separate-out-SMC-based-transport.patch \
+    file://0031-ANDROID-trusty-Modify-device-compatible-string.patch \
+    file://0032-ANDROID-trusty-Add-transport-descriptor.patch \
+    file://0033-ANDROID-trusty-Add-trusty-ffa-driver.patch \
+    file://0034-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch \
+    file://0035-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch \
+    file://0036-ANDROID-trusty-Make-trusty-transports-configurable.patch \
+    file://0037-ANDROID-trusty-log-include-panic_notifier.h.patch \
+    file://0038-ANDROID-trusty-ipc-fix-VIRTIO_ID_TRUSTY_IPC-ID.patch \
+    file://0039-gki_config-add-tc-disable_mpam.patch \
+    file://0040-ANDROID-KVM-arm64-disable-FFA-driver-at-EL2.patch \
     file://init_disassemble_info-signature-changes-causes-compile-failures.patch \
+    file://0041-etherdevice-Adjust-ether_addr-prototypes-to-silence-.patch \
+    file://0042-mm-page_alloc-fix-building-error-on-Werror-array-com.patch \
     "
 KERNEL_FEATURES:append:tc = " bsp/arm-platforms/tc.scc"
 KERNEL_FEATURES:append:tc1 = " bsp/arm-platforms/tc-autofdo.scc"
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0003-dt-bindings-mailbox-arm-mhuv2-Add-bindings.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0003-dt-bindings-mailbox-arm-mhuv2-Add-bindings.patch
deleted file mode 100644
index 1da75ea..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0003-dt-bindings-mailbox-arm-mhuv2-Add-bindings.patch
+++ /dev/null
@@ -1,241 +0,0 @@
-From cdda49168d42c897574388356555f8130c021bb5 Mon Sep 17 00:00:00 2001
-From: Viresh Kumar <viresh.kumar@linaro.org>
-Date: Tue, 17 Nov 2020 15:32:05 +0530
-Subject: [PATCH 03/22] dt-bindings: mailbox : arm,mhuv2: Add bindings
-
-This patch adds device tree binding for ARM Message Handling Unit (MHU)
-controller version 2.
-
-Based on earlier work by Morten Borup Petersen.
-
-Reviewed-by: Rob Herring <robh@kernel.org>
-Co-developed-by: Tushar Khandelwal <tushar.khandelwal@arm.com>
-Signed-off-by: Tushar Khandelwal <tushar.khandelwal@arm.com>
-Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-
-Upstream-Status: Backport [https://lkml.org/lkml/2020/11/17/234]
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
----
- .../bindings/mailbox/arm,mhuv2.yaml           | 209 ++++++++++++++++++
- 1 file changed, 209 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
-
-diff --git a/Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml b/Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
-new file mode 100644
-index 000000000000..6608545ea66f
---- /dev/null
-+++ b/Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
-@@ -0,0 +1,209 @@
-+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-+%YAML 1.2
-+---
-+$id: http://devicetree.org/schemas/mailbox/arm,mhuv2.yaml#
-+$schema: http://devicetree.org/meta-schemas/core.yaml#
-+
-+title: ARM MHUv2 Mailbox Controller
-+
-+maintainers:
-+  - Tushar Khandelwal <tushar.khandelwal@arm.com>
-+  - Viresh Kumar <viresh.kumar@linaro.org>
-+
-+description: |
-+  The Arm Message Handling Unit (MHU) Version 2 is a mailbox controller that has
-+  between 1 and 124 channel windows (each 32-bit wide) to provide unidirectional
-+  communication with remote processor(s), where the number of channel windows
-+  are implementation dependent.
-+
-+  Given the unidirectional nature of the controller, an MHUv2 mailbox may only
-+  be written to or read from. If a pair of MHU controllers is implemented
-+  between two processing elements to provide bidirectional communication, these
-+  must be specified as two separate mailboxes.
-+
-+  If the interrupts property is present in device tree node, then its treated as
-+  a "receiver" mailbox, otherwise a "sender".
-+
-+  An MHU controller must be specified along with the supported transport
-+  protocols. The transport protocols determine the method of data transmission
-+  as well as the number of provided mailbox channels.
-+
-+  Following are the possible transport protocols.
-+
-+  - Data-transfer: Each transfer is made of one or more words, using one or more
-+    channel windows.
-+
-+  - Doorbell: Each transfer is made up of single bit flag, using any one of the
-+    bits in a channel window. A channel window can support up to 32 doorbells
-+    and the entire window shall be used in doorbell protocol.  Optionally, data
-+    may be transmitted through a shared memory region, wherein the MHU is used
-+    strictly as an interrupt generation mechanism but that is out of the scope
-+    of these bindings.
-+
-+# We need a select here so we don't match all nodes with 'arm,primecell'
-+select:
-+  properties:
-+    compatible:
-+      contains:
-+        enum:
-+          - arm,mhuv2-tx
-+          - arm,mhuv2-rx
-+  required:
-+    - compatible
-+
-+properties:
-+  compatible:
-+    oneOf:
-+      - description: Sender mode
-+        items:
-+          - const: arm,mhuv2-tx
-+          - const: arm,primecell
-+
-+      - description: Receiver-mode
-+        items:
-+          - const: arm,mhuv2-rx
-+          - const: arm,primecell
-+
-+  reg:
-+    maxItems: 1
-+
-+  interrupts:
-+    description: |
-+      The MHUv2 controller always implements an interrupt in the "receiver"
-+      mode, while the interrupt in the "sender" mode was not available in the
-+      version MHUv2.0, but the later versions do have it.
-+    maxItems: 1
-+
-+  clocks:
-+    maxItems: 1
-+
-+  clock-names:
-+    maxItems: 1
-+
-+  arm,mhuv2-protocols:
-+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
-+    description: |
-+      The MHUv2 controller may contain up to 124 channel windows (each 32-bit
-+      wide). The hardware and the DT bindings allows any combination of those to
-+      be used for various transport protocols.
-+
-+      This property allows a platform to describe how these channel windows are
-+      used in various transport protocols. The entries in this property shall be
-+      present as an array of tuples, where each tuple describes details about
-+      one of the transport protocol being implemented over some channel
-+      window(s).
-+
-+      The first field of a tuple signifies the transfer protocol, 0 is reserved
-+      for doorbell protocol, and 1 is reserved for data-transfer protocol.
-+      Using any other value in the first field of a tuple makes it invalid.
-+
-+      The second field of a tuple signifies the number of channel windows where
-+      the protocol would be used and should be set to a non zero value. For
-+      doorbell protocol this field signifies the number of 32-bit channel
-+      windows that implement the doorbell protocol. For data-transfer protocol,
-+      this field signifies the number of 32-bit channel windows that implement
-+      the data-transfer protocol.
-+
-+      The total number of channel windows specified here shouldn't be more than
-+      the ones implemented by the platform, though one can specify lesser number
-+      of windows here than what the platform implements.
-+
-+      mhu: mailbox@2b1f0000 {
-+          ...
-+
-+          arm,mhuv2-protocols = <0 2>, <1 1>, <1 5>, <1 7>;
-+      }
-+
-+      The above example defines the protocols of an ARM MHUv2 mailbox
-+      controller, where a total of 15 channel windows are used. The first two
-+      windows are used in doorbell protocol (64 doorbells), followed by 1, 5 and
-+      7 windows (separately) used in data-transfer protocol.
-+
-+    minItems: 1
-+    maxItems: 124
-+    items:
-+      items:
-+        - enum: [ 0, 1 ]
-+        - minimum: 0
-+          maximum: 124
-+
-+
-+  '#mbox-cells':
-+    description: |
-+      It is always set to 2. The first argument in the consumers 'mboxes'
-+      property represents the channel window group, which may be used in
-+      doorbell, or data-transfer protocol, and the second argument (only
-+      relevant in doorbell protocol, should be 0 otherwise) represents the
-+      doorbell number within the 32 bit wide channel window.
-+
-+      From the example given above for arm,mhuv2-protocols, here is how a client
-+      node can reference them.
-+
-+      mboxes = <&mhu 0 5>; // Channel Window Group 0, doorbell 5.
-+      mboxes = <&mhu 1 7>; // Channel Window Group 1, doorbell 7.
-+      mboxes = <&mhu 2 0>; // Channel Window Group 2, data transfer protocol with 1 window.
-+      mboxes = <&mhu 3 0>; // Channel Window Group 3, data transfer protocol with 5 windows.
-+      mboxes = <&mhu 4 0>; // Channel Window Group 4, data transfer protocol with 7 windows.
-+
-+    const: 2
-+
-+if:
-+  # Interrupt is compulsory for receiver
-+  properties:
-+    compatible:
-+      contains:
-+        const: arm,mhuv2-rx
-+then:
-+  required:
-+    - interrupts
-+
-+required:
-+  - compatible
-+  - reg
-+  - '#mbox-cells'
-+  - arm,mhuv2-protocols
-+
-+additionalProperties: false
-+
-+examples:
-+  # Multiple transport protocols implemented by the mailbox controllers
-+  - |
-+    soc {
-+        #address-cells = <2>;
-+        #size-cells = <2>;
-+
-+        mhu_tx: mailbox@2b1f0000 {
-+            #mbox-cells = <2>;
-+            compatible = "arm,mhuv2-tx", "arm,primecell";
-+            reg = <0 0x2b1f0000 0 0x1000>;
-+            clocks = <&clock 0>;
-+            clock-names = "apb_pclk";
-+            interrupts = <0 45 4>;
-+            arm,mhuv2-protocols = <1 5>, <1 2>, <1 5>, <1 7>, <0 2>;
-+        };
-+
-+        mhu_rx: mailbox@2b1f1000 {
-+            #mbox-cells = <2>;
-+            compatible = "arm,mhuv2-rx", "arm,primecell";
-+            reg = <0 0x2b1f1000 0 0x1000>;
-+            clocks = <&clock 0>;
-+            clock-names = "apb_pclk";
-+            interrupts = <0 46 4>;
-+            arm,mhuv2-protocols = <1 1>, <1 7>, <0 2>;
-+        };
-+
-+        mhu_client: scb@2e000000 {
-+            compatible = "fujitsu,mb86s70-scb-1.0";
-+            reg = <0 0x2e000000 0 0x4000>;
-+
-+            mboxes =
-+                     //data-transfer protocol with 5 windows, mhu-tx
-+                     <&mhu_tx 2 0>,
-+                     //data-transfer protocol with 7 windows, mhu-tx
-+                     <&mhu_tx 3 0>,
-+                     //doorbell protocol channel 4, doorbell 27, mhu-tx
-+                     <&mhu_tx 4 27>,
-+                     //data-transfer protocol with 1 window, mhu-rx
-+                     <&mhu_rx 0 0>;
-+        };
-+    };
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0004-mailbox-arm_mhuv2-Add-driver.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0004-mailbox-arm_mhuv2-Add-driver.patch
deleted file mode 100644
index a4dd961..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0004-mailbox-arm_mhuv2-Add-driver.patch
+++ /dev/null
@@ -1,1256 +0,0 @@
-From eadd9235d084da8022df2d232c90590f2160e433 Mon Sep 17 00:00:00 2001
-From: Viresh Kumar <viresh.kumar@linaro.org>
-Date: Tue, 17 Nov 2020 15:32:06 +0530
-Subject: [PATCH 04/22] mailbox: arm_mhuv2: Add driver
-
-This adds driver for the ARM MHUv2 (Message Handling Unit) mailbox
-controller.
-
-This is based on the accepted DT bindings of the controller and supports
-combination of both transport protocols, i.e. doorbell and data-transfer.
-
-Transmitting and receiving data through the mailbox framework is done
-through struct arm_mhuv2_mbox_msg.
-
-Based on the initial work done by Morten Borup Petersen from ARM.
-
-Co-developed-by: Tushar Khandelwal <tushar.khandelwal@arm.com>
-Signed-off-by: Tushar Khandelwal <tushar.khandelwal@arm.com>
-Tested-by: Usama Arif <usama.arif@arm.com>
-Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-
-Upstream-Status: Backport [https://www.lkml.org/lkml/2020/11/17/235]
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
----
- MAINTAINERS                               |    9 +
- drivers/mailbox/Kconfig                   |    7 +
- drivers/mailbox/Makefile                  |    2 +
- drivers/mailbox/arm_mhuv2.c               | 1136 +++++++++++++++++++++
- include/linux/mailbox/arm_mhuv2_message.h |   20 +
- 5 files changed, 1174 insertions(+)
- create mode 100644 drivers/mailbox/arm_mhuv2.c
- create mode 100644 include/linux/mailbox/arm_mhuv2_message.h
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index 354831907474..5234423c477a 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -10459,6 +10459,15 @@ F:	drivers/mailbox/
- F:	include/linux/mailbox_client.h
- F:	include/linux/mailbox_controller.h
- 
-+MAILBOX ARM MHUv2
-+M:	Viresh Kumar <viresh.kumar@linaro.org>
-+M:	Tushar Khandelwal <Tushar.Khandelwal@arm.com>
-+L:	linux-kernel@vger.kernel.org
-+S:	Maintained
-+F:	drivers/mailbox/arm_mhuv2.c
-+F:	include/linux/mailbox/arm_mhuv2_message.h
-+F:	Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
-+
- MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
- M:	Michael Kerrisk <mtk.manpages@gmail.com>
- L:	linux-man@vger.kernel.org
-diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
-index 05b1009e2820..3c0ea96a0a8b 100644
---- a/drivers/mailbox/Kconfig
-+++ b/drivers/mailbox/Kconfig
-@@ -16,6 +16,13 @@ config ARM_MHU
- 	  The controller has 3 mailbox channels, the last of which can be
- 	  used in Secure mode only.
- 
-+config ARM_MHU_V2
-+	tristate "ARM MHUv2 Mailbox"
-+	depends on ARM_AMBA
-+	help
-+	  Say Y here if you want to build the ARM MHUv2 controller driver,
-+	  which provides unidirectional mailboxes between processing elements.
-+
- config IMX_MBOX
- 	tristate "i.MX Mailbox"
- 	depends on ARCH_MXC || COMPILE_TEST
-diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
-index 2e06e02b2e03..7194fa92c787 100644
---- a/drivers/mailbox/Makefile
-+++ b/drivers/mailbox/Makefile
-@@ -7,6 +7,8 @@ obj-$(CONFIG_MAILBOX_TEST)	+= mailbox-test.o
- 
- obj-$(CONFIG_ARM_MHU)	+= arm_mhu.o arm_mhu_db.o
- 
-+obj-$(CONFIG_ARM_MHU_V2)	+= arm_mhuv2.o
-+
- obj-$(CONFIG_IMX_MBOX)	+= imx-mailbox.o
- 
- obj-$(CONFIG_ARMADA_37XX_RWTM_MBOX)	+= armada-37xx-rwtm-mailbox.o
-diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
-new file mode 100644
-index 000000000000..67fb10885bb4
---- /dev/null
-+++ b/drivers/mailbox/arm_mhuv2.c
-@@ -0,0 +1,1136 @@
-+// SPDX-License-Identifier: GPL-2.0
-+/*
-+ * ARM Message Handling Unit Version 2 (MHUv2) driver.
-+ *
-+ * Copyright (C) 2020 ARM Ltd.
-+ * Copyright (C) 2020 Linaro Ltd.
-+ *
-+ * An MHUv2 mailbox controller can provide up to 124 channel windows (each 32
-+ * bit long) and the driver allows any combination of both the transport
-+ * protocol modes: data-transfer and doorbell, to be used on those channel
-+ * windows.
-+ *
-+ * The transport protocols should be specified in the device tree entry for the
-+ * device. The transport protocols determine how the underlying hardware
-+ * resources of the device are utilized when transmitting data. Refer to the
-+ * device tree bindings of the ARM MHUv2 controller for more details.
-+ *
-+ * The number of registered mailbox channels is dependent on both the underlying
-+ * hardware - mainly the number of channel windows implemented by the platform,
-+ * as well as the selected transport protocols.
-+ *
-+ * The MHUv2 controller can work both as a sender and receiver, but the driver
-+ * and the DT bindings support unidirectional transfers for better allocation of
-+ * the channels. That is, this driver will be probed for two separate devices
-+ * for each mailbox controller, a sender device and a receiver device.
-+ */
-+
-+#include <linux/amba/bus.h>
-+#include <linux/interrupt.h>
-+#include <linux/mailbox_controller.h>
-+#include <linux/mailbox/arm_mhuv2_message.h>
-+#include <linux/module.h>
-+#include <linux/of_address.h>
-+#include <linux/spinlock.h>
-+
-+/* ====== MHUv2 Registers ====== */
-+
-+/* Maximum number of channel windows */
-+#define MHUV2_CH_WN_MAX			124
-+/* Number of combined interrupt status registers */
-+#define MHUV2_CMB_INT_ST_REG_CNT	4
-+#define MHUV2_STAT_BYTES		(sizeof(u32))
-+#define MHUV2_STAT_BITS			(MHUV2_STAT_BYTES * __CHAR_BIT__)
-+
-+#define LSB_MASK(n)			((1 << (n * __CHAR_BIT__)) - 1)
-+#define MHUV2_PROTOCOL_PROP		"arm,mhuv2-protocols"
-+
-+/* Register Message Handling Unit Configuration fields */
-+struct mhu_cfg_t {
-+	u32 num_ch : 7;
-+	u32 pad : 25;
-+} __packed;
-+
-+/* register Interrupt Status fields */
-+struct int_st_t {
-+	u32 nr2r : 1;
-+	u32 r2nr : 1;
-+	u32 pad : 30;
-+} __packed;
-+
-+/* Register Interrupt Clear fields */
-+struct int_clr_t {
-+	u32 nr2r : 1;
-+	u32 r2nr : 1;
-+	u32 pad : 30;
-+} __packed;
-+
-+/* Register Interrupt Enable fields */
-+struct int_en_t {
-+	u32 r2nr : 1;
-+	u32 nr2r : 1;
-+	u32 chcomb : 1;
-+	u32 pad : 29;
-+} __packed;
-+
-+/* Register Implementer Identification fields */
-+struct iidr_t {
-+	u32 implementer : 12;
-+	u32 revision : 4;
-+	u32 variant : 4;
-+	u32 product_id : 12;
-+} __packed;
-+
-+/* Register Architecture Identification Register fields */
-+struct aidr_t {
-+	u32 arch_minor_rev : 4;
-+	u32 arch_major_rev : 4;
-+	u32 pad : 24;
-+} __packed;
-+
-+/* Sender Channel Window fields */
-+struct mhu2_send_ch_wn_reg {
-+	u32 stat;
-+	u8 pad1[0x0C - 0x04];
-+	u32 stat_set;
-+	u32 int_st;
-+	u32 int_clr;
-+	u32 int_en;
-+	u8 pad2[0x20 - 0x1C];
-+} __packed;
-+
-+/* Sender frame register fields */
-+struct mhu2_send_frame_reg {
-+	struct mhu2_send_ch_wn_reg ch_wn[MHUV2_CH_WN_MAX];
-+	struct mhu_cfg_t mhu_cfg;
-+	u32 resp_cfg;
-+	u32 access_request;
-+	u32 access_ready;
-+	struct int_st_t int_st;
-+	struct int_clr_t int_clr;
-+	struct int_en_t int_en;
-+	u32 reserved0;
-+	u32 chcomb_int_st[MHUV2_CMB_INT_ST_REG_CNT];
-+	u8 pad[0xFC8 - 0xFB0];
-+	struct iidr_t iidr;
-+	struct aidr_t aidr;
-+} __packed;
-+
-+/* Receiver Channel Window fields */
-+struct mhu2_recv_ch_wn_reg {
-+	u32 stat;
-+	u32 stat_masked;
-+	u32 stat_clear;
-+	u8 reserved0[0x10 - 0x0C];
-+	u32 mask;
-+	u32 mask_set;
-+	u32 mask_clear;
-+	u8 pad[0x20 - 0x1C];
-+} __packed;
-+
-+/* Receiver frame register fields */
-+struct mhu2_recv_frame_reg {
-+	struct mhu2_recv_ch_wn_reg ch_wn[MHUV2_CH_WN_MAX];
-+	struct mhu_cfg_t mhu_cfg;
-+	u8 reserved0[0xF90 - 0xF84];
-+	struct int_st_t int_st;
-+	struct int_clr_t int_clr;
-+	struct int_en_t int_en;
-+	u32 pad;
-+	u32 chcomb_int_st[MHUV2_CMB_INT_ST_REG_CNT];
-+	u8 reserved2[0xFC8 - 0xFB0];
-+	struct iidr_t iidr;
-+	struct aidr_t aidr;
-+} __packed;
-+
-+
-+/* ====== MHUv2 data structures ====== */
-+
-+enum mhuv2_transport_protocol {
-+	DOORBELL = 0,
-+	DATA_TRANSFER = 1
-+};
-+
-+enum mhuv2_frame {
-+	RECEIVER_FRAME,
-+	SENDER_FRAME
-+};
-+
-+/**
-+ * struct mhuv2 - MHUv2 mailbox controller data
-+ *
-+ * @mbox:	Mailbox controller belonging to the MHU frame.
-+ * @send/recv:	Base address of the register mapping region.
-+ * @frame:	Frame type: RECEIVER_FRAME or SENDER_FRAME.
-+ * @irq:	Interrupt.
-+ * @windows:	Channel windows implemented by the platform.
-+ * @minor:	Minor version of the controller.
-+ * @length:	Length of the protocols array in bytes.
-+ * @protocols:	Raw protocol information, derived from device tree.
-+ * @doorbell_pending_lock: spinlock required for correct operation of Tx
-+ *		interrupt for doorbells.
-+ */
-+struct mhuv2 {
-+	struct mbox_controller mbox;
-+	union {
-+		struct mhu2_send_frame_reg __iomem *send;
-+		struct mhu2_recv_frame_reg __iomem *recv;
-+	};
-+	enum mhuv2_frame frame;
-+	unsigned int irq;
-+	unsigned int windows;
-+	unsigned int minor;
-+	unsigned int length;
-+	u32 *protocols;
-+
-+	spinlock_t doorbell_pending_lock;
-+};
-+
-+#define mhu_from_mbox(_mbox) container_of(_mbox, struct mhuv2, mbox)
-+
-+/**
-+ * struct mhuv2_protocol_ops - MHUv2 operations
-+ *
-+ * Each transport protocol must provide an implementation of the operations
-+ * provided here.
-+ *
-+ * @rx_startup: Startup callback for receiver.
-+ * @rx_shutdown: Shutdown callback for receiver.
-+ * @read_data: Reads and clears newly available data.
-+ * @tx_startup: Startup callback for receiver.
-+ * @tx_shutdown: Shutdown callback for receiver.
-+ * @last_tx_done: Report back if the last tx is completed or not.
-+ * @send_data: Send data to the receiver.
-+ */
-+struct mhuv2_protocol_ops {
-+	int (*rx_startup)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+	void (*rx_shutdown)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+	void *(*read_data)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+
-+	void (*tx_startup)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+	void (*tx_shutdown)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+	int (*last_tx_done)(struct mhuv2 *mhu, struct mbox_chan *chan);
-+	int (*send_data)(struct mhuv2 *mhu, struct mbox_chan *chan, void *arg);
-+};
-+
-+/*
-+ * MHUv2 mailbox channel's private information
-+ *
-+ * @ops:	protocol specific ops for the channel.
-+ * @ch_wn_idx:	Channel window index allocated to the channel.
-+ * @windows:	Total number of windows consumed by the channel, only relevant
-+ *		in DATA_TRANSFER protocol.
-+ * @doorbell:	Doorbell bit number within the ch_wn_idx window, only relevant
-+ *		in DOORBELL protocol.
-+ * @pending:	Flag indicating pending doorbell interrupt, only relevant in
-+ *		DOORBELL protocol.
-+ */
-+struct mhuv2_mbox_chan_priv {
-+	const struct mhuv2_protocol_ops *ops;
-+	u32 ch_wn_idx;
-+	union {
-+		u32 windows;
-+		struct {
-+			u32 doorbell;
-+			u32 pending;
-+		};
-+	};
-+};
-+
-+/* Macro for reading a bitfield within a physically mapped packed struct */
-+#define readl_relaxed_bitfield(_regptr, _field)				\
-+	({								\
-+		u32 _regval;						\
-+		_regval = readl_relaxed((_regptr));			\
-+		(*(typeof((_regptr)))(&_regval))._field;		\
-+	})
-+
-+/* Macro for writing a bitfield within a physically mapped packed struct */
-+#define writel_relaxed_bitfield(_value, _regptr, _field)		\
-+	({								\
-+		u32 _regval;						\
-+		_regval = readl_relaxed(_regptr);			\
-+		(*(typeof(_regptr))(&_regval))._field = _value;		\
-+		writel_relaxed(_regval, _regptr);			\
-+	})
-+
-+
-+/* =================== Doorbell transport protocol operations =============== */
-+
-+static int mhuv2_doorbell_rx_startup(struct mhuv2 *mhu, struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	writel_relaxed(BIT(priv->doorbell),
-+		       &mhu->recv->ch_wn[priv->ch_wn_idx].mask_clear);
-+	return 0;
-+}
-+
-+static void mhuv2_doorbell_rx_shutdown(struct mhuv2 *mhu,
-+				       struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	writel_relaxed(BIT(priv->doorbell),
-+		       &mhu->recv->ch_wn[priv->ch_wn_idx].mask_set);
-+}
-+
-+static void *mhuv2_doorbell_read_data(struct mhuv2 *mhu, struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	writel_relaxed(BIT(priv->doorbell),
-+		       &mhu->recv->ch_wn[priv->ch_wn_idx].stat_clear);
-+	return NULL;
-+}
-+
-+static int mhuv2_doorbell_last_tx_done(struct mhuv2 *mhu,
-+				       struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	return !(readl_relaxed(&mhu->send->ch_wn[priv->ch_wn_idx].stat) &
-+		 BIT(priv->doorbell));
-+}
-+
-+static int mhuv2_doorbell_send_data(struct mhuv2 *mhu, struct mbox_chan *chan,
-+				    void *arg)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	unsigned long flags;
-+
-+	spin_lock_irqsave(&mhu->doorbell_pending_lock, flags);
-+
-+	priv->pending = 1;
-+	writel_relaxed(BIT(priv->doorbell),
-+		       &mhu->send->ch_wn[priv->ch_wn_idx].stat_set);
-+
-+	spin_unlock_irqrestore(&mhu->doorbell_pending_lock, flags);
-+
-+	return 0;
-+}
-+
-+static const struct mhuv2_protocol_ops mhuv2_doorbell_ops = {
-+	.rx_startup = mhuv2_doorbell_rx_startup,
-+	.rx_shutdown = mhuv2_doorbell_rx_shutdown,
-+	.read_data = mhuv2_doorbell_read_data,
-+	.last_tx_done = mhuv2_doorbell_last_tx_done,
-+	.send_data = mhuv2_doorbell_send_data,
-+};
-+#define IS_PROTOCOL_DOORBELL(_priv) (_priv->ops == &mhuv2_doorbell_ops)
-+
-+/* ============= Data transfer transport protocol operations ================ */
-+
-+static int mhuv2_data_transfer_rx_startup(struct mhuv2 *mhu,
-+					  struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int i = priv->ch_wn_idx + priv->windows - 1;
-+
-+	/*
-+	 * The protocol mandates that all but the last status register must be
-+	 * masked.
-+	 */
-+	writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_clear);
-+	return 0;
-+}
-+
-+static void mhuv2_data_transfer_rx_shutdown(struct mhuv2 *mhu,
-+					    struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int i = priv->ch_wn_idx + priv->windows - 1;
-+
-+	writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set);
-+}
-+
-+static void *mhuv2_data_transfer_read_data(struct mhuv2 *mhu,
-+					   struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	const int windows = priv->windows;
-+	struct arm_mhuv2_mbox_msg *msg;
-+	u32 *data;
-+	int i, idx;
-+
-+	msg = kzalloc(sizeof(*msg) + windows * MHUV2_STAT_BYTES, GFP_KERNEL);
-+	if (!msg)
-+		return ERR_PTR(-ENOMEM);
-+
-+	data = msg->data = msg + 1;
-+	msg->len = windows * MHUV2_STAT_BYTES;
-+
-+	/*
-+	 * Messages are expected in order of most significant word to least
-+	 * significant word. Refer mhuv2_data_transfer_send_data() for more
-+	 * details.
-+	 *
-+	 * We also need to read the stat register instead of stat_masked, as we
-+	 * masked all but the last window.
-+	 *
-+	 * Last channel window must be cleared as the final operation. Upon
-+	 * clearing the last channel window register, which is unmasked in
-+	 * data-transfer protocol, the interrupt is de-asserted.
-+	 */
-+	for (i = 0; i < windows; i++) {
-+		idx = priv->ch_wn_idx + i;
-+		data[windows - 1 - i] = readl_relaxed(&mhu->recv->ch_wn[idx].stat);
-+		writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[idx].stat_clear);
-+	}
-+
-+	return msg;
-+}
-+
-+static void mhuv2_data_transfer_tx_startup(struct mhuv2 *mhu,
-+					   struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int i = priv->ch_wn_idx + priv->windows - 1;
-+
-+	/* Enable interrupts only for the last window */
-+	if (mhu->minor) {
-+		writel_relaxed(0x1, &mhu->send->ch_wn[i].int_clr);
-+		writel_relaxed(0x1, &mhu->send->ch_wn[i].int_en);
-+	}
-+}
-+
-+static void mhuv2_data_transfer_tx_shutdown(struct mhuv2 *mhu,
-+					    struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int i = priv->ch_wn_idx + priv->windows - 1;
-+
-+	if (mhu->minor)
-+		writel_relaxed(0x0, &mhu->send->ch_wn[i].int_en);
-+}
-+
-+static int mhuv2_data_transfer_last_tx_done(struct mhuv2 *mhu,
-+					    struct mbox_chan *chan)
-+{
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int i = priv->ch_wn_idx + priv->windows - 1;
-+
-+	/* Just checking the last channel window should be enough */
-+	return !readl_relaxed(&mhu->send->ch_wn[i].stat);
-+}
-+
-+/*
-+ * Message will be transmitted from most significant to least significant word.
-+ * This is to allow for messages shorter than channel windows to still trigger
-+ * the receiver interrupt which gets activated when the last stat register is
-+ * written. As an example, a 6-word message is to be written on a 4-channel MHU
-+ * connection: Registers marked with '*' are masked, and will not generate an
-+ * interrupt on the receiver side once written.
-+ *
-+ * u32 *data =	[0x00000001], [0x00000002], [0x00000003], [0x00000004],
-+ *		[0x00000005], [0x00000006]
-+ *
-+ * ROUND 1:
-+ * stat reg		To write	Write sequence
-+ * [ stat 3 ]	<-	[0x00000001]	4 <- triggers interrupt on receiver
-+ * [ stat 2 ]	<-	[0x00000002]	3
-+ * [ stat 1 ]	<-	[0x00000003]	2
-+ * [ stat 0 ]	<-	[0x00000004]	1
-+ *
-+ * data += 4 // Increment data pointer by number of stat regs
-+ *
-+ * ROUND 2:
-+ * stat reg		To write	Write sequence
-+ * [ stat 3 ]	<-	[0x00000005]	2 <- triggers interrupt on receiver
-+ * [ stat 2 ]	<-	[0x00000006]	1
-+ * [ stat 1 ]	<-	[0x00000000]
-+ * [ stat 0 ]	<-	[0x00000000]
-+ */
-+static int mhuv2_data_transfer_send_data(struct mhuv2 *mhu,
-+					 struct mbox_chan *chan, void *arg)
-+{
-+	const struct arm_mhuv2_mbox_msg *msg = arg;
-+	int bytes_left = msg->len, bytes_to_send, bytes_in_round, i;
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+	int windows = priv->windows;
-+	u32 *data = msg->data, word;
-+
-+	while (bytes_left) {
-+		if (!data[0]) {
-+			dev_err(mhu->mbox.dev, "Data aligned at first window can't be zero to guarantee interrupt generation at receiver");
-+			return -EINVAL;
-+		}
-+
-+		while(!mhuv2_data_transfer_last_tx_done(mhu, chan))
-+			continue;
-+
-+		bytes_in_round = min(bytes_left, (int)(windows * MHUV2_STAT_BYTES));
-+
-+		for (i = windows - 1; i >= 0; i--) {
-+			/* Data less than windows can transfer ? */
-+			if (unlikely(bytes_in_round <= i * MHUV2_STAT_BYTES))
-+				continue;
-+
-+			word = data[i];
-+			bytes_to_send = bytes_in_round & (MHUV2_STAT_BYTES - 1);
-+			if (unlikely(bytes_to_send))
-+				word &= LSB_MASK(bytes_to_send);
-+			else
-+				bytes_to_send = MHUV2_STAT_BYTES;
-+
-+			writel_relaxed(word, &mhu->send->ch_wn[priv->ch_wn_idx + windows - 1 - i].stat_set);
-+			bytes_left -= bytes_to_send;
-+			bytes_in_round -= bytes_to_send;
-+		}
-+
-+		data += windows;
-+	}
-+
-+	return 0;
-+}
-+
-+static const struct mhuv2_protocol_ops mhuv2_data_transfer_ops = {
-+	.rx_startup = mhuv2_data_transfer_rx_startup,
-+	.rx_shutdown = mhuv2_data_transfer_rx_shutdown,
-+	.read_data = mhuv2_data_transfer_read_data,
-+	.tx_startup = mhuv2_data_transfer_tx_startup,
-+	.tx_shutdown = mhuv2_data_transfer_tx_shutdown,
-+	.last_tx_done = mhuv2_data_transfer_last_tx_done,
-+	.send_data = mhuv2_data_transfer_send_data,
-+};
-+
-+/* Interrupt handlers */
-+
-+static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 *reg)
-+{
-+	struct mbox_chan *chans = mhu->mbox.chans;
-+	int channel = 0, i, offset = 0, windows, protocol, ch_wn;
-+	u32 stat;
-+
-+	for (i = 0; i < MHUV2_CMB_INT_ST_REG_CNT; i++) {
-+		stat = readl_relaxed(reg + i);
-+		if (!stat)
-+			continue;
-+
-+		ch_wn = i * MHUV2_STAT_BITS + __builtin_ctz(stat);
-+
-+		for (i = 0; i < mhu->length; i += 2) {
-+			protocol = mhu->protocols[i];
-+			windows = mhu->protocols[i + 1];
-+
-+			if (ch_wn >= offset + windows) {
-+				if (protocol == DOORBELL)
-+					channel += MHUV2_STAT_BITS * windows;
-+				else
-+					channel++;
-+
-+				offset += windows;
-+				continue;
-+			}
-+
-+			/* Return first chan of the window in doorbell mode */
-+			if (protocol == DOORBELL)
-+				channel += MHUV2_STAT_BITS * (ch_wn - offset);
-+
-+			return &chans[channel];
-+		}
-+	}
-+
-+	return ERR_PTR(-EIO);
-+}
-+
-+static irqreturn_t mhuv2_sender_interrupt(int irq, void *data)
-+{
-+	struct mhuv2 *mhu = data;
-+	struct device *dev = mhu->mbox.dev;
-+	struct mhuv2_mbox_chan_priv *priv;
-+	struct mbox_chan *chan;
-+	unsigned long flags;
-+	int i, found = 0;
-+	u32 stat;
-+
-+	chan = get_irq_chan_comb(mhu, mhu->send->chcomb_int_st);
-+	if (IS_ERR(chan)) {
-+		dev_warn(dev, "Failed to find channel for the Tx interrupt\n");
-+		return IRQ_NONE;
-+	}
-+	priv = chan->con_priv;
-+
-+	if (!IS_PROTOCOL_DOORBELL(priv)) {
-+		writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + priv->windows - 1].int_clr);
-+
-+		if (chan->cl) {
-+			mbox_chan_txdone(chan, 0);
-+			return IRQ_HANDLED;
-+		}
-+
-+		dev_warn(dev, "Tx interrupt Received on channel (%u) not currently attached to a mailbox client\n",
-+			 priv->ch_wn_idx);
-+		return IRQ_NONE;
-+	}
-+
-+	/* Clear the interrupt first, so we don't miss any doorbell later */
-+	writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx].int_clr);
-+
-+	/*
-+	 * In Doorbell mode, make sure no new transitions happen while the
-+	 * interrupt handler is trying to find the finished doorbell tx
-+	 * operations, else we may think few of the transfers were complete
-+	 * before they actually were.
-+	 */
-+	spin_lock_irqsave(&mhu->doorbell_pending_lock, flags);
-+
-+	/*
-+	 * In case of doorbell mode, the first channel of the window is returned
-+	 * by get_irq_chan_comb(). Find all the pending channels here.
-+	 */
-+	stat = readl_relaxed(&mhu->send->ch_wn[priv->ch_wn_idx].stat);
-+
-+	for (i = 0; i < MHUV2_STAT_BITS; i++) {
-+		priv = chan[i].con_priv;
-+
-+		/* Find cases where pending was 1, but stat's bit is cleared */
-+		if (priv->pending ^ ((stat >> i) & 0x1)) {
-+			BUG_ON(!priv->pending);
-+
-+			if (!chan->cl) {
-+				dev_warn(dev, "Tx interrupt received on doorbell (%u : %u) channel not currently attached to a mailbox client\n",
-+					 priv->ch_wn_idx, i);
-+				continue;
-+			}
-+
-+			mbox_chan_txdone(&chan[i], 0);
-+			priv->pending = 0;
-+			found++;
-+		}
-+	}
-+
-+	spin_unlock_irqrestore(&mhu->doorbell_pending_lock, flags);
-+
-+	if (!found) {
-+		/*
-+		 * We may have already processed the doorbell in the previous
-+		 * iteration if the interrupt came right after we cleared it but
-+		 * before we read the stat register.
-+		 */
-+		dev_dbg(dev, "Couldn't find the doorbell (%u) for the Tx interrupt interrupt\n",
-+			priv->ch_wn_idx);
-+		return IRQ_NONE;
-+	}
-+
-+	return IRQ_HANDLED;
-+}
-+
-+static struct mbox_chan *get_irq_chan_comb_rx(struct mhuv2 *mhu)
-+{
-+	struct mhuv2_mbox_chan_priv *priv;
-+	struct mbox_chan *chan;
-+	u32 stat;
-+
-+	chan = get_irq_chan_comb(mhu, mhu->recv->chcomb_int_st);
-+	if (IS_ERR(chan))
-+		return chan;
-+
-+	priv = chan->con_priv;
-+	if (!IS_PROTOCOL_DOORBELL(priv))
-+		return chan;
-+
-+	/*
-+	 * In case of doorbell mode, the first channel of the window is returned
-+	 * by the routine. Find the exact channel here.
-+	 */
-+	stat = readl_relaxed(&mhu->recv->ch_wn[priv->ch_wn_idx].stat_masked);
-+	BUG_ON(!stat);
-+
-+	return chan + __builtin_ctz(stat);
-+}
-+
-+static struct mbox_chan *get_irq_chan_stat_rx(struct mhuv2 *mhu)
-+{
-+	struct mbox_chan *chans = mhu->mbox.chans;
-+	struct mhuv2_mbox_chan_priv *priv;
-+	u32 stat;
-+	int i = 0;
-+
-+	while (i < mhu->mbox.num_chans) {
-+		priv = chans[i].con_priv;
-+		stat = readl_relaxed(&mhu->recv->ch_wn[priv->ch_wn_idx].stat_masked);
-+
-+		if (stat) {
-+			if (IS_PROTOCOL_DOORBELL(priv))
-+				i += __builtin_ctz(stat);
-+			return &chans[i];
-+		}
-+
-+		i += IS_PROTOCOL_DOORBELL(priv) ? MHUV2_STAT_BITS : 1;
-+	}
-+
-+	return ERR_PTR(-EIO);
-+}
-+
-+static struct mbox_chan *get_irq_chan_rx(struct mhuv2 *mhu)
-+{
-+	if (!mhu->minor)
-+		return get_irq_chan_stat_rx(mhu);
-+
-+	return get_irq_chan_comb_rx(mhu);
-+}
-+
-+static irqreturn_t mhuv2_receiver_interrupt(int irq, void *arg)
-+{
-+	struct mhuv2 *mhu = arg;
-+	struct mbox_chan *chan = get_irq_chan_rx(mhu);
-+	struct device *dev = mhu->mbox.dev;
-+	struct mhuv2_mbox_chan_priv *priv;
-+	int ret = IRQ_NONE;
-+	void *data;
-+
-+	if (IS_ERR(chan)) {
-+		dev_warn(dev, "Failed to find channel for the rx interrupt\n");
-+		return IRQ_NONE;
-+	}
-+	priv = chan->con_priv;
-+
-+	/* Read and clear the data first */
-+	data = priv->ops->read_data(mhu, chan);
-+
-+	if (!chan->cl) {
-+		dev_warn(dev, "Received data on channel (%u) not currently attached to a mailbox client\n",
-+			 priv->ch_wn_idx);
-+	} else if (IS_ERR(data)) {
-+		dev_err(dev, "Failed to read data: %lu\n", PTR_ERR(data));
-+	} else {
-+		mbox_chan_received_data(chan, data);
-+		ret = IRQ_HANDLED;
-+	}
-+
-+	kfree(data);
-+	return ret;
-+}
-+
-+/* Sender and receiver ops */
-+static bool mhuv2_sender_last_tx_done(struct mbox_chan *chan)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	return priv->ops->last_tx_done(mhu, chan);
-+}
-+
-+static int mhuv2_sender_send_data(struct mbox_chan *chan, void *data)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	if (!priv->ops->last_tx_done(mhu, chan))
-+		return -EBUSY;
-+
-+	return priv->ops->send_data(mhu, chan, data);
-+}
-+
-+static int mhuv2_sender_startup(struct mbox_chan *chan)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	if (priv->ops->tx_startup)
-+		priv->ops->tx_startup(mhu, chan);
-+	return 0;
-+}
-+
-+static void mhuv2_sender_shutdown(struct mbox_chan *chan)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	if (priv->ops->tx_shutdown)
-+		priv->ops->tx_shutdown(mhu, chan);
-+}
-+
-+static const struct mbox_chan_ops mhuv2_sender_ops = {
-+	.send_data = mhuv2_sender_send_data,
-+	.startup = mhuv2_sender_startup,
-+	.shutdown = mhuv2_sender_shutdown,
-+	.last_tx_done = mhuv2_sender_last_tx_done,
-+};
-+
-+static int mhuv2_receiver_startup(struct mbox_chan *chan)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	return priv->ops->rx_startup(mhu, chan);
-+}
-+
-+static void mhuv2_receiver_shutdown(struct mbox_chan *chan)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(chan->mbox);
-+	struct mhuv2_mbox_chan_priv *priv = chan->con_priv;
-+
-+	priv->ops->rx_shutdown(mhu, chan);
-+}
-+
-+static int mhuv2_receiver_send_data(struct mbox_chan *chan, void *data)
-+{
-+	dev_err(chan->mbox->dev,
-+		"Trying to transmit on a receiver MHU frame\n");
-+	return -EIO;
-+}
-+
-+static bool mhuv2_receiver_last_tx_done(struct mbox_chan *chan)
-+{
-+	dev_err(chan->mbox->dev, "Trying to Tx poll on a receiver MHU frame\n");
-+	return true;
-+}
-+
-+static const struct mbox_chan_ops mhuv2_receiver_ops = {
-+	.send_data = mhuv2_receiver_send_data,
-+	.startup = mhuv2_receiver_startup,
-+	.shutdown = mhuv2_receiver_shutdown,
-+	.last_tx_done = mhuv2_receiver_last_tx_done,
-+};
-+
-+static struct mbox_chan *mhuv2_mbox_of_xlate(struct mbox_controller *mbox,
-+					     const struct of_phandle_args *pa)
-+{
-+	struct mhuv2 *mhu = mhu_from_mbox(mbox);
-+	struct mbox_chan *chans = mbox->chans;
-+	int channel = 0, i, offset, doorbell, protocol, windows;
-+
-+	if (pa->args_count != 2)
-+		return ERR_PTR(-EINVAL);
-+
-+	offset = pa->args[0];
-+	doorbell = pa->args[1];
-+	if (doorbell >= MHUV2_STAT_BITS)
-+		goto out;
-+
-+	for (i = 0; i < mhu->length; i += 2) {
-+		protocol = mhu->protocols[i];
-+		windows = mhu->protocols[i + 1];
-+
-+		if (protocol == DOORBELL) {
-+			if (offset < windows)
-+				return &chans[channel + MHUV2_STAT_BITS * offset + doorbell];
-+
-+			channel += MHUV2_STAT_BITS * windows;
-+			offset -= windows;
-+		} else {
-+			if (offset == 0) {
-+				if (doorbell)
-+					goto out;
-+
-+				return &chans[channel];
-+			}
-+
-+			channel++;
-+			offset--;
-+		}
-+	}
-+
-+out:
-+	dev_err(mbox->dev, "Couldn't xlate to a valid channel (%d: %d)\n",
-+		pa->args[0], doorbell);
-+	return ERR_PTR(-ENODEV);
-+}
-+
-+static int mhuv2_verify_protocol(struct mhuv2 *mhu)
-+{
-+	struct device *dev = mhu->mbox.dev;
-+	int protocol, windows, channels = 0, total_windows = 0, i;
-+
-+	for (i = 0; i < mhu->length; i += 2) {
-+		protocol = mhu->protocols[i];
-+		windows = mhu->protocols[i + 1];
-+
-+		if (!windows) {
-+			dev_err(dev, "Window size can't be zero (%d)\n", i);
-+			return -EINVAL;
-+		}
-+		total_windows += windows;
-+
-+		if (protocol == DOORBELL) {
-+			channels += MHUV2_STAT_BITS * windows;
-+		} else if (protocol == DATA_TRANSFER) {
-+			channels++;
-+		} else {
-+			dev_err(dev, "Invalid protocol (%d) present in %s property at index %d\n",
-+				protocol, MHUV2_PROTOCOL_PROP, i);
-+			return -EINVAL;
-+		}
-+	}
-+
-+	if (total_windows > mhu->windows) {
-+		dev_err(dev, "Channel windows can't be more than what's implemented by the hardware ( %d: %d)\n",
-+			total_windows, mhu->windows);
-+		return -EINVAL;
-+	}
-+
-+	mhu->mbox.num_chans = channels;
-+	return 0;
-+}
-+
-+static int mhuv2_allocate_channels(struct mhuv2 *mhu)
-+{
-+	struct mbox_controller *mbox = &mhu->mbox;
-+	struct mhuv2_mbox_chan_priv *priv;
-+	struct device *dev = mbox->dev;
-+	struct mbox_chan *chans;
-+	int protocol, windows = 0, next_window = 0, i, j, k;
-+
-+	chans = devm_kcalloc(dev, mbox->num_chans, sizeof(*chans), GFP_KERNEL);
-+	if (!chans)
-+		return -ENOMEM;
-+
-+	mbox->chans = chans;
-+
-+	for (i = 0; i < mhu->length; i += 2) {
-+		next_window += windows;
-+
-+		protocol = mhu->protocols[i];
-+		windows = mhu->protocols[i + 1];
-+
-+		if (protocol == DATA_TRANSFER) {
-+			priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL);
-+			if (!priv)
-+				return -ENOMEM;
-+
-+			priv->ch_wn_idx = next_window;
-+			priv->ops = &mhuv2_data_transfer_ops;
-+			priv->windows = windows;
-+			chans++->con_priv = priv;
-+			continue;
-+		}
-+
-+		for (j = 0; j < windows; j++) {
-+			for (k = 0; k < MHUV2_STAT_BITS; k++) {
-+				priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL);
-+				if (!priv)
-+					return -ENOMEM;
-+
-+				priv->ch_wn_idx = next_window + j;
-+				priv->ops = &mhuv2_doorbell_ops;
-+				priv->doorbell = k;
-+				chans++->con_priv = priv;
-+			}
-+
-+			/*
-+			 * Permanently enable interrupt as we can't
-+			 * control it per doorbell.
-+			 */
-+			if (mhu->frame == SENDER_FRAME && mhu->minor)
-+				writel_relaxed(0x1, &mhu->send->ch_wn[priv->ch_wn_idx].int_en);
-+		}
-+	}
-+
-+	/* Make sure we have initialized all channels */
-+	BUG_ON(chans - mbox->chans != mbox->num_chans);
-+
-+	return 0;
-+}
-+
-+static int mhuv2_parse_channels(struct mhuv2 *mhu)
-+{
-+	struct device *dev = mhu->mbox.dev;
-+	const struct device_node *np = dev->of_node;
-+	int ret, count;
-+	u32 *protocols;
-+
-+	count = of_property_count_u32_elems(np, MHUV2_PROTOCOL_PROP);
-+	if (count <= 0 || count % 2) {
-+		dev_err(dev, "Invalid %s property (%d)\n", MHUV2_PROTOCOL_PROP,
-+			count);
-+		return -EINVAL;
-+	}
-+
-+	protocols = devm_kmalloc_array(dev, count, sizeof(*protocols), GFP_KERNEL);
-+	if (!protocols)
-+		return -ENOMEM;
-+
-+	ret = of_property_read_u32_array(np, MHUV2_PROTOCOL_PROP, protocols, count);
-+	if (ret) {
-+		dev_err(dev, "Failed to read %s property: %d\n",
-+			MHUV2_PROTOCOL_PROP, ret);
-+		return ret;
-+	}
-+
-+	mhu->protocols = protocols;
-+	mhu->length = count;
-+
-+	ret = mhuv2_verify_protocol(mhu);
-+	if (ret)
-+		return ret;
-+
-+	return mhuv2_allocate_channels(mhu);
-+}
-+
-+static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
-+			 void __iomem *reg)
-+{
-+	struct device *dev = mhu->mbox.dev;
-+	int ret, i;
-+
-+	mhu->frame = SENDER_FRAME;
-+	mhu->mbox.ops = &mhuv2_sender_ops;
-+	mhu->send = reg;
-+
-+	mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, num_ch);
-+	mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, arch_minor_rev);
-+
-+	spin_lock_init(&mhu->doorbell_pending_lock);
-+
-+	/*
-+	 * For minor version 1 and forward, tx interrupt is provided by
-+	 * the controller.
-+	 */
-+	if (mhu->minor && adev->irq[0]) {
-+		ret = devm_request_threaded_irq(dev, adev->irq[0], NULL,
-+						mhuv2_sender_interrupt,
-+						IRQF_ONESHOT, "mhuv2-tx", mhu);
-+		if (ret) {
-+			dev_err(dev, "Failed to request tx IRQ, fallback to polling mode: %d\n",
-+				ret);
-+		} else {
-+			mhu->mbox.txdone_irq = true;
-+			mhu->mbox.txdone_poll = false;
-+			mhu->irq = adev->irq[0];
-+
-+			writel_relaxed_bitfield(1, &mhu->send->int_en, chcomb);
-+
-+			/* Disable all channel interrupts */
-+			for (i = 0; i < mhu->windows; i++)
-+				writel_relaxed(0x0, &mhu->send->ch_wn[i].int_en);
-+
-+			goto out;
-+		}
-+	}
-+
-+	mhu->mbox.txdone_irq = false;
-+	mhu->mbox.txdone_poll = true;
-+	mhu->mbox.txpoll_period = 1;
-+
-+out:
-+	/* Wait for receiver to be ready */
-+	writel_relaxed(0x1, &mhu->send->access_request);
-+	while (!readl_relaxed(&mhu->send->access_ready))
-+		continue;
-+
-+	return 0;
-+}
-+
-+static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
-+			 void __iomem *reg)
-+{
-+	struct device *dev = mhu->mbox.dev;
-+	int ret, i;
-+
-+	mhu->frame = RECEIVER_FRAME;
-+	mhu->mbox.ops = &mhuv2_receiver_ops;
-+	mhu->recv = reg;
-+
-+	mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, num_ch);
-+	mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, arch_minor_rev);
-+
-+	mhu->irq = adev->irq[0];
-+	if (!mhu->irq) {
-+		dev_err(dev, "Missing receiver IRQ\n");
-+		return -EINVAL;
-+	}
-+
-+	ret = devm_request_threaded_irq(dev, mhu->irq, NULL,
-+					mhuv2_receiver_interrupt, IRQF_ONESHOT,
-+					"mhuv2-rx", mhu);
-+	if (ret) {
-+		dev_err(dev, "Failed to request rx IRQ\n");
-+		return ret;
-+	}
-+
-+	/* Mask all the channel windows */
-+	for (i = 0; i < mhu->windows; i++)
-+		writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set);
-+
-+	if (mhu->minor)
-+		writel_relaxed_bitfield(1, &mhu->recv->int_en, chcomb);
-+
-+	return 0;
-+}
-+
-+static int mhuv2_probe(struct amba_device *adev, const struct amba_id *id)
-+{
-+	struct device *dev = &adev->dev;
-+	const struct device_node *np = dev->of_node;
-+	struct mhuv2 *mhu;
-+	void __iomem *reg;
-+	int ret = -EINVAL;
-+
-+	reg = devm_of_iomap(dev, dev->of_node, 0, NULL);
-+	if (!reg)
-+		return -ENOMEM;
-+
-+	mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL);
-+	if (!mhu)
-+		return -ENOMEM;
-+
-+	mhu->mbox.dev = dev;
-+	mhu->mbox.of_xlate = mhuv2_mbox_of_xlate;
-+
-+	if (of_device_is_compatible(np, "arm,mhuv2-tx"))
-+		ret = mhuv2_tx_init(adev, mhu, reg);
-+	else if (of_device_is_compatible(np, "arm,mhuv2-rx"))
-+		ret = mhuv2_rx_init(adev, mhu, reg);
-+	else
-+		dev_err(dev, "Invalid compatible property\n");
-+
-+	if (ret)
-+		return ret;
-+
-+	/* Channel windows can't be 0 */
-+	BUG_ON(!mhu->windows);
-+
-+	ret = mhuv2_parse_channels(mhu);
-+	if (ret)
-+		return ret;
-+
-+	amba_set_drvdata(adev, mhu);
-+
-+	ret = devm_mbox_controller_register(dev, &mhu->mbox);
-+	if (ret)
-+		dev_err(dev, "failed to register ARM MHUv2 driver %d\n", ret);
-+
-+	return ret;
-+}
-+
-+static int mhuv2_remove(struct amba_device *adev)
-+{
-+	struct mhuv2 *mhu = amba_get_drvdata(adev);
-+
-+	if (mhu->frame == SENDER_FRAME)
-+		writel_relaxed(0x0, &mhu->send->access_request);
-+
-+	return 0;
-+}
-+
-+static struct amba_id mhuv2_ids[] = {
-+	{
-+		/* 2.0 */
-+		.id = 0xbb0d1,
-+		.mask = 0xfffff,
-+	},
-+	{
-+		/* 2.1 */
-+		.id = 0xbb076,
-+		.mask = 0xfffff,
-+	},
-+	{ 0, 0 },
-+};
-+MODULE_DEVICE_TABLE(amba, mhuv2_ids);
-+
-+static struct amba_driver mhuv2_driver = {
-+	.drv = {
-+		.name	= "arm-mhuv2",
-+	},
-+	.id_table	= mhuv2_ids,
-+	.probe		= mhuv2_probe,
-+	.remove		= mhuv2_remove,
-+};
-+module_amba_driver(mhuv2_driver);
-+
-+MODULE_LICENSE("GPL v2");
-+MODULE_DESCRIPTION("ARM MHUv2 Driver");
-+MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>");
-+MODULE_AUTHOR("Tushar Khandelwal <tushar.khandelwal@arm.com>");
-diff --git a/include/linux/mailbox/arm_mhuv2_message.h b/include/linux/mailbox/arm_mhuv2_message.h
-new file mode 100644
-index 000000000000..821b9d96daa4
---- /dev/null
-+++ b/include/linux/mailbox/arm_mhuv2_message.h
-@@ -0,0 +1,20 @@
-+// SPDX-License-Identifier: GPL-2.0
-+/*
-+ * ARM MHUv2 Mailbox Message
-+ *
-+ * Copyright (C) 2020 Arm Ltd.
-+ * Copyright (C) 2020 Linaro Ltd.
-+ */
-+
-+#ifndef _LINUX_ARM_MHUV2_MESSAGE_H_
-+#define _LINUX_ARM_MHUV2_MESSAGE_H_
-+
-+#include <linux/types.h>
-+
-+/* Data structure for data-transfer protocol */
-+struct arm_mhuv2_mbox_msg {
-+	void *data;
-+	size_t len;
-+};
-+
-+#endif /* _LINUX_ARM_MHUV2_MESSAGE_H_ */
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0005-mailbox-arm_mhuv2-Fix-sparse-warnings.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0005-mailbox-arm_mhuv2-Fix-sparse-warnings.patch
deleted file mode 100644
index 8905f74..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0005-mailbox-arm_mhuv2-Fix-sparse-warnings.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 1c75e7d566e29258e9daf7b1548f2d681efb4aea Mon Sep 17 00:00:00 2001
-From: Viresh Kumar <viresh.kumar@linaro.org>
-Date: Wed, 30 Dec 2020 10:12:04 +0530
-Subject: [PATCH 05/22] mailbox: arm_mhuv2: Fix sparse warnings
-
-This patch fixes a bunch of sparse warnings in the newly added arm_mhuv2
-driver.
-
-drivers/mailbox/arm_mhuv2.c:506:24: warning: incorrect type in argument 1 (different address spaces)
-drivers/mailbox/arm_mhuv2.c:506:24:    expected void const volatile [noderef] __iomem *addr
-drivers/mailbox/arm_mhuv2.c:506:24:    got unsigned int [usertype] *
-drivers/mailbox/arm_mhuv2.c:547:42: warning: incorrect type in argument 2 (different address spaces)
-drivers/mailbox/arm_mhuv2.c:547:42:    expected unsigned int [usertype] *reg
-drivers/mailbox/arm_mhuv2.c:547:42:    got unsigned int [noderef] __iomem *
-drivers/mailbox/arm_mhuv2.c:625:42: warning: incorrect type in argument 2 (different address spaces)
-drivers/mailbox/arm_mhuv2.c:625:42:    expected unsigned int [usertype] *reg
-drivers/mailbox/arm_mhuv2.c:625:42:    got unsigned int [noderef] __iomem *
-drivers/mailbox/arm_mhuv2.c:972:24: warning: dereference of noderef expression
-drivers/mailbox/arm_mhuv2.c:973:22: warning: dereference of noderef expression
-drivers/mailbox/arm_mhuv2.c:993:25: warning: dereference of noderef expression
-drivers/mailbox/arm_mhuv2.c:1026:24: warning: dereference of noderef expression
-drivers/mailbox/arm_mhuv2.c:1027:22: warning: dereference of noderef expression
-drivers/mailbox/arm_mhuv2.c:1048:17: warning: dereference of noderef expression
-
-Reported-by: kernel test robot <lkp@intel.com>
-Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-
-Upstream-Status: Backport [https://lkml.org/lkml/2021/2/9/428]
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
----
- drivers/mailbox/arm_mhuv2.c | 22 +++++++++++-----------
- 1 file changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
-index 67fb10885bb4..8223c1005254 100644
---- a/drivers/mailbox/arm_mhuv2.c
-+++ b/drivers/mailbox/arm_mhuv2.c
-@@ -238,19 +238,19 @@ struct mhuv2_mbox_chan_priv {
- };
- 
- /* Macro for reading a bitfield within a physically mapped packed struct */
--#define readl_relaxed_bitfield(_regptr, _field)				\
-+#define readl_relaxed_bitfield(_regptr, _type, _field)			\
- 	({								\
- 		u32 _regval;						\
- 		_regval = readl_relaxed((_regptr));			\
--		(*(typeof((_regptr)))(&_regval))._field;		\
-+		(*(_type *)(&_regval))._field;				\
- 	})
- 
- /* Macro for writing a bitfield within a physically mapped packed struct */
--#define writel_relaxed_bitfield(_value, _regptr, _field)		\
-+#define writel_relaxed_bitfield(_value, _regptr, _type, _field)		\
- 	({								\
- 		u32 _regval;						\
- 		_regval = readl_relaxed(_regptr);			\
--		(*(typeof(_regptr))(&_regval))._field = _value;		\
-+		(*(_type *)(&_regval))._field = _value;			\
- 		writel_relaxed(_regval, _regptr);			\
- 	})
- 
-@@ -496,7 +496,7 @@ static const struct mhuv2_protocol_ops mhuv2_data_transfer_ops = {
- 
- /* Interrupt handlers */
- 
--static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 *reg)
-+static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg)
- {
- 	struct mbox_chan *chans = mhu->mbox.chans;
- 	int channel = 0, i, offset = 0, windows, protocol, ch_wn;
-@@ -969,8 +969,8 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
- 	mhu->mbox.ops = &mhuv2_sender_ops;
- 	mhu->send = reg;
- 
--	mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, num_ch);
--	mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, arch_minor_rev);
-+	mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, struct mhu_cfg_t, num_ch);
-+	mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, struct aidr_t, arch_minor_rev);
- 
- 	spin_lock_init(&mhu->doorbell_pending_lock);
- 
-@@ -990,7 +990,7 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
- 			mhu->mbox.txdone_poll = false;
- 			mhu->irq = adev->irq[0];
- 
--			writel_relaxed_bitfield(1, &mhu->send->int_en, chcomb);
-+			writel_relaxed_bitfield(1, &mhu->send->int_en, struct int_en_t, chcomb);
- 
- 			/* Disable all channel interrupts */
- 			for (i = 0; i < mhu->windows; i++)
-@@ -1023,8 +1023,8 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
- 	mhu->mbox.ops = &mhuv2_receiver_ops;
- 	mhu->recv = reg;
- 
--	mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, num_ch);
--	mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, arch_minor_rev);
-+	mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, struct mhu_cfg_t, num_ch);
-+	mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, struct aidr_t, arch_minor_rev);
- 
- 	mhu->irq = adev->irq[0];
- 	if (!mhu->irq) {
-@@ -1045,7 +1045,7 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
- 		writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set);
- 
- 	if (mhu->minor)
--		writel_relaxed_bitfield(1, &mhu->recv->int_en, chcomb);
-+		writel_relaxed_bitfield(1, &mhu->recv->int_en, struct int_en_t, chcomb);
- 
- 	return 0;
- }
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0006-mailbox-arm_mhuv2-make-remove-callback-return-void.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0006-mailbox-arm_mhuv2-make-remove-callback-return-void.patch
deleted file mode 100644
index a353f31..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0006-mailbox-arm_mhuv2-make-remove-callback-return-void.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 107f39e7741bb77688df47ce3f56b25cceb301c3 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Tue, 2 Feb 2021 20:43:08 +0100
-Subject: [PATCH 06/22] mailbox: arm_mhuv2: make remove callback return void
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-My build tests failed to catch that amba driver that would have needed
-adaption in commit 3fd269e74f2f ("amba: Make the remove callback return
-void"). Change the remove function to make the driver build again.
-
-Reported-by: kernel test robot <lkp@intel.com>
-Fixes: 3fd269e74f2f ("amba: Make the remove callback return void")
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-
-Upstream-Status: Backport [https://lkml.org/lkml/2021/2/2/1525]
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
----
- drivers/mailbox/arm_mhuv2.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
-index 8223c1005254..cdfb1939fabf 100644
---- a/drivers/mailbox/arm_mhuv2.c
-+++ b/drivers/mailbox/arm_mhuv2.c
-@@ -1095,14 +1095,12 @@ static int mhuv2_probe(struct amba_device *adev, const struct amba_id *id)
- 	return ret;
- }
- 
--static int mhuv2_remove(struct amba_device *adev)
-+static void mhuv2_remove(struct amba_device *adev)
- {
- 	struct mhuv2 *mhu = amba_get_drvdata(adev);
- 
- 	if (mhu->frame == SENDER_FRAME)
- 		writel_relaxed(0x0, &mhu->send->access_request);
--
--	return 0;
- }
- 
- static struct amba_id mhuv2_ids[] = {
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0007-mailbox-arm_mhuv2-Skip-calling-kfree-with-invalid-po.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0007-mailbox-arm_mhuv2-Skip-calling-kfree-with-invalid-po.patch
deleted file mode 100644
index cf5b0b0..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0007-mailbox-arm_mhuv2-Skip-calling-kfree-with-invalid-po.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 81d76e92b03a6f33acefd8aef168948c5f595205 Mon Sep 17 00:00:00 2001
-From: Viresh Kumar <viresh.kumar@linaro.org>
-Date: Mon, 22 Feb 2021 12:48:06 +0530
-Subject: [PATCH 07/22] mailbox: arm_mhuv2: Skip calling kfree() with invalid
- pointer
-
-It is possible that 'data' passed to kfree() is set to a error value
-instead of allocated space. Make sure it doesn't get called with invalid
-pointer.
-
-Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver")
-Cc: v5.11 <stable@vger.kernel.org> # v5.11
-Reported-by: kernel test robot <lkp@intel.com>
-Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
-Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-
-Upstream-Status: Backport [https://lkml.org/lkml/2021/2/22/57]
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
----
- drivers/mailbox/arm_mhuv2.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
-index cdfb1939fabf..d997f8ebfa98 100644
---- a/drivers/mailbox/arm_mhuv2.c
-+++ b/drivers/mailbox/arm_mhuv2.c
-@@ -699,7 +699,9 @@ static irqreturn_t mhuv2_receiver_interrupt(int irq, void *arg)
- 		ret = IRQ_HANDLED;
- 	}
- 
--	kfree(data);
-+	if (!IS_ERR(data))
-+		kfree(data);
-+
- 	return ret;
- }
- 
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0008-firmware-arm_ffa-Backport-of-arm_ffa-driver.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0008-firmware-arm_ffa-Backport-of-arm_ffa-driver.patch
deleted file mode 100644
index d91dbc5..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0008-firmware-arm_ffa-Backport-of-arm_ffa-driver.patch
+++ /dev/null
@@ -1,1684 +0,0 @@
-From 85df9333f0adf60fd76eb5ebb21b89c5b0a86c10 Mon Sep 17 00:00:00 2001
-From: Sudeep Holla <sudeep.holla@arm.com>
-Date: Tue, 18 May 2021 17:36:18 +0100
-Subject: [PATCH 01/32] firmware: arm_ffa: Backport of arm_ffa driver
-
-This is a backport of upstream ARM FFA driver from:
-https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git/commit/?h=v5.10/ffa&id=c0aff30cb9ad6a00c82acef0f2a48f99adf997c0
-
-to branch=android12-5.10-lts
-
-   arm64: smccc: Add support for SMCCCv1.2 extended input/output registers
-   commit 3fdc0cb59d97f87e2cc708d424f1538e31744286 upstream.
-
-   firmware: arm_ffa: Add initial FFA bus support for device enumeration
-   commit e781858488b918e30a6ff28e9eab6058b787e3b3 upstream.
-
-   firmware: arm_ffa: Add initial Arm FFA driver support
-   commit 3bbfe9871005f38df2955b2e125933edf1d2feef upstream.
-
-   firmware: arm_ffa: Add support for SMCCC as transport to FFA driver
-   commit 714be77e976a4b013b935b3223b2ef68856084d0 upstream.
-
-   firmware: arm_ffa: Setup in-kernel users of FFA partitions
-   commit d0c0bce831223b08e5bade2cefc93c3ddb790796 upstream.
-
-   firmware: arm_ffa: Add support for MEM_* interfaces
-   commit cc2195fe536c28e192df5d07e6dd277af36814b4 upstream.
-
-   firmware: arm_ffa: Ensure drivers provide a probe function
-   commit 92743071464fca5acbbe812d9a0d88de3eaaad36 upstream.
-
-   firmware: arm_ffa: Simplify probe function
-   commit e362547addc39e4bb18ad5bdfd59ce4d512d0c08 upstream.
-
-   firmware: arm_ffa: Fix the comment style
-   commit ba684a31d3626c86cd9097e12d6ed57d224d077d upstream.
-
-   firmware: arm_ffa: Fix a possible ffa_linux_errmap buffer overflow
-   commit dd925db6f07556061c11ab1fbfa4a0145ae6b438 upstream.
-
-   firmware: arm_ffa: Add missing remove callback to ffa_bus_type
-   commit 244f5d597e1ea519c2085fbd9819458688775e42 upstream.
-
-   firmware: arm_ffa: Fix __ffa_devices_unregister
-   commit eb7b52e6db7c21400b9b2d539f9343fb6e94bd94 upstream.
-
-   firmware: arm_ffa: Handle compatibility with different firmware versions
-   commit 8e3f9da608f14cfebac2659d8dd8737b79d01308 upstream.
-
-   firmware: arm_ffa: Add support for MEM_LEND
-   commit 82a8daaecfd9382e9450a05f86be8a274cf69a27 upstream.
-
-   firmware: arm_ffa: Remove unused 'compat_version' variable
-   commit 01537a078b86917c7bb69aa4b756b42b980c158b upstream.
-
-Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
-Change-Id: If9df40d2d10be9e3c95298820bc20c201ea1774c
-Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
-
-Upstream-Status: Backport
-Change-Id: I8e6197d8b7ef6654dacd21450069b8e284a3cec5
----
- MAINTAINERS                       |   7 +
- arch/arm64/kernel/asm-offsets.c   |   9 +
- arch/arm64/kernel/smccc-call.S    |  57 +++
- drivers/firmware/Kconfig          |   1 +
- drivers/firmware/Makefile         |   1 +
- drivers/firmware/arm_ffa/Kconfig  |  21 +
- drivers/firmware/arm_ffa/Makefile |   6 +
- drivers/firmware/arm_ffa/bus.c    | 220 +++++++++
- drivers/firmware/arm_ffa/common.h |  31 ++
- drivers/firmware/arm_ffa/driver.c | 776 ++++++++++++++++++++++++++++++
- drivers/firmware/arm_ffa/smccc.c  |  39 ++
- include/linux/arm-smccc.h         |  55 +++
- include/linux/arm_ffa.h           | 269 +++++++++++
- 13 files changed, 1492 insertions(+)
- create mode 100644 drivers/firmware/arm_ffa/Kconfig
- create mode 100644 drivers/firmware/arm_ffa/Makefile
- create mode 100644 drivers/firmware/arm_ffa/bus.c
- create mode 100644 drivers/firmware/arm_ffa/common.h
- create mode 100644 drivers/firmware/arm_ffa/driver.c
- create mode 100644 drivers/firmware/arm_ffa/smccc.c
- create mode 100644 include/linux/arm_ffa.h
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index 5234423c477a..d5fdc9e68c89 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -6847,6 +6847,13 @@ F:	include/linux/firewire.h
- F:	include/uapi/linux/firewire*.h
- F:	tools/firewire/
- 
-+FIRMWARE FRAMEWORK FOR ARMV8-A
-+M:	Sudeep Holla <sudeep.holla@arm.com>
-+L:	linux-arm-kernel@lists.infradead.org
-+S:	Maintained
-+F:	drivers/firmware/arm_ffa/
-+F:	include/linux/arm_ffa.h
-+
- FIRMWARE LOADER (request_firmware)
- M:	Luis Chamberlain <mcgrof@kernel.org>
- L:	linux-kernel@vger.kernel.org
-diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
-index 93da876a58e6..bad4a367da28 100644
---- a/arch/arm64/kernel/asm-offsets.c
-+++ b/arch/arm64/kernel/asm-offsets.c
-@@ -139,6 +139,15 @@ int main(void)
-   DEFINE(ARM_SMCCC_RES_X2_OFFS,		offsetof(struct arm_smccc_res, a2));
-   DEFINE(ARM_SMCCC_QUIRK_ID_OFFS,	offsetof(struct arm_smccc_quirk, id));
-   DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS,	offsetof(struct arm_smccc_quirk, state));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X0_OFFS,	offsetof(struct arm_smccc_1_2_regs, a0));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X2_OFFS,	offsetof(struct arm_smccc_1_2_regs, a2));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X4_OFFS,	offsetof(struct arm_smccc_1_2_regs, a4));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X6_OFFS,	offsetof(struct arm_smccc_1_2_regs, a6));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X8_OFFS,	offsetof(struct arm_smccc_1_2_regs, a8));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X10_OFFS,	offsetof(struct arm_smccc_1_2_regs, a10));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X12_OFFS,	offsetof(struct arm_smccc_1_2_regs, a12));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X14_OFFS,	offsetof(struct arm_smccc_1_2_regs, a14));
-+  DEFINE(ARM_SMCCC_1_2_REGS_X16_OFFS,	offsetof(struct arm_smccc_1_2_regs, a16));
-   BLANK();
-   DEFINE(HIBERN_PBE_ORIG,	offsetof(struct pbe, orig_address));
-   DEFINE(HIBERN_PBE_ADDR,	offsetof(struct pbe, address));
-diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S
-index d62447964ed9..2def9d0dd3dd 100644
---- a/arch/arm64/kernel/smccc-call.S
-+++ b/arch/arm64/kernel/smccc-call.S
-@@ -43,3 +43,60 @@ SYM_FUNC_START(__arm_smccc_hvc)
- 	SMCCC	hvc
- SYM_FUNC_END(__arm_smccc_hvc)
- EXPORT_SYMBOL(__arm_smccc_hvc)
-+
-+	.macro SMCCC_1_2 instr
-+	/* Save `res` and free a GPR that won't be clobbered */
-+	stp     x1, x19, [sp, #-16]!
-+
-+	/* Ensure `args` won't be clobbered while loading regs in next step */
-+	mov	x19, x0
-+
-+	/* Load the registers x0 - x17 from the struct arm_smccc_1_2_regs */
-+	ldp	x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
-+	ldp	x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
-+	ldp	x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
-+	ldp	x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
-+	ldp	x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
-+	ldp	x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
-+	ldp	x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
-+	ldp	x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
-+	ldp	x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
-+
-+	\instr #0
-+
-+	/* Load the `res` from the stack */
-+	ldr	x19, [sp]
-+
-+	/* Store the registers x0 - x17 into the result structure */
-+	stp	x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
-+	stp	x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
-+	stp	x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
-+	stp	x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
-+	stp	x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
-+	stp	x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
-+	stp	x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
-+	stp	x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
-+	stp	x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
-+
-+	/* Restore original x19 */
-+	ldp     xzr, x19, [sp], #16
-+	ret
-+.endm
-+
-+/*
-+ * void arm_smccc_1_2_hvc(const struct arm_smccc_1_2_regs *args,
-+ *			  struct arm_smccc_1_2_regs *res);
-+ */
-+SYM_FUNC_START(arm_smccc_1_2_hvc)
-+	SMCCC_1_2 hvc
-+SYM_FUNC_END(arm_smccc_1_2_hvc)
-+EXPORT_SYMBOL(arm_smccc_1_2_hvc)
-+
-+/*
-+ * void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,
-+ *			  struct arm_smccc_1_2_regs *res);
-+ */
-+SYM_FUNC_START(arm_smccc_1_2_smc)
-+	SMCCC_1_2 smc
-+SYM_FUNC_END(arm_smccc_1_2_smc)
-+EXPORT_SYMBOL(arm_smccc_1_2_smc)
-diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
-index bfef3d8d14e7..90e6dd32f2cd 100644
---- a/drivers/firmware/Kconfig
-+++ b/drivers/firmware/Kconfig
-@@ -296,6 +296,7 @@ config TURRIS_MOX_RWTM
- 	  other manufacturing data and also utilize the Entropy Bit Generator
- 	  for hardware random number generation.
- 
-+source "drivers/firmware/arm_ffa/Kconfig"
- source "drivers/firmware/broadcom/Kconfig"
- source "drivers/firmware/google/Kconfig"
- source "drivers/firmware/efi/Kconfig"
-diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
-index 523173cbff33..3c2af2e98def 100644
---- a/drivers/firmware/Makefile
-+++ b/drivers/firmware/Makefile
-@@ -23,6 +23,7 @@ obj-$(CONFIG_TI_SCI_PROTOCOL)	+= ti_sci.o
- obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
- obj-$(CONFIG_TURRIS_MOX_RWTM)	+= turris-mox-rwtm.o
- 
-+obj-y				+= arm_ffa/
- obj-y				+= arm_scmi/
- obj-y				+= broadcom/
- obj-y				+= meson/
-diff --git a/drivers/firmware/arm_ffa/Kconfig b/drivers/firmware/arm_ffa/Kconfig
-new file mode 100644
-index 000000000000..5e3ae5cf82e8
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/Kconfig
-@@ -0,0 +1,21 @@
-+# SPDX-License-Identifier: GPL-2.0-only
-+config ARM_FFA_TRANSPORT
-+	tristate "Arm Firmware Framework for Armv8-A"
-+	depends on OF
-+	depends on ARM64
-+	default n
-+	help
-+	  This Firmware Framework(FF) for Arm A-profile processors describes
-+	  interfaces that standardize communication between the various
-+	  software images which includes communication between images in
-+	  the Secure world and Normal world. It also leverages the
-+	  virtualization extension to isolate software images provided
-+	  by an ecosystem of vendors from each other.
-+
-+	  This driver provides interface for all the client drivers making
-+	  use of the features offered by ARM FF-A.
-+
-+config ARM_FFA_SMCCC
-+	bool
-+	default ARM_FFA_TRANSPORT
-+	depends on ARM64 && HAVE_ARM_SMCCC_DISCOVERY
-diff --git a/drivers/firmware/arm_ffa/Makefile b/drivers/firmware/arm_ffa/Makefile
-new file mode 100644
-index 000000000000..9d9f37523200
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/Makefile
-@@ -0,0 +1,6 @@
-+# SPDX-License-Identifier: GPL-2.0-only
-+ffa-bus-y = bus.o
-+ffa-driver-y = driver.o
-+ffa-transport-$(CONFIG_ARM_FFA_SMCCC) += smccc.o
-+ffa-module-objs := $(ffa-bus-y) $(ffa-driver-y) $(ffa-transport-y)
-+obj-$(CONFIG_ARM_FFA_TRANSPORT) = ffa-module.o
-diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
-new file mode 100644
-index 000000000000..fca1e311ea6c
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/bus.c
-@@ -0,0 +1,220 @@
-+// SPDX-License-Identifier: GPL-2.0
-+/*
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-+
-+#include <linux/arm_ffa.h>
-+#include <linux/device.h>
-+#include <linux/fs.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+#include <linux/types.h>
-+
-+#include "common.h"
-+
-+static int ffa_device_match(struct device *dev, struct device_driver *drv)
-+{
-+	const struct ffa_device_id *id_table;
-+	struct ffa_device *ffa_dev;
-+
-+	id_table = to_ffa_driver(drv)->id_table;
-+	ffa_dev = to_ffa_dev(dev);
-+
-+	while (!uuid_is_null(&id_table->uuid)) {
-+		/*
-+		 * FF-A v1.0 doesn't provide discovery of UUIDs, just the
-+		 * partition IDs, so fetch the partitions IDs for this
-+		 * id_table UUID and assign the UUID to the device if the
-+		 * partition ID matches
-+		 */
-+		if (uuid_is_null(&ffa_dev->uuid))
-+			ffa_device_match_uuid(ffa_dev, &id_table->uuid);
-+
-+		if (uuid_equal(&ffa_dev->uuid, &id_table->uuid))
-+			return 1;
-+		id_table++;
-+	}
-+
-+	return 0;
-+}
-+
-+static int ffa_device_probe(struct device *dev)
-+{
-+	struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
-+	struct ffa_device *ffa_dev = to_ffa_dev(dev);
-+
-+	return ffa_drv->probe(ffa_dev);
-+}
-+
-+static int ffa_device_remove(struct device *dev)
-+{
-+	struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
-+
-+	ffa_drv->remove(to_ffa_dev(dev));
-+
-+	return 0;
-+}
-+
-+static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env)
-+{
-+	struct ffa_device *ffa_dev = to_ffa_dev(dev);
-+
-+	return add_uevent_var(env, "MODALIAS=arm_ffa:%04x:%pUb",
-+			      ffa_dev->vm_id, &ffa_dev->uuid);
-+}
-+
-+static ssize_t partition_id_show(struct device *dev,
-+				 struct device_attribute *attr, char *buf)
-+{
-+	struct ffa_device *ffa_dev = to_ffa_dev(dev);
-+
-+	return sprintf(buf, "0x%04x\n", ffa_dev->vm_id);
-+}
-+static DEVICE_ATTR_RO(partition_id);
-+
-+static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
-+			 char *buf)
-+{
-+	struct ffa_device *ffa_dev = to_ffa_dev(dev);
-+
-+	return sprintf(buf, "%pUb\n", &ffa_dev->uuid);
-+}
-+static DEVICE_ATTR_RO(uuid);
-+
-+static struct attribute *ffa_device_attributes_attrs[] = {
-+	&dev_attr_partition_id.attr,
-+	&dev_attr_uuid.attr,
-+	NULL,
-+};
-+ATTRIBUTE_GROUPS(ffa_device_attributes);
-+
-+struct bus_type ffa_bus_type = {
-+	.name		= "arm_ffa",
-+	.match		= ffa_device_match,
-+	.probe		= ffa_device_probe,
-+	.remove		= ffa_device_remove,
-+	.uevent		= ffa_device_uevent,
-+	.dev_groups	= ffa_device_attributes_groups,
-+};
-+EXPORT_SYMBOL_GPL(ffa_bus_type);
-+
-+int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
-+			const char *mod_name)
-+{
-+	int ret;
-+
-+	if (!driver->probe)
-+		return -EINVAL;
-+
-+	driver->driver.bus = &ffa_bus_type;
-+	driver->driver.name = driver->name;
-+	driver->driver.owner = owner;
-+	driver->driver.mod_name = mod_name;
-+
-+	ret = driver_register(&driver->driver);
-+	if (!ret)
-+		pr_debug("registered new ffa driver %s\n", driver->name);
-+
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(ffa_driver_register);
-+
-+void ffa_driver_unregister(struct ffa_driver *driver)
-+{
-+	driver_unregister(&driver->driver);
-+}
-+EXPORT_SYMBOL_GPL(ffa_driver_unregister);
-+
-+static void ffa_release_device(struct device *dev)
-+{
-+	struct ffa_device *ffa_dev = to_ffa_dev(dev);
-+
-+	kfree(ffa_dev);
-+}
-+
-+static int __ffa_devices_unregister(struct device *dev, void *data)
-+{
-+	device_unregister(dev);
-+
-+	return 0;
-+}
-+
-+static void ffa_devices_unregister(void)
-+{
-+	bus_for_each_dev(&ffa_bus_type, NULL, NULL,
-+			 __ffa_devices_unregister);
-+}
-+
-+bool ffa_device_is_valid(struct ffa_device *ffa_dev)
-+{
-+	bool valid = false;
-+	struct device *dev = NULL;
-+	struct ffa_device *tmp_dev;
-+
-+	do {
-+		dev = bus_find_next_device(&ffa_bus_type, dev);
-+		tmp_dev = to_ffa_dev(dev);
-+		if (tmp_dev == ffa_dev) {
-+			valid = true;
-+			break;
-+		}
-+		put_device(dev);
-+	} while (dev);
-+
-+	put_device(dev);
-+
-+	return valid;
-+}
-+
-+struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id)
-+{
-+	int ret;
-+	struct device *dev;
-+	struct ffa_device *ffa_dev;
-+
-+	ffa_dev = kzalloc(sizeof(*ffa_dev), GFP_KERNEL);
-+	if (!ffa_dev)
-+		return NULL;
-+
-+	dev = &ffa_dev->dev;
-+	dev->bus = &ffa_bus_type;
-+	dev->release = ffa_release_device;
-+	dev_set_name(&ffa_dev->dev, "arm-ffa-%04x", vm_id);
-+
-+	ffa_dev->vm_id = vm_id;
-+	uuid_copy(&ffa_dev->uuid, uuid);
-+
-+	ret = device_register(&ffa_dev->dev);
-+	if (ret) {
-+		dev_err(dev, "unable to register device %s err=%d\n",
-+			dev_name(dev), ret);
-+		put_device(dev);
-+		return NULL;
-+	}
-+
-+	return ffa_dev;
-+}
-+EXPORT_SYMBOL_GPL(ffa_device_register);
-+
-+void ffa_device_unregister(struct ffa_device *ffa_dev)
-+{
-+	if (!ffa_dev)
-+		return;
-+
-+	device_unregister(&ffa_dev->dev);
-+}
-+EXPORT_SYMBOL_GPL(ffa_device_unregister);
-+
-+int arm_ffa_bus_init(void)
-+{
-+	return bus_register(&ffa_bus_type);
-+}
-+
-+void arm_ffa_bus_exit(void)
-+{
-+	ffa_devices_unregister();
-+	bus_unregister(&ffa_bus_type);
-+}
-diff --git a/drivers/firmware/arm_ffa/common.h b/drivers/firmware/arm_ffa/common.h
-new file mode 100644
-index 000000000000..d6eccf1fd3f6
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/common.h
-@@ -0,0 +1,31 @@
-+/* SPDX-License-Identifier: GPL-2.0 */
-+/*
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#ifndef _FFA_COMMON_H
-+#define _FFA_COMMON_H
-+
-+#include <linux/arm_ffa.h>
-+#include <linux/arm-smccc.h>
-+#include <linux/err.h>
-+
-+typedef struct arm_smccc_1_2_regs ffa_value_t;
-+
-+typedef void (ffa_fn)(ffa_value_t, ffa_value_t *);
-+
-+int arm_ffa_bus_init(void);
-+void arm_ffa_bus_exit(void);
-+bool ffa_device_is_valid(struct ffa_device *ffa_dev);
-+void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid);
-+
-+#ifdef CONFIG_ARM_FFA_SMCCC
-+int __init ffa_transport_init(ffa_fn **invoke_ffa_fn);
-+#else
-+static inline int __init ffa_transport_init(ffa_fn **invoke_ffa_fn)
-+{
-+	return -EOPNOTSUPP;
-+}
-+#endif
-+
-+#endif /* _FFA_COMMON_H */
-diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
-new file mode 100644
-index 000000000000..14f900047ac0
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/driver.c
-@@ -0,0 +1,776 @@
-+// SPDX-License-Identifier: GPL-2.0-only
-+/*
-+ * Arm Firmware Framework for ARMv8-A(FFA) interface driver
-+ *
-+ * The Arm FFA specification[1] describes a software architecture to
-+ * leverages the virtualization extension to isolate software images
-+ * provided by an ecosystem of vendors from each other and describes
-+ * interfaces that standardize communication between the various software
-+ * images including communication between images in the Secure world and
-+ * Normal world. Any Hypervisor could use the FFA interfaces to enable
-+ * communication between VMs it manages.
-+ *
-+ * The Hypervisor a.k.a Partition managers in FFA terminology can assign
-+ * system resources(Memory regions, Devices, CPU cycles) to the partitions
-+ * and manage isolation amongst them.
-+ *
-+ * [1] https://developer.arm.com/docs/den0077/latest
-+ *
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#define DRIVER_NAME "ARM FF-A"
-+#define pr_fmt(fmt) DRIVER_NAME ": " fmt
-+
-+#include <linux/arm_ffa.h>
-+#include <linux/bitfield.h>
-+#include <linux/device.h>
-+#include <linux/io.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/mm.h>
-+#include <linux/scatterlist.h>
-+#include <linux/slab.h>
-+#include <linux/uuid.h>
-+
-+#include "common.h"
-+
-+#define FFA_DRIVER_VERSION	FFA_VERSION_1_0
-+
-+#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))
-+
-+#define FFA_ERROR			FFA_SMC_32(0x60)
-+#define FFA_SUCCESS			FFA_SMC_32(0x61)
-+#define FFA_INTERRUPT			FFA_SMC_32(0x62)
-+#define FFA_VERSION			FFA_SMC_32(0x63)
-+#define FFA_FEATURES			FFA_SMC_32(0x64)
-+#define FFA_RX_RELEASE			FFA_SMC_32(0x65)
-+#define FFA_RXTX_MAP			FFA_SMC_32(0x66)
-+#define FFA_FN64_RXTX_MAP		FFA_SMC_64(0x66)
-+#define FFA_RXTX_UNMAP			FFA_SMC_32(0x67)
-+#define FFA_PARTITION_INFO_GET		FFA_SMC_32(0x68)
-+#define FFA_ID_GET			FFA_SMC_32(0x69)
-+#define FFA_MSG_POLL			FFA_SMC_32(0x6A)
-+#define FFA_MSG_WAIT			FFA_SMC_32(0x6B)
-+#define FFA_YIELD			FFA_SMC_32(0x6C)
-+#define FFA_RUN				FFA_SMC_32(0x6D)
-+#define FFA_MSG_SEND			FFA_SMC_32(0x6E)
-+#define FFA_MSG_SEND_DIRECT_REQ		FFA_SMC_32(0x6F)
-+#define FFA_FN64_MSG_SEND_DIRECT_REQ	FFA_SMC_64(0x6F)
-+#define FFA_MSG_SEND_DIRECT_RESP	FFA_SMC_32(0x70)
-+#define FFA_FN64_MSG_SEND_DIRECT_RESP	FFA_SMC_64(0x70)
-+#define FFA_MEM_DONATE			FFA_SMC_32(0x71)
-+#define FFA_FN64_MEM_DONATE		FFA_SMC_64(0x71)
-+#define FFA_MEM_LEND			FFA_SMC_32(0x72)
-+#define FFA_FN64_MEM_LEND		FFA_SMC_64(0x72)
-+#define FFA_MEM_SHARE			FFA_SMC_32(0x73)
-+#define FFA_FN64_MEM_SHARE		FFA_SMC_64(0x73)
-+#define FFA_MEM_RETRIEVE_REQ		FFA_SMC_32(0x74)
-+#define FFA_FN64_MEM_RETRIEVE_REQ	FFA_SMC_64(0x74)
-+#define FFA_MEM_RETRIEVE_RESP		FFA_SMC_32(0x75)
-+#define FFA_MEM_RELINQUISH		FFA_SMC_32(0x76)
-+#define FFA_MEM_RECLAIM			FFA_SMC_32(0x77)
-+#define FFA_MEM_OP_PAUSE		FFA_SMC_32(0x78)
-+#define FFA_MEM_OP_RESUME		FFA_SMC_32(0x79)
-+#define FFA_MEM_FRAG_RX			FFA_SMC_32(0x7A)
-+#define FFA_MEM_FRAG_TX			FFA_SMC_32(0x7B)
-+#define FFA_NORMAL_WORLD_RESUME		FFA_SMC_32(0x7C)
-+
-+/*
-+ * For some calls it is necessary to use SMC64 to pass or return 64-bit values.
-+ * For such calls FFA_FN_NATIVE(name) will choose the appropriate
-+ * (native-width) function ID.
-+ */
-+#ifdef CONFIG_64BIT
-+#define FFA_FN_NATIVE(name)	FFA_FN64_##name
-+#else
-+#define FFA_FN_NATIVE(name)	FFA_##name
-+#endif
-+
-+/* FFA error codes. */
-+#define FFA_RET_SUCCESS            (0)
-+#define FFA_RET_NOT_SUPPORTED      (-1)
-+#define FFA_RET_INVALID_PARAMETERS (-2)
-+#define FFA_RET_NO_MEMORY          (-3)
-+#define FFA_RET_BUSY               (-4)
-+#define FFA_RET_INTERRUPTED        (-5)
-+#define FFA_RET_DENIED             (-6)
-+#define FFA_RET_RETRY              (-7)
-+#define FFA_RET_ABORTED            (-8)
-+
-+#define MAJOR_VERSION_MASK	GENMASK(30, 16)
-+#define MINOR_VERSION_MASK	GENMASK(15, 0)
-+#define MAJOR_VERSION(x)	((u16)(FIELD_GET(MAJOR_VERSION_MASK, (x))))
-+#define 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_VERSION_1_0		PACK_VERSION_INFO(1, 0)
-+#define FFA_MIN_VERSION		FFA_VERSION_1_0
-+
-+#define SENDER_ID_MASK		GENMASK(31, 16)
-+#define RECEIVER_ID_MASK	GENMASK(15, 0)
-+#define SENDER_ID(x)		((u16)(FIELD_GET(SENDER_ID_MASK, (x))))
-+#define RECEIVER_ID(x)		((u16)(FIELD_GET(RECEIVER_ID_MASK, (x))))
-+#define PACK_TARGET_INFO(s, r)		\
-+	(FIELD_PREP(SENDER_ID_MASK, (s)) | FIELD_PREP(RECEIVER_ID_MASK, (r)))
-+
-+/*
-+ * FF-A specification mentions explicitly about '4K pages'. This should
-+ * not be confused with the kernel PAGE_SIZE, which is the translation
-+ * granule kernel is configured and may be one among 4K, 16K and 64K.
-+ */
-+#define FFA_PAGE_SIZE		SZ_4K
-+/*
-+ * Keeping RX TX buffer size as 4K for now
-+ * 64K may be preferred to keep it min a page in 64K PAGE_SIZE config
-+ */
-+#define RXTX_BUFFER_SIZE	SZ_4K
-+
-+static ffa_fn *invoke_ffa_fn;
-+
-+static const int ffa_linux_errmap[] = {
-+	/* better than switch case as long as return value is continuous */
-+	0,		/* FFA_RET_SUCCESS */
-+	-EOPNOTSUPP,	/* FFA_RET_NOT_SUPPORTED */
-+	-EINVAL,	/* FFA_RET_INVALID_PARAMETERS */
-+	-ENOMEM,	/* FFA_RET_NO_MEMORY */
-+	-EBUSY,		/* FFA_RET_BUSY */
-+	-EINTR,		/* FFA_RET_INTERRUPTED */
-+	-EACCES,	/* FFA_RET_DENIED */
-+	-EAGAIN,	/* FFA_RET_RETRY */
-+	-ECANCELED,	/* FFA_RET_ABORTED */
-+};
-+
-+static inline int ffa_to_linux_errno(int errno)
-+{
-+	int err_idx = -errno;
-+
-+	if (err_idx >= 0 && err_idx < ARRAY_SIZE(ffa_linux_errmap))
-+		return ffa_linux_errmap[err_idx];
-+	return -EINVAL;
-+}
-+
-+struct ffa_drv_info {
-+	u32 version;
-+	u16 vm_id;
-+	struct mutex rx_lock; /* lock to protect Rx buffer */
-+	struct mutex tx_lock; /* lock to protect Tx buffer */
-+	void *rx_buffer;
-+	void *tx_buffer;
-+};
-+
-+static struct ffa_drv_info *drv_info;
-+
-+/*
-+ * The driver must be able to support all the versions from the earliest
-+ * supported FFA_MIN_VERSION to the latest supported FFA_DRIVER_VERSION.
-+ * The specification states that if firmware supports a FFA implementation
-+ * that is incompatible with and at a greater version number than specified
-+ * by the caller(FFA_DRIVER_VERSION passed as parameter to FFA_VERSION),
-+ * it must return the NOT_SUPPORTED error code.
-+ */
-+static u32 ffa_compatible_version_find(u32 version)
-+{
-+	u16 major = MAJOR_VERSION(version), minor = MINOR_VERSION(version);
-+	u16 drv_major = MAJOR_VERSION(FFA_DRIVER_VERSION);
-+	u16 drv_minor = MINOR_VERSION(FFA_DRIVER_VERSION);
-+
-+	if ((major < drv_major) || (major == drv_major && minor <= drv_minor))
-+		return version;
-+
-+	pr_info("Firmware version higher than driver version, downgrading\n");
-+	return FFA_DRIVER_VERSION;
-+}
-+
-+static int ffa_version_check(u32 *version)
-+{
-+	ffa_value_t ver;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_VERSION, .a1 = FFA_DRIVER_VERSION,
-+		      }, &ver);
-+
-+	if (ver.a0 == FFA_RET_NOT_SUPPORTED) {
-+		pr_info("FFA_VERSION returned not supported\n");
-+		return -EOPNOTSUPP;
-+	}
-+
-+	if (ver.a0 < FFA_MIN_VERSION) {
-+		pr_err("Incompatible v%d.%d! Earliest supported v%d.%d\n",
-+		       MAJOR_VERSION(ver.a0), MINOR_VERSION(ver.a0),
-+		       MAJOR_VERSION(FFA_MIN_VERSION),
-+		       MINOR_VERSION(FFA_MIN_VERSION));
-+		return -EINVAL;
-+	}
-+
-+	pr_info("Driver version %d.%d\n", MAJOR_VERSION(FFA_DRIVER_VERSION),
-+		MINOR_VERSION(FFA_DRIVER_VERSION));
-+	pr_info("Firmware version %d.%d found\n", MAJOR_VERSION(ver.a0),
-+		MINOR_VERSION(ver.a0));
-+	*version = ffa_compatible_version_find(ver.a0);
-+
-+	return 0;
-+}
-+
-+static int ffa_rx_release(void)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_RX_RELEASE,
-+		      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	/* check for ret.a0 == FFA_RX_RELEASE ? */
-+
-+	return 0;
-+}
-+
-+static int ffa_rxtx_map(phys_addr_t tx_buf, phys_addr_t rx_buf, u32 pg_cnt)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_FN_NATIVE(RXTX_MAP),
-+		      .a1 = tx_buf, .a2 = rx_buf, .a3 = pg_cnt,
-+		      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	return 0;
-+}
-+
-+static int ffa_rxtx_unmap(u16 vm_id)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_RXTX_UNMAP, .a1 = PACK_TARGET_INFO(vm_id, 0),
-+		      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	return 0;
-+}
-+
-+/* buffer must be sizeof(struct ffa_partition_info) * num_partitions */
-+static int
-+__ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3,
-+			 struct ffa_partition_info *buffer, int num_partitions)
-+{
-+	int count;
-+	ffa_value_t partition_info;
-+
-+	mutex_lock(&drv_info->rx_lock);
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_PARTITION_INFO_GET,
-+		      .a1 = uuid0, .a2 = uuid1, .a3 = uuid2, .a4 = uuid3,
-+		      }, &partition_info);
-+
-+	if (partition_info.a0 == FFA_ERROR) {
-+		mutex_unlock(&drv_info->rx_lock);
-+		return ffa_to_linux_errno((int)partition_info.a2);
-+	}
-+
-+	count = partition_info.a2;
-+
-+	if (buffer && count <= num_partitions)
-+		memcpy(buffer, drv_info->rx_buffer, sizeof(*buffer) * count);
-+
-+	ffa_rx_release();
-+
-+	mutex_unlock(&drv_info->rx_lock);
-+
-+	return count;
-+}
-+
-+/* buffer is allocated and caller must free the same if returned count > 0 */
-+static int
-+ffa_partition_probe(const uuid_t *uuid, struct ffa_partition_info **buffer)
-+{
-+	int count;
-+	u32 uuid0_4[4];
-+	struct ffa_partition_info *pbuf;
-+
-+	export_uuid((u8 *)uuid0_4, uuid);
-+	count = __ffa_partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2],
-+					 uuid0_4[3], NULL, 0);
-+	if (count <= 0)
-+		return count;
-+
-+	pbuf = kcalloc(count, sizeof(*pbuf), GFP_KERNEL);
-+	if (!pbuf)
-+		return -ENOMEM;
-+
-+	count = __ffa_partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2],
-+					 uuid0_4[3], pbuf, count);
-+	if (count <= 0)
-+		kfree(pbuf);
-+	else
-+		*buffer = pbuf;
-+
-+	return count;
-+}
-+
-+#define VM_ID_MASK	GENMASK(15, 0)
-+static int ffa_id_get(u16 *vm_id)
-+{
-+	ffa_value_t id;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_ID_GET,
-+		      }, &id);
-+
-+	if (id.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)id.a2);
-+
-+	*vm_id = FIELD_GET(VM_ID_MASK, (id.a2));
-+
-+	return 0;
-+}
-+
-+static int ffa_msg_send_direct_req(u16 src_id, u16 dst_id, bool mode_32bit,
-+				   struct ffa_send_direct_data *data)
-+{
-+	u32 req_id, resp_id, src_dst_ids = PACK_TARGET_INFO(src_id, dst_id);
-+	ffa_value_t ret;
-+
-+	if (mode_32bit) {
-+		req_id = FFA_MSG_SEND_DIRECT_REQ;
-+		resp_id = FFA_MSG_SEND_DIRECT_RESP;
-+	} else {
-+		req_id = FFA_FN_NATIVE(MSG_SEND_DIRECT_REQ);
-+		resp_id = FFA_FN_NATIVE(MSG_SEND_DIRECT_RESP);
-+	}
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = req_id, .a1 = src_dst_ids, .a2 = 0,
-+		      .a3 = data->data0, .a4 = data->data1, .a5 = data->data2,
-+		      .a6 = data->data3, .a7 = data->data4,
-+		      }, &ret);
-+
-+	while (ret.a0 == FFA_INTERRUPT)
-+		invoke_ffa_fn((ffa_value_t){
-+			      .a0 = FFA_RUN, .a1 = ret.a1,
-+			      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	if (ret.a0 == resp_id) {
-+		data->data0 = ret.a3;
-+		data->data1 = ret.a4;
-+		data->data2 = ret.a5;
-+		data->data3 = ret.a6;
-+		data->data4 = ret.a7;
-+		return 0;
-+	}
-+
-+	return -EINVAL;
-+}
-+
-+static int ffa_mem_first_frag(u32 func_id, phys_addr_t buf, u32 buf_sz,
-+			      u32 frag_len, u32 len, u64 *handle)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = func_id, .a1 = len, .a2 = frag_len,
-+		      .a3 = buf, .a4 = buf_sz,
-+		      }, &ret);
-+
-+	while (ret.a0 == FFA_MEM_OP_PAUSE)
-+		invoke_ffa_fn((ffa_value_t){
-+			      .a0 = FFA_MEM_OP_RESUME,
-+			      .a1 = ret.a1, .a2 = ret.a2,
-+			      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	if (ret.a0 != FFA_SUCCESS)
-+		return -EOPNOTSUPP;
-+
-+	if (handle)
-+		*handle = PACK_HANDLE(ret.a2, ret.a3);
-+
-+	return frag_len;
-+}
-+
-+static int ffa_mem_next_frag(u64 handle, u32 frag_len)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_MEM_FRAG_TX,
-+		      .a1 = HANDLE_LOW(handle), .a2 = HANDLE_HIGH(handle),
-+		      .a3 = frag_len,
-+		      }, &ret);
-+
-+	while (ret.a0 == FFA_MEM_OP_PAUSE)
-+		invoke_ffa_fn((ffa_value_t){
-+			      .a0 = FFA_MEM_OP_RESUME,
-+			      .a1 = ret.a1, .a2 = ret.a2,
-+			      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	if (ret.a0 != FFA_MEM_FRAG_RX)
-+		return -EOPNOTSUPP;
-+
-+	return ret.a3;
-+}
-+
-+static int
-+ffa_transmit_fragment(u32 func_id, phys_addr_t buf, u32 buf_sz, u32 frag_len,
-+		      u32 len, u64 *handle, bool first)
-+{
-+	if (!first)
-+		return ffa_mem_next_frag(*handle, frag_len);
-+
-+	return ffa_mem_first_frag(func_id, buf, buf_sz, frag_len, len, handle);
-+}
-+
-+static u32 ffa_get_num_pages_sg(struct scatterlist *sg)
-+{
-+	u32 num_pages = 0;
-+
-+	do {
-+		num_pages += sg->length / FFA_PAGE_SIZE;
-+	} while ((sg = sg_next(sg)));
-+
-+	return num_pages;
-+}
-+
-+static int
-+ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
-+		       struct ffa_mem_ops_args *args)
-+{
-+	int rc = 0;
-+	bool first = true;
-+	phys_addr_t addr = 0;
-+	struct ffa_composite_mem_region *composite;
-+	struct ffa_mem_region_addr_range *constituents;
-+	struct ffa_mem_region_attributes *ep_mem_access;
-+	struct ffa_mem_region *mem_region = buffer;
-+	u32 idx, frag_len, length, buf_sz = 0, num_entries = sg_nents(args->sg);
-+
-+	mem_region->tag = args->tag;
-+	mem_region->flags = args->flags;
-+	mem_region->sender_id = drv_info->vm_id;
-+	mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK |
-+				 FFA_MEM_INNER_SHAREABLE;
-+	ep_mem_access = &mem_region->ep_mem_access[0];
-+
-+	for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {
-+		ep_mem_access->receiver = args->attrs[idx].receiver;
-+		ep_mem_access->attrs = args->attrs[idx].attrs;
-+		ep_mem_access->composite_off = COMPOSITE_OFFSET(args->nattrs);
-+	}
-+	mem_region->ep_count = args->nattrs;
-+
-+	composite = buffer + COMPOSITE_OFFSET(args->nattrs);
-+	composite->total_pg_cnt = ffa_get_num_pages_sg(args->sg);
-+	composite->addr_range_cnt = num_entries;
-+
-+	length = COMPOSITE_CONSTITUENTS_OFFSET(args->nattrs, num_entries);
-+	frag_len = COMPOSITE_CONSTITUENTS_OFFSET(args->nattrs, 0);
-+	if (frag_len > max_fragsize)
-+		return -ENXIO;
-+
-+	if (!args->use_txbuf) {
-+		addr = virt_to_phys(buffer);
-+		buf_sz = max_fragsize / FFA_PAGE_SIZE;
-+	}
-+
-+	constituents = buffer + frag_len;
-+	idx = 0;
-+	do {
-+		if (frag_len == max_fragsize) {
-+			rc = ffa_transmit_fragment(func_id, addr, buf_sz,
-+						   frag_len, length,
-+						   &args->g_handle, first);
-+			if (rc < 0)
-+				return -ENXIO;
-+
-+			first = false;
-+			idx = 0;
-+			frag_len = 0;
-+			constituents = buffer;
-+		}
-+
-+		if ((void *)constituents - buffer > max_fragsize) {
-+			pr_err("Memory Region Fragment > Tx Buffer size\n");
-+			return -EFAULT;
-+		}
-+
-+		constituents->address = sg_phys(args->sg);
-+		constituents->pg_cnt = args->sg->length / FFA_PAGE_SIZE;
-+		constituents++;
-+		frag_len += sizeof(struct ffa_mem_region_addr_range);
-+	} while ((args->sg = sg_next(args->sg)));
-+
-+	return ffa_transmit_fragment(func_id, addr, buf_sz, frag_len,
-+				     length, &args->g_handle, first);
-+}
-+
-+static int ffa_memory_ops(u32 func_id, struct ffa_mem_ops_args *args)
-+{
-+	int ret;
-+	void *buffer;
-+
-+	if (!args->use_txbuf) {
-+		buffer = alloc_pages_exact(RXTX_BUFFER_SIZE, GFP_KERNEL);
-+		if (!buffer)
-+			return -ENOMEM;
-+	} else {
-+		buffer = drv_info->tx_buffer;
-+		mutex_lock(&drv_info->tx_lock);
-+	}
-+
-+	ret = ffa_setup_and_transmit(func_id, buffer, RXTX_BUFFER_SIZE, args);
-+
-+	if (args->use_txbuf)
-+		mutex_unlock(&drv_info->tx_lock);
-+	else
-+		free_pages_exact(buffer, RXTX_BUFFER_SIZE);
-+
-+	return ret < 0 ? ret : 0;
-+}
-+
-+static int ffa_memory_reclaim(u64 g_handle, u32 flags)
-+{
-+	ffa_value_t ret;
-+
-+	invoke_ffa_fn((ffa_value_t){
-+		      .a0 = FFA_MEM_RECLAIM,
-+		      .a1 = HANDLE_LOW(g_handle), .a2 = HANDLE_HIGH(g_handle),
-+		      .a3 = flags,
-+		      }, &ret);
-+
-+	if (ret.a0 == FFA_ERROR)
-+		return ffa_to_linux_errno((int)ret.a2);
-+
-+	return 0;
-+}
-+
-+static u32 ffa_api_version_get(void)
-+{
-+	return drv_info->version;
-+}
-+
-+static int ffa_partition_info_get(const char *uuid_str,
-+				  struct ffa_partition_info *buffer)
-+{
-+	int count;
-+	uuid_t uuid;
-+	struct ffa_partition_info *pbuf;
-+
-+	if (uuid_parse(uuid_str, &uuid)) {
-+		pr_err("invalid uuid (%s)\n", uuid_str);
-+		return -ENODEV;
-+	}
-+
-+	count = ffa_partition_probe(&uuid_null, &pbuf);
-+	if (count <= 0)
-+		return -ENOENT;
-+
-+	memcpy(buffer, pbuf, sizeof(*pbuf) * count);
-+	kfree(pbuf);
-+	return 0;
-+}
-+
-+static void ffa_mode_32bit_set(struct ffa_device *dev)
-+{
-+	dev->mode_32bit = true;
-+}
-+
-+static int ffa_sync_send_receive(struct ffa_device *dev,
-+				 struct ffa_send_direct_data *data)
-+{
-+	return ffa_msg_send_direct_req(drv_info->vm_id, dev->vm_id,
-+				       dev->mode_32bit, data);
-+}
-+
-+static int
-+ffa_memory_share(struct ffa_device *dev, struct ffa_mem_ops_args *args)
-+{
-+	if (dev->mode_32bit)
-+		return ffa_memory_ops(FFA_MEM_SHARE, args);
-+
-+	return ffa_memory_ops(FFA_FN_NATIVE(MEM_SHARE), args);
-+}
-+
-+static int
-+ffa_memory_lend(struct ffa_device *dev, struct ffa_mem_ops_args *args)
-+{
-+	/* Note that upon a successful MEM_LEND request the caller
-+	 * must ensure that the memory region specified is not accessed
-+	 * until a successful MEM_RECALIM call has been made.
-+	 * On systems with a hypervisor present this will been enforced,
-+	 * however on systems without a hypervisor the responsibility
-+	 * falls to the calling kernel driver to prevent access.
-+	 */
-+	if (dev->mode_32bit)
-+		return ffa_memory_ops(FFA_MEM_LEND, args);
-+
-+	return ffa_memory_ops(FFA_FN_NATIVE(MEM_LEND), args);
-+}
-+
-+static const struct ffa_dev_ops ffa_ops = {
-+	.api_version_get = ffa_api_version_get,
-+	.partition_info_get = ffa_partition_info_get,
-+	.mode_32bit_set = ffa_mode_32bit_set,
-+	.sync_send_receive = ffa_sync_send_receive,
-+	.memory_reclaim = ffa_memory_reclaim,
-+	.memory_share = ffa_memory_share,
-+	.memory_lend = ffa_memory_lend,
-+};
-+
-+const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev)
-+{
-+	if (ffa_device_is_valid(dev))
-+		return &ffa_ops;
-+
-+	return NULL;
-+}
-+EXPORT_SYMBOL_GPL(ffa_dev_ops_get);
-+
-+void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid)
-+{
-+	int count, idx;
-+	struct ffa_partition_info *pbuf, *tpbuf;
-+
-+	count = ffa_partition_probe(uuid, &pbuf);
-+	if (count <= 0)
-+		return;
-+
-+	for (idx = 0, tpbuf = pbuf; idx < count; idx++, tpbuf++)
-+		if (tpbuf->id == ffa_dev->vm_id)
-+			uuid_copy(&ffa_dev->uuid, uuid);
-+	kfree(pbuf);
-+}
-+
-+static void ffa_setup_partitions(void)
-+{
-+	int count, idx;
-+	struct ffa_device *ffa_dev;
-+	struct ffa_partition_info *pbuf, *tpbuf;
-+
-+	count = ffa_partition_probe(&uuid_null, &pbuf);
-+	if (count <= 0) {
-+		pr_info("%s: No partitions found, error %d\n", __func__, count);
-+		return;
-+	}
-+
-+	for (idx = 0, tpbuf = pbuf; idx < count; idx++, tpbuf++) {
-+		/* Note that the &uuid_null parameter will require
-+		 * ffa_device_match() to find the UUID of this partition id
-+		 * with help of ffa_device_match_uuid(). Once the FF-A spec
-+		 * is updated to provide correct UUID here for each partition
-+		 * as part of the discovery API, we need to pass the
-+		 * discovered UUID here instead.
-+		 */
-+		ffa_dev = ffa_device_register(&uuid_null, tpbuf->id);
-+		if (!ffa_dev) {
-+			pr_err("%s: failed to register partition ID 0x%x\n",
-+			       __func__, tpbuf->id);
-+			continue;
-+		}
-+
-+		ffa_dev_set_drvdata(ffa_dev, drv_info);
-+	}
-+	kfree(pbuf);
-+}
-+
-+static int __init ffa_init(void)
-+{
-+	int ret;
-+
-+	ret = ffa_transport_init(&invoke_ffa_fn);
-+	if (ret)
-+		return ret;
-+
-+	ret = arm_ffa_bus_init();
-+	if (ret)
-+		return ret;
-+
-+	drv_info = kzalloc(sizeof(*drv_info), GFP_KERNEL);
-+	if (!drv_info) {
-+		ret = -ENOMEM;
-+		goto ffa_bus_exit;
-+	}
-+
-+	ret = ffa_version_check(&drv_info->version);
-+	if (ret)
-+		goto free_drv_info;
-+
-+	if (ffa_id_get(&drv_info->vm_id)) {
-+		pr_err("failed to obtain VM id for self\n");
-+		ret = -ENODEV;
-+		goto free_drv_info;
-+	}
-+
-+	drv_info->rx_buffer = alloc_pages_exact(RXTX_BUFFER_SIZE, GFP_KERNEL);
-+	if (!drv_info->rx_buffer) {
-+		ret = -ENOMEM;
-+		goto free_pages;
-+	}
-+
-+	drv_info->tx_buffer = alloc_pages_exact(RXTX_BUFFER_SIZE, GFP_KERNEL);
-+	if (!drv_info->tx_buffer) {
-+		ret = -ENOMEM;
-+		goto free_pages;
-+	}
-+
-+	ret = ffa_rxtx_map(virt_to_phys(drv_info->tx_buffer),
-+			   virt_to_phys(drv_info->rx_buffer),
-+			   RXTX_BUFFER_SIZE / FFA_PAGE_SIZE);
-+	if (ret) {
-+		pr_err("failed to register FFA RxTx buffers\n");
-+		goto free_pages;
-+	}
-+
-+	mutex_init(&drv_info->rx_lock);
-+	mutex_init(&drv_info->tx_lock);
-+
-+	ffa_setup_partitions();
-+
-+	return 0;
-+free_pages:
-+	if (drv_info->tx_buffer)
-+		free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
-+	free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
-+free_drv_info:
-+	kfree(drv_info);
-+ffa_bus_exit:
-+	arm_ffa_bus_exit();
-+	return ret;
-+}
-+subsys_initcall(ffa_init);
-+
-+static void __exit ffa_exit(void)
-+{
-+	ffa_rxtx_unmap(drv_info->vm_id);
-+	free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
-+	free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
-+	kfree(drv_info);
-+	arm_ffa_bus_exit();
-+}
-+module_exit(ffa_exit);
-+
-+MODULE_ALIAS("arm-ffa");
-+MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
-+MODULE_DESCRIPTION("Arm FF-A interface driver");
-+MODULE_LICENSE("GPL v2");
-diff --git a/drivers/firmware/arm_ffa/smccc.c b/drivers/firmware/arm_ffa/smccc.c
-new file mode 100644
-index 000000000000..4d85bfff0a4e
---- /dev/null
-+++ b/drivers/firmware/arm_ffa/smccc.c
-@@ -0,0 +1,39 @@
-+// SPDX-License-Identifier: GPL-2.0-only
-+/*
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#include <linux/printk.h>
-+
-+#include "common.h"
-+
-+static void __arm_ffa_fn_smc(ffa_value_t args, ffa_value_t *res)
-+{
-+	arm_smccc_1_2_smc(&args, res);
-+}
-+
-+static void __arm_ffa_fn_hvc(ffa_value_t args, ffa_value_t *res)
-+{
-+	arm_smccc_1_2_hvc(&args, res);
-+}
-+
-+int __init ffa_transport_init(ffa_fn **invoke_ffa_fn)
-+{
-+	enum arm_smccc_conduit conduit;
-+
-+	if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
-+		return -EOPNOTSUPP;
-+
-+	conduit = arm_smccc_1_1_get_conduit();
-+	if (conduit == SMCCC_CONDUIT_NONE) {
-+		pr_err("%s: invalid SMCCC conduit\n", __func__);
-+		return -EOPNOTSUPP;
-+	}
-+
-+	if (conduit == SMCCC_CONDUIT_SMC)
-+		*invoke_ffa_fn = __arm_ffa_fn_smc;
-+	else
-+		*invoke_ffa_fn = __arm_ffa_fn_hvc;
-+
-+	return 0;
-+}
-diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
-index 62c54234576c..c8eb24af3c62 100644
---- a/include/linux/arm-smccc.h
-+++ b/include/linux/arm-smccc.h
-@@ -186,6 +186,61 @@ struct arm_smccc_res {
- 	unsigned long a3;
- };
- 
-+#ifdef CONFIG_ARM64
-+/**
-+ * struct arm_smccc_1_2_regs - Arguments for or Results from SMC/HVC 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_hvc() - make HVC 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 HVC 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 HVC instruction. The return values
-+ * are updated with the content from registers on return from the HVC
-+ * instruction.
-+ */
-+asmlinkage void arm_smccc_1_2_hvc(const struct arm_smccc_1_2_regs *args,
-+				  struct arm_smccc_1_2_regs *res);
-+
-+/**
-+ * 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/linux/arm_ffa.h b/include/linux/arm_ffa.h
-new file mode 100644
-index 000000000000..85651e41ded8
---- /dev/null
-+++ b/include/linux/arm_ffa.h
-@@ -0,0 +1,269 @@
-+/* SPDX-License-Identifier: GPL-2.0-only */
-+/*
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#ifndef _LINUX_ARM_FFA_H
-+#define _LINUX_ARM_FFA_H
-+
-+#include <linux/device.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/uuid.h>
-+
-+/* FFA Bus/Device/Driver related */
-+struct ffa_device {
-+	int vm_id;
-+	bool mode_32bit;
-+	uuid_t uuid;
-+	struct device dev;
-+};
-+
-+#define to_ffa_dev(d) container_of(d, struct ffa_device, dev)
-+
-+struct ffa_device_id {
-+	uuid_t uuid;
-+};
-+
-+struct ffa_driver {
-+	const char *name;
-+	int (*probe)(struct ffa_device *sdev);
-+	void (*remove)(struct ffa_device *sdev);
-+	const struct ffa_device_id *id_table;
-+
-+	struct device_driver driver;
-+};
-+
-+#define to_ffa_driver(d) container_of(d, struct ffa_driver, driver)
-+
-+static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data)
-+{
-+	fdev->dev.driver_data = data;
-+}
-+
-+#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
-+struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id);
-+void ffa_device_unregister(struct ffa_device *ffa_dev);
-+int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
-+			const char *mod_name);
-+void ffa_driver_unregister(struct ffa_driver *driver);
-+bool ffa_device_is_valid(struct ffa_device *ffa_dev);
-+const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev);
-+
-+#else
-+static inline
-+struct ffa_device *ffa_device_register(const uuid_t *uuid, int vm_id)
-+{
-+	return NULL;
-+}
-+
-+static inline void ffa_device_unregister(struct ffa_device *dev) {}
-+
-+static inline int
-+ffa_driver_register(struct ffa_driver *driver, struct module *owner,
-+		    const char *mod_name)
-+{
-+	return -EINVAL;
-+}
-+
-+static inline void ffa_driver_unregister(struct ffa_driver *driver) {}
-+
-+static inline
-+bool ffa_device_is_valid(struct ffa_device *ffa_dev) { return false; }
-+
-+static inline
-+const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev)
-+{
-+	return NULL;
-+}
-+#endif /* CONFIG_ARM_FFA_TRANSPORT */
-+
-+#define ffa_register(driver) \
-+	ffa_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
-+#define ffa_unregister(driver) \
-+	ffa_driver_unregister(driver)
-+
-+/**
-+ * module_ffa_driver() - Helper macro for registering a psa_ffa driver
-+ * @__ffa_driver: ffa_driver structure
-+ *
-+ * Helper macro for psa_ffa drivers to set up proper module init / exit
-+ * functions.  Replaces module_init() and module_exit() and keeps people from
-+ * printing pointless things to the kernel log when their driver is loaded.
-+ */
-+#define module_ffa_driver(__ffa_driver)	\
-+	module_driver(__ffa_driver, ffa_register, ffa_unregister)
-+
-+/* FFA transport related */
-+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;
-+};
-+
-+/* For use with FFA_MSG_SEND_DIRECT_{REQ,RESP} which pass data via registers */
-+struct ffa_send_direct_data {
-+	unsigned long data0; /* w3/x3 */
-+	unsigned long data1; /* w4/x4 */
-+	unsigned long data2; /* w5/x5 */
-+	unsigned long data3; /* w6/x6 */
-+	unsigned long data4; /* w7/x7 */
-+};
-+
-+struct ffa_mem_region_addr_range {
-+	/* The base IPA of the constituent memory region, aligned to 4 kiB */
-+	u64 address;
-+	/* The number of 4 kiB pages in the constituent memory region. */
-+	u32 pg_cnt;
-+	u32 reserved;
-+};
-+
-+struct ffa_composite_mem_region {
-+	/*
-+	 * The total number of 4 kiB pages included in this memory region. This
-+	 * must be equal to the sum of page counts specified in each
-+	 * `struct ffa_mem_region_addr_range`.
-+	 */
-+	u32 total_pg_cnt;
-+	/* The number of constituents included in this memory region range */
-+	u32 addr_range_cnt;
-+	u64 reserved;
-+	/** An array of `addr_range_cnt` memory region constituents. */
-+	struct ffa_mem_region_addr_range constituents[];
-+};
-+
-+struct ffa_mem_region_attributes {
-+	/* The ID of the VM to which the memory is being given or shared. */
-+	u16 receiver;
-+	/*
-+	 * The permissions with which the memory region should be mapped in the
-+	 * receiver's page table.
-+	 */
-+#define FFA_MEM_EXEC		BIT(3)
-+#define FFA_MEM_NO_EXEC		BIT(2)
-+#define FFA_MEM_RW		BIT(1)
-+#define FFA_MEM_RO		BIT(0)
-+	u8 attrs;
-+	/*
-+	 * Flags used during FFA_MEM_RETRIEVE_REQ and FFA_MEM_RETRIEVE_RESP
-+	 * for memory regions with multiple borrowers.
-+	 */
-+#define FFA_MEM_RETRIEVE_SELF_BORROWER	BIT(0)
-+	u8 flag;
-+	u32 composite_off;
-+	/*
-+	 * Offset in bytes from the start of the outer `ffa_memory_region` to
-+	 * an `struct ffa_mem_region_addr_range`.
-+	 */
-+	u64 reserved;
-+};
-+
-+struct ffa_mem_region {
-+	/* The ID of the VM/owner which originally sent the memory region */
-+	u16 sender_id;
-+#define FFA_MEM_NORMAL		BIT(5)
-+#define FFA_MEM_DEVICE		BIT(4)
-+
-+#define FFA_MEM_WRITE_BACK	(3 << 2)
-+#define FFA_MEM_NON_CACHEABLE	(1 << 2)
-+
-+#define FFA_DEV_nGnRnE		(0 << 2)
-+#define FFA_DEV_nGnRE		(1 << 2)
-+#define FFA_DEV_nGRE		(2 << 2)
-+#define FFA_DEV_GRE		(3 << 2)
-+
-+#define FFA_MEM_NON_SHAREABLE	(0)
-+#define FFA_MEM_OUTER_SHAREABLE	(2)
-+#define FFA_MEM_INNER_SHAREABLE	(3)
-+	u8 attributes;
-+	u8 reserved_0;
-+/*
-+ * Clear memory region contents after unmapping it from the sender and
-+ * before mapping it for any receiver.
-+ */
-+#define FFA_MEM_CLEAR			BIT(0)
-+/*
-+ * Whether the hypervisor may time slice the memory sharing or retrieval
-+ * operation.
-+ */
-+#define FFA_TIME_SLICE_ENABLE		BIT(1)
-+
-+#define FFA_MEM_RETRIEVE_TYPE_IN_RESP	(0 << 3)
-+#define FFA_MEM_RETRIEVE_TYPE_SHARE	(1 << 3)
-+#define FFA_MEM_RETRIEVE_TYPE_LEND	(2 << 3)
-+#define FFA_MEM_RETRIEVE_TYPE_DONATE	(3 << 3)
-+
-+#define FFA_MEM_RETRIEVE_ADDR_ALIGN_HINT	BIT(9)
-+#define FFA_MEM_RETRIEVE_ADDR_ALIGN(x)		((x) << 5)
-+	/* Flags to control behaviour of the transaction. */
-+	u32 flags;
-+#define HANDLE_LOW_MASK		GENMASK_ULL(31, 0)
-+#define HANDLE_HIGH_MASK	GENMASK_ULL(63, 32)
-+#define HANDLE_LOW(x)		((u32)(FIELD_GET(HANDLE_LOW_MASK, (x))))
-+#define	HANDLE_HIGH(x)		((u32)(FIELD_GET(HANDLE_HIGH_MASK, (x))))
-+
-+#define PACK_HANDLE(l, h)		\
-+	(FIELD_PREP(HANDLE_LOW_MASK, (l)) | FIELD_PREP(HANDLE_HIGH_MASK, (h)))
-+	/*
-+	 * A globally-unique ID assigned by the hypervisor for a region
-+	 * of memory being sent between VMs.
-+	 */
-+	u64 handle;
-+	/*
-+	 * An implementation defined value associated with the receiver and the
-+	 * memory region.
-+	 */
-+	u64 tag;
-+	u32 reserved_1;
-+	/*
-+	 * The number of `ffa_mem_region_attributes` entries included in this
-+	 * transaction.
-+	 */
-+	u32 ep_count;
-+	/*
-+	 * An array of endpoint memory access descriptors.
-+	 * Each one specifies a memory region offset, an endpoint and the
-+	 * attributes with which this memory region should be mapped in that
-+	 * endpoint's page table.
-+	 */
-+	struct ffa_mem_region_attributes ep_mem_access[];
-+};
-+
-+#define	COMPOSITE_OFFSET(x)	\
-+	(offsetof(struct ffa_mem_region, ep_mem_access[x]))
-+#define CONSTITUENTS_OFFSET(x)	\
-+	(offsetof(struct ffa_composite_mem_region, constituents[x]))
-+#define COMPOSITE_CONSTITUENTS_OFFSET(x, y)	\
-+	(COMPOSITE_OFFSET(x) + CONSTITUENTS_OFFSET(y))
-+
-+struct ffa_mem_ops_args {
-+	bool use_txbuf;
-+	u32 nattrs;
-+	u32 flags;
-+	u64 tag;
-+	u64 g_handle;
-+	struct scatterlist *sg;
-+	struct ffa_mem_region_attributes *attrs;
-+};
-+
-+struct ffa_dev_ops {
-+	u32 (*api_version_get)(void);
-+	int (*partition_info_get)(const char *uuid_str,
-+				  struct ffa_partition_info *buffer);
-+	void (*mode_32bit_set)(struct ffa_device *dev);
-+	int (*sync_send_receive)(struct ffa_device *dev,
-+				 struct ffa_send_direct_data *data);
-+	int (*memory_reclaim)(u64 g_handle, u32 flags);
-+	int (*memory_share)(struct ffa_device *dev,
-+			    struct ffa_mem_ops_args *args);
-+	int (*memory_lend)(struct ffa_device *dev,
-+			   struct ffa_mem_ops_args *args);
-+};
-+
-+#endif /* _LINUX_ARM_FFA_H */
--- 
-2.30.2
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0011-optee-sync-OP-TEE-headers.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0011-optee-sync-OP-TEE-headers.patch
deleted file mode 100644
index 5e3e868..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0011-optee-sync-OP-TEE-headers.patch
+++ /dev/null
@@ -1,644 +0,0 @@
-From 1e43bd55c951da0610230c4f28a8ebdd13b30733 Mon Sep 17 00:00:00 2001
-From: Jens Wiklander <jens.wiklander@linaro.org>
-Date: Wed, 20 Jan 2021 11:14:12 +0100
-Subject: [PATCH 16/22] optee: sync OP-TEE headers
-
-Pulls in updates in the internal headers from OP-TEE OS [1]. A few
-defines has been shortened, hence the changes in rpc.c. Defines not used
-by the driver in tee_rpc_cmd.h has been filtered out.
-
-Note that this does not change the ABI.
-
-Link: [1] https://github.com/OP-TEE/optee_os
-Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
-Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-Change-Id: I5d20a22a3f38bfc9d232279d5f00505c4d3ba965
-
-Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.13-rc7&id=617d8e8b347edcee6da38df0aeb671fc9c9ba19c]
----
- drivers/tee/optee/optee_msg.h     | 156 ++----------------------------
- drivers/tee/optee/optee_rpc_cmd.h | 103 ++++++++++++++++++++
- drivers/tee/optee/optee_smc.h     |  70 +++++++++-----
- drivers/tee/optee/rpc.c           |  39 ++++----
- 4 files changed, 179 insertions(+), 189 deletions(-)
- create mode 100644 drivers/tee/optee/optee_rpc_cmd.h
-
-diff --git a/drivers/tee/optee/optee_msg.h b/drivers/tee/optee/optee_msg.h
-index c7ac7d02d6cc..5bef6a0165db 100644
---- a/drivers/tee/optee/optee_msg.h
-+++ b/drivers/tee/optee/optee_msg.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
- /*
-- * Copyright (c) 2015-2019, Linaro Limited
-+ * Copyright (c) 2015-2021, Linaro Limited
-  */
- #ifndef _OPTEE_MSG_H
- #define _OPTEE_MSG_H
-@@ -12,11 +12,9 @@
-  * This file defines the OP-TEE message protocol (ABI) used to communicate
-  * with an instance of OP-TEE running in secure world.
-  *
-- * This file is divided into three sections.
-+ * This file is divided into two sections.
-  * 1. Formatting of messages.
-  * 2. Requests from normal world
-- * 3. Requests from secure world, Remote Procedure Call (RPC), handled by
-- *    tee-supplicant.
-  */
- 
- /*****************************************************************************
-@@ -54,8 +52,8 @@
-  * Every entry in buffer should point to a 4k page beginning (12 least
-  * significant bits must be equal to zero).
-  *
-- * 12 least significant bints of optee_msg_param.u.tmem.buf_ptr should hold page
-- * offset of the user buffer.
-+ * 12 least significant bits of optee_msg_param.u.tmem.buf_ptr should hold
-+ * page offset of user buffer.
-  *
-  * So, entries should be placed like members of this structure:
-  *
-@@ -178,17 +176,9 @@ struct optee_msg_param {
-  * @params: the parameters supplied to the OS Command
-  *
-  * All normal calls to Trusted OS uses this struct. If cmd requires further
-- * information than what these field holds it can be passed as a parameter
-+ * information than what these fields hold it can be passed as a parameter
-  * tagged as meta (setting the OPTEE_MSG_ATTR_META bit in corresponding
-- * attrs field). All parameters tagged as meta has to come first.
-- *
-- * Temp memref parameters can be fragmented if supported by the Trusted OS
-- * (when optee_smc.h is bearer of this protocol this is indicated with
-- * OPTEE_SMC_SEC_CAP_UNREGISTERED_SHM). If a logical memref parameter is
-- * fragmented then has all but the last fragment the
-- * OPTEE_MSG_ATTR_FRAGMENT bit set in attrs. Even if a memref is fragmented
-- * it will still be presented as a single logical memref to the Trusted
-- * Application.
-+ * attrs field). All parameters tagged as meta have to come first.
-  */
- struct optee_msg_arg {
- 	u32 cmd;
-@@ -292,15 +282,12 @@ struct optee_msg_arg {
-  * OPTEE_MSG_CMD_REGISTER_SHM registers a shared memory reference. The
-  * information is passed as:
-  * [in] param[0].attr			OPTEE_MSG_ATTR_TYPE_TMEM_INPUT
-- *					[| OPTEE_MSG_ATTR_FRAGMENT]
-+ *					[| OPTEE_MSG_ATTR_NONCONTIG]
-  * [in] param[0].u.tmem.buf_ptr		physical address (of first fragment)
-  * [in] param[0].u.tmem.size		size (of first fragment)
-  * [in] param[0].u.tmem.shm_ref		holds shared memory reference
-- * ...
-- * The shared memory can optionally be fragmented, temp memrefs can follow
-- * each other with all but the last with the OPTEE_MSG_ATTR_FRAGMENT bit set.
-  *
-- * OPTEE_MSG_CMD_UNREGISTER_SHM unregisteres a previously registered shared
-+ * OPTEE_MSG_CMD_UNREGISTER_SHM unregisters a previously registered shared
-  * memory reference. The information is passed as:
-  * [in] param[0].attr			OPTEE_MSG_ATTR_TYPE_RMEM_INPUT
-  * [in] param[0].u.rmem.shm_ref		holds shared memory reference
-@@ -315,131 +302,4 @@ struct optee_msg_arg {
- #define OPTEE_MSG_CMD_UNREGISTER_SHM	5
- #define OPTEE_MSG_FUNCID_CALL_WITH_ARG	0x0004
- 
--/*****************************************************************************
-- * Part 3 - Requests from secure world, RPC
-- *****************************************************************************/
--
--/*
-- * All RPC is done with a struct optee_msg_arg as bearer of information,
-- * struct optee_msg_arg::arg holds values defined by OPTEE_MSG_RPC_CMD_* below
-- *
-- * RPC communication with tee-supplicant is reversed compared to normal
-- * client communication desribed above. The supplicant receives requests
-- * and sends responses.
-- */
--
--/*
-- * Load a TA into memory, defined in tee-supplicant
-- */
--#define OPTEE_MSG_RPC_CMD_LOAD_TA	0
--
--/*
-- * Reserved
-- */
--#define OPTEE_MSG_RPC_CMD_RPMB		1
--
--/*
-- * File system access, defined in tee-supplicant
-- */
--#define OPTEE_MSG_RPC_CMD_FS		2
--
--/*
-- * Get time
-- *
-- * Returns number of seconds and nano seconds since the Epoch,
-- * 1970-01-01 00:00:00 +0000 (UTC).
-- *
-- * [out] param[0].u.value.a	Number of seconds
-- * [out] param[0].u.value.b	Number of nano seconds.
-- */
--#define OPTEE_MSG_RPC_CMD_GET_TIME	3
--
--/*
-- * Wait queue primitive, helper for secure world to implement a wait queue.
-- *
-- * If secure world need to wait for a secure world mutex it issues a sleep
-- * request instead of spinning in secure world. Conversely is a wakeup
-- * request issued when a secure world mutex with a thread waiting thread is
-- * unlocked.
-- *
-- * Waiting on a key
-- * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP
-- * [in] param[0].u.value.b wait key
-- *
-- * Waking up a key
-- * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP
-- * [in] param[0].u.value.b wakeup key
-- */
--#define OPTEE_MSG_RPC_CMD_WAIT_QUEUE	4
--#define OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP	0
--#define OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP	1
--
--/*
-- * Suspend execution
-- *
-- * [in] param[0].value	.a number of milliseconds to suspend
-- */
--#define OPTEE_MSG_RPC_CMD_SUSPEND	5
--
--/*
-- * Allocate a piece of shared memory
-- *
-- * Shared memory can optionally be fragmented, to support that additional
-- * spare param entries are allocated to make room for eventual fragments.
-- * The spare param entries has .attr = OPTEE_MSG_ATTR_TYPE_NONE when
-- * unused. All returned temp memrefs except the last should have the
-- * OPTEE_MSG_ATTR_FRAGMENT bit set in the attr field.
-- *
-- * [in]  param[0].u.value.a		type of memory one of
-- *					OPTEE_MSG_RPC_SHM_TYPE_* below
-- * [in]  param[0].u.value.b		requested size
-- * [in]  param[0].u.value.c		required alignment
-- *
-- * [out] param[0].u.tmem.buf_ptr	physical address (of first fragment)
-- * [out] param[0].u.tmem.size		size (of first fragment)
-- * [out] param[0].u.tmem.shm_ref	shared memory reference
-- * ...
-- * [out] param[n].u.tmem.buf_ptr	physical address
-- * [out] param[n].u.tmem.size		size
-- * [out] param[n].u.tmem.shm_ref	shared memory reference (same value
-- *					as in param[n-1].u.tmem.shm_ref)
-- */
--#define OPTEE_MSG_RPC_CMD_SHM_ALLOC	6
--/* Memory that can be shared with a non-secure user space application */
--#define OPTEE_MSG_RPC_SHM_TYPE_APPL	0
--/* Memory only shared with non-secure kernel */
--#define OPTEE_MSG_RPC_SHM_TYPE_KERNEL	1
--
--/*
-- * Free shared memory previously allocated with OPTEE_MSG_RPC_CMD_SHM_ALLOC
-- *
-- * [in]  param[0].u.value.a		type of memory one of
-- *					OPTEE_MSG_RPC_SHM_TYPE_* above
-- * [in]  param[0].u.value.b		value of shared memory reference
-- *					returned in param[0].u.tmem.shm_ref
-- *					above
-- */
--#define OPTEE_MSG_RPC_CMD_SHM_FREE	7
--
--/*
-- * Access a device on an i2c bus
-- *
-- * [in]  param[0].u.value.a		mode: RD(0), WR(1)
-- * [in]  param[0].u.value.b		i2c adapter
-- * [in]  param[0].u.value.c		i2c chip
-- *
-- * [in]  param[1].u.value.a		i2c control flags
-- *
-- * [in/out] memref[2]			buffer to exchange the transfer data
-- *					with the secure world
-- *
-- * [out]  param[3].u.value.a		bytes transferred by the driver
-- */
--#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21
--/* I2C master transfer modes */
--#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0
--#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1
--/* I2C master control flags */
--#define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT  BIT(0)
--
- #endif /* _OPTEE_MSG_H */
-diff --git a/drivers/tee/optee/optee_rpc_cmd.h b/drivers/tee/optee/optee_rpc_cmd.h
-new file mode 100644
-index 000000000000..b8275140cef8
---- /dev/null
-+++ b/drivers/tee/optee/optee_rpc_cmd.h
-@@ -0,0 +1,103 @@
-+/* SPDX-License-Identifier: BSD-2-Clause */
-+/*
-+ * Copyright (c) 2016-2021, Linaro Limited
-+ */
-+
-+#ifndef __OPTEE_RPC_CMD_H
-+#define __OPTEE_RPC_CMD_H
-+
-+/*
-+ * All RPC is done with a struct optee_msg_arg as bearer of information,
-+ * struct optee_msg_arg::arg holds values defined by OPTEE_RPC_CMD_* below.
-+ * Only the commands handled by the kernel driver are defined here.
-+ *
-+ * RPC communication with tee-supplicant is reversed compared to normal
-+ * client communication described above. The supplicant receives requests
-+ * and sends responses.
-+ */
-+
-+/*
-+ * Get time
-+ *
-+ * Returns number of seconds and nano seconds since the Epoch,
-+ * 1970-01-01 00:00:00 +0000 (UTC).
-+ *
-+ * [out]    value[0].a	    Number of seconds
-+ * [out]    value[0].b	    Number of nano seconds.
-+ */
-+#define OPTEE_RPC_CMD_GET_TIME		3
-+
-+/*
-+ * Wait queue primitive, helper for secure world to implement a wait queue.
-+ *
-+ * If secure world needs to wait for a secure world mutex it issues a sleep
-+ * request instead of spinning in secure world. Conversely is a wakeup
-+ * request issued when a secure world mutex with a thread waiting thread is
-+ * unlocked.
-+ *
-+ * Waiting on a key
-+ * [in]    value[0].a	    OPTEE_RPC_WAIT_QUEUE_SLEEP
-+ * [in]    value[0].b	    Wait key
-+ *
-+ * Waking up a key
-+ * [in]    value[0].a	    OPTEE_RPC_WAIT_QUEUE_WAKEUP
-+ * [in]    value[0].b	    Wakeup key
-+ */
-+#define OPTEE_RPC_CMD_WAIT_QUEUE	4
-+#define OPTEE_RPC_WAIT_QUEUE_SLEEP	0
-+#define OPTEE_RPC_WAIT_QUEUE_WAKEUP	1
-+
-+/*
-+ * Suspend execution
-+ *
-+ * [in]    value[0].a	Number of milliseconds to suspend
-+ */
-+#define OPTEE_RPC_CMD_SUSPEND		5
-+
-+/*
-+ * Allocate a piece of shared memory
-+ *
-+ * [in]    value[0].a	    Type of memory one of
-+ *			    OPTEE_RPC_SHM_TYPE_* below
-+ * [in]    value[0].b	    Requested size
-+ * [in]    value[0].c	    Required alignment
-+ * [out]   memref[0]	    Buffer
-+ */
-+#define OPTEE_RPC_CMD_SHM_ALLOC		6
-+/* Memory that can be shared with a non-secure user space application */
-+#define OPTEE_RPC_SHM_TYPE_APPL		0
-+/* Memory only shared with non-secure kernel */
-+#define OPTEE_RPC_SHM_TYPE_KERNEL	1
-+
-+/*
-+ * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC
-+ *
-+ * [in]     value[0].a	    Type of memory one of
-+ *			    OPTEE_RPC_SHM_TYPE_* above
-+ * [in]     value[0].b	    Value of shared memory reference or cookie
-+ */
-+#define OPTEE_RPC_CMD_SHM_FREE		7
-+
-+/*
-+ * Issue master requests (read and write operations) to an I2C chip.
-+ *
-+ * [in]     value[0].a	    Transfer mode (OPTEE_RPC_I2C_TRANSFER_*)
-+ * [in]     value[0].b	    The I2C bus (a.k.a adapter).
-+ *				16 bit field.
-+ * [in]     value[0].c	    The I2C chip (a.k.a address).
-+ *				16 bit field (either 7 or 10 bit effective).
-+ * [in]     value[1].a	    The I2C master control flags (ie, 10 bit address).
-+ *				16 bit field.
-+ * [in/out] memref[2]	    Buffer used for data transfers.
-+ * [out]    value[3].a	    Number of bytes transferred by the REE.
-+ */
-+#define OPTEE_RPC_CMD_I2C_TRANSFER	21
-+
-+/* I2C master transfer modes */
-+#define OPTEE_RPC_I2C_TRANSFER_RD	0
-+#define OPTEE_RPC_I2C_TRANSFER_WR	1
-+
-+/* I2C master control flags */
-+#define OPTEE_RPC_I2C_FLAGS_TEN_BIT	BIT(0)
-+
-+#endif /*__OPTEE_RPC_CMD_H*/
-diff --git a/drivers/tee/optee/optee_smc.h b/drivers/tee/optee/optee_smc.h
-index 777ad54d4c2c..821e1c30c150 100644
---- a/drivers/tee/optee/optee_smc.h
-+++ b/drivers/tee/optee/optee_smc.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
- /*
-- * Copyright (c) 2015-2019, Linaro Limited
-+ * Copyright (c) 2015-2021, Linaro Limited
-  */
- #ifndef OPTEE_SMC_H
- #define OPTEE_SMC_H
-@@ -39,10 +39,10 @@
- /*
-  * Function specified by SMC Calling convention
-  *
-- * Return one of the following UIDs if using API specified in this file
-- * without further extentions:
-- * 65cb6b93-af0c-4617-8ed6-644a8d1140f8
-- * see also OPTEE_SMC_UID_* in optee_msg.h
-+ * Return the following UID if using API specified in this file
-+ * without further extensions:
-+ * 384fb3e0-e7f8-11e3-af63-0002a5d5c51b.
-+ * see also OPTEE_MSG_UID_* in optee_msg.h
-  */
- #define OPTEE_SMC_FUNCID_CALLS_UID OPTEE_MSG_FUNCID_CALLS_UID
- #define OPTEE_SMC_CALLS_UID \
-@@ -53,7 +53,7 @@
- /*
-  * Function specified by SMC Calling convention
-  *
-- * Returns 2.0 if using API specified in this file without further extentions.
-+ * Returns 2.0 if using API specified in this file without further extensions.
-  * see also OPTEE_MSG_REVISION_* in optee_msg.h
-  */
- #define OPTEE_SMC_FUNCID_CALLS_REVISION OPTEE_MSG_FUNCID_CALLS_REVISION
-@@ -109,8 +109,8 @@ struct optee_smc_call_get_os_revision_result {
-  *
-  * Call register usage:
-  * a0	SMC Function ID, OPTEE_SMC*CALL_WITH_ARG
-- * a1	Upper 32bit of a 64bit physical pointer to a struct optee_msg_arg
-- * a2	Lower 32bit of a 64bit physical pointer to a struct optee_msg_arg
-+ * a1	Upper 32 bits of a 64-bit physical pointer to a struct optee_msg_arg
-+ * a2	Lower 32 bits of a 64-bit physical pointer to a struct optee_msg_arg
-  * a3	Cache settings, not used if physical pointer is in a predefined shared
-  *	memory area else per OPTEE_SMC_SHM_*
-  * a4-6	Not used
-@@ -214,8 +214,9 @@ struct optee_smc_get_shm_config_result {
-  * secure world accepts command buffers located in any parts of non-secure RAM
-  */
- #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM		BIT(2)
--
--/* Secure world supports Shared Memory with a NULL buffer reference */
-+/* Secure world is built with virtualization support */
-+#define OPTEE_SMC_SEC_CAP_VIRTUALIZATION	BIT(3)
-+/* Secure world supports Shared Memory with a NULL reference */
- #define OPTEE_SMC_SEC_CAP_MEMREF_NULL		BIT(4)
- 
- #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES	9
-@@ -245,8 +246,8 @@ struct optee_smc_exchange_capabilities_result {
-  *
-  * Normal return register usage:
-  * a0	OPTEE_SMC_RETURN_OK
-- * a1	Upper 32bit of a 64bit Shared memory cookie
-- * a2	Lower 32bit of a 64bit Shared memory cookie
-+ * a1	Upper 32 bits of a 64-bit Shared memory cookie
-+ * a2	Lower 32 bits of a 64-bit Shared memory cookie
-  * a3-7	Preserved
-  *
-  * Cache empty return register usage:
-@@ -293,6 +294,31 @@ struct optee_smc_disable_shm_cache_result {
- #define OPTEE_SMC_ENABLE_SHM_CACHE \
- 	OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_ENABLE_SHM_CACHE)
- 
-+/*
-+ * Query OP-TEE about number of supported threads
-+ *
-+ * Normal World OS or Hypervisor issues this call to find out how many
-+ * threads OP-TEE supports. That is how many standard calls can be issued
-+ * in parallel before OP-TEE will return OPTEE_SMC_RETURN_ETHREAD_LIMIT.
-+ *
-+ * Call requests usage:
-+ * a0	SMC Function ID, OPTEE_SMC_GET_THREAD_COUNT
-+ * a1-6 Not used
-+ * a7	Hypervisor Client ID register
-+ *
-+ * Normal return register usage:
-+ * a0	OPTEE_SMC_RETURN_OK
-+ * a1	Number of threads
-+ * a2-7 Preserved
-+ *
-+ * Error return:
-+ * a0	OPTEE_SMC_RETURN_UNKNOWN_FUNCTION   Requested call is not implemented
-+ * a1-7	Preserved
-+ */
-+#define OPTEE_SMC_FUNCID_GET_THREAD_COUNT	15
-+#define OPTEE_SMC_GET_THREAD_COUNT \
-+	OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_GET_THREAD_COUNT)
-+
- /*
-  * Resume from RPC (for example after processing a foreign interrupt)
-  *
-@@ -341,16 +367,16 @@ struct optee_smc_disable_shm_cache_result {
-  *
-  * "Return" register usage:
-  * a0	SMC Function ID, OPTEE_SMC_CALL_RETURN_FROM_RPC.
-- * a1	Upper 32bits of 64bit physical pointer to allocated
-+ * a1	Upper 32 bits of 64-bit physical pointer to allocated
-  *	memory, (a1 == 0 && a2 == 0) if size was 0 or if memory can't
-  *	be allocated.
-- * a2	Lower 32bits of 64bit physical pointer to allocated
-+ * a2	Lower 32 bits of 64-bit physical pointer to allocated
-  *	memory, (a1 == 0 && a2 == 0) if size was 0 or if memory can't
-  *	be allocated
-  * a3	Preserved
-- * a4	Upper 32bits of 64bit Shared memory cookie used when freeing
-+ * a4	Upper 32 bits of 64-bit Shared memory cookie used when freeing
-  *	the memory or doing an RPC
-- * a5	Lower 32bits of 64bit Shared memory cookie used when freeing
-+ * a5	Lower 32 bits of 64-bit Shared memory cookie used when freeing
-  *	the memory or doing an RPC
-  * a6-7	Preserved
-  */
-@@ -363,9 +389,9 @@ struct optee_smc_disable_shm_cache_result {
-  *
-  * "Call" register usage:
-  * a0	This value, OPTEE_SMC_RETURN_RPC_FREE
-- * a1	Upper 32bits of 64bit shared memory cookie belonging to this
-+ * a1	Upper 32 bits of 64-bit shared memory cookie belonging to this
-  *	argument memory
-- * a2	Lower 32bits of 64bit shared memory cookie belonging to this
-+ * a2	Lower 32 bits of 64-bit shared memory cookie belonging to this
-  *	argument memory
-  * a3-7	Resume information, must be preserved
-  *
-@@ -379,7 +405,7 @@ struct optee_smc_disable_shm_cache_result {
- 	OPTEE_SMC_RPC_VAL(OPTEE_SMC_RPC_FUNC_FREE)
- 
- /*
-- * Deliver foreign interrupt to normal world.
-+ * Deliver a foreign interrupt in normal world.
-  *
-  * "Call" register usage:
-  * a0	OPTEE_SMC_RETURN_RPC_FOREIGN_INTR
-@@ -389,7 +415,7 @@ struct optee_smc_disable_shm_cache_result {
-  * a0	SMC Function ID, OPTEE_SMC_CALL_RETURN_FROM_RPC.
-  * a1-7	Preserved
-  */
--#define OPTEE_SMC_RPC_FUNC_FOREIGN_INTR		4
-+#define OPTEE_SMC_RPC_FUNC_FOREIGN_INTR	4
- #define OPTEE_SMC_RETURN_RPC_FOREIGN_INTR \
- 	OPTEE_SMC_RPC_VAL(OPTEE_SMC_RPC_FUNC_FOREIGN_INTR)
- 
-@@ -405,10 +431,10 @@ struct optee_smc_disable_shm_cache_result {
-  *
-  * "Call" register usage:
-  * a0	OPTEE_SMC_RETURN_RPC_CMD
-- * a1	Upper 32bit of a 64bit Shared memory cookie holding a
-+ * a1	Upper 32 bits of a 64-bit Shared memory cookie holding a
-  *	struct optee_msg_arg, must be preserved, only the data should
-  *	be updated
-- * a2	Lower 32bit of a 64bit Shared memory cookie holding a
-+ * a2	Lower 32 bits of a 64-bit Shared memory cookie holding a
-  *	struct optee_msg_arg, must be preserved, only the data should
-  *	be updated
-  * a3-7	Resume information, must be preserved
-diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
-index 6cbb3643c6c4..1849180b0278 100644
---- a/drivers/tee/optee/rpc.c
-+++ b/drivers/tee/optee/rpc.c
-@@ -12,6 +12,7 @@
- #include <linux/tee_drv.h>
- #include "optee_private.h"
- #include "optee_smc.h"
-+#include "optee_rpc_cmd.h"
- 
- struct wq_entry {
- 	struct list_head link;
-@@ -90,7 +91,7 @@ static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
- 	if (!adapter)
- 		goto bad;
- 
--	if (params[1].u.value.a & OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT) {
-+	if (params[1].u.value.a & OPTEE_RPC_I2C_FLAGS_TEN_BIT) {
- 		if (!i2c_check_functionality(adapter,
- 					     I2C_FUNC_10BIT_ADDR)) {
- 			i2c_put_adapter(adapter);
-@@ -105,10 +106,10 @@ static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx,
- 	msg.len  = params[2].u.memref.size;
- 
- 	switch (params[0].u.value.a) {
--	case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD:
-+	case OPTEE_RPC_I2C_TRANSFER_RD:
- 		msg.flags |= I2C_M_RD;
- 		break;
--	case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR:
-+	case OPTEE_RPC_I2C_TRANSFER_WR:
- 		break;
- 	default:
- 		i2c_put_adapter(adapter);
-@@ -195,10 +196,10 @@ static void handle_rpc_func_cmd_wq(struct optee *optee,
- 		goto bad;
- 
- 	switch (arg->params[0].u.value.a) {
--	case OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP:
-+	case OPTEE_RPC_WAIT_QUEUE_SLEEP:
- 		wq_sleep(&optee->wait_queue, arg->params[0].u.value.b);
- 		break;
--	case OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP:
-+	case OPTEE_RPC_WAIT_QUEUE_WAKEUP:
- 		wq_wakeup(&optee->wait_queue, arg->params[0].u.value.b);
- 		break;
- 	default:
-@@ -268,11 +269,11 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
- 	struct tee_shm *shm;
- 
- 	param.attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT;
--	param.u.value.a = OPTEE_MSG_RPC_SHM_TYPE_APPL;
-+	param.u.value.a = OPTEE_RPC_SHM_TYPE_APPL;
- 	param.u.value.b = sz;
- 	param.u.value.c = 0;
- 
--	ret = optee_supp_thrd_req(ctx, OPTEE_MSG_RPC_CMD_SHM_ALLOC, 1, &param);
-+	ret = optee_supp_thrd_req(ctx, OPTEE_RPC_CMD_SHM_ALLOC, 1, &param);
- 	if (ret)
- 		return ERR_PTR(-ENOMEM);
- 
-@@ -309,10 +310,10 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
- 
- 	sz = arg->params[0].u.value.b;
- 	switch (arg->params[0].u.value.a) {
--	case OPTEE_MSG_RPC_SHM_TYPE_APPL:
-+	case OPTEE_RPC_SHM_TYPE_APPL:
- 		shm = cmd_alloc_suppl(ctx, sz);
- 		break;
--	case OPTEE_MSG_RPC_SHM_TYPE_KERNEL:
-+	case OPTEE_RPC_SHM_TYPE_KERNEL:
- 		shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED);
- 		break;
- 	default:
-@@ -384,7 +385,7 @@ static void cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm)
- 	struct tee_param param;
- 
- 	param.attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT;
--	param.u.value.a = OPTEE_MSG_RPC_SHM_TYPE_APPL;
-+	param.u.value.a = OPTEE_RPC_SHM_TYPE_APPL;
- 	param.u.value.b = tee_shm_get_id(shm);
- 	param.u.value.c = 0;
- 
-@@ -401,7 +402,7 @@ static void cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm)
- 	 */
- 	tee_shm_put(shm);
- 
--	optee_supp_thrd_req(ctx, OPTEE_MSG_RPC_CMD_SHM_FREE, 1, &param);
-+	optee_supp_thrd_req(ctx, OPTEE_RPC_CMD_SHM_FREE, 1, &param);
- }
- 
- static void handle_rpc_func_cmd_shm_free(struct tee_context *ctx,
-@@ -419,10 +420,10 @@ static void handle_rpc_func_cmd_shm_free(struct tee_context *ctx,
- 
- 	shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b;
- 	switch (arg->params[0].u.value.a) {
--	case OPTEE_MSG_RPC_SHM_TYPE_APPL:
-+	case OPTEE_RPC_SHM_TYPE_APPL:
- 		cmd_free_suppl(ctx, shm);
- 		break;
--	case OPTEE_MSG_RPC_SHM_TYPE_KERNEL:
-+	case OPTEE_RPC_SHM_TYPE_KERNEL:
- 		tee_shm_free(shm);
- 		break;
- 	default:
-@@ -459,23 +460,23 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
- 	}
- 
- 	switch (arg->cmd) {
--	case OPTEE_MSG_RPC_CMD_GET_TIME:
-+	case OPTEE_RPC_CMD_GET_TIME:
- 		handle_rpc_func_cmd_get_time(arg);
- 		break;
--	case OPTEE_MSG_RPC_CMD_WAIT_QUEUE:
-+	case OPTEE_RPC_CMD_WAIT_QUEUE:
- 		handle_rpc_func_cmd_wq(optee, arg);
- 		break;
--	case OPTEE_MSG_RPC_CMD_SUSPEND:
-+	case OPTEE_RPC_CMD_SUSPEND:
- 		handle_rpc_func_cmd_wait(arg);
- 		break;
--	case OPTEE_MSG_RPC_CMD_SHM_ALLOC:
-+	case OPTEE_RPC_CMD_SHM_ALLOC:
- 		free_pages_list(call_ctx);
- 		handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
- 		break;
--	case OPTEE_MSG_RPC_CMD_SHM_FREE:
-+	case OPTEE_RPC_CMD_SHM_FREE:
- 		handle_rpc_func_cmd_shm_free(ctx, arg);
- 		break;
--	case OPTEE_MSG_RPC_CMD_I2C_TRANSFER:
-+	case OPTEE_RPC_CMD_I2C_TRANSFER:
- 		handle_rpc_func_cmd_i2c_transfer(ctx, arg);
- 		break;
- 	default:
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0013-optee-add-a-FF-A-memory-pool.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0013-optee-add-a-FF-A-memory-pool.patch
deleted file mode 100644
index 6be1581..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0013-optee-add-a-FF-A-memory-pool.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From eafffa586795e3cb485310fbd287322c9c7dc3bb Mon Sep 17 00:00:00 2001
-From: Jens Wiklander <jens.wiklander@linaro.org>
-Date: Thu, 25 Mar 2021 15:08:52 +0100
-Subject: [PATCH 18/22] optee: add a FF-A memory pool
-
-Adds a memory pool to be used when the driver uses FF-A [1] as transport
-layer.
-
-[1] https://developer.arm.com/documentation/den0077/latest
-Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-
-Upstream-Status: Pending [Not submitted to upstream yet]
----
- drivers/tee/optee/shm_pool.c | 65 +++++++++++++++++++++++++++++++++---
- drivers/tee/optee/shm_pool.h |  1 +
- 2 files changed, 61 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
-index d767eebf30bd..d2116cb39c8b 100644
---- a/drivers/tee/optee/shm_pool.c
-+++ b/drivers/tee/optee/shm_pool.c
-@@ -12,8 +12,14 @@
- #include "optee_smc.h"
- #include "shm_pool.h"
- 
--static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
--			 struct tee_shm *shm, size_t size)
-+static int
-+pool_op_alloc_helper(struct tee_shm_pool_mgr *poolm,
-+		     struct tee_shm *shm, size_t size,
-+		     int (*shm_register)(struct tee_context *ctx,
-+					 struct tee_shm *shm,
-+					 struct page **pages,
-+					 size_t num_pages,
-+					 unsigned long start))
- {
- 	unsigned int order = get_order(size);
- 	struct page *page;
-@@ -27,7 +33,7 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
- 	shm->paddr = page_to_phys(page);
- 	shm->size = PAGE_SIZE << order;
- 
--	if (shm->flags & TEE_SHM_DMA_BUF) {
-+	if (shm_register) {
- 		unsigned int nr_pages = 1 << order, i;
- 		struct page **pages;
- 
-@@ -41,14 +47,23 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
- 		}
- 
- 		shm->flags |= TEE_SHM_REGISTER;
--		rc = optee_shm_register(shm->ctx, shm, pages, nr_pages,
--					(unsigned long)shm->kaddr);
-+		rc = shm_register(shm->ctx, shm, pages, nr_pages,
-+				  (unsigned long)shm->kaddr);
- 		kfree(pages);
- 	}
- 
- 	return rc;
- }
- 
-+static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
-+			 struct tee_shm *shm, size_t size)
-+{
-+	if (!(shm->flags & TEE_SHM_DMA_BUF))
-+		return pool_op_alloc_helper(poolm, shm, size, NULL);
-+
-+	return pool_op_alloc_helper(poolm, shm, size, optee_shm_register);
-+}
-+
- static void pool_op_free(struct tee_shm_pool_mgr *poolm,
- 			 struct tee_shm *shm)
- {
-@@ -87,3 +102,43 @@ struct tee_shm_pool_mgr *optee_shm_pool_alloc_pages(void)
- 
- 	return mgr;
- }
-+
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+static int pool_ffa_op_alloc(struct tee_shm_pool_mgr *poolm,
-+			     struct tee_shm *shm, size_t size)
-+{
-+	return pool_op_alloc_helper(poolm, shm, size, optee_ffa_shm_register);
-+}
-+
-+static void pool_ffa_op_free(struct tee_shm_pool_mgr *poolm,
-+			     struct tee_shm *shm)
-+{
-+	optee_ffa_shm_unregister(shm->ctx, shm);
-+	free_pages((unsigned long)shm->kaddr, get_order(shm->size));
-+	shm->kaddr = NULL;
-+}
-+
-+static const struct tee_shm_pool_mgr_ops pool_ffa_ops = {
-+	.alloc = pool_ffa_op_alloc,
-+	.free = pool_ffa_op_free,
-+	.destroy_poolmgr = pool_op_destroy_poolmgr,
-+};
-+
-+/**
-+ * optee_ffa_shm_pool_alloc_pages() - create page-based allocator pool
-+ *
-+ * This pool is used with OP-TEE over FF-A. In this case command buffers
-+ * and such are allocated from kernel's own memory.
-+ */
-+struct tee_shm_pool_mgr *optee_ffa_shm_pool_alloc_pages(void)
-+{
-+	struct tee_shm_pool_mgr *mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
-+
-+	if (!mgr)
-+		return ERR_PTR(-ENOMEM);
-+
-+	mgr->ops = &pool_ffa_ops;
-+
-+	return mgr;
-+}
-+#endif /*CONFIG_ARM_FFA_TRANSPORT*/
-diff --git a/drivers/tee/optee/shm_pool.h b/drivers/tee/optee/shm_pool.h
-index 28109d991c4b..34c5fd74a3ff 100644
---- a/drivers/tee/optee/shm_pool.h
-+++ b/drivers/tee/optee/shm_pool.h
-@@ -10,5 +10,6 @@
- #include <linux/tee_drv.h>
- 
- struct tee_shm_pool_mgr *optee_shm_pool_alloc_pages(void);
-+struct tee_shm_pool_mgr *optee_ffa_shm_pool_alloc_pages(void);
- 
- #endif
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0015-coresight-etm4x-Save-restore-TRFCR_EL1.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0015-coresight-etm4x-Save-restore-TRFCR_EL1.patch
deleted file mode 100644
index e67658f..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0015-coresight-etm4x-Save-restore-TRFCR_EL1.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From 7150eac72ee0c2c7da03f53a90a871c3d6d4e538 Mon Sep 17 00:00:00 2001
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-Date: Tue, 14 Sep 2021 11:26:32 +0100
-Subject: [PATCH 1/2] coresight: etm4x: Save restore TRFCR_EL1
-
-When the CPU enters a low power mode, the TRFCR_EL1 contents could be
-reset. Thus we need to save/restore the TRFCR_EL1 along with the ETM4x
-registers to allow the tracing.
-
-The TRFCR related helpers are in a new header file, as we need to use
-them for TRBE in the later patches.
-
-Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
-Cc: Anshuman Khandual <anshuman.khandual@arm.com>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: Leo Yan <leo.yan@linaro.org>
-Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Link: https://lore.kernel.org/r/20210914102641.1852544-2-suzuki.poulose@arm.com
-[Fixed cosmetic details]
-Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
-
-Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=937d3f58cacf377cab7c32e475e1ffa91d611dce]
-Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
----
- .../coresight/coresight-etm4x-core.c          | 43 +++++++++++++------
- drivers/hwtracing/coresight/coresight-etm4x.h |  2 +
- .../coresight/coresight-self-hosted-trace.h   | 24 +++++++++++
- 3 files changed, 57 insertions(+), 12 deletions(-)
- create mode 100644 drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index 90827077d2f9..b78080d169f8 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -39,6 +39,7 @@
- 
- #include "coresight-etm4x.h"
- #include "coresight-etm-perf.h"
-+#include "coresight-self-hosted-trace.h"
- 
- static int boot_enable;
- module_param(boot_enable, int, 0444);
-@@ -990,7 +991,7 @@ static void cpu_enable_tracing(struct etmv4_drvdata *drvdata)
- 	if (is_kernel_in_hyp_mode())
- 		trfcr |= TRFCR_EL2_CX;
- 
--	write_sysreg_s(trfcr, SYS_TRFCR_EL1);
-+	write_trfcr(trfcr);
- }
- 
- static void etm4_init_arch_data(void *info)
-@@ -1528,7 +1529,7 @@ static void etm4_init_trace_id(struct etmv4_drvdata *drvdata)
- 	drvdata->trcid = coresight_get_trace_id(drvdata->cpu);
- }
- 
--static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
-+static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
- {
- 	int i, ret = 0;
- 	struct etmv4_save_state *state;
-@@ -1667,7 +1668,23 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
- 	return ret;
- }
- 
--static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
-+static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
-+{
-+	int ret = 0;
-+
-+	/* Save the TRFCR irrespective of whether the ETM is ON */
-+	if (drvdata->trfc)
-+		drvdata->save_trfcr = read_trfcr();
-+	/*
-+	 * Save and restore the ETM Trace registers only if
-+	 * the ETM is active.
-+	 */
-+	if (local_read(&drvdata->mode) && drvdata->save_state)
-+		ret = __etm4_cpu_save(drvdata);
-+	return ret;
-+}
-+
-+static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- {
- 	int i;
- 	struct etmv4_save_state *state = drvdata->save_state;
-@@ -1763,6 +1780,14 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- 	etm4_cs_lock(drvdata, csa);
- }
- 
-+static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
-+{
-+	if (drvdata->trfc)
-+		write_trfcr(drvdata->save_trfcr);
-+	if (drvdata->state_needs_restore)
-+		__etm4_cpu_restore(drvdata);
-+}
-+
- static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,
- 			      void *v)
- {
-@@ -1774,23 +1799,17 @@ static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,
- 
- 	drvdata = etmdrvdata[cpu];
- 
--	if (!drvdata->save_state)
--		return NOTIFY_OK;
--
- 	if (WARN_ON_ONCE(drvdata->cpu != cpu))
- 		return NOTIFY_BAD;
- 
- 	switch (cmd) {
- 	case CPU_PM_ENTER:
--		/* save the state if self-hosted coresight is in use */
--		if (local_read(&drvdata->mode))
--			if (etm4_cpu_save(drvdata))
--				return NOTIFY_BAD;
-+		if (etm4_cpu_save(drvdata))
-+			return NOTIFY_BAD;
- 		break;
- 	case CPU_PM_EXIT:
- 	case CPU_PM_ENTER_FAILED:
--		if (drvdata->state_needs_restore)
--			etm4_cpu_restore(drvdata);
-+		etm4_cpu_restore(drvdata);
- 		break;
- 	default:
- 		return NOTIFY_DONE;
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
-index e5b79bdb9851..82cba16b73a6 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x.h
-+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
-@@ -921,6 +921,7 @@ struct etmv4_save_state {
-  * @lpoverride:	If the implementation can support low-power state over.
-  * @trfc:	If the implementation supports Arm v8.4 trace filter controls.
-  * @config:	structure holding configuration parameters.
-+ * @save_trfcr:	Saved TRFCR_EL1 register during a CPU PM event.
-  * @save_state:	State to be preserved across power loss
-  * @state_needs_restore: True when there is context to restore after PM exit
-  * @skip_power_up: Indicates if an implementation can skip powering up
-@@ -973,6 +974,7 @@ struct etmv4_drvdata {
- 	bool				lpoverride;
- 	bool				trfc;
- 	struct etmv4_config		config;
-+	u64				save_trfcr;
- 	struct etmv4_save_state		*save_state;
- 	bool				state_needs_restore;
- 	bool				skip_power_up;
-diff --git a/drivers/hwtracing/coresight/coresight-self-hosted-trace.h b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-new file mode 100644
-index 000000000000..303d71911870
---- /dev/null
-+++ b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-@@ -0,0 +1,24 @@
-+/* SPDX-License-Identifier: GPL-2.0-only */
-+/*
-+ * Arm v8 Self-Hosted trace support.
-+ *
-+ * Copyright (C) 2021 ARM Ltd.
-+ */
-+
-+#ifndef __CORESIGHT_SELF_HOSTED_TRACE_H
-+#define __CORESIGHT_SELF_HOSTED_TRACE_H
-+
-+#include <asm/sysreg.h>
-+
-+static inline u64 read_trfcr(void)
-+{
-+	return read_sysreg_s(SYS_TRFCR_EL1);
-+}
-+
-+static inline void write_trfcr(u64 val)
-+{
-+	write_sysreg_s(val, SYS_TRFCR_EL1);
-+	isb();
-+}
-+
-+#endif /*  __CORESIGHT_SELF_HOSTED_TRACE_H */
--- 
-2.34.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0016-coresight-etm4x-Use-Trace-Filtering-controls-dynamic.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0016-coresight-etm4x-Use-Trace-Filtering-controls-dynamic.patch
deleted file mode 100644
index 4d5a719..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0016-coresight-etm4x-Use-Trace-Filtering-controls-dynamic.patch
+++ /dev/null
@@ -1,227 +0,0 @@
-From 55228b0522bfb7d945019a8931742ab9b063b6c9 Mon Sep 17 00:00:00 2001
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-Date: Tue, 14 Sep 2021 11:26:33 +0100
-Subject: [PATCH 2/2] coresight: etm4x: Use Trace Filtering controls
- dynamically
-
-The Trace Filtering support (FEAT_TRF) ensures that the ETM
-can be prohibited from generating any trace for a given EL.
-This is much stricter knob, than the TRCVICTLR exception level
-masks, which doesn't prevent the ETM from generating Context
-packets for an "excluded" EL. At the moment, we do a onetime
-enable trace at user and kernel and leave it untouched for the
-kernel life time. This implies that the ETM could potentially
-generate trace packets containing the kernel addresses, and
-thus leaking the kernel virtual address in the trace.
-
-This patch makes the switch dynamic, by honoring the filters
-set by the user and enforcing them in the TRFCR controls.
-We also rename the cpu_enable_tracing() appropriately to
-cpu_detect_trace_filtering() and the drvdata member
-trfc => trfcr to indicate the "value" of the TRFCR_EL1.
-
-Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
-Cc: Al Grant <al.grant@arm.com>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: Leo Yan <leo.yan@linaro.org>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Link: https://lore.kernel.org/r/20210914102641.1852544-3-suzuki.poulose@arm.com
-Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
-
-Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f6fd1aa8cc147b111af1a833574487a87237dc0]
-Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
----
- .../coresight/coresight-etm4x-core.c          | 63 ++++++++++++++-----
- drivers/hwtracing/coresight/coresight-etm4x.h |  7 ++-
- .../coresight/coresight-self-hosted-trace.h   |  7 +++
- 3 files changed, 59 insertions(+), 18 deletions(-)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index b78080d169f8..b804d4413b43 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -237,6 +237,45 @@ struct etm4_enable_arg {
- 	int rc;
- };
- 
-+/*
-+ * etm4x_prohibit_trace - Prohibit the CPU from tracing at all ELs.
-+ * When the CPU supports FEAT_TRF, we could move the ETM to a trace
-+ * prohibited state by filtering the Exception levels via TRFCR_EL1.
-+ */
-+static void etm4x_prohibit_trace(struct etmv4_drvdata *drvdata)
-+{
-+	/* If the CPU doesn't support FEAT_TRF, nothing to do */
-+	if (!drvdata->trfcr)
-+		return;
-+	cpu_prohibit_trace();
-+}
-+
-+/*
-+ * etm4x_allow_trace - Allow CPU tracing in the respective ELs,
-+ * as configured by the drvdata->config.mode for the current
-+ * session. Even though we have TRCVICTLR bits to filter the
-+ * trace in the ELs, it doesn't prevent the ETM from generating
-+ * a packet (e.g, TraceInfo) that might contain the addresses from
-+ * the excluded levels. Thus we use the additional controls provided
-+ * via the Trace Filtering controls (FEAT_TRF) to make sure no trace
-+ * is generated for the excluded ELs.
-+ */
-+static void etm4x_allow_trace(struct etmv4_drvdata *drvdata)
-+{
-+	u64 trfcr = drvdata->trfcr;
-+
-+	/* If the CPU doesn't support FEAT_TRF, nothing to do */
-+	if (!trfcr)
-+		return;
-+
-+	if (drvdata->config.mode & ETM_MODE_EXCL_KERN)
-+		trfcr &= ~TRFCR_ELx_ExTRE;
-+	if (drvdata->config.mode & ETM_MODE_EXCL_USER)
-+		trfcr &= ~TRFCR_ELx_E0TRE;
-+
-+	write_trfcr(trfcr);
-+}
-+
- #ifdef CONFIG_ETM4X_IMPDEF_FEATURE
- 
- #define HISI_HIP08_AMBA_ID		0x000b6d01
-@@ -441,6 +480,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
- 	if (etm4x_is_ete(drvdata))
- 		etm4x_relaxed_write32(csa, TRCRSR_TA, TRCRSR);
- 
-+	etm4x_allow_trace(drvdata);
- 	/* Enable the trace unit */
- 	etm4x_relaxed_write32(csa, 1, TRCPRGCTLR);
- 
-@@ -724,7 +764,6 @@ static int etm4_enable(struct coresight_device *csdev,
- static void etm4_disable_hw(void *info)
- {
- 	u32 control;
--	u64 trfcr;
- 	struct etmv4_drvdata *drvdata = info;
- 	struct etmv4_config *config = &drvdata->config;
- 	struct coresight_device *csdev = drvdata->csdev;
-@@ -751,12 +790,7 @@ static void etm4_disable_hw(void *info)
- 	 * If the CPU supports v8.4 Trace filter Control,
- 	 * set the ETM to trace prohibited region.
- 	 */
--	if (drvdata->trfc) {
--		trfcr = read_sysreg_s(SYS_TRFCR_EL1);
--		write_sysreg_s(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE),
--			       SYS_TRFCR_EL1);
--		isb();
--	}
-+	etm4x_prohibit_trace(drvdata);
- 	/*
- 	 * Make sure everything completes before disabling, as recommended
- 	 * by section 7.3.77 ("TRCVICTLR, ViewInst Main Control Register,
-@@ -772,9 +806,6 @@ static void etm4_disable_hw(void *info)
- 	if (coresight_timeout(csa, TRCSTATR, TRCSTATR_PMSTABLE_BIT, 1))
- 		dev_err(etm_dev,
- 			"timeout while waiting for PM stable Trace Status\n");
--	if (drvdata->trfc)
--		write_sysreg_s(trfcr, SYS_TRFCR_EL1);
--
- 	/* read the status of the single shot comparators */
- 	for (i = 0; i < drvdata->nr_ss_cmp; i++) {
- 		config->ss_status[i] =
-@@ -969,15 +1000,15 @@ static bool etm4_init_csdev_access(struct etmv4_drvdata *drvdata,
- 	return false;
- }
- 
--static void cpu_enable_tracing(struct etmv4_drvdata *drvdata)
-+static void cpu_detect_trace_filtering(struct etmv4_drvdata *drvdata)
- {
- 	u64 dfr0 = read_sysreg(id_aa64dfr0_el1);
- 	u64 trfcr;
- 
-+	drvdata->trfcr = 0;
- 	if (!cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_TRACE_FILT_SHIFT))
- 		return;
- 
--	drvdata->trfc = true;
- 	/*
- 	 * If the CPU supports v8.4 SelfHosted Tracing, enable
- 	 * tracing at the kernel EL and EL0, forcing to use the
-@@ -991,7 +1022,7 @@ static void cpu_enable_tracing(struct etmv4_drvdata *drvdata)
- 	if (is_kernel_in_hyp_mode())
- 		trfcr |= TRFCR_EL2_CX;
- 
--	write_trfcr(trfcr);
-+	drvdata->trfcr = trfcr;
- }
- 
- static void etm4_init_arch_data(void *info)
-@@ -1177,7 +1208,7 @@ static void etm4_init_arch_data(void *info)
- 	/* NUMCNTR, bits[30:28] number of counters available for tracing */
- 	drvdata->nr_cntr = BMVAL(etmidr5, 28, 30);
- 	etm4_cs_lock(drvdata, csa);
--	cpu_enable_tracing(drvdata);
-+	cpu_detect_trace_filtering(drvdata);
- }
- 
- static inline u32 etm4_get_victlr_access_type(struct etmv4_config *config)
-@@ -1673,7 +1704,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
- 	int ret = 0;
- 
- 	/* Save the TRFCR irrespective of whether the ETM is ON */
--	if (drvdata->trfc)
-+	if (drvdata->trfcr)
- 		drvdata->save_trfcr = read_trfcr();
- 	/*
- 	 * Save and restore the ETM Trace registers only if
-@@ -1782,7 +1813,7 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- 
- static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- {
--	if (drvdata->trfc)
-+	if (drvdata->trfcr)
- 		write_trfcr(drvdata->save_trfcr);
- 	if (drvdata->state_needs_restore)
- 		__etm4_cpu_restore(drvdata);
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
-index 82cba16b73a6..3c4d69b096ca 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x.h
-+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
-@@ -919,7 +919,10 @@ struct etmv4_save_state {
-  * @nooverflow:	Indicate if overflow prevention is supported.
-  * @atbtrig:	If the implementation can support ATB triggers
-  * @lpoverride:	If the implementation can support low-power state over.
-- * @trfc:	If the implementation supports Arm v8.4 trace filter controls.
-+ * @trfcr:	If the CPU supports FEAT_TRF, value of the TRFCR_ELx that
-+ *		allows tracing at all ELs. We don't want to compute this
-+ *		at runtime, due to the additional setting of TRFCR_CX when
-+ *		in EL2. Otherwise, 0.
-  * @config:	structure holding configuration parameters.
-  * @save_trfcr:	Saved TRFCR_EL1 register during a CPU PM event.
-  * @save_state:	State to be preserved across power loss
-@@ -972,7 +975,7 @@ struct etmv4_drvdata {
- 	bool				nooverflow;
- 	bool				atbtrig;
- 	bool				lpoverride;
--	bool				trfc;
-+	u64				trfcr;
- 	struct etmv4_config		config;
- 	u64				save_trfcr;
- 	struct etmv4_save_state		*save_state;
-diff --git a/drivers/hwtracing/coresight/coresight-self-hosted-trace.h b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-index 303d71911870..23f05df3f173 100644
---- a/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-+++ b/drivers/hwtracing/coresight/coresight-self-hosted-trace.h
-@@ -21,4 +21,11 @@ static inline void write_trfcr(u64 val)
- 	isb();
- }
- 
-+static inline void cpu_prohibit_trace(void)
-+{
-+	u64 trfcr = read_trfcr();
-+
-+	/* Prohibit tracing at EL0 & the kernel EL */
-+	write_trfcr(trfcr & ~(TRFCR_ELx_ExTRE | TRFCR_ELx_E0TRE));
-+}
- #endif /*  __CORESIGHT_SELF_HOSTED_TRACE_H */
--- 
-2.34.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0017-perf-arm-cmn-Use-irq_set_affinity.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0017-perf-arm-cmn-Use-irq_set_affinity.patch
deleted file mode 100644
index e8674c3..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0017-perf-arm-cmn-Use-irq_set_affinity.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From ad3c5d9224ffcd7b2e083f03441c6188d2bbef67 Mon Sep 17 00:00:00 2001
-From: Thomas Gleixner <tglx@linutronix.de>
-Date: Tue, 18 May 2021 11:17:28 +0200
-Subject: [PATCH 01/14] perf/arm-cmn: Use irq_set_affinity()
-
-The driver uses irq_set_affinity_hint() to set the affinity for the PMU
-interrupts, which relies on the undocumented side effect that this function
-actually sets the affinity under the hood.
-
-Setting an hint is clearly not a guarantee and for these PMU interrupts an
-affinity hint, which is supposed to guide userspace for setting affinity,
-is beyond pointless, because the affinity of these interrupts cannot be
-modified from user space.
-
-Aside of that the error checks are bogus because the only error which is
-returned from irq_set_affinity_hint() is when there is no irq descriptor
-for the interrupt number, but not when the affinity set fails. That's on
-purpose because the hint can point to an offline CPU.
-
-Replace the mindless abuse with irq_set_affinity().
-
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-
-Link: https://lore.kernel.org/r/20210518093118.277228577@linutronix.de
-Signed-off-by: Will Deacon <will@kernel.org>
-
-Upstream-Status: Backport [https://lore.kernel.org/r/20210518093118.277228577@linutronix.de]
-Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
----
- drivers/perf/arm-cmn.c | 9 ++-------
- 1 file changed, 2 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 46defb1dcf86..38fa6f89d0bc 100644
---- a/drivers/perf/arm-cmn.c
-+++ b/drivers/perf/arm-cmn.c
-@@ -1162,7 +1162,7 @@ static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
- 
- 	perf_pmu_migrate_context(&cmn->pmu, cpu, target);
- 	for (i = 0; i < cmn->num_dtcs; i++)
--		irq_set_affinity_hint(cmn->dtc[i].irq, cpumask_of(target));
-+		irq_set_affinity(cmn->dtc[i].irq, cpumask_of(target));
- 	cmn->cpu = target;
- 	return 0;
- }
-@@ -1222,7 +1222,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn)
- 		if (err)
- 			return err;
- 
--		err = irq_set_affinity_hint(irq, cpumask_of(cmn->cpu));
-+		err = irq_set_affinity(irq, cpumask_of(cmn->cpu));
- 		if (err)
- 			return err;
- 	next:
-@@ -1568,16 +1568,11 @@ static int arm_cmn_probe(struct platform_device *pdev)
- static int arm_cmn_remove(struct platform_device *pdev)
- {
- 	struct arm_cmn *cmn = platform_get_drvdata(pdev);
--	int i;
- 
- 	writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL);
- 
- 	perf_pmu_unregister(&cmn->pmu);
- 	cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node);
--
--	for (i = 0; i < cmn->num_dtcs; i++)
--		irq_set_affinity_hint(cmn->dtc[i].irq, NULL);
--
- 	return 0;
- }
- 
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0018-perf-arm-cmn-Fix-CPU-hotplug-unregistration.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0018-perf-arm-cmn-Fix-CPU-hotplug-unregistration.patch
deleted file mode 100644
index e06fb88..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0018-perf-arm-cmn-Fix-CPU-hotplug-unregistration.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 249304c3517a38863c8e45e63d509d01bd67dead Mon Sep 17 00:00:00 2001
-From: Robin Murphy <robin.murphy@arm.com>
-Date: Fri, 3 Dec 2021 11:44:50 +0000
-Subject: [PATCH 02/14] perf/arm-cmn: Fix CPU hotplug unregistration
-
-Attempting to migrate the PMU context after we've unregistered the PMU
-device, or especially if we never successfully registered it in the
-first place, is a woefully bad idea. It's also fundamentally pointless
-anyway. Make sure to unregister an instance from the hotplug handler
-*without* invoking the teardown callback.
-
-Fixes: 0ba64770a2f2 ("perf: Add Arm CMN-600 PMU driver")
-Signed-off-by: Robin Murphy <robin.murphy@arm.com>
-
-Upstream-Status: Backport [https://lore.kernel.org/r/2c221d745544774e4b07583b65b5d4d94f7e0fe4.1638530442.git.robin.murphy@arm.com]
-Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
----
- drivers/perf/arm-cmn.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 38fa6f89d0bc..fe7f3e945481 100644
---- a/drivers/perf/arm-cmn.c
-+++ b/drivers/perf/arm-cmn.c
-@@ -1561,7 +1561,8 @@ static int arm_cmn_probe(struct platform_device *pdev)
- 
- 	err = perf_pmu_register(&cmn->pmu, name, -1);
- 	if (err)
--		cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node);
-+		cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node);
-+
- 	return err;
- }
- 
-@@ -1572,7 +1573,7 @@ static int arm_cmn_remove(struct platform_device *pdev)
- 	writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL);
- 
- 	perf_pmu_unregister(&cmn->pmu);
--	cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node);
-+	cpuhp_state_remove_instance_nocalls(arm_cmn_hp_state, &cmn->cpuhp_node);
- 	return 0;
- }
- 
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0023-drivers-perf-arm-cmn-Add-space-after.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0023-drivers-perf-arm-cmn-Add-space-after.patch
deleted file mode 100644
index 3b11192..0000000
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0023-drivers-perf-arm-cmn-Add-space-after.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From c3e137a2231f434f623593b6951c7575d22e1cdb Mon Sep 17 00:00:00 2001
-From: Junhao He <hejunhao2@hisilicon.com>
-Date: Tue, 11 May 2021 20:27:33 +0800
-Subject: [PATCH 07/14] drivers/perf: arm-cmn: Add space after ','
-
-Fix a warning from checkpatch.pl.
-
-ERROR: space required after that ',' (ctx:VxV)
-
-Signed-off-by: Junhao He <hejunhao2@hisilicon.com>
-Signed-off-by: Jay Fang <f.fangjian@huawei.com>
-
-Upstream-Status: Backport [https://lore.kernel.org/all/1620736054-58412-4-git-send-email-f.fangjian@huawei.com]
-Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
----
- drivers/perf/arm-cmn.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 77ebed7fae08..e9f27f7776a2 100644
---- a/drivers/perf/arm-cmn.c
-+++ b/drivers/perf/arm-cmn.c
-@@ -32,7 +32,7 @@
- #define CMN_CI_CHILD_COUNT		GENMASK_ULL(15, 0)
- #define CMN_CI_CHILD_PTR_OFFSET		GENMASK_ULL(31, 16)
- 
--#define CMN_CHILD_NODE_ADDR		GENMASK(27,0)
-+#define CMN_CHILD_NODE_ADDR		GENMASK(27, 0)
- #define CMN_CHILD_NODE_EXTERNAL		BIT(31)
- 
- #define CMN_ADDR_NODE_PTR		GENMASK(27, 14)
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0001-drm-Add-component-aware-simple-encoder.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-Add-component-aware-simple-encoder.patch
similarity index 95%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0001-drm-Add-component-aware-simple-encoder.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-Add-component-aware-simple-encoder.patch
index 1586034..d361efd 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0001-drm-Add-component-aware-simple-encoder.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-Add-component-aware-simple-encoder.patch
@@ -1,7 +1,7 @@
-From 39e6b51150c36dd659b85de0c4339594da389da9 Mon Sep 17 00:00:00 2001
+From 5c07d2e7bf1634743249178bf2ca2a06779e6e7a Mon Sep 17 00:00:00 2001
 From: Tushar Khandelwal <tushar.khandelwal@arm.com>
 Date: Tue, 16 Jun 2020 12:39:06 +0000
-Subject: [PATCH 01/22] drm: Add component-aware simple encoder
+Subject: [PATCH 01/40] drm: Add component-aware simple encoder
 
 This is a simple DRM encoder that gets its connector timings information
 from a OF subnode in the device tree and exposes that as a "discovered"
@@ -13,6 +13,8 @@
 
 Upstream-Status: Backport [https://git.linaro.org/landing-teams/working/arm/kernel-release.git/commit/?h=latest-armlt&id=15283f7be4b1e586702551e85b4caf06531ac2fc]
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Change-Id: Ic68cbba7da7d36ee23359ff53bf30eb44cb78661
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/gpu/drm/Kconfig               |  11 +
  drivers/gpu/drm/Makefile              |   2 +
@@ -21,10 +23,10 @@
  create mode 100644 drivers/gpu/drm/drm_virtual_encoder.c
 
 diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
-index ca868271f4c4..6ae8ba3ca7b3 100644
+index cea777ae7fb9..2468ec7155ef 100644
 --- a/drivers/gpu/drm/Kconfig
 +++ b/drivers/gpu/drm/Kconfig
-@@ -300,6 +300,17 @@ config DRM_VKMS
+@@ -291,6 +291,17 @@ config DRM_VKMS
  
  	  If M is selected the module will be called vkms.
  
@@ -43,10 +45,10 @@
  
  source "drivers/gpu/drm/rockchip/Kconfig"
 diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
-index 81569009f884..a3429152c613 100644
+index ad1112154898..361999b7d063 100644
 --- a/drivers/gpu/drm/Makefile
 +++ b/drivers/gpu/drm/Makefile
-@@ -56,6 +56,8 @@ drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
+@@ -59,6 +59,8 @@ drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
  
  obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
  obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/
@@ -57,7 +59,7 @@
  obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
 diff --git a/drivers/gpu/drm/drm_virtual_encoder.c b/drivers/gpu/drm/drm_virtual_encoder.c
 new file mode 100644
-index 000000000000..2f65c6b47d00
+index 000000000000..39a902ecfe32
 --- /dev/null
 +++ b/drivers/gpu/drm/drm_virtual_encoder.c
 @@ -0,0 +1,299 @@
@@ -167,7 +169,7 @@
 +
 +struct drm_encoder *
 +drm_virtcon_atomic_best_encoder(struct drm_connector *connector,
-+				 struct drm_connector_state *connector_state)
++				struct drm_atomic_state *state)
 +{
 +	struct drm_virt_priv *priv = connector_to_drm_virt_priv(connector);
 +
@@ -361,5 +363,5 @@
 +MODULE_DESCRIPTION("Virtual DRM Encoder");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-komeda-Fix-handling-of-atomic-commits-in-the-ato.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-komeda-Fix-handling-of-atomic-commits-in-the-ato.patch
new file mode 100644
index 0000000..c038ad7
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0001-drm-komeda-Fix-handling-of-atomic-commits-in-the-ato.patch
@@ -0,0 +1,115 @@
+From 3bfadb22e58bdf7691f80f403dd85794f2b86ad6 Mon Sep 17 00:00:00 2001
+From: Liviu Dudau <liviu.dudau@arm.com>
+Date: Fri, 8 Jul 2022 16:39:21 +0100
+Subject: [PATCH] drm/komeda: Fix handling of atomic commits in the
+ atomic_commit_tail hook
+
+Komeda driver relies on the generic DRM atomic helper functions to handle
+commits. It only implements an atomic_commit_tail hook for the
+mode_config_helper_funcs and even that one is pretty close to the generic
+implementation with the exception of additional dma_fence signalling.
+
+What the generic helper framework doesn't do is waiting for the actual
+hardware to signal that the commit parameters have been written into the
+appropriate registers. As we signal CRTC events only on the irq handlers,
+we need to flush the configuration and wait for the hardware to respond.
+
+Add the Komeda specific implementation for atomic_commit_hw_done() that
+flushes and waits for flip done before calling drm_atomic_helper_commit_hw_done().
+
+The fix was prompted by a patch from Carsten Haitzler where he was trying to
+solve the same issue but in a different way that I think can lead to wrong
+event signaling to userspace.
+
+Upstream-Status: Backport [https://patchwork.freedesktop.org/patch/msgid/20220722122139.288486-1-liviu.dudau@arm.com]
+Reported-by: Carsten Haitzler <carsten.haitzler@arm.com>
+Tested-by: Carsten Haitzler <carsten.haitzler@arm.com>
+Reviewed-by: Carsten Haitzler <carsten.haitzler@arm.com>
+Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220722122139.288486-1-liviu.dudau@arm.com
+Signed-off-by: Ben Horgan <ben.horgan@arm.com>
+Change-Id: I0bd92150120eb929692c1d38c4d1077d38401cdd
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
+---
+ .../gpu/drm/arm/display/komeda/komeda_crtc.c  |  4 ++--
+ .../gpu/drm/arm/display/komeda/komeda_kms.c   | 21 ++++++++++++++++++-
+ .../gpu/drm/arm/display/komeda/komeda_kms.h   |  2 ++
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
+index 59172acb9738..292f533d8cf0 100644
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
+@@ -235,7 +235,7 @@ void komeda_crtc_handle_event(struct komeda_crtc   *kcrtc,
+ 			crtc->state->event = NULL;
+ 			drm_crtc_send_vblank_event(crtc, event);
+ 		} else {
+-			DRM_WARN("CRTC[%d]: FLIP happen but no pending commit.\n",
++			DRM_WARN("CRTC[%d]: FLIP happened but no pending commit.\n",
+ 				 drm_crtc_index(&kcrtc->base));
+ 		}
+ 		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+@@ -286,7 +286,7 @@ komeda_crtc_atomic_enable(struct drm_crtc *crtc,
+ 	komeda_crtc_do_flush(crtc, old);
+ }
+ 
+-static void
++void
+ komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc,
+ 					 struct completion *input_flip_done)
+ {
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+index 8b2be8a9a27d..c434fb43d82c 100644
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+@@ -69,6 +69,25 @@ static const struct drm_driver komeda_kms_driver = {
+ 	.minor = 1,
+ };
+ 
++static void komeda_kms_atomic_commit_hw_done(struct drm_atomic_state *state)
++{
++	struct drm_device *dev = state->dev;
++	struct komeda_kms_dev *kms = to_kdev(dev);
++	int i;
++
++	for (i = 0; i < kms->n_crtcs; i++) {
++		struct komeda_crtc *kcrtc = &kms->crtcs[i];
++
++		if (kcrtc->base.state->active) {
++			struct completion *flip_done = NULL;
++			if (kcrtc->base.state->event)
++				flip_done = kcrtc->base.state->event->base.completion;
++			komeda_crtc_flush_and_wait_for_flip_done(kcrtc, flip_done);
++		}
++	}
++	drm_atomic_helper_commit_hw_done(state);
++}
++
+ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state)
+ {
+ 	struct drm_device *dev = old_state->dev;
+@@ -81,7 +100,7 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state)
+ 
+ 	drm_atomic_helper_commit_modeset_enables(dev, old_state);
+ 
+-	drm_atomic_helper_commit_hw_done(old_state);
++	komeda_kms_atomic_commit_hw_done(old_state);
+ 
+ 	drm_atomic_helper_wait_for_flip_done(dev, old_state);
+ 
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h
+index 456f3c435719..bf6e8fba5061 100644
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h
+@@ -182,6 +182,8 @@ void komeda_kms_cleanup_private_objs(struct komeda_kms_dev *kms);
+ 
+ void komeda_crtc_handle_event(struct komeda_crtc   *kcrtc,
+ 			      struct komeda_events *evts);
++void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc,
++					      struct completion *input_flip_done);
+ 
+ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev);
+ void komeda_kms_detach(struct komeda_kms_dev *kms);
+-- 
+2.25.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch
similarity index 74%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch
index 77519f1..f662fe4 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0002-drm-arm-komeda-add-RENDER-capability-to-the-device-n.patch
@@ -1,7 +1,7 @@
-From 1b2c200673b4a08324f3a6575b30bd16030ed586 Mon Sep 17 00:00:00 2001
+From 97bdf703e47606d15cd04f1aa5490bcaed842ae3 Mon Sep 17 00:00:00 2001
 From: Tushar Khandelwal <tushar.khandelwal@arm.com>
 Date: Wed, 17 Jun 2020 10:49:26 +0000
-Subject: [PATCH 02/22] drm: arm: komeda: add RENDER capability to the device
+Subject: [PATCH 02/40] drm: arm: komeda: add RENDER capability to the device
  node
 
 this is required to make this driver work with android framework
@@ -10,23 +10,24 @@
 
 Upstream-Status: Inappropriate [Product specific configuration]
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
-index 1f6682032ca4..9d1a1942e673 100644
+index 93b7f09b96ca..8b2be8a9a27d 100644
 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
 +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
-@@ -59,7 +59,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
+@@ -58,7 +58,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
  }
  
- static struct drm_driver komeda_kms_driver = {
+ static const struct drm_driver komeda_kms_driver = {
 -	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 +	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_RENDER,
  	.lastclose			= drm_fb_helper_lastclose,
  	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_cma_dumb_create),
  	.fops = &komeda_cma_fops,
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0031-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0003-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch
similarity index 71%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0031-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0003-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch
index 35b4f10..fa7c2ef 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0031-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0003-firmware-arm_ffa-Fix-uuid-argument-passed-to-ffa_par.patch
@@ -1,21 +1,22 @@
-From 4d0a8147477699d40a02f121e7c72b21547273cf Mon Sep 17 00:00:00 2001
+From 6b9cf2d89db4fc10b930b8d8f8fce3a0d00fecf8 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Thu, 13 Jan 2022 20:14:25 +0000
-Subject: [PATCH 19/32] firmware: arm_ffa: Fix uuid argument passed to
+Subject: [PATCH 03/40] firmware: arm_ffa: Fix uuid argument passed to
  ffa_partition_probe
 
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Ib2749ec3e02da5bb6d835f7dbf2d608c41fad1f2
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/firmware/arm_ffa/driver.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
-index 14f900047ac0..8fa1785afd42 100644
+index fc6d3b9bd472..d3d53fbd3d29 100644
 --- a/drivers/firmware/arm_ffa/driver.c
 +++ b/drivers/firmware/arm_ffa/driver.c
-@@ -582,7 +582,7 @@ static int ffa_partition_info_get(const char *uuid_str,
+@@ -501,7 +501,7 @@ static int ffa_partition_info_get(const char *uuid_str,
  		return -ENODEV;
  	}
  
@@ -25,5 +26,5 @@
  		return -ENOENT;
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0032-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0004-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch
similarity index 74%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0032-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0004-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch
index 52cf71b..752a94b 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0032-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0004-firmware-arm_ffa-Add-ffa_dev_get_drvdata.patch
@@ -1,20 +1,21 @@
-From 9acd4425667e240603ec196d8b64b2b25879805e Mon Sep 17 00:00:00 2001
+From 9fe23341c66deefb1f953d7ca642f928d8a50c6e Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Thu, 13 Jan 2022 22:22:28 +0000
-Subject: [PATCH 20/32] firmware: arm_ffa: Add ffa_dev_get_drvdata
+Subject: [PATCH 04/40] firmware: arm_ffa: Add ffa_dev_get_drvdata
 
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Icd09d686cab9922563b1deda5276307ea5d94923
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  include/linux/arm_ffa.h | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h
-index 85651e41ded8..e5c76c1ef9ed 100644
+index f0cb5b72b87b..06dc83d38779 100644
 --- a/include/linux/arm_ffa.h
 +++ b/include/linux/arm_ffa.h
-@@ -38,7 +38,12 @@ struct ffa_driver {
+@@ -129,7 +129,12 @@ struct ffa_driver {
  
  static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data)
  {
@@ -29,5 +30,5 @@
  
  #if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0033-firmware-arm_ffa-extern-ffa_bus_type.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0005-firmware-arm_ffa-extern-ffa_bus_type.patch
similarity index 70%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0033-firmware-arm_ffa-extern-ffa_bus_type.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0005-firmware-arm_ffa-extern-ffa_bus_type.patch
index bbbc178..62e130c 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0033-firmware-arm_ffa-extern-ffa_bus_type.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0005-firmware-arm_ffa-extern-ffa_bus_type.patch
@@ -1,22 +1,23 @@
-From 7a9298916fe892ddac5fe4e0a13a566b1636f542 Mon Sep 17 00:00:00 2001
+From 53e29fa837f36f3a699f7ada50dd08e43028a9c7 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Thu, 13 Jan 2022 22:23:52 +0000
-Subject: [PATCH 21/32] firmware: arm_ffa: extern ffa_bus_type
+Subject: [PATCH 05/40] firmware: arm_ffa: extern ffa_bus_type
 
 extern ffa_bus_type so that SP driver can use it in bus_find_device call.
 
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Ib7a6a563aa35627a545f82c796816a5f72c80d70
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  include/linux/arm_ffa.h | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h
-index e5c76c1ef9ed..4eb7e03ca560 100644
+index 06dc83d38779..d5c0a0c37fbe 100644
 --- a/include/linux/arm_ffa.h
 +++ b/include/linux/arm_ffa.h
-@@ -88,6 +88,8 @@ const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev)
+@@ -179,6 +179,8 @@ const struct ffa_dev_ops *ffa_dev_ops_get(struct ffa_device *dev)
  #define ffa_unregister(driver) \
  	ffa_driver_unregister(driver)
  
@@ -26,5 +27,5 @@
   * module_ffa_driver() - Helper macro for registering a psa_ffa driver
   * @__ffa_driver: ffa_driver structure
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0034-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0006-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch
similarity index 79%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0034-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0006-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch
index 977b550..fccf346 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0034-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0006-firmware-arm_ffa-Fix-FFA_MEM_SHARE-and-FFA_MEM_FRAG_.patch
@@ -1,7 +1,7 @@
-From e0b9971db819fb9ed9b08a5d3f6f2a4565e92a1a Mon Sep 17 00:00:00 2001
+From 47cd54d908380de17d84a852625ef3a1ff92f496 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 12:23:04 +0000
-Subject: [PATCH 22/32] firmware: arm_ffa: Fix FFA_MEM_SHARE and
+Subject: [PATCH 06/40] firmware: arm_ffa: Fix FFA_MEM_SHARE and
  FFA_MEM_FRAG_TX
 
 FFA memory share on success might return FFA_MEM_FRAG_RX. In that case
@@ -13,15 +13,16 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: I7ef44742d53a9e75d8587d1213be98a1352f16d4
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/firmware/arm_ffa/driver.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
-index 8fa1785afd42..a3b1df6d7f3c 100644
+index d3d53fbd3d29..de6641912768 100644
 --- a/drivers/firmware/arm_ffa/driver.c
 +++ b/drivers/firmware/arm_ffa/driver.c
-@@ -398,11 +398,15 @@ static int ffa_mem_first_frag(u32 func_id, phys_addr_t buf, u32 buf_sz,
+@@ -317,11 +317,15 @@ static int ffa_mem_first_frag(u32 func_id, phys_addr_t buf, u32 buf_sz,
  	if (ret.a0 == FFA_ERROR)
  		return ffa_to_linux_errno((int)ret.a2);
  
@@ -40,7 +41,7 @@
  
  	return frag_len;
  }
-@@ -426,7 +430,7 @@ static int ffa_mem_next_frag(u64 handle, u32 frag_len)
+@@ -345,7 +349,7 @@ static int ffa_mem_next_frag(u64 handle, u32 frag_len)
  	if (ret.a0 == FFA_ERROR)
  		return ffa_to_linux_errno((int)ret.a2);
  
@@ -50,5 +51,5 @@
  
  	return ret.a3;
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0007-Revert-optee-use-driver-internal-tee_context-for-som.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0007-Revert-optee-use-driver-internal-tee_context-for-som.patch
new file mode 100644
index 0000000..f3cd0e8
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0007-Revert-optee-use-driver-internal-tee_context-for-som.patch
@@ -0,0 +1,111 @@
+From 96e0bd88e2fb4fcb1625240ef36bccf0383633f6 Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Date: Tue, 17 May 2022 16:53:56 +0100
+Subject: [PATCH 07/40] Revert "optee: use driver internal tee_context for some
+ rpc"
+
+This reverts commit 2922aff4339712ef004451715e94bdbd55fe38ed.
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
+---
+ drivers/tee/optee/core.c          | 8 --------
+ drivers/tee/optee/optee_private.h | 2 --
+ drivers/tee/optee/rpc.c           | 8 +++-----
+ 3 files changed, 3 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
+index 50c0d839fe75..5363ebebfc35 100644
+--- a/drivers/tee/optee/core.c
++++ b/drivers/tee/optee/core.c
+@@ -588,7 +588,6 @@ static int optee_remove(struct platform_device *pdev)
+ 	/* Unregister OP-TEE specific client devices on TEE bus */
+ 	optee_unregister_devices();
+ 
+-	teedev_close_context(optee->ctx);
+ 	/*
+ 	 * Ask OP-TEE to free all cached shared memory objects to decrease
+ 	 * reference counters and also avoid wild pointers in secure world
+@@ -634,7 +633,6 @@ static int optee_probe(struct platform_device *pdev)
+ 	struct optee *optee = NULL;
+ 	void *memremaped_shm = NULL;
+ 	struct tee_device *teedev;
+-	struct tee_context *ctx;
+ 	u32 sec_caps;
+ 	int rc;
+ 
+@@ -721,12 +719,6 @@ static int optee_probe(struct platform_device *pdev)
+ 	optee_supp_init(&optee->supp);
+ 	optee->memremaped_shm = memremaped_shm;
+ 	optee->pool = pool;
+-	ctx = teedev_open(optee->teedev);
+-	if (IS_ERR(ctx)) {
+-		rc = PTR_ERR(ctx);
+-		goto err;
+-	}
+-	optee->ctx = ctx;
+ 
+ 	/*
+ 	 * Ensure that there are no pre-existing shm objects before enabling
+diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
+index ea09533e30cd..f6bb4a763ba9 100644
+--- a/drivers/tee/optee/optee_private.h
++++ b/drivers/tee/optee/optee_private.h
+@@ -70,7 +70,6 @@ struct optee_supp {
+  * struct optee - main service struct
+  * @supp_teedev:	supplicant device
+  * @teedev:		client device
+- * @ctx:		driver internal TEE context
+  * @invoke_fn:		function to issue smc or hvc
+  * @call_queue:		queue of threads waiting to call @invoke_fn
+  * @wait_queue:		queue of threads from secure world waiting for a
+@@ -88,7 +87,6 @@ struct optee {
+ 	struct tee_device *supp_teedev;
+ 	struct tee_device *teedev;
+ 	optee_invoke_fn *invoke_fn;
+-	struct tee_context *ctx;
+ 	struct optee_call_queue call_queue;
+ 	struct optee_wait_queue wait_queue;
+ 	struct optee_supp supp;
+diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
+index 456833d82007..efbaff7ad7e5 100644
+--- a/drivers/tee/optee/rpc.c
++++ b/drivers/tee/optee/rpc.c
+@@ -285,7 +285,6 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
+ }
+ 
+ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
+-					  struct optee *optee,
+ 					  struct optee_msg_arg *arg,
+ 					  struct optee_call_ctx *call_ctx)
+ {
+@@ -315,8 +314,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
+ 		shm = cmd_alloc_suppl(ctx, sz);
+ 		break;
+ 	case OPTEE_RPC_SHM_TYPE_KERNEL:
+-		shm = tee_shm_alloc(optee->ctx, sz,
+-				    TEE_SHM_MAPPED | TEE_SHM_PRIV);
++		shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
+ 		break;
+ 	default:
+ 		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+@@ -473,7 +471,7 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
+ 		break;
+ 	case OPTEE_RPC_CMD_SHM_ALLOC:
+ 		free_pages_list(call_ctx);
+-		handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx);
++		handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
+ 		break;
+ 	case OPTEE_RPC_CMD_SHM_FREE:
+ 		handle_rpc_func_cmd_shm_free(ctx, arg);
+@@ -504,7 +502,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
+ 
+ 	switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
+ 	case OPTEE_SMC_RPC_FUNC_ALLOC:
+-		shm = tee_shm_alloc(optee->ctx, param->a1,
++		shm = tee_shm_alloc(ctx, param->a1,
+ 				    TEE_SHM_MAPPED | TEE_SHM_PRIV);
+ 		if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
+ 			reg_pair_from_64(&param->a1, &param->a2, pa);
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0009-tee-add-sec_world_id-to-struct-tee_shm.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0008-tee-add-sec_world_id-to-struct-tee_shm.patch
similarity index 72%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0009-tee-add-sec_world_id-to-struct-tee_shm.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0008-tee-add-sec_world_id-to-struct-tee_shm.patch
index eab6527..fd5bc79 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0009-tee-add-sec_world_id-to-struct-tee_shm.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0008-tee-add-sec_world_id-to-struct-tee_shm.patch
@@ -1,26 +1,27 @@
-From 812d2a649a9cc2a0004cbde2b3e411b46ec84af4 Mon Sep 17 00:00:00 2001
+From 04f76b1e265b37ab8a3acf4bbf64d1efd69a6c73 Mon Sep 17 00:00:00 2001
 From: Jens Wiklander <jens.wiklander@linaro.org>
 Date: Thu, 25 Mar 2021 15:08:44 +0100
-Subject: [PATCH 14/22] tee: add sec_world_id to struct tee_shm
+Subject: [PATCH 08/40] tee: add sec_world_id to struct tee_shm
 
 Adds sec_world_id to struct tee_shm which describes a shared memory
 object. sec_world_id can be used by a driver to store an id assigned by
 secure world.
 
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
 Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  include/linux/tee_drv.h | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
-index cdd049a724b1..93d836fded8b 100644
+index 38b701b7af4c..5e1533ee3785 100644
 --- a/include/linux/tee_drv.h
 +++ b/include/linux/tee_drv.h
-@@ -196,7 +196,11 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
+@@ -197,7 +197,11 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
   * @num_pages:	number of locked pages
-  * @dmabuf:	dmabuf used to for exporting to user space
+  * @refcount:	reference counter
   * @flags:	defined by TEE_SHM_* in tee_drv.h
 - * @id:		unique id of a shared memory object on this device
 + * @id:		unique id of a shared memory object on this device, shared
@@ -31,8 +32,8 @@
   *
   * This pool is only supposed to be accessed directly from the TEE
   * subsystem and from drivers that implements their own shm pool manager.
-@@ -212,6 +216,7 @@ struct tee_shm {
- 	struct dma_buf *dmabuf;
+@@ -213,6 +217,7 @@ struct tee_shm {
+ 	refcount_t refcount;
  	u32 flags;
  	int id;
 +	u64 sec_world_id;
@@ -40,5 +41,5 @@
  
  /**
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0010-optee-simplify-optee_release.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0009-optee-simplify-optee_release.patch
similarity index 85%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0010-optee-simplify-optee_release.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0009-optee-simplify-optee_release.patch
index 94973c7..aaf96e8 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0010-optee-simplify-optee_release.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0009-optee-simplify-optee_release.patch
@@ -1,7 +1,7 @@
-From cb4f6a55b9c61a82a65edcd4b18c505d92480710 Mon Sep 17 00:00:00 2001
+From 5a2565d002084a4c6b80329a4a23cb6c98c4f344 Mon Sep 17 00:00:00 2001
 From: Jens Wiklander <jens.wiklander@linaro.org>
 Date: Thu, 25 Mar 2021 15:08:46 +0100
-Subject: [PATCH 15/22] optee: simplify optee_release()
+Subject: [PATCH 09/40] optee: simplify optee_release()
 
 Simplifies optee_release() with a new helper function,
 optee_close_session_helper() which has been factored out from
@@ -9,20 +9,21 @@
 
 A separate optee_release_supp() is added for the supplicant device.
 
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
 Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/tee/optee/call.c          | 31 ++++++++++-------
- drivers/tee/optee/core.c          | 55 +++++++++++--------------------
+ drivers/tee/optee/core.c          | 56 +++++++++++--------------------
  drivers/tee/optee/optee_private.h |  1 +
- 3 files changed, 39 insertions(+), 48 deletions(-)
+ 3 files changed, 39 insertions(+), 49 deletions(-)
 
 diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
-index 0790de29f0ca..1b339b743ff5 100644
+index 945f03da0223..103976df2062 100644
 --- a/drivers/tee/optee/call.c
 +++ b/drivers/tee/optee/call.c
-@@ -285,12 +285,28 @@ int optee_open_session(struct tee_context *ctx,
+@@ -288,12 +288,28 @@ int optee_open_session(struct tee_context *ctx,
  	return rc;
  }
  
@@ -53,7 +54,7 @@
  	struct optee_session *sess;
  
  	/* Check that the session is valid and remove it from the list */
-@@ -303,16 +319,7 @@ int optee_close_session(struct tee_context *ctx, u32 session)
+@@ -306,16 +322,7 @@ int optee_close_session(struct tee_context *ctx, u32 session)
  		return -EINVAL;
  	kfree(sess);
  
@@ -72,10 +73,10 @@
  
  int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
 diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
-index 63542c1cc291..e39c6d290d83 100644
+index 5363ebebfc35..79f67a79e7b7 100644
 --- a/drivers/tee/optee/core.c
 +++ b/drivers/tee/optee/core.c
-@@ -263,59 +263,42 @@ static int optee_open(struct tee_context *ctx)
+@@ -264,60 +264,42 @@ static int optee_open(struct tee_context *ctx)
  	return 0;
  }
  
@@ -96,7 +97,8 @@
  	if (!ctxdata)
  		return;
  
--	shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED);
+-	shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg),
+-			    TEE_SHM_MAPPED | TEE_SHM_PRIV);
 -	if (!IS_ERR(shm)) {
 -		arg = tee_shm_get_va(shm, 0);
 -		/*
@@ -153,7 +155,7 @@
  }
  
  static const struct tee_driver_ops optee_ops = {
-@@ -339,7 +322,7 @@ static const struct tee_desc optee_desc = {
+@@ -341,7 +323,7 @@ static const struct tee_desc optee_desc = {
  static const struct tee_driver_ops optee_supp_ops = {
  	.get_version = optee_get_version,
  	.open = optee_open,
@@ -163,7 +165,7 @@
  	.supp_send = optee_supp_send,
  	.shm_register = optee_shm_register_supp,
 diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
-index e25b216a14ef..2b63b796645e 100644
+index f6bb4a763ba9..a55793f9f6eb 100644
 --- a/drivers/tee/optee/optee_private.h
 +++ b/drivers/tee/optee/optee_private.h
 @@ -152,6 +152,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg);
@@ -175,5 +177,5 @@
  int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
  		      struct tee_param *param);
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0012-optee-refactor-driver-with-internal-callbacks.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0010-optee-refactor-driver-with-internal-callbacks.patch
similarity index 90%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0012-optee-refactor-driver-with-internal-callbacks.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0010-optee-refactor-driver-with-internal-callbacks.patch
index 083843d..cc6863c 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0012-optee-refactor-driver-with-internal-callbacks.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0010-optee-refactor-driver-with-internal-callbacks.patch
@@ -1,7 +1,7 @@
-From abda5d14075802b84fe9e38f77bfdc371606172c Mon Sep 17 00:00:00 2001
+From cbb24d5b6b4e6704da79bb3df76179a88a6ee14f Mon Sep 17 00:00:00 2001
 From: Jens Wiklander <jens.wiklander@linaro.org>
 Date: Thu, 25 Mar 2021 15:08:50 +0100
-Subject: [PATCH 17/22] optee: refactor driver with internal callbacks
+Subject: [PATCH 10/40] optee: refactor driver with internal callbacks
 
 The OP-TEE driver is refactored with three internal callbacks replacing
 direct calls to optee_from_msg_param(), optee_to_msg_param() and
@@ -14,9 +14,10 @@
 with OP-TEE in secure world while being able to reuse as much as
 possible from the present driver.
 
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
 Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  drivers/tee/optee/call.c          |  86 +++++++++--------
  drivers/tee/optee/core.c          | 148 ++++++++++++++++++++----------
@@ -25,7 +26,7 @@
  4 files changed, 182 insertions(+), 106 deletions(-)
 
 diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
-index 1b339b743ff5..e7b93153252c 100644
+index 103976df2062..ddedde45f1ee 100644
 --- a/drivers/tee/optee/call.c
 +++ b/drivers/tee/optee/call.c
 @@ -1,6 +1,6 @@
@@ -36,7 +37,7 @@
   */
  #include <linux/arm-smccc.h>
  #include <linux/device.h>
-@@ -116,20 +116,25 @@ static struct optee_session *find_session(struct optee_context_data *ctxdata,
+@@ -118,20 +118,25 @@ static struct optee_session *find_session(struct optee_context_data *ctxdata,
  /**
   * optee_do_call_with_arg() - Do an SMC to OP-TEE in secure world
   * @ctx:	calling context
@@ -65,7 +66,7 @@
  
  	param.a0 = OPTEE_SMC_CALL_WITH_ARG;
  	reg_pair_from_64(&param.a1, &param.a2, parg);
-@@ -157,7 +162,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
+@@ -160,7 +165,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
  			param.a3 = res.a3;
  			optee_handle_rpc(ctx, &param, &call_ctx);
  		} else {
@@ -74,7 +75,7 @@
  			break;
  		}
  	}
-@@ -169,14 +174,12 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
+@@ -172,14 +177,12 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
  	 */
  	optee_cq_wait_final(&optee->call_queue, &w);
  
@@ -91,7 +92,7 @@
  	struct tee_shm *shm;
  	struct optee_msg_arg *ma;
  
-@@ -187,22 +190,13 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params,
+@@ -190,22 +193,13 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params,
  
  	ma = tee_shm_get_va(shm, 0);
  	if (IS_ERR(ma)) {
@@ -116,7 +117,7 @@
  
  	return shm;
  }
-@@ -211,16 +205,16 @@ int optee_open_session(struct tee_context *ctx,
+@@ -214,16 +208,16 @@ int optee_open_session(struct tee_context *ctx,
  		       struct tee_ioctl_open_session_arg *arg,
  		       struct tee_param *param)
  {
@@ -135,7 +136,7 @@
  	if (IS_ERR(shm))
  		return PTR_ERR(shm);
  
-@@ -244,7 +238,8 @@ int optee_open_session(struct tee_context *ctx,
+@@ -247,7 +241,8 @@ int optee_open_session(struct tee_context *ctx,
  		goto out;
  	export_uuid(msg_arg->params[1].u.octets, &client_uuid);
  
@@ -145,7 +146,7 @@
  	if (rc)
  		goto out;
  
-@@ -254,7 +249,7 @@ int optee_open_session(struct tee_context *ctx,
+@@ -257,7 +252,7 @@ int optee_open_session(struct tee_context *ctx,
  		goto out;
  	}
  
@@ -154,7 +155,7 @@
  		msg_arg->ret = TEEC_ERROR_COMMUNICATION;
  		msg_arg->ret_origin = TEEC_ORIGIN_COMMS;
  	}
-@@ -269,7 +264,8 @@ int optee_open_session(struct tee_context *ctx,
+@@ -272,7 +267,8 @@ int optee_open_session(struct tee_context *ctx,
  		kfree(sess);
  	}
  
@@ -164,7 +165,7 @@
  		arg->ret = TEEC_ERROR_COMMUNICATION;
  		arg->ret_origin = TEEC_ORIGIN_COMMS;
  		/* Close session again to avoid leakage */
-@@ -288,16 +284,16 @@ int optee_open_session(struct tee_context *ctx,
+@@ -291,16 +287,16 @@ int optee_open_session(struct tee_context *ctx,
  int optee_close_session_helper(struct tee_context *ctx, u32 session)
  {
  	struct tee_shm *shm;
@@ -184,7 +185,7 @@
  
  	tee_shm_free(shm);
  
-@@ -325,10 +321,10 @@ int optee_close_session(struct tee_context *ctx, u32 session)
+@@ -328,10 +324,10 @@ int optee_close_session(struct tee_context *ctx, u32 session)
  int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
  		      struct tee_param *param)
  {
@@ -196,7 +197,7 @@
  	struct optee_session *sess;
  	int rc;
  
-@@ -339,7 +335,7 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
+@@ -342,7 +338,7 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
  	if (!sess)
  		return -EINVAL;
  
@@ -205,7 +206,7 @@
  	if (IS_ERR(shm))
  		return PTR_ERR(shm);
  	msg_arg->cmd = OPTEE_MSG_CMD_INVOKE_COMMAND;
-@@ -347,16 +343,18 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
+@@ -350,16 +346,18 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
  	msg_arg->session = arg->session;
  	msg_arg->cancel_id = arg->cancel_id;
  
@@ -227,7 +228,7 @@
  		msg_arg->ret = TEEC_ERROR_COMMUNICATION;
  		msg_arg->ret_origin = TEEC_ORIGIN_COMMS;
  	}
-@@ -370,10 +368,10 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
+@@ -373,10 +371,10 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
  
  int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
  {
@@ -239,7 +240,7 @@
  	struct optee_session *sess;
  
  	/* Check that the session is valid */
-@@ -383,14 +381,14 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
+@@ -386,14 +384,14 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
  	if (!sess)
  		return -EINVAL;
  
@@ -256,7 +257,7 @@
  
  	tee_shm_free(shm);
  	return 0;
-@@ -589,10 +587,10 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+@@ -622,10 +620,10 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
  		       struct page **pages, size_t num_pages,
  		       unsigned long start)
  {
@@ -269,7 +270,7 @@
  	int rc;
  
  	if (!num_pages)
-@@ -606,7 +604,7 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+@@ -639,7 +637,7 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
  	if (!pages_list)
  		return -ENOMEM;
  
@@ -278,16 +279,16 @@
  	if (IS_ERR(shm_arg)) {
  		rc = PTR_ERR(shm_arg);
  		goto out;
-@@ -627,7 +625,7 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+@@ -660,7 +658,7 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
  	msg_arg->params->u.tmem.buf_ptr = virt_to_phys(pages_list) |
  	  (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1));
  
 -	if (optee_do_call_with_arg(ctx, msg_parg) ||
-+	if (optee->ops->do_call_with_arg(ctx, shm) ||
++	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
  	    msg_arg->ret != TEEC_SUCCESS)
  		rc = -EINVAL;
  
-@@ -639,12 +637,12 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+@@ -672,12 +670,12 @@ int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
  
  int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
  {
@@ -303,17 +304,17 @@
  	if (IS_ERR(shm_arg))
  		return PTR_ERR(shm_arg);
  
-@@ -653,7 +651,7 @@ int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
+@@ -686,7 +684,7 @@ int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
  	msg_arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT;
  	msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm;
  
 -	if (optee_do_call_with_arg(ctx, msg_parg) ||
-+	if (optee->ops->do_call_with_arg(ctx, shm) ||
++	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
  	    msg_arg->ret != TEEC_SUCCESS)
  		rc = -EINVAL;
  	tee_shm_free(shm_arg);
 diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
-index e39c6d290d83..ab602bb8e14a 100644
+index 79f67a79e7b7..26492d3115f5 100644
 --- a/drivers/tee/optee/core.c
 +++ b/drivers/tee/optee/core.c
 @@ -1,6 +1,6 @@
@@ -324,7 +325,7 @@
   */
  
  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-@@ -26,21 +26,87 @@
+@@ -27,21 +27,87 @@
  
  #define OPTEE_SHM_NUM_PRIV_PAGES	CONFIG_OPTEE_SHM_NUM_PRIV_PAGES
  
@@ -416,7 +417,7 @@
  
  	for (n = 0; n < num_params; n++) {
  		struct tee_param *p = params + n;
-@@ -55,48 +121,19 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params,
+@@ -56,48 +122,19 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params,
  		case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
  		case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
  		case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
@@ -468,7 +469,7 @@
  			break;
  
  		default:
-@@ -106,6 +143,16 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params,
+@@ -107,6 +144,16 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params,
  	return 0;
  }
  
@@ -485,7 +486,7 @@
  static int to_msg_param_tmp_mem(struct optee_msg_param *mp,
  				const struct tee_param *p)
  {
-@@ -148,13 +195,15 @@ static int to_msg_param_reg_mem(struct optee_msg_param *mp,
+@@ -149,13 +196,15 @@ static int to_msg_param_reg_mem(struct optee_msg_param *mp,
  
  /**
   * optee_to_msg_param() - convert from struct tee_params to OPTEE_MSG parameters
@@ -503,7 +504,7 @@
  {
  	int rc;
  	size_t n;
-@@ -171,11 +220,7 @@ int optee_to_msg_param(struct optee_msg_param *msg_params, size_t num_params,
+@@ -172,11 +221,7 @@ int optee_to_msg_param(struct optee_msg_param *msg_params, size_t num_params,
  		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
  		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
  		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
@@ -516,7 +517,7 @@
  			break;
  		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
  		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
-@@ -301,7 +346,7 @@ static void optee_release_supp(struct tee_context *ctx)
+@@ -302,7 +347,7 @@ static void optee_release_supp(struct tee_context *ctx)
  	optee_supp_release(&optee->supp);
  }
  
@@ -525,7 +526,7 @@
  	.get_version = optee_get_version,
  	.open = optee_open,
  	.release = optee_release,
-@@ -313,9 +358,9 @@ static const struct tee_driver_ops optee_ops = {
+@@ -314,9 +359,9 @@ static const struct tee_driver_ops optee_ops = {
  	.shm_unregister = optee_shm_unregister,
  };
  
@@ -537,7 +538,7 @@
  	.owner = THIS_MODULE,
  };
  
-@@ -336,6 +381,12 @@ static const struct tee_desc optee_supp_desc = {
+@@ -337,6 +382,12 @@ static const struct tee_desc optee_supp_desc = {
  	.flags = TEE_DESC_PRIVILEGED,
  };
  
@@ -550,7 +551,7 @@
  static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
  {
  	struct arm_smccc_res res;
-@@ -637,10 +688,11 @@ static int optee_probe(struct platform_device *pdev)
+@@ -670,10 +721,11 @@ static int optee_probe(struct platform_device *pdev)
  		goto err;
  	}
  
@@ -564,7 +565,7 @@
  		rc = PTR_ERR(teedev);
  		goto err;
 diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
-index 2b63b796645e..c5741e96e967 100644
+index a55793f9f6eb..beca97017996 100644
 --- a/drivers/tee/optee/optee_private.h
 +++ b/drivers/tee/optee/optee_private.h
 @@ -1,6 +1,6 @@
@@ -627,7 +628,7 @@
  int optee_open_session(struct tee_context *ctx,
  		       struct tee_ioctl_open_session_arg *arg,
  		       struct tee_param *param);
-@@ -171,11 +197,6 @@ int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
+@@ -172,11 +198,6 @@ int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
  			    unsigned long start);
  int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm);
  
@@ -640,7 +641,7 @@
  void optee_free_pages_list(void *array, size_t num_entries);
  void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
 diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
-index 1849180b0278..39562fb6841e 100644
+index efbaff7ad7e5..309258d47790 100644
 --- a/drivers/tee/optee/rpc.c
 +++ b/drivers/tee/optee/rpc.c
 @@ -1,6 +1,6 @@
@@ -717,5 +718,5 @@
  }
  
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0011-optee-isolate-smc-abi.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0011-optee-isolate-smc-abi.patch
new file mode 100644
index 0000000..c2ac12a
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0011-optee-isolate-smc-abi.patch
@@ -0,0 +1,3168 @@
+From bfcb795efc2d07bf99fd6c6e4f43951bc7354d5e Mon Sep 17 00:00:00 2001
+From: Jens Wiklander <jens.wiklander@linaro.org>
+Date: Wed, 21 Jul 2021 16:30:28 +0200
+Subject: [PATCH 11/40] optee: isolate smc abi
+
+Isolate the ABI based on raw SMCs. Code specific to the raw SMC ABI is
+moved into smc_abi.c. This makes room for other ABIs with a clear
+separation.
+
+The driver changes to use module_init()/module_exit() instead of
+module_platform_driver(). The platform_driver_register() and
+platform_driver_unregister() functions called directly to keep the same
+behavior. This is needed because module_platform_driver() is based on
+module_driver() which can only be used once in a module.
+
+A function optee_rpc_cmd() is factored out from the function
+handle_rpc_func_cmd() to handle the ABI independent part of RPC
+processing.
+
+This patch is not supposed to change the driver behavior, it's only a
+matter of reorganizing the code.
+
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
+Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
+---
+ drivers/tee/optee/Makefile        |    4 +-
+ drivers/tee/optee/call.c          |  369 +-------
+ drivers/tee/optee/core.c          |  721 ++-------------
+ drivers/tee/optee/optee_private.h |  106 ++-
+ drivers/tee/optee/rpc.c           |  218 +----
+ drivers/tee/optee/shm_pool.h      |   14 -
+ drivers/tee/optee/smc_abi.c       | 1361 +++++++++++++++++++++++++++++
+ 7 files changed, 1506 insertions(+), 1287 deletions(-)
+ delete mode 100644 drivers/tee/optee/shm_pool.h
+ create mode 100644 drivers/tee/optee/smc_abi.c
+
+diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile
+index 3aa33ea9e6a6..97ac3ab3e1c0 100644
+--- a/drivers/tee/optee/Makefile
++++ b/drivers/tee/optee/Makefile
+@@ -4,8 +4,8 @@ optee-objs += core.o
+ optee-objs += call.o
+ optee-objs += rpc.o
+ optee-objs += supp.o
+-optee-objs += shm_pool.o
+ optee-objs += device.o
++optee-objs += smc_abi.o
+ 
+ # for tracing framework to find optee_trace.h
+-CFLAGS_call.o := -I$(src)
++CFLAGS_smc_abi.o := -I$(src)
+diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
+index ddedde45f1ee..9ff4f0812825 100644
+--- a/drivers/tee/optee/call.c
++++ b/drivers/tee/optee/call.c
+@@ -2,28 +2,17 @@
+ /*
+  * Copyright (c) 2015-2021, Linaro Limited
+  */
+-#include <linux/arm-smccc.h>
+ #include <linux/device.h>
+ #include <linux/err.h>
+ #include <linux/errno.h>
+ #include <linux/mm.h>
+-#include <linux/sched.h>
+ #include <linux/slab.h>
+ #include <linux/tee_drv.h>
+ #include <linux/types.h>
+-#include <linux/uaccess.h>
+ #include "optee_private.h"
+-#include "optee_smc.h"
+-#define CREATE_TRACE_POINTS
+-#include "optee_trace.h"
+ 
+-struct optee_call_waiter {
+-	struct list_head list_node;
+-	struct completion c;
+-};
+-
+-static void optee_cq_wait_init(struct optee_call_queue *cq,
+-			       struct optee_call_waiter *w)
++void optee_cq_wait_init(struct optee_call_queue *cq,
++			struct optee_call_waiter *w)
+ {
+ 	/*
+ 	 * We're preparing to make a call to secure world. In case we can't
+@@ -47,8 +36,8 @@ static void optee_cq_wait_init(struct optee_call_queue *cq,
+ 	mutex_unlock(&cq->mutex);
+ }
+ 
+-static void optee_cq_wait_for_completion(struct optee_call_queue *cq,
+-					 struct optee_call_waiter *w)
++void optee_cq_wait_for_completion(struct optee_call_queue *cq,
++				  struct optee_call_waiter *w)
+ {
+ 	wait_for_completion(&w->c);
+ 
+@@ -74,8 +63,8 @@ static void optee_cq_complete_one(struct optee_call_queue *cq)
+ 	}
+ }
+ 
+-static void optee_cq_wait_final(struct optee_call_queue *cq,
+-				struct optee_call_waiter *w)
++void optee_cq_wait_final(struct optee_call_queue *cq,
++			 struct optee_call_waiter *w)
+ {
+ 	/*
+ 	 * We're done with the call to secure world. The thread in secure
+@@ -115,73 +104,8 @@ static struct optee_session *find_session(struct optee_context_data *ctxdata,
+ 	return NULL;
+ }
+ 
+-/**
+- * optee_do_call_with_arg() - Do an SMC to OP-TEE in secure world
+- * @ctx:	calling context
+- * @arg:	shared memory holding the message to pass to secure world
+- *
+- * Does and SMC to OP-TEE in secure world and handles eventual resulting
+- * Remote Procedure Calls (RPC) from OP-TEE.
+- *
+- * Returns return code from secure world, 0 is OK
+- */
+-int optee_do_call_with_arg(struct tee_context *ctx, struct tee_shm *arg)
+-{
+-	struct optee *optee = tee_get_drvdata(ctx->teedev);
+-	struct optee_call_waiter w;
+-	struct optee_rpc_param param = { };
+-	struct optee_call_ctx call_ctx = { };
+-	phys_addr_t parg;
+-	int rc;
+-
+-	rc = tee_shm_get_pa(arg, 0, &parg);
+-	if (rc)
+-		return rc;
+-
+-	param.a0 = OPTEE_SMC_CALL_WITH_ARG;
+-	reg_pair_from_64(&param.a1, &param.a2, parg);
+-	/* Initialize waiter */
+-	optee_cq_wait_init(&optee->call_queue, &w);
+-	while (true) {
+-		struct arm_smccc_res res;
+-
+-		trace_optee_invoke_fn_begin(&param);
+-		optee->invoke_fn(param.a0, param.a1, param.a2, param.a3,
+-				 param.a4, param.a5, param.a6, param.a7,
+-				 &res);
+-		trace_optee_invoke_fn_end(&param, &res);
+-
+-		if (res.a0 == OPTEE_SMC_RETURN_ETHREAD_LIMIT) {
+-			/*
+-			 * Out of threads in secure world, wait for a thread
+-			 * become available.
+-			 */
+-			optee_cq_wait_for_completion(&optee->call_queue, &w);
+-		} else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
+-			cond_resched();
+-			param.a0 = res.a0;
+-			param.a1 = res.a1;
+-			param.a2 = res.a2;
+-			param.a3 = res.a3;
+-			optee_handle_rpc(ctx, &param, &call_ctx);
+-		} else {
+-			rc = res.a0;
+-			break;
+-		}
+-	}
+-
+-	optee_rpc_finalize_call(&call_ctx);
+-	/*
+-	 * We're done with our thread in secure world, if there's any
+-	 * thread waiters wake up one.
+-	 */
+-	optee_cq_wait_final(&optee->call_queue, &w);
+-
+-	return rc;
+-}
+-
+-static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params,
+-				   struct optee_msg_arg **msg_arg)
++struct tee_shm *optee_get_msg_arg(struct tee_context *ctx, size_t num_params,
++				  struct optee_msg_arg **msg_arg)
+ {
+ 	struct tee_shm *shm;
+ 	struct optee_msg_arg *ma;
+@@ -217,7 +141,7 @@ int optee_open_session(struct tee_context *ctx,
+ 	uuid_t client_uuid;
+ 
+ 	/* +2 for the meta parameters added below */
+-	shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg);
++	shm = optee_get_msg_arg(ctx, arg->num_params + 2, &msg_arg);
+ 	if (IS_ERR(shm))
+ 		return PTR_ERR(shm);
+ 
+@@ -290,7 +214,7 @@ int optee_close_session_helper(struct tee_context *ctx, u32 session)
+ 	struct optee *optee = tee_get_drvdata(ctx->teedev);
+ 	struct optee_msg_arg *msg_arg;
+ 
+-	shm = get_msg_arg(ctx, 0, &msg_arg);
++	shm = optee_get_msg_arg(ctx, 0, &msg_arg);
+ 	if (IS_ERR(shm))
+ 		return PTR_ERR(shm);
+ 
+@@ -338,7 +262,7 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
+ 	if (!sess)
+ 		return -EINVAL;
+ 
+-	shm = get_msg_arg(ctx, arg->num_params, &msg_arg);
++	shm = optee_get_msg_arg(ctx, arg->num_params, &msg_arg);
+ 	if (IS_ERR(shm))
+ 		return PTR_ERR(shm);
+ 	msg_arg->cmd = OPTEE_MSG_CMD_INVOKE_COMMAND;
+@@ -384,7 +308,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
+ 	if (!sess)
+ 		return -EINVAL;
+ 
+-	shm = get_msg_arg(ctx, 0, &msg_arg);
++	shm = optee_get_msg_arg(ctx, 0, &msg_arg);
+ 	if (IS_ERR(shm))
+ 		return PTR_ERR(shm);
+ 
+@@ -397,182 +321,6 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
+ 	return 0;
+ }
+ 
+-/**
+- * optee_enable_shm_cache() - Enables caching of some shared memory allocation
+- *			      in OP-TEE
+- * @optee:	main service struct
+- */
+-void optee_enable_shm_cache(struct optee *optee)
+-{
+-	struct optee_call_waiter w;
+-
+-	/* We need to retry until secure world isn't busy. */
+-	optee_cq_wait_init(&optee->call_queue, &w);
+-	while (true) {
+-		struct arm_smccc_res res;
+-
+-		optee->invoke_fn(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+-				 0, &res);
+-		if (res.a0 == OPTEE_SMC_RETURN_OK)
+-			break;
+-		optee_cq_wait_for_completion(&optee->call_queue, &w);
+-	}
+-	optee_cq_wait_final(&optee->call_queue, &w);
+-}
+-
+-/**
+- * __optee_disable_shm_cache() - Disables caching of some shared memory
+- *                               allocation in OP-TEE
+- * @optee:	main service struct
+- * @is_mapped:	true if the cached shared memory addresses were mapped by this
+- *		kernel, are safe to dereference, and should be freed
+- */
+-static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
+-{
+-	struct optee_call_waiter w;
+-
+-	/* We need to retry until secure world isn't busy. */
+-	optee_cq_wait_init(&optee->call_queue, &w);
+-	while (true) {
+-		union {
+-			struct arm_smccc_res smccc;
+-			struct optee_smc_disable_shm_cache_result result;
+-		} res;
+-
+-		optee->invoke_fn(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
+-				 0, &res.smccc);
+-		if (res.result.status == OPTEE_SMC_RETURN_ENOTAVAIL)
+-			break; /* All shm's freed */
+-		if (res.result.status == OPTEE_SMC_RETURN_OK) {
+-			struct tee_shm *shm;
+-
+-			/*
+-			 * Shared memory references that were not mapped by
+-			 * this kernel must be ignored to prevent a crash.
+-			 */
+-			if (!is_mapped)
+-				continue;
+-
+-			shm = reg_pair_to_ptr(res.result.shm_upper32,
+-					      res.result.shm_lower32);
+-			tee_shm_free(shm);
+-		} else {
+-			optee_cq_wait_for_completion(&optee->call_queue, &w);
+-		}
+-	}
+-	optee_cq_wait_final(&optee->call_queue, &w);
+-}
+-
+-/**
+- * optee_disable_shm_cache() - Disables caching of mapped shared memory
+- *                             allocations in OP-TEE
+- * @optee:	main service struct
+- */
+-void optee_disable_shm_cache(struct optee *optee)
+-{
+-	return __optee_disable_shm_cache(optee, true);
+-}
+-
+-/**
+- * optee_disable_unmapped_shm_cache() - Disables caching of shared memory
+- *                                      allocations in OP-TEE which are not
+- *                                      currently mapped
+- * @optee:	main service struct
+- */
+-void optee_disable_unmapped_shm_cache(struct optee *optee)
+-{
+-	return __optee_disable_shm_cache(optee, false);
+-}
+-
+-#define PAGELIST_ENTRIES_PER_PAGE				\
+-	((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
+-
+-/**
+- * optee_fill_pages_list() - write list of user pages to given shared
+- * buffer.
+- *
+- * @dst: page-aligned buffer where list of pages will be stored
+- * @pages: array of pages that represents shared buffer
+- * @num_pages: number of entries in @pages
+- * @page_offset: offset of user buffer from page start
+- *
+- * @dst should be big enough to hold list of user page addresses and
+- *	links to the next pages of buffer
+- */
+-void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
+-			   size_t page_offset)
+-{
+-	int n = 0;
+-	phys_addr_t optee_page;
+-	/*
+-	 * Refer to OPTEE_MSG_ATTR_NONCONTIG description in optee_msg.h
+-	 * for details.
+-	 */
+-	struct {
+-		u64 pages_list[PAGELIST_ENTRIES_PER_PAGE];
+-		u64 next_page_data;
+-	} *pages_data;
+-
+-	/*
+-	 * Currently OP-TEE uses 4k page size and it does not looks
+-	 * like this will change in the future.  On other hand, there are
+-	 * no know ARM architectures with page size < 4k.
+-	 * Thus the next built assert looks redundant. But the following
+-	 * code heavily relies on this assumption, so it is better be
+-	 * safe than sorry.
+-	 */
+-	BUILD_BUG_ON(PAGE_SIZE < OPTEE_MSG_NONCONTIG_PAGE_SIZE);
+-
+-	pages_data = (void *)dst;
+-	/*
+-	 * If linux page is bigger than 4k, and user buffer offset is
+-	 * larger than 4k/8k/12k/etc this will skip first 4k pages,
+-	 * because they bear no value data for OP-TEE.
+-	 */
+-	optee_page = page_to_phys(*pages) +
+-		round_down(page_offset, OPTEE_MSG_NONCONTIG_PAGE_SIZE);
+-
+-	while (true) {
+-		pages_data->pages_list[n++] = optee_page;
+-
+-		if (n == PAGELIST_ENTRIES_PER_PAGE) {
+-			pages_data->next_page_data =
+-				virt_to_phys(pages_data + 1);
+-			pages_data++;
+-			n = 0;
+-		}
+-
+-		optee_page += OPTEE_MSG_NONCONTIG_PAGE_SIZE;
+-		if (!(optee_page & ~PAGE_MASK)) {
+-			if (!--num_pages)
+-				break;
+-			pages++;
+-			optee_page = page_to_phys(*pages);
+-		}
+-	}
+-}
+-
+-/*
+- * The final entry in each pagelist page is a pointer to the next
+- * pagelist page.
+- */
+-static size_t get_pages_list_size(size_t num_entries)
+-{
+-	int pages = DIV_ROUND_UP(num_entries, PAGELIST_ENTRIES_PER_PAGE);
+-
+-	return pages * OPTEE_MSG_NONCONTIG_PAGE_SIZE;
+-}
+-
+-u64 *optee_allocate_pages_list(size_t num_entries)
+-{
+-	return alloc_pages_exact(get_pages_list_size(num_entries), GFP_KERNEL);
+-}
+-
+-void optee_free_pages_list(void *list, size_t num_entries)
+-{
+-	free_pages_exact(list, get_pages_list_size(num_entries));
+-}
+-
+ static bool is_normal_memory(pgprot_t p)
+ {
+ #if defined(CONFIG_ARM)
+@@ -596,7 +344,7 @@ static int __check_mem_type(struct vm_area_struct *vma, unsigned long end)
+ 	return -EINVAL;
+ }
+ 
+-static int check_mem_type(unsigned long start, size_t num_pages)
++int optee_check_mem_type(unsigned long start, size_t num_pages)
+ {
+ 	struct mm_struct *mm = current->mm;
+ 	int rc;
+@@ -615,94 +363,3 @@ static int check_mem_type(unsigned long start, size_t num_pages)
+ 
+ 	return rc;
+ }
+-
+-int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+-		       struct page **pages, size_t num_pages,
+-		       unsigned long start)
+-{
+-	struct optee *optee = tee_get_drvdata(ctx->teedev);
+-	struct optee_msg_arg *msg_arg;
+-	struct tee_shm *shm_arg;
+-	u64 *pages_list;
+-	int rc;
+-
+-	if (!num_pages)
+-		return -EINVAL;
+-
+-	rc = check_mem_type(start, num_pages);
+-	if (rc)
+-		return rc;
+-
+-	pages_list = optee_allocate_pages_list(num_pages);
+-	if (!pages_list)
+-		return -ENOMEM;
+-
+-	shm_arg = get_msg_arg(ctx, 1, &msg_arg);
+-	if (IS_ERR(shm_arg)) {
+-		rc = PTR_ERR(shm_arg);
+-		goto out;
+-	}
+-
+-	optee_fill_pages_list(pages_list, pages, num_pages,
+-			      tee_shm_get_page_offset(shm));
+-
+-	msg_arg->cmd = OPTEE_MSG_CMD_REGISTER_SHM;
+-	msg_arg->params->attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT |
+-				OPTEE_MSG_ATTR_NONCONTIG;
+-	msg_arg->params->u.tmem.shm_ref = (unsigned long)shm;
+-	msg_arg->params->u.tmem.size = tee_shm_get_size(shm);
+-	/*
+-	 * In the least bits of msg_arg->params->u.tmem.buf_ptr we
+-	 * store buffer offset from 4k page, as described in OP-TEE ABI.
+-	 */
+-	msg_arg->params->u.tmem.buf_ptr = virt_to_phys(pages_list) |
+-	  (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1));
+-
+-	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
+-	    msg_arg->ret != TEEC_SUCCESS)
+-		rc = -EINVAL;
+-
+-	tee_shm_free(shm_arg);
+-out:
+-	optee_free_pages_list(pages_list, num_pages);
+-	return rc;
+-}
+-
+-int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
+-{
+-	struct optee *optee = tee_get_drvdata(ctx->teedev);
+-	struct optee_msg_arg *msg_arg;
+-	struct tee_shm *shm_arg;
+-	int rc = 0;
+-
+-	shm_arg = get_msg_arg(ctx, 1, &msg_arg);
+-	if (IS_ERR(shm_arg))
+-		return PTR_ERR(shm_arg);
+-
+-	msg_arg->cmd = OPTEE_MSG_CMD_UNREGISTER_SHM;
+-
+-	msg_arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT;
+-	msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm;
+-
+-	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
+-	    msg_arg->ret != TEEC_SUCCESS)
+-		rc = -EINVAL;
+-	tee_shm_free(shm_arg);
+-	return rc;
+-}
+-
+-int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
+-			    struct page **pages, size_t num_pages,
+-			    unsigned long start)
+-{
+-	/*
+-	 * We don't want to register supplicant memory in OP-TEE.
+-	 * Instead information about it will be passed in RPC code.
+-	 */
+-	return check_mem_type(start, num_pages);
+-}
+-
+-int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm)
+-{
+-	return 0;
+-}
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
+index 26492d3115f5..27b855325b33 100644
+--- a/drivers/tee/optee/core.c
++++ b/drivers/tee/optee/core.c
+@@ -1,260 +1,71 @@
+ // SPDX-License-Identifier: GPL-2.0-only
+ /*
+  * Copyright (c) 2015-2021, Linaro Limited
++ * Copyright (c) 2016, EPAM Systems
+  */
+ 
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ 
+-#include <linux/arm-smccc.h>
+ #include <linux/crash_dump.h>
+ #include <linux/errno.h>
+ #include <linux/io.h>
++#include <linux/mm.h>
+ #include <linux/module.h>
+-#include <linux/of.h>
+-#include <linux/of_platform.h>
+-#include <linux/platform_device.h>
+ #include <linux/slab.h>
+ #include <linux/string.h>
+ #include <linux/tee_drv.h>
+ #include <linux/types.h>
+-#include <linux/uaccess.h>
+ #include <linux/workqueue.h>
+ #include "optee_private.h"
+-#include "optee_smc.h"
+-#include "shm_pool.h"
+ 
+-#define DRIVER_NAME "optee"
+-
+-#define OPTEE_SHM_NUM_PRIV_PAGES	CONFIG_OPTEE_SHM_NUM_PRIV_PAGES
+-
+-static void from_msg_param_value(struct tee_param *p, u32 attr,
+-				 const struct optee_msg_param *mp)
+-{
+-	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT +
+-		  attr - OPTEE_MSG_ATTR_TYPE_VALUE_INPUT;
+-	p->u.value.a = mp->u.value.a;
+-	p->u.value.b = mp->u.value.b;
+-	p->u.value.c = mp->u.value.c;
+-}
+-
+-static int from_msg_param_tmp_mem(struct tee_param *p, u32 attr,
+-				  const struct optee_msg_param *mp)
+-{
+-	struct tee_shm *shm;
+-	phys_addr_t pa;
+-	int rc;
+-
+-	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
+-		  attr - OPTEE_MSG_ATTR_TYPE_TMEM_INPUT;
+-	p->u.memref.size = mp->u.tmem.size;
+-	shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref;
+-	if (!shm) {
+-		p->u.memref.shm_offs = 0;
+-		p->u.memref.shm = NULL;
+-		return 0;
+-	}
+-
+-	rc = tee_shm_get_pa(shm, 0, &pa);
+-	if (rc)
+-		return rc;
+-
+-	p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa;
+-	p->u.memref.shm = shm;
+-
+-	/* Check that the memref is covered by the shm object */
+-	if (p->u.memref.size) {
+-		size_t o = p->u.memref.shm_offs +
+-			   p->u.memref.size - 1;
+-
+-		rc = tee_shm_get_pa(shm, o, NULL);
+-		if (rc)
+-			return rc;
+-	}
+-
+-	return 0;
+-}
+-
+-static void from_msg_param_reg_mem(struct tee_param *p, u32 attr,
+-				   const struct optee_msg_param *mp)
++int optee_pool_op_alloc_helper(struct tee_shm_pool_mgr *poolm,
++			       struct tee_shm *shm, size_t size,
++			       int (*shm_register)(struct tee_context *ctx,
++						   struct tee_shm *shm,
++						   struct page **pages,
++						   size_t num_pages,
++						   unsigned long start))
+ {
+-	struct tee_shm *shm;
++	unsigned int order = get_order(size);
++	struct page *page;
++	int rc = 0;
+ 
+-	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
+-		  attr - OPTEE_MSG_ATTR_TYPE_RMEM_INPUT;
+-	p->u.memref.size = mp->u.rmem.size;
+-	shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref;
+-
+-	if (shm) {
+-		p->u.memref.shm_offs = mp->u.rmem.offs;
+-		p->u.memref.shm = shm;
+-	} else {
+-		p->u.memref.shm_offs = 0;
+-		p->u.memref.shm = NULL;
+-	}
+-}
+-
+-/**
+- * optee_from_msg_param() - convert from OPTEE_MSG parameters to
+- *			    struct tee_param
+- * @optee:	main service struct
+- * @params:	subsystem internal parameter representation
+- * @num_params:	number of elements in the parameter arrays
+- * @msg_params:	OPTEE_MSG parameters
+- * Returns 0 on success or <0 on failure
+- */
+-static int optee_from_msg_param(struct optee *optee, struct tee_param *params,
+-				size_t num_params,
+-				const struct optee_msg_param *msg_params)
+-{
+-	int rc;
+-	size_t n;
++	page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
++	if (!page)
++		return -ENOMEM;
+ 
+-	for (n = 0; n < num_params; n++) {
+-		struct tee_param *p = params + n;
+-		const struct optee_msg_param *mp = msg_params + n;
+-		u32 attr = mp->attr & OPTEE_MSG_ATTR_TYPE_MASK;
++	shm->kaddr = page_address(page);
++	shm->paddr = page_to_phys(page);
++	shm->size = PAGE_SIZE << order;
+ 
+-		switch (attr) {
+-		case OPTEE_MSG_ATTR_TYPE_NONE:
+-			p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
+-			memset(&p->u, 0, sizeof(p->u));
+-			break;
+-		case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
+-		case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
+-		case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
+-			from_msg_param_value(p, attr, mp);
+-			break;
+-		case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT:
+-		case OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT:
+-		case OPTEE_MSG_ATTR_TYPE_TMEM_INOUT:
+-			rc = from_msg_param_tmp_mem(p, attr, mp);
+-			if (rc)
+-				return rc;
+-			break;
+-		case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT:
+-		case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT:
+-		case OPTEE_MSG_ATTR_TYPE_RMEM_INOUT:
+-			from_msg_param_reg_mem(p, attr, mp);
+-			break;
++	if (shm_register) {
++		unsigned int nr_pages = 1 << order, i;
++		struct page **pages;
+ 
+-		default:
+-			return -EINVAL;
++		pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
++		if (!pages) {
++			rc = -ENOMEM;
++			goto err;
+ 		}
+-	}
+-	return 0;
+-}
+-
+-static void to_msg_param_value(struct optee_msg_param *mp,
+-			       const struct tee_param *p)
+-{
+-	mp->attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT + p->attr -
+-		   TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT;
+-	mp->u.value.a = p->u.value.a;
+-	mp->u.value.b = p->u.value.b;
+-	mp->u.value.c = p->u.value.c;
+-}
+-
+-static int to_msg_param_tmp_mem(struct optee_msg_param *mp,
+-				const struct tee_param *p)
+-{
+-	int rc;
+-	phys_addr_t pa;
+ 
+-	mp->attr = OPTEE_MSG_ATTR_TYPE_TMEM_INPUT + p->attr -
+-		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
+-
+-	mp->u.tmem.shm_ref = (unsigned long)p->u.memref.shm;
+-	mp->u.tmem.size = p->u.memref.size;
++		for (i = 0; i < nr_pages; i++) {
++			pages[i] = page;
++			page++;
++		}
+ 
+-	if (!p->u.memref.shm) {
+-		mp->u.tmem.buf_ptr = 0;
+-		return 0;
++		shm->flags |= TEE_SHM_REGISTER;
++		rc = shm_register(shm->ctx, shm, pages, nr_pages,
++				  (unsigned long)shm->kaddr);
++		kfree(pages);
++		if (rc)
++			goto err;
+ 	}
+ 
+-	rc = tee_shm_get_pa(p->u.memref.shm, p->u.memref.shm_offs, &pa);
+-	if (rc)
+-		return rc;
+-
+-	mp->u.tmem.buf_ptr = pa;
+-	mp->attr |= OPTEE_MSG_ATTR_CACHE_PREDEFINED <<
+-		    OPTEE_MSG_ATTR_CACHE_SHIFT;
+-
+-	return 0;
+-}
+-
+-static int to_msg_param_reg_mem(struct optee_msg_param *mp,
+-				const struct tee_param *p)
+-{
+-	mp->attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT + p->attr -
+-		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
+-
+-	mp->u.rmem.shm_ref = (unsigned long)p->u.memref.shm;
+-	mp->u.rmem.size = p->u.memref.size;
+-	mp->u.rmem.offs = p->u.memref.shm_offs;
+-	return 0;
+-}
+-
+-/**
+- * optee_to_msg_param() - convert from struct tee_params to OPTEE_MSG parameters
+- * @optee:	main service struct
+- * @msg_params:	OPTEE_MSG parameters
+- * @num_params:	number of elements in the parameter arrays
+- * @params:	subsystem itnernal parameter representation
+- * Returns 0 on success or <0 on failure
+- */
+-static int optee_to_msg_param(struct optee *optee,
+-			      struct optee_msg_param *msg_params,
+-			      size_t num_params, const struct tee_param *params)
+-{
+-	int rc;
+-	size_t n;
+-
+-	for (n = 0; n < num_params; n++) {
+-		const struct tee_param *p = params + n;
+-		struct optee_msg_param *mp = msg_params + n;
+-
+-		switch (p->attr) {
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
+-			mp->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
+-			memset(&mp->u, 0, sizeof(mp->u));
+-			break;
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
+-			to_msg_param_value(mp, p);
+-			break;
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
+-		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
+-			if (tee_shm_is_registered(p->u.memref.shm))
+-				rc = to_msg_param_reg_mem(mp, p);
+-			else
+-				rc = to_msg_param_tmp_mem(mp, p);
+-			if (rc)
+-				return rc;
+-			break;
+-		default:
+-			return -EINVAL;
+-		}
+-	}
+ 	return 0;
+-}
+ 
+-static void optee_get_version(struct tee_device *teedev,
+-			      struct tee_ioctl_version_data *vers)
+-{
+-	struct tee_ioctl_version_data v = {
+-		.impl_id = TEE_IMPL_ID_OPTEE,
+-		.impl_caps = TEE_OPTEE_CAP_TZ,
+-		.gen_caps = TEE_GEN_CAP_GP,
+-	};
+-	struct optee *optee = tee_get_drvdata(teedev);
+-
+-	if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+-		v.gen_caps |= TEE_GEN_CAP_REG_MEM;
+-	if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
+-		v.gen_caps |= TEE_GEN_CAP_MEMREF_NULL;
+-	*vers = v;
++err:
++	__free_pages(page, order);
++	return rc;
+ }
+ 
+ static void optee_bus_scan(struct work_struct *work)
+@@ -262,7 +73,7 @@ static void optee_bus_scan(struct work_struct *work)
+ 	WARN_ON(optee_enumerate_devices(PTA_CMD_GET_DEVICES_SUPP));
+ }
+ 
+-static int optee_open(struct tee_context *ctx)
++int optee_open(struct tee_context *ctx, bool cap_memref_null)
+ {
+ 	struct optee_context_data *ctxdata;
+ 	struct tee_device *teedev = ctx->teedev;
+@@ -300,11 +111,7 @@ static int optee_open(struct tee_context *ctx)
+ 	mutex_init(&ctxdata->mutex);
+ 	INIT_LIST_HEAD(&ctxdata->sess_list);
+ 
+-	if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
+-		ctx->cap_memref_null  = true;
+-	else
+-		ctx->cap_memref_null = false;
+-
++	ctx->cap_memref_null = cap_memref_null;
+ 	ctx->data = ctxdata;
+ 	return 0;
+ }
+@@ -330,12 +137,12 @@ static void optee_release_helper(struct tee_context *ctx,
+ 	ctx->data = NULL;
+ }
+ 
+-static void optee_release(struct tee_context *ctx)
++void optee_release(struct tee_context *ctx)
+ {
+ 	optee_release_helper(ctx, optee_close_session_helper);
+ }
+ 
+-static void optee_release_supp(struct tee_context *ctx)
++void optee_release_supp(struct tee_context *ctx)
+ {
+ 	struct optee *optee = tee_get_drvdata(ctx->teedev);
+ 
+@@ -347,287 +154,11 @@ static void optee_release_supp(struct tee_context *ctx)
+ 	optee_supp_release(&optee->supp);
+ }
+ 
+-static const struct tee_driver_ops optee_clnt_ops = {
+-	.get_version = optee_get_version,
+-	.open = optee_open,
+-	.release = optee_release,
+-	.open_session = optee_open_session,
+-	.close_session = optee_close_session,
+-	.invoke_func = optee_invoke_func,
+-	.cancel_req = optee_cancel_req,
+-	.shm_register = optee_shm_register,
+-	.shm_unregister = optee_shm_unregister,
+-};
+-
+-static const struct tee_desc optee_clnt_desc = {
+-	.name = DRIVER_NAME "-clnt",
+-	.ops = &optee_clnt_ops,
+-	.owner = THIS_MODULE,
+-};
+-
+-static const struct tee_driver_ops optee_supp_ops = {
+-	.get_version = optee_get_version,
+-	.open = optee_open,
+-	.release = optee_release_supp,
+-	.supp_recv = optee_supp_recv,
+-	.supp_send = optee_supp_send,
+-	.shm_register = optee_shm_register_supp,
+-	.shm_unregister = optee_shm_unregister_supp,
+-};
+-
+-static const struct tee_desc optee_supp_desc = {
+-	.name = DRIVER_NAME "-supp",
+-	.ops = &optee_supp_ops,
+-	.owner = THIS_MODULE,
+-	.flags = TEE_DESC_PRIVILEGED,
+-};
+-
+-static const struct optee_ops optee_ops = {
+-	.do_call_with_arg = optee_do_call_with_arg,
+-	.to_msg_param = optee_to_msg_param,
+-	.from_msg_param = optee_from_msg_param,
+-};
+-
+-static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
+-{
+-	struct arm_smccc_res res;
+-
+-	invoke_fn(OPTEE_SMC_CALLS_UID, 0, 0, 0, 0, 0, 0, 0, &res);
+-
+-	if (res.a0 == OPTEE_MSG_UID_0 && res.a1 == OPTEE_MSG_UID_1 &&
+-	    res.a2 == OPTEE_MSG_UID_2 && res.a3 == OPTEE_MSG_UID_3)
+-		return true;
+-	return false;
+-}
+-
+-static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn)
+-{
+-	union {
+-		struct arm_smccc_res smccc;
+-		struct optee_smc_call_get_os_revision_result result;
+-	} res = {
+-		.result = {
+-			.build_id = 0
+-		}
+-	};
+-
+-	invoke_fn(OPTEE_SMC_CALL_GET_OS_REVISION, 0, 0, 0, 0, 0, 0, 0,
+-		  &res.smccc);
+-
+-	if (res.result.build_id)
+-		pr_info("revision %lu.%lu (%08lx)", res.result.major,
+-			res.result.minor, res.result.build_id);
+-	else
+-		pr_info("revision %lu.%lu", res.result.major, res.result.minor);
+-}
+-
+-static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
+-{
+-	union {
+-		struct arm_smccc_res smccc;
+-		struct optee_smc_calls_revision_result result;
+-	} res;
+-
+-	invoke_fn(OPTEE_SMC_CALLS_REVISION, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
+-
+-	if (res.result.major == OPTEE_MSG_REVISION_MAJOR &&
+-	    (int)res.result.minor >= OPTEE_MSG_REVISION_MINOR)
+-		return true;
+-	return false;
+-}
+-
+-static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn,
+-					    u32 *sec_caps)
+-{
+-	union {
+-		struct arm_smccc_res smccc;
+-		struct optee_smc_exchange_capabilities_result result;
+-	} res;
+-	u32 a1 = 0;
+-
+-	/*
+-	 * TODO This isn't enough to tell if it's UP system (from kernel
+-	 * point of view) or not, is_smp() returns the the information
+-	 * needed, but can't be called directly from here.
+-	 */
+-	if (!IS_ENABLED(CONFIG_SMP) || nr_cpu_ids == 1)
+-		a1 |= OPTEE_SMC_NSEC_CAP_UNIPROCESSOR;
+-
+-	invoke_fn(OPTEE_SMC_EXCHANGE_CAPABILITIES, a1, 0, 0, 0, 0, 0, 0,
+-		  &res.smccc);
+-
+-	if (res.result.status != OPTEE_SMC_RETURN_OK)
+-		return false;
+-
+-	*sec_caps = res.result.capabilities;
+-	return true;
+-}
+-
+-static struct tee_shm_pool *optee_config_dyn_shm(void)
+-{
+-	struct tee_shm_pool_mgr *priv_mgr;
+-	struct tee_shm_pool_mgr *dmabuf_mgr;
+-	void *rc;
+-
+-	rc = optee_shm_pool_alloc_pages();
+-	if (IS_ERR(rc))
+-		return rc;
+-	priv_mgr = rc;
+-
+-	rc = optee_shm_pool_alloc_pages();
+-	if (IS_ERR(rc)) {
+-		tee_shm_pool_mgr_destroy(priv_mgr);
+-		return rc;
+-	}
+-	dmabuf_mgr = rc;
+-
+-	rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr);
+-	if (IS_ERR(rc)) {
+-		tee_shm_pool_mgr_destroy(priv_mgr);
+-		tee_shm_pool_mgr_destroy(dmabuf_mgr);
+-	}
+-
+-	return rc;
+-}
+-
+-static struct tee_shm_pool *
+-optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm)
++void optee_remove_common(struct optee *optee)
+ {
+-	union {
+-		struct arm_smccc_res smccc;
+-		struct optee_smc_get_shm_config_result result;
+-	} res;
+-	unsigned long vaddr;
+-	phys_addr_t paddr;
+-	size_t size;
+-	phys_addr_t begin;
+-	phys_addr_t end;
+-	void *va;
+-	struct tee_shm_pool_mgr *priv_mgr;
+-	struct tee_shm_pool_mgr *dmabuf_mgr;
+-	void *rc;
+-	const int sz = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
+-
+-	invoke_fn(OPTEE_SMC_GET_SHM_CONFIG, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
+-	if (res.result.status != OPTEE_SMC_RETURN_OK) {
+-		pr_err("static shm service not available\n");
+-		return ERR_PTR(-ENOENT);
+-	}
+-
+-	if (res.result.settings != OPTEE_SMC_SHM_CACHED) {
+-		pr_err("only normal cached shared memory supported\n");
+-		return ERR_PTR(-EINVAL);
+-	}
+-
+-	begin = roundup(res.result.start, PAGE_SIZE);
+-	end = rounddown(res.result.start + res.result.size, PAGE_SIZE);
+-	paddr = begin;
+-	size = end - begin;
+-
+-	if (size < 2 * OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE) {
+-		pr_err("too small shared memory area\n");
+-		return ERR_PTR(-EINVAL);
+-	}
+-
+-	va = memremap(paddr, size, MEMREMAP_WB);
+-	if (!va) {
+-		pr_err("shared memory ioremap failed\n");
+-		return ERR_PTR(-EINVAL);
+-	}
+-	vaddr = (unsigned long)va;
+-
+-	rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, sz,
+-					    3 /* 8 bytes aligned */);
+-	if (IS_ERR(rc))
+-		goto err_memunmap;
+-	priv_mgr = rc;
+-
+-	vaddr += sz;
+-	paddr += sz;
+-	size -= sz;
+-
+-	rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, size, PAGE_SHIFT);
+-	if (IS_ERR(rc))
+-		goto err_free_priv_mgr;
+-	dmabuf_mgr = rc;
+-
+-	rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr);
+-	if (IS_ERR(rc))
+-		goto err_free_dmabuf_mgr;
+-
+-	*memremaped_shm = va;
+-
+-	return rc;
+-
+-err_free_dmabuf_mgr:
+-	tee_shm_pool_mgr_destroy(dmabuf_mgr);
+-err_free_priv_mgr:
+-	tee_shm_pool_mgr_destroy(priv_mgr);
+-err_memunmap:
+-	memunmap(va);
+-	return rc;
+-}
+-
+-/* Simple wrapper functions to be able to use a function pointer */
+-static void optee_smccc_smc(unsigned long a0, unsigned long a1,
+-			    unsigned long a2, unsigned long a3,
+-			    unsigned long a4, unsigned long a5,
+-			    unsigned long a6, unsigned long a7,
+-			    struct arm_smccc_res *res)
+-{
+-	arm_smccc_smc(a0, a1, a2, a3, a4, a5, a6, a7, res);
+-}
+-
+-static void optee_smccc_hvc(unsigned long a0, unsigned long a1,
+-			    unsigned long a2, unsigned long a3,
+-			    unsigned long a4, unsigned long a5,
+-			    unsigned long a6, unsigned long a7,
+-			    struct arm_smccc_res *res)
+-{
+-	arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res);
+-}
+-
+-static optee_invoke_fn *get_invoke_func(struct device *dev)
+-{
+-	const char *method;
+-
+-	pr_info("probing for conduit method.\n");
+-
+-	if (device_property_read_string(dev, "method", &method)) {
+-		pr_warn("missing \"method\" property\n");
+-		return ERR_PTR(-ENXIO);
+-	}
+-
+-	if (!strcmp("hvc", method))
+-		return optee_smccc_hvc;
+-	else if (!strcmp("smc", method))
+-		return optee_smccc_smc;
+-
+-	pr_warn("invalid \"method\" property: %s\n", method);
+-	return ERR_PTR(-EINVAL);
+-}
+-
+-/* optee_remove - Device Removal Routine
+- * @pdev: platform device information struct
+- *
+- * optee_remove is called by platform subsystem to alert the driver
+- * that it should release the device
+- */
+-
+-static int optee_remove(struct platform_device *pdev)
+-{
+-	struct optee *optee = platform_get_drvdata(pdev);
+-
+ 	/* Unregister OP-TEE specific client devices on TEE bus */
+ 	optee_unregister_devices();
+ 
+-	/*
+-	 * Ask OP-TEE to free all cached shared memory objects to decrease
+-	 * reference counters and also avoid wild pointers in secure world
+-	 * into the old shared memory range.
+-	 */
+-	optee_disable_shm_cache(optee);
+-
+ 	/*
+ 	 * The two devices have to be unregistered before we can free the
+ 	 * other resources.
+@@ -636,39 +167,13 @@ static int optee_remove(struct platform_device *pdev)
+ 	tee_device_unregister(optee->teedev);
+ 
+ 	tee_shm_pool_free(optee->pool);
+-	if (optee->memremaped_shm)
+-		memunmap(optee->memremaped_shm);
+ 	optee_wait_queue_exit(&optee->wait_queue);
+ 	optee_supp_uninit(&optee->supp);
+ 	mutex_destroy(&optee->call_queue.mutex);
+-
+-	kfree(optee);
+-
+-	return 0;
+-}
+-
+-/* optee_shutdown - Device Removal Routine
+- * @pdev: platform device information struct
+- *
+- * platform_shutdown is called by the platform subsystem to alert
+- * the driver that a shutdown, reboot, or kexec is happening and
+- * device must be disabled.
+- */
+-static void optee_shutdown(struct platform_device *pdev)
+-{
+-	optee_disable_shm_cache(platform_get_drvdata(pdev));
+ }
+ 
+-static int optee_probe(struct platform_device *pdev)
++static int optee_core_init(void)
+ {
+-	optee_invoke_fn *invoke_fn;
+-	struct tee_shm_pool *pool = ERR_PTR(-EINVAL);
+-	struct optee *optee = NULL;
+-	void *memremaped_shm = NULL;
+-	struct tee_device *teedev;
+-	u32 sec_caps;
+-	int rc;
+-
+ 	/*
+ 	 * The kernel may have crashed at the same time that all available
+ 	 * secure world threads were suspended and we cannot reschedule the
+@@ -679,139 +184,15 @@ static int optee_probe(struct platform_device *pdev)
+ 	if (is_kdump_kernel())
+ 		return -ENODEV;
+ 
+-	invoke_fn = get_invoke_func(&pdev->dev);
+-	if (IS_ERR(invoke_fn))
+-		return PTR_ERR(invoke_fn);
+-
+-	if (!optee_msg_api_uid_is_optee_api(invoke_fn)) {
+-		pr_warn("api uid mismatch\n");
+-		return -EINVAL;
+-	}
+-
+-	optee_msg_get_os_revision(invoke_fn);
+-
+-	if (!optee_msg_api_revision_is_compatible(invoke_fn)) {
+-		pr_warn("api revision mismatch\n");
+-		return -EINVAL;
+-	}
+-
+-	if (!optee_msg_exchange_capabilities(invoke_fn, &sec_caps)) {
+-		pr_warn("capabilities mismatch\n");
+-		return -EINVAL;
+-	}
+-
+-	/*
+-	 * Try to use dynamic shared memory if possible
+-	 */
+-	if (sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+-		pool = optee_config_dyn_shm();
+-
+-	/*
+-	 * If dynamic shared memory is not available or failed - try static one
+-	 */
+-	if (IS_ERR(pool) && (sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM))
+-		pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm);
+-
+-	if (IS_ERR(pool))
+-		return PTR_ERR(pool);
+-
+-	optee = kzalloc(sizeof(*optee), GFP_KERNEL);
+-	if (!optee) {
+-		rc = -ENOMEM;
+-		goto err;
+-	}
+-
+-	optee->ops = &optee_ops;
+-	optee->invoke_fn = invoke_fn;
+-	optee->sec_caps = sec_caps;
+-
+-	teedev = tee_device_alloc(&optee_clnt_desc, NULL, pool, optee);
+-	if (IS_ERR(teedev)) {
+-		rc = PTR_ERR(teedev);
+-		goto err;
+-	}
+-	optee->teedev = teedev;
+-
+-	teedev = tee_device_alloc(&optee_supp_desc, NULL, pool, optee);
+-	if (IS_ERR(teedev)) {
+-		rc = PTR_ERR(teedev);
+-		goto err;
+-	}
+-	optee->supp_teedev = teedev;
+-
+-	rc = tee_device_register(optee->teedev);
+-	if (rc)
+-		goto err;
+-
+-	rc = tee_device_register(optee->supp_teedev);
+-	if (rc)
+-		goto err;
+-
+-	mutex_init(&optee->call_queue.mutex);
+-	INIT_LIST_HEAD(&optee->call_queue.waiters);
+-	optee_wait_queue_init(&optee->wait_queue);
+-	optee_supp_init(&optee->supp);
+-	optee->memremaped_shm = memremaped_shm;
+-	optee->pool = pool;
+-
+-	/*
+-	 * Ensure that there are no pre-existing shm objects before enabling
+-	 * the shm cache so that there's no chance of receiving an invalid
+-	 * address during shutdown. This could occur, for example, if we're
+-	 * kexec booting from an older kernel that did not properly cleanup the
+-	 * shm cache.
+-	 */
+-	optee_disable_unmapped_shm_cache(optee);
+-
+-	optee_enable_shm_cache(optee);
+-
+-	if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+-		pr_info("dynamic shared memory is enabled\n");
+-
+-	platform_set_drvdata(pdev, optee);
+-
+-	rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES);
+-	if (rc) {
+-		optee_remove(pdev);
+-		return rc;
+-	}
+-
+-	pr_info("initialized driver\n");
+-	return 0;
+-err:
+-	if (optee) {
+-		/*
+-		 * tee_device_unregister() is safe to call even if the
+-		 * devices hasn't been registered with
+-		 * tee_device_register() yet.
+-		 */
+-		tee_device_unregister(optee->supp_teedev);
+-		tee_device_unregister(optee->teedev);
+-		kfree(optee);
+-	}
+-	if (pool)
+-		tee_shm_pool_free(pool);
+-	if (memremaped_shm)
+-		memunmap(memremaped_shm);
+-	return rc;
++	return optee_smc_abi_register();
+ }
++module_init(optee_core_init);
+ 
+-static const struct of_device_id optee_dt_match[] = {
+-	{ .compatible = "linaro,optee-tz" },
+-	{},
+-};
+-MODULE_DEVICE_TABLE(of, optee_dt_match);
+-
+-static struct platform_driver optee_driver = {
+-	.probe  = optee_probe,
+-	.remove = optee_remove,
+-	.shutdown = optee_shutdown,
+-	.driver = {
+-		.name = "optee",
+-		.of_match_table = optee_dt_match,
+-	},
+-};
+-module_platform_driver(optee_driver);
++static void optee_core_exit(void)
++{
++	optee_smc_abi_unregister();
++}
++module_exit(optee_core_exit);
+ 
+ MODULE_AUTHOR("Linaro");
+ MODULE_DESCRIPTION("OP-TEE driver");
+diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
+index beca97017996..40af6b059b20 100644
+--- a/drivers/tee/optee/optee_private.h
++++ b/drivers/tee/optee/optee_private.h
+@@ -12,6 +12,8 @@
+ #include <linux/types.h>
+ #include "optee_msg.h"
+ 
++#define DRIVER_NAME "optee"
++
+ #define OPTEE_MAX_ARG_SIZE	1024
+ 
+ /* Some Global Platform error codes used in this driver */
+@@ -29,6 +31,11 @@ typedef void (optee_invoke_fn)(unsigned long, unsigned long, unsigned long,
+ 				unsigned long, unsigned long,
+ 				struct arm_smccc_res *);
+ 
++struct optee_call_waiter {
++	struct list_head list_node;
++	struct completion c;
++};
++
+ struct optee_call_queue {
+ 	/* Serializes access to this struct */
+ 	struct mutex mutex;
+@@ -66,6 +73,19 @@ struct optee_supp {
+ 	struct completion reqs_c;
+ };
+ 
++/**
++ * struct optee_smc - SMC ABI specifics
++ * @invoke_fn:		function to issue smc or hvc
++ * @memremaped_shm	virtual address of memory in shared memory pool
++ * @sec_caps:		secure world capabilities defined by
++ *			OPTEE_SMC_SEC_CAP_* in optee_smc.h
++ */
++struct optee_smc {
++	optee_invoke_fn *invoke_fn;
++	void *memremaped_shm;
++	u32 sec_caps;
++};
++
+ struct optee;
+ 
+ /**
+@@ -95,15 +115,12 @@ struct optee_ops {
+  * @ops:		internal callbacks for different ways to reach secure
+  *			world
+  * @teedev:		client device
+- * @invoke_fn:		function to issue smc or hvc
++ * @smc:		specific to SMC ABI
+  * @call_queue:		queue of threads waiting to call @invoke_fn
+  * @wait_queue:		queue of threads from secure world waiting for a
+  *			secure world sync object
+  * @supp:		supplicant synchronization struct for RPC to supplicant
+  * @pool:		shared memory pool
+- * @memremaped_shm	virtual address of memory in shared memory pool
+- * @sec_caps:		secure world capabilities defined by
+- *			OPTEE_SMC_SEC_CAP_* in optee_smc.h
+  * @scan_bus_done	flag if device registation was already done.
+  * @scan_bus_wq		workqueue to scan optee bus and register optee drivers
+  * @scan_bus_work	workq to scan optee bus and register optee drivers
+@@ -112,13 +129,11 @@ struct optee {
+ 	struct tee_device *supp_teedev;
+ 	struct tee_device *teedev;
+ 	const struct optee_ops *ops;
+-	optee_invoke_fn *invoke_fn;
++	struct optee_smc smc;
+ 	struct optee_call_queue call_queue;
+ 	struct optee_wait_queue wait_queue;
+ 	struct optee_supp supp;
+ 	struct tee_shm_pool *pool;
+-	void *memremaped_shm;
+-	u32 sec_caps;
+ 	bool   scan_bus_done;
+ 	struct workqueue_struct *scan_bus_wq;
+ 	struct work_struct scan_bus_work;
+@@ -153,10 +168,6 @@ struct optee_call_ctx {
+ 	size_t num_entries;
+ };
+ 
+-void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
+-		      struct optee_call_ctx *call_ctx);
+-void optee_rpc_finalize_call(struct optee_call_ctx *call_ctx);
+-
+ void optee_wait_queue_init(struct optee_wait_queue *wq);
+ void optee_wait_queue_exit(struct optee_wait_queue *wq);
+ 
+@@ -174,7 +185,6 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,
+ int optee_supp_send(struct tee_context *ctx, u32 ret, u32 num_params,
+ 		    struct tee_param *param);
+ 
+-int optee_do_call_with_arg(struct tee_context *ctx, struct tee_shm *arg);
+ int optee_open_session(struct tee_context *ctx,
+ 		       struct tee_ioctl_open_session_arg *arg,
+ 		       struct tee_param *param);
+@@ -184,30 +194,60 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
+ 		      struct tee_param *param);
+ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session);
+ 
+-void optee_enable_shm_cache(struct optee *optee);
+-void optee_disable_shm_cache(struct optee *optee);
+-void optee_disable_unmapped_shm_cache(struct optee *optee);
+-
+-int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
+-		       struct page **pages, size_t num_pages,
+-		       unsigned long start);
+-int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm);
+-
+-int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
+-			    struct page **pages, size_t num_pages,
+-			    unsigned long start);
+-int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm);
+-
+-u64 *optee_allocate_pages_list(size_t num_entries);
+-void optee_free_pages_list(void *array, size_t num_entries);
+-void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
+-			   size_t page_offset);
+-
+ #define PTA_CMD_GET_DEVICES		0x0
+ #define PTA_CMD_GET_DEVICES_SUPP	0x1
+ int optee_enumerate_devices(u32 func);
+ void optee_unregister_devices(void);
+ 
++int optee_pool_op_alloc_helper(struct tee_shm_pool_mgr *poolm,
++			       struct tee_shm *shm, size_t size,
++			       int (*shm_register)(struct tee_context *ctx,
++						   struct tee_shm *shm,
++						   struct page **pages,
++						   size_t num_pages,
++						   unsigned long start));
++
++
++void optee_remove_common(struct optee *optee);
++int optee_open(struct tee_context *ctx, bool cap_memref_null);
++void optee_release(struct tee_context *ctx);
++void optee_release_supp(struct tee_context *ctx);
++
++static inline void optee_from_msg_param_value(struct tee_param *p, u32 attr,
++					      const struct optee_msg_param *mp)
++{
++	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT +
++		  attr - OPTEE_MSG_ATTR_TYPE_VALUE_INPUT;
++	p->u.value.a = mp->u.value.a;
++	p->u.value.b = mp->u.value.b;
++	p->u.value.c = mp->u.value.c;
++}
++
++static inline void optee_to_msg_param_value(struct optee_msg_param *mp,
++					    const struct tee_param *p)
++{
++	mp->attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT + p->attr -
++		   TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT;
++	mp->u.value.a = p->u.value.a;
++	mp->u.value.b = p->u.value.b;
++	mp->u.value.c = p->u.value.c;
++}
++
++void optee_cq_wait_init(struct optee_call_queue *cq,
++			struct optee_call_waiter *w);
++void optee_cq_wait_for_completion(struct optee_call_queue *cq,
++				  struct optee_call_waiter *w);
++void optee_cq_wait_final(struct optee_call_queue *cq,
++			 struct optee_call_waiter *w);
++int optee_check_mem_type(unsigned long start, size_t num_pages);
++struct tee_shm *optee_get_msg_arg(struct tee_context *ctx, size_t num_params,
++				  struct optee_msg_arg **msg_arg);
++
++struct tee_shm *optee_rpc_cmd_alloc_suppl(struct tee_context *ctx, size_t sz);
++void optee_rpc_cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm);
++void optee_rpc_cmd(struct tee_context *ctx, struct optee *optee,
++		   struct optee_msg_arg *arg);
++
+ /*
+  * Small helpers
+  */
+@@ -223,4 +263,8 @@ static inline void reg_pair_from_64(u32 *reg0, u32 *reg1, u64 val)
+ 	*reg1 = val;
+ }
+ 
++/* Registration of the ABIs */
++int optee_smc_abi_register(void);
++void optee_smc_abi_unregister(void);
++
+ #endif /*OPTEE_PRIVATE_H*/
+diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
+index 309258d47790..cd642e340eaf 100644
+--- a/drivers/tee/optee/rpc.c
++++ b/drivers/tee/optee/rpc.c
+@@ -6,12 +6,10 @@
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ 
+ #include <linux/delay.h>
+-#include <linux/device.h>
+ #include <linux/i2c.h>
+ #include <linux/slab.h>
+ #include <linux/tee_drv.h>
+ #include "optee_private.h"
+-#include "optee_smc.h"
+ #include "optee_rpc_cmd.h"
+ 
+ struct wq_entry {
+@@ -266,7 +264,7 @@ static void handle_rpc_supp_cmd(struct tee_context *ctx, struct optee *optee,
+ 	kfree(params);
+ }
+ 
+-static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
++struct tee_shm *optee_rpc_cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
+ {
+ 	u32 ret;
+ 	struct tee_param param;
+@@ -289,103 +287,7 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz)
+ 	return shm;
+ }
+ 
+-static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
+-					  struct optee_msg_arg *arg,
+-					  struct optee_call_ctx *call_ctx)
+-{
+-	phys_addr_t pa;
+-	struct tee_shm *shm;
+-	size_t sz;
+-	size_t n;
+-
+-	arg->ret_origin = TEEC_ORIGIN_COMMS;
+-
+-	if (!arg->num_params ||
+-	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
+-		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-		return;
+-	}
+-
+-	for (n = 1; n < arg->num_params; n++) {
+-		if (arg->params[n].attr != OPTEE_MSG_ATTR_TYPE_NONE) {
+-			arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-			return;
+-		}
+-	}
+-
+-	sz = arg->params[0].u.value.b;
+-	switch (arg->params[0].u.value.a) {
+-	case OPTEE_RPC_SHM_TYPE_APPL:
+-		shm = cmd_alloc_suppl(ctx, sz);
+-		break;
+-	case OPTEE_RPC_SHM_TYPE_KERNEL:
+-		shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
+-		break;
+-	default:
+-		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-		return;
+-	}
+-
+-	if (IS_ERR(shm)) {
+-		arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
+-		return;
+-	}
+-
+-	if (tee_shm_get_pa(shm, 0, &pa)) {
+-		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-		goto bad;
+-	}
+-
+-	sz = tee_shm_get_size(shm);
+-
+-	if (tee_shm_is_registered(shm)) {
+-		struct page **pages;
+-		u64 *pages_list;
+-		size_t page_num;
+-
+-		pages = tee_shm_get_pages(shm, &page_num);
+-		if (!pages || !page_num) {
+-			arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
+-			goto bad;
+-		}
+-
+-		pages_list = optee_allocate_pages_list(page_num);
+-		if (!pages_list) {
+-			arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
+-			goto bad;
+-		}
+-
+-		call_ctx->pages_list = pages_list;
+-		call_ctx->num_entries = page_num;
+-
+-		arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT |
+-				      OPTEE_MSG_ATTR_NONCONTIG;
+-		/*
+-		 * In the least bits of u.tmem.buf_ptr we store buffer offset
+-		 * from 4k page, as described in OP-TEE ABI.
+-		 */
+-		arg->params[0].u.tmem.buf_ptr = virt_to_phys(pages_list) |
+-			(tee_shm_get_page_offset(shm) &
+-			 (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1));
+-		arg->params[0].u.tmem.size = tee_shm_get_size(shm);
+-		arg->params[0].u.tmem.shm_ref = (unsigned long)shm;
+-
+-		optee_fill_pages_list(pages_list, pages, page_num,
+-				      tee_shm_get_page_offset(shm));
+-	} else {
+-		arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT;
+-		arg->params[0].u.tmem.buf_ptr = pa;
+-		arg->params[0].u.tmem.size = sz;
+-		arg->params[0].u.tmem.shm_ref = (unsigned long)shm;
+-	}
+-
+-	arg->ret = TEEC_SUCCESS;
+-	return;
+-bad:
+-	tee_shm_free(shm);
+-}
+-
+-static void cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm)
++void optee_rpc_cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm)
+ {
+ 	struct tee_param param;
+ 
+@@ -410,60 +312,9 @@ static void cmd_free_suppl(struct tee_context *ctx, struct tee_shm *shm)
+ 	optee_supp_thrd_req(ctx, OPTEE_RPC_CMD_SHM_FREE, 1, &param);
+ }
+ 
+-static void handle_rpc_func_cmd_shm_free(struct tee_context *ctx,
+-					 struct optee_msg_arg *arg)
+-{
+-	struct tee_shm *shm;
+-
+-	arg->ret_origin = TEEC_ORIGIN_COMMS;
+-
+-	if (arg->num_params != 1 ||
+-	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
+-		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-		return;
+-	}
+-
+-	shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b;
+-	switch (arg->params[0].u.value.a) {
+-	case OPTEE_RPC_SHM_TYPE_APPL:
+-		cmd_free_suppl(ctx, shm);
+-		break;
+-	case OPTEE_RPC_SHM_TYPE_KERNEL:
+-		tee_shm_free(shm);
+-		break;
+-	default:
+-		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+-	}
+-	arg->ret = TEEC_SUCCESS;
+-}
+-
+-static void free_pages_list(struct optee_call_ctx *call_ctx)
+-{
+-	if (call_ctx->pages_list) {
+-		optee_free_pages_list(call_ctx->pages_list,
+-				      call_ctx->num_entries);
+-		call_ctx->pages_list = NULL;
+-		call_ctx->num_entries = 0;
+-	}
+-}
+-
+-void optee_rpc_finalize_call(struct optee_call_ctx *call_ctx)
+-{
+-	free_pages_list(call_ctx);
+-}
+-
+-static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
+-				struct tee_shm *shm,
+-				struct optee_call_ctx *call_ctx)
++void optee_rpc_cmd(struct tee_context *ctx, struct optee *optee,
++		   struct optee_msg_arg *arg)
+ {
+-	struct optee_msg_arg *arg;
+-
+-	arg = tee_shm_get_va(shm, 0);
+-	if (IS_ERR(arg)) {
+-		pr_err("%s: tee_shm_get_va %p failed\n", __func__, shm);
+-		return;
+-	}
+-
+ 	switch (arg->cmd) {
+ 	case OPTEE_RPC_CMD_GET_TIME:
+ 		handle_rpc_func_cmd_get_time(arg);
+@@ -474,13 +325,6 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
+ 	case OPTEE_RPC_CMD_SUSPEND:
+ 		handle_rpc_func_cmd_wait(arg);
+ 		break;
+-	case OPTEE_RPC_CMD_SHM_ALLOC:
+-		free_pages_list(call_ctx);
+-		handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
+-		break;
+-	case OPTEE_RPC_CMD_SHM_FREE:
+-		handle_rpc_func_cmd_shm_free(ctx, arg);
+-		break;
+ 	case OPTEE_RPC_CMD_I2C_TRANSFER:
+ 		handle_rpc_func_cmd_i2c_transfer(ctx, arg);
+ 		break;
+@@ -489,58 +333,4 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
+ 	}
+ }
+ 
+-/**
+- * optee_handle_rpc() - handle RPC from secure world
+- * @ctx:	context doing the RPC
+- * @param:	value of registers for the RPC
+- * @call_ctx:	call context. Preserved during one OP-TEE invocation
+- *
+- * Result of RPC is written back into @param.
+- */
+-void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
+-		      struct optee_call_ctx *call_ctx)
+-{
+-	struct tee_device *teedev = ctx->teedev;
+-	struct optee *optee = tee_get_drvdata(teedev);
+-	struct tee_shm *shm;
+-	phys_addr_t pa;
+-
+-	switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
+-	case OPTEE_SMC_RPC_FUNC_ALLOC:
+-		shm = tee_shm_alloc(ctx, param->a1,
+-				    TEE_SHM_MAPPED | TEE_SHM_PRIV);
+-		if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
+-			reg_pair_from_64(&param->a1, &param->a2, pa);
+-			reg_pair_from_64(&param->a4, &param->a5,
+-					 (unsigned long)shm);
+-		} else {
+-			param->a1 = 0;
+-			param->a2 = 0;
+-			param->a4 = 0;
+-			param->a5 = 0;
+-		}
+-		break;
+-	case OPTEE_SMC_RPC_FUNC_FREE:
+-		shm = reg_pair_to_ptr(param->a1, param->a2);
+-		tee_shm_free(shm);
+-		break;
+-	case OPTEE_SMC_RPC_FUNC_FOREIGN_INTR:
+-		/*
+-		 * A foreign interrupt was raised while secure world was
+-		 * executing, since they are handled in Linux a dummy RPC is
+-		 * performed to let Linux take the interrupt through the normal
+-		 * vector.
+-		 */
+-		break;
+-	case OPTEE_SMC_RPC_FUNC_CMD:
+-		shm = reg_pair_to_ptr(param->a1, param->a2);
+-		handle_rpc_func_cmd(ctx, optee, shm, call_ctx);
+-		break;
+-	default:
+-		pr_warn("Unknown RPC func 0x%x\n",
+-			(u32)OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0));
+-		break;
+-	}
+ 
+-	param->a0 = OPTEE_SMC_CALL_RETURN_FROM_RPC;
+-}
+diff --git a/drivers/tee/optee/shm_pool.h b/drivers/tee/optee/shm_pool.h
+deleted file mode 100644
+index 28109d991c4b..000000000000
+--- a/drivers/tee/optee/shm_pool.h
++++ /dev/null
+@@ -1,14 +0,0 @@
+-/* SPDX-License-Identifier: GPL-2.0-only */
+-/*
+- * Copyright (c) 2015, Linaro Limited
+- * Copyright (c) 2016, EPAM Systems
+- */
+-
+-#ifndef SHM_POOL_H
+-#define SHM_POOL_H
+-
+-#include <linux/tee_drv.h>
+-
+-struct tee_shm_pool_mgr *optee_shm_pool_alloc_pages(void);
+-
+-#endif
+diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
+new file mode 100644
+index 000000000000..9a787fb4f5e5
+--- /dev/null
++++ b/drivers/tee/optee/smc_abi.c
+@@ -0,0 +1,1361 @@
++// SPDX-License-Identifier: GPL-2.0-only
++/*
++ * Copyright (c) 2015-2021, Linaro Limited
++ * Copyright (c) 2016, EPAM Systems
++ */
++
++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++
++#include <linux/arm-smccc.h>
++#include <linux/errno.h>
++#include <linux/io.h>
++#include <linux/sched.h>
++#include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_platform.h>
++#include <linux/platform_device.h>
++#include <linux/slab.h>
++#include <linux/string.h>
++#include <linux/tee_drv.h>
++#include <linux/types.h>
++#include <linux/workqueue.h>
++#include "optee_private.h"
++#include "optee_smc.h"
++#include "optee_rpc_cmd.h"
++#define CREATE_TRACE_POINTS
++#include "optee_trace.h"
++
++/*
++ * This file implement the SMC ABI used when communicating with secure world
++ * OP-TEE OS via raw SMCs.
++ * This file is divided into the following sections:
++ * 1. Convert between struct tee_param and struct optee_msg_param
++ * 2. Low level support functions to register shared memory in secure world
++ * 3. Dynamic shared memory pool based on alloc_pages()
++ * 4. Do a normal scheduled call into secure world
++ * 5. Driver initialization.
++ */
++
++#define OPTEE_SHM_NUM_PRIV_PAGES	CONFIG_OPTEE_SHM_NUM_PRIV_PAGES
++
++/*
++ * 1. Convert between struct tee_param and struct optee_msg_param
++ *
++ * optee_from_msg_param() and optee_to_msg_param() are the main
++ * functions.
++ */
++
++static int from_msg_param_tmp_mem(struct tee_param *p, u32 attr,
++				  const struct optee_msg_param *mp)
++{
++	struct tee_shm *shm;
++	phys_addr_t pa;
++	int rc;
++
++	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
++		  attr - OPTEE_MSG_ATTR_TYPE_TMEM_INPUT;
++	p->u.memref.size = mp->u.tmem.size;
++	shm = (struct tee_shm *)(unsigned long)mp->u.tmem.shm_ref;
++	if (!shm) {
++		p->u.memref.shm_offs = 0;
++		p->u.memref.shm = NULL;
++		return 0;
++	}
++
++	rc = tee_shm_get_pa(shm, 0, &pa);
++	if (rc)
++		return rc;
++
++	p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa;
++	p->u.memref.shm = shm;
++
++	/* Check that the memref is covered by the shm object */
++	if (p->u.memref.size) {
++		size_t o = p->u.memref.shm_offs +
++			   p->u.memref.size - 1;
++
++		rc = tee_shm_get_pa(shm, o, NULL);
++		if (rc)
++			return rc;
++	}
++
++	return 0;
++}
++
++static void from_msg_param_reg_mem(struct tee_param *p, u32 attr,
++				   const struct optee_msg_param *mp)
++{
++	struct tee_shm *shm;
++
++	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
++		  attr - OPTEE_MSG_ATTR_TYPE_RMEM_INPUT;
++	p->u.memref.size = mp->u.rmem.size;
++	shm = (struct tee_shm *)(unsigned long)mp->u.rmem.shm_ref;
++
++	if (shm) {
++		p->u.memref.shm_offs = mp->u.rmem.offs;
++		p->u.memref.shm = shm;
++	} else {
++		p->u.memref.shm_offs = 0;
++		p->u.memref.shm = NULL;
++	}
++}
++
++/**
++ * optee_from_msg_param() - convert from OPTEE_MSG parameters to
++ *			    struct tee_param
++ * @optee:	main service struct
++ * @params:	subsystem internal parameter representation
++ * @num_params:	number of elements in the parameter arrays
++ * @msg_params:	OPTEE_MSG parameters
++ * Returns 0 on success or <0 on failure
++ */
++static int optee_from_msg_param(struct optee *optee, struct tee_param *params,
++				size_t num_params,
++				const struct optee_msg_param *msg_params)
++{
++	int rc;
++	size_t n;
++
++	for (n = 0; n < num_params; n++) {
++		struct tee_param *p = params + n;
++		const struct optee_msg_param *mp = msg_params + n;
++		u32 attr = mp->attr & OPTEE_MSG_ATTR_TYPE_MASK;
++
++		switch (attr) {
++		case OPTEE_MSG_ATTR_TYPE_NONE:
++			p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
++			memset(&p->u, 0, sizeof(p->u));
++			break;
++		case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
++		case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
++		case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
++			optee_from_msg_param_value(p, attr, mp);
++			break;
++		case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT:
++		case OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT:
++		case OPTEE_MSG_ATTR_TYPE_TMEM_INOUT:
++			rc = from_msg_param_tmp_mem(p, attr, mp);
++			if (rc)
++				return rc;
++			break;
++		case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT:
++		case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT:
++		case OPTEE_MSG_ATTR_TYPE_RMEM_INOUT:
++			from_msg_param_reg_mem(p, attr, mp);
++			break;
++
++		default:
++			return -EINVAL;
++		}
++	}
++	return 0;
++}
++
++static int to_msg_param_tmp_mem(struct optee_msg_param *mp,
++				const struct tee_param *p)
++{
++	int rc;
++	phys_addr_t pa;
++
++	mp->attr = OPTEE_MSG_ATTR_TYPE_TMEM_INPUT + p->attr -
++		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
++
++	mp->u.tmem.shm_ref = (unsigned long)p->u.memref.shm;
++	mp->u.tmem.size = p->u.memref.size;
++
++	if (!p->u.memref.shm) {
++		mp->u.tmem.buf_ptr = 0;
++		return 0;
++	}
++
++	rc = tee_shm_get_pa(p->u.memref.shm, p->u.memref.shm_offs, &pa);
++	if (rc)
++		return rc;
++
++	mp->u.tmem.buf_ptr = pa;
++	mp->attr |= OPTEE_MSG_ATTR_CACHE_PREDEFINED <<
++		    OPTEE_MSG_ATTR_CACHE_SHIFT;
++
++	return 0;
++}
++
++static int to_msg_param_reg_mem(struct optee_msg_param *mp,
++				const struct tee_param *p)
++{
++	mp->attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT + p->attr -
++		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
++
++	mp->u.rmem.shm_ref = (unsigned long)p->u.memref.shm;
++	mp->u.rmem.size = p->u.memref.size;
++	mp->u.rmem.offs = p->u.memref.shm_offs;
++	return 0;
++}
++
++/**
++ * optee_to_msg_param() - convert from struct tee_params to OPTEE_MSG parameters
++ * @optee:	main service struct
++ * @msg_params:	OPTEE_MSG parameters
++ * @num_params:	number of elements in the parameter arrays
++ * @params:	subsystem itnernal parameter representation
++ * Returns 0 on success or <0 on failure
++ */
++static int optee_to_msg_param(struct optee *optee,
++			      struct optee_msg_param *msg_params,
++			      size_t num_params, const struct tee_param *params)
++{
++	int rc;
++	size_t n;
++
++	for (n = 0; n < num_params; n++) {
++		const struct tee_param *p = params + n;
++		struct optee_msg_param *mp = msg_params + n;
++
++		switch (p->attr) {
++		case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
++			mp->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
++			memset(&mp->u, 0, sizeof(mp->u));
++			break;
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
++			optee_to_msg_param_value(mp, p);
++			break;
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
++			if (tee_shm_is_registered(p->u.memref.shm))
++				rc = to_msg_param_reg_mem(mp, p);
++			else
++				rc = to_msg_param_tmp_mem(mp, p);
++			if (rc)
++				return rc;
++			break;
++		default:
++			return -EINVAL;
++		}
++	}
++	return 0;
++}
++
++/*
++ * 2. Low level support functions to register shared memory in secure world
++ *
++ * Functions to enable/disable shared memory caching in secure world, that
++ * is, lazy freeing of previously allocated shared memory. Freeing is
++ * performed when a request has been compled.
++ *
++ * Functions to register and unregister shared memory both for normal
++ * clients and for tee-supplicant.
++ */
++
++/**
++ * optee_enable_shm_cache() - Enables caching of some shared memory allocation
++ *			      in OP-TEE
++ * @optee:	main service struct
++ */
++static void optee_enable_shm_cache(struct optee *optee)
++{
++	struct optee_call_waiter w;
++
++	/* We need to retry until secure world isn't busy. */
++	optee_cq_wait_init(&optee->call_queue, &w);
++	while (true) {
++		struct arm_smccc_res res;
++
++		optee->smc.invoke_fn(OPTEE_SMC_ENABLE_SHM_CACHE,
++				     0, 0, 0, 0, 0, 0, 0, &res);
++		if (res.a0 == OPTEE_SMC_RETURN_OK)
++			break;
++		optee_cq_wait_for_completion(&optee->call_queue, &w);
++	}
++	optee_cq_wait_final(&optee->call_queue, &w);
++}
++
++/**
++ * __optee_disable_shm_cache() - Disables caching of some shared memory
++ *				 allocation in OP-TEE
++ * @optee:	main service struct
++ * @is_mapped:	true if the cached shared memory addresses were mapped by this
++ *		kernel, are safe to dereference, and should be freed
++ */
++static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
++{
++	struct optee_call_waiter w;
++
++	/* We need to retry until secure world isn't busy. */
++	optee_cq_wait_init(&optee->call_queue, &w);
++	while (true) {
++		union {
++			struct arm_smccc_res smccc;
++			struct optee_smc_disable_shm_cache_result result;
++		} res;
++
++		optee->smc.invoke_fn(OPTEE_SMC_DISABLE_SHM_CACHE,
++				     0, 0, 0, 0, 0, 0, 0, &res.smccc);
++		if (res.result.status == OPTEE_SMC_RETURN_ENOTAVAIL)
++			break; /* All shm's freed */
++		if (res.result.status == OPTEE_SMC_RETURN_OK) {
++			struct tee_shm *shm;
++
++			/*
++			 * Shared memory references that were not mapped by
++			 * this kernel must be ignored to prevent a crash.
++			 */
++			if (!is_mapped)
++				continue;
++
++			shm = reg_pair_to_ptr(res.result.shm_upper32,
++					      res.result.shm_lower32);
++			tee_shm_free(shm);
++		} else {
++			optee_cq_wait_for_completion(&optee->call_queue, &w);
++		}
++	}
++	optee_cq_wait_final(&optee->call_queue, &w);
++}
++
++/**
++ * optee_disable_shm_cache() - Disables caching of mapped shared memory
++ *			       allocations in OP-TEE
++ * @optee:	main service struct
++ */
++static void optee_disable_shm_cache(struct optee *optee)
++{
++	return __optee_disable_shm_cache(optee, true);
++}
++
++/**
++ * optee_disable_unmapped_shm_cache() - Disables caching of shared memory
++ *					allocations in OP-TEE which are not
++ *					currently mapped
++ * @optee:	main service struct
++ */
++static void optee_disable_unmapped_shm_cache(struct optee *optee)
++{
++	return __optee_disable_shm_cache(optee, false);
++}
++
++#define PAGELIST_ENTRIES_PER_PAGE				\
++	((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
++
++/*
++ * The final entry in each pagelist page is a pointer to the next
++ * pagelist page.
++ */
++static size_t get_pages_list_size(size_t num_entries)
++{
++	int pages = DIV_ROUND_UP(num_entries, PAGELIST_ENTRIES_PER_PAGE);
++
++	return pages * OPTEE_MSG_NONCONTIG_PAGE_SIZE;
++}
++
++static u64 *optee_allocate_pages_list(size_t num_entries)
++{
++	return alloc_pages_exact(get_pages_list_size(num_entries), GFP_KERNEL);
++}
++
++static void optee_free_pages_list(void *list, size_t num_entries)
++{
++	free_pages_exact(list, get_pages_list_size(num_entries));
++}
++
++/**
++ * optee_fill_pages_list() - write list of user pages to given shared
++ * buffer.
++ *
++ * @dst: page-aligned buffer where list of pages will be stored
++ * @pages: array of pages that represents shared buffer
++ * @num_pages: number of entries in @pages
++ * @page_offset: offset of user buffer from page start
++ *
++ * @dst should be big enough to hold list of user page addresses and
++ *	links to the next pages of buffer
++ */
++static void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
++				  size_t page_offset)
++{
++	int n = 0;
++	phys_addr_t optee_page;
++	/*
++	 * Refer to OPTEE_MSG_ATTR_NONCONTIG description in optee_msg.h
++	 * for details.
++	 */
++	struct {
++		u64 pages_list[PAGELIST_ENTRIES_PER_PAGE];
++		u64 next_page_data;
++	} *pages_data;
++
++	/*
++	 * Currently OP-TEE uses 4k page size and it does not looks
++	 * like this will change in the future.  On other hand, there are
++	 * no know ARM architectures with page size < 4k.
++	 * Thus the next built assert looks redundant. But the following
++	 * code heavily relies on this assumption, so it is better be
++	 * safe than sorry.
++	 */
++	BUILD_BUG_ON(PAGE_SIZE < OPTEE_MSG_NONCONTIG_PAGE_SIZE);
++
++	pages_data = (void *)dst;
++	/*
++	 * If linux page is bigger than 4k, and user buffer offset is
++	 * larger than 4k/8k/12k/etc this will skip first 4k pages,
++	 * because they bear no value data for OP-TEE.
++	 */
++	optee_page = page_to_phys(*pages) +
++		round_down(page_offset, OPTEE_MSG_NONCONTIG_PAGE_SIZE);
++
++	while (true) {
++		pages_data->pages_list[n++] = optee_page;
++
++		if (n == PAGELIST_ENTRIES_PER_PAGE) {
++			pages_data->next_page_data =
++				virt_to_phys(pages_data + 1);
++			pages_data++;
++			n = 0;
++		}
++
++		optee_page += OPTEE_MSG_NONCONTIG_PAGE_SIZE;
++		if (!(optee_page & ~PAGE_MASK)) {
++			if (!--num_pages)
++				break;
++			pages++;
++			optee_page = page_to_phys(*pages);
++		}
++	}
++}
++
++static int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
++			      struct page **pages, size_t num_pages,
++			      unsigned long start)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	struct optee_msg_arg *msg_arg;
++	struct tee_shm *shm_arg;
++	u64 *pages_list;
++	int rc;
++
++	if (!num_pages)
++		return -EINVAL;
++
++	rc = optee_check_mem_type(start, num_pages);
++	if (rc)
++		return rc;
++
++	pages_list = optee_allocate_pages_list(num_pages);
++	if (!pages_list)
++		return -ENOMEM;
++
++	shm_arg = optee_get_msg_arg(ctx, 1, &msg_arg);
++	if (IS_ERR(shm_arg)) {
++		rc = PTR_ERR(shm_arg);
++		goto out;
++	}
++
++	optee_fill_pages_list(pages_list, pages, num_pages,
++			      tee_shm_get_page_offset(shm));
++
++	msg_arg->cmd = OPTEE_MSG_CMD_REGISTER_SHM;
++	msg_arg->params->attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT |
++				OPTEE_MSG_ATTR_NONCONTIG;
++	msg_arg->params->u.tmem.shm_ref = (unsigned long)shm;
++	msg_arg->params->u.tmem.size = tee_shm_get_size(shm);
++	/*
++	 * In the least bits of msg_arg->params->u.tmem.buf_ptr we
++	 * store buffer offset from 4k page, as described in OP-TEE ABI.
++	 */
++	msg_arg->params->u.tmem.buf_ptr = virt_to_phys(pages_list) |
++	  (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1));
++
++	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
++	    msg_arg->ret != TEEC_SUCCESS)
++		rc = -EINVAL;
++
++	tee_shm_free(shm_arg);
++out:
++	optee_free_pages_list(pages_list, num_pages);
++	return rc;
++}
++
++static int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	struct optee_msg_arg *msg_arg;
++	struct tee_shm *shm_arg;
++	int rc = 0;
++
++	shm_arg = optee_get_msg_arg(ctx, 1, &msg_arg);
++	if (IS_ERR(shm_arg))
++		return PTR_ERR(shm_arg);
++
++	msg_arg->cmd = OPTEE_MSG_CMD_UNREGISTER_SHM;
++
++	msg_arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT;
++	msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm;
++
++	if (optee->ops->do_call_with_arg(ctx, shm_arg) ||
++	    msg_arg->ret != TEEC_SUCCESS)
++		rc = -EINVAL;
++	tee_shm_free(shm_arg);
++	return rc;
++}
++
++static int optee_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
++				   struct page **pages, size_t num_pages,
++				   unsigned long start)
++{
++	/*
++	 * We don't want to register supplicant memory in OP-TEE.
++	 * Instead information about it will be passed in RPC code.
++	 */
++	return optee_check_mem_type(start, num_pages);
++}
++
++static int optee_shm_unregister_supp(struct tee_context *ctx,
++				     struct tee_shm *shm)
++{
++	return 0;
++}
++
++/*
++ * 3. Dynamic shared memory pool based on alloc_pages()
++ *
++ * Implements an OP-TEE specific shared memory pool which is used
++ * when dynamic shared memory is supported by secure world.
++ *
++ * The main function is optee_shm_pool_alloc_pages().
++ */
++
++static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
++			 struct tee_shm *shm, size_t size)
++{
++	/*
++	 * Shared memory private to the OP-TEE driver doesn't need
++	 * to be registered with OP-TEE.
++	 */
++	if (shm->flags & TEE_SHM_PRIV)
++		return optee_pool_op_alloc_helper(poolm, shm, size, NULL);
++
++	return optee_pool_op_alloc_helper(poolm, shm, size, optee_shm_register);
++}
++
++static void pool_op_free(struct tee_shm_pool_mgr *poolm,
++			 struct tee_shm *shm)
++{
++	if (!(shm->flags & TEE_SHM_PRIV))
++		optee_shm_unregister(shm->ctx, shm);
++
++	free_pages((unsigned long)shm->kaddr, get_order(shm->size));
++	shm->kaddr = NULL;
++}
++
++static void pool_op_destroy_poolmgr(struct tee_shm_pool_mgr *poolm)
++{
++	kfree(poolm);
++}
++
++static const struct tee_shm_pool_mgr_ops pool_ops = {
++	.alloc = pool_op_alloc,
++	.free = pool_op_free,
++	.destroy_poolmgr = pool_op_destroy_poolmgr,
++};
++
++/**
++ * optee_shm_pool_alloc_pages() - create page-based allocator pool
++ *
++ * This pool is used when OP-TEE supports dymanic SHM. In this case
++ * command buffers and such are allocated from kernel's own memory.
++ */
++static struct tee_shm_pool_mgr *optee_shm_pool_alloc_pages(void)
++{
++	struct tee_shm_pool_mgr *mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
++
++	if (!mgr)
++		return ERR_PTR(-ENOMEM);
++
++	mgr->ops = &pool_ops;
++
++	return mgr;
++}
++
++/*
++ * 4. Do a normal scheduled call into secure world
++ *
++ * The function optee_smc_do_call_with_arg() performs a normal scheduled
++ * call into secure world. During this call may normal world request help
++ * from normal world using RPCs, Remote Procedure Calls. This includes
++ * delivery of non-secure interrupts to for instance allow rescheduling of
++ * the current task.
++ */
++
++static void handle_rpc_func_cmd_shm_free(struct tee_context *ctx,
++					 struct optee_msg_arg *arg)
++{
++	struct tee_shm *shm;
++
++	arg->ret_origin = TEEC_ORIGIN_COMMS;
++
++	if (arg->num_params != 1 ||
++	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		return;
++	}
++
++	shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b;
++	switch (arg->params[0].u.value.a) {
++	case OPTEE_RPC_SHM_TYPE_APPL:
++		optee_rpc_cmd_free_suppl(ctx, shm);
++		break;
++	case OPTEE_RPC_SHM_TYPE_KERNEL:
++		tee_shm_free(shm);
++		break;
++	default:
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++	}
++	arg->ret = TEEC_SUCCESS;
++}
++
++static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
++					  struct optee_msg_arg *arg,
++					  struct optee_call_ctx *call_ctx)
++{
++	phys_addr_t pa;
++	struct tee_shm *shm;
++	size_t sz;
++	size_t n;
++
++	arg->ret_origin = TEEC_ORIGIN_COMMS;
++
++	if (!arg->num_params ||
++	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		return;
++	}
++
++	for (n = 1; n < arg->num_params; n++) {
++		if (arg->params[n].attr != OPTEE_MSG_ATTR_TYPE_NONE) {
++			arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++			return;
++		}
++	}
++
++	sz = arg->params[0].u.value.b;
++	switch (arg->params[0].u.value.a) {
++	case OPTEE_RPC_SHM_TYPE_APPL:
++		shm = optee_rpc_cmd_alloc_suppl(ctx, sz);
++		break;
++	case OPTEE_RPC_SHM_TYPE_KERNEL:
++		shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
++		break;
++	default:
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		return;
++	}
++
++	if (IS_ERR(shm)) {
++		arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
++		return;
++	}
++
++	if (tee_shm_get_pa(shm, 0, &pa)) {
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		goto bad;
++	}
++
++	sz = tee_shm_get_size(shm);
++
++	if (tee_shm_is_registered(shm)) {
++		struct page **pages;
++		u64 *pages_list;
++		size_t page_num;
++
++		pages = tee_shm_get_pages(shm, &page_num);
++		if (!pages || !page_num) {
++			arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
++			goto bad;
++		}
++
++		pages_list = optee_allocate_pages_list(page_num);
++		if (!pages_list) {
++			arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
++			goto bad;
++		}
++
++		call_ctx->pages_list = pages_list;
++		call_ctx->num_entries = page_num;
++
++		arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT |
++				      OPTEE_MSG_ATTR_NONCONTIG;
++		/*
++		 * In the least bits of u.tmem.buf_ptr we store buffer offset
++		 * from 4k page, as described in OP-TEE ABI.
++		 */
++		arg->params[0].u.tmem.buf_ptr = virt_to_phys(pages_list) |
++			(tee_shm_get_page_offset(shm) &
++			 (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1));
++		arg->params[0].u.tmem.size = tee_shm_get_size(shm);
++		arg->params[0].u.tmem.shm_ref = (unsigned long)shm;
++
++		optee_fill_pages_list(pages_list, pages, page_num,
++				      tee_shm_get_page_offset(shm));
++	} else {
++		arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT;
++		arg->params[0].u.tmem.buf_ptr = pa;
++		arg->params[0].u.tmem.size = sz;
++		arg->params[0].u.tmem.shm_ref = (unsigned long)shm;
++	}
++
++	arg->ret = TEEC_SUCCESS;
++	return;
++bad:
++	tee_shm_free(shm);
++}
++
++static void free_pages_list(struct optee_call_ctx *call_ctx)
++{
++	if (call_ctx->pages_list) {
++		optee_free_pages_list(call_ctx->pages_list,
++				      call_ctx->num_entries);
++		call_ctx->pages_list = NULL;
++		call_ctx->num_entries = 0;
++	}
++}
++
++static void optee_rpc_finalize_call(struct optee_call_ctx *call_ctx)
++{
++	free_pages_list(call_ctx);
++}
++
++static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee,
++				struct tee_shm *shm,
++				struct optee_call_ctx *call_ctx)
++{
++	struct optee_msg_arg *arg;
++
++	arg = tee_shm_get_va(shm, 0);
++	if (IS_ERR(arg)) {
++		pr_err("%s: tee_shm_get_va %p failed\n", __func__, shm);
++		return;
++	}
++
++	switch (arg->cmd) {
++	case OPTEE_RPC_CMD_SHM_ALLOC:
++		free_pages_list(call_ctx);
++		handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx);
++		break;
++	case OPTEE_RPC_CMD_SHM_FREE:
++		handle_rpc_func_cmd_shm_free(ctx, arg);
++		break;
++	default:
++		optee_rpc_cmd(ctx, optee, arg);
++	}
++}
++
++/**
++ * optee_handle_rpc() - handle RPC from secure world
++ * @ctx:	context doing the RPC
++ * @param:	value of registers for the RPC
++ * @call_ctx:	call context. Preserved during one OP-TEE invocation
++ *
++ * Result of RPC is written back into @param.
++ */
++static void optee_handle_rpc(struct tee_context *ctx,
++			     struct optee_rpc_param *param,
++			     struct optee_call_ctx *call_ctx)
++{
++	struct tee_device *teedev = ctx->teedev;
++	struct optee *optee = tee_get_drvdata(teedev);
++	struct tee_shm *shm;
++	phys_addr_t pa;
++
++	switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
++	case OPTEE_SMC_RPC_FUNC_ALLOC:
++		shm = tee_shm_alloc(ctx, param->a1,
++				    TEE_SHM_MAPPED | TEE_SHM_PRIV);
++		if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
++			reg_pair_from_64(&param->a1, &param->a2, pa);
++			reg_pair_from_64(&param->a4, &param->a5,
++					 (unsigned long)shm);
++		} else {
++			param->a1 = 0;
++			param->a2 = 0;
++			param->a4 = 0;
++			param->a5 = 0;
++		}
++		break;
++	case OPTEE_SMC_RPC_FUNC_FREE:
++		shm = reg_pair_to_ptr(param->a1, param->a2);
++		tee_shm_free(shm);
++		break;
++	case OPTEE_SMC_RPC_FUNC_FOREIGN_INTR:
++		/*
++		 * A foreign interrupt was raised while secure world was
++		 * executing, since they are handled in Linux a dummy RPC is
++		 * performed to let Linux take the interrupt through the normal
++		 * vector.
++		 */
++		break;
++	case OPTEE_SMC_RPC_FUNC_CMD:
++		shm = reg_pair_to_ptr(param->a1, param->a2);
++		handle_rpc_func_cmd(ctx, optee, shm, call_ctx);
++		break;
++	default:
++		pr_warn("Unknown RPC func 0x%x\n",
++			(u32)OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0));
++		break;
++	}
++
++	param->a0 = OPTEE_SMC_CALL_RETURN_FROM_RPC;
++}
++
++/**
++ * optee_smc_do_call_with_arg() - Do an SMC to OP-TEE in secure world
++ * @ctx:	calling context
++ * @arg:	shared memory holding the message to pass to secure world
++ *
++ * Does and SMC to OP-TEE in secure world and handles eventual resulting
++ * Remote Procedure Calls (RPC) from OP-TEE.
++ *
++ * Returns return code from secure world, 0 is OK
++ */
++static int optee_smc_do_call_with_arg(struct tee_context *ctx,
++				      struct tee_shm *arg)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	struct optee_call_waiter w;
++	struct optee_rpc_param param = { };
++	struct optee_call_ctx call_ctx = { };
++	phys_addr_t parg;
++	int rc;
++
++	rc = tee_shm_get_pa(arg, 0, &parg);
++	if (rc)
++		return rc;
++
++	param.a0 = OPTEE_SMC_CALL_WITH_ARG;
++	reg_pair_from_64(&param.a1, &param.a2, parg);
++	/* Initialize waiter */
++	optee_cq_wait_init(&optee->call_queue, &w);
++	while (true) {
++		struct arm_smccc_res res;
++
++		trace_optee_invoke_fn_begin(&param);
++		optee->smc.invoke_fn(param.a0, param.a1, param.a2, param.a3,
++				     param.a4, param.a5, param.a6, param.a7,
++				     &res);
++		trace_optee_invoke_fn_end(&param, &res);
++
++		if (res.a0 == OPTEE_SMC_RETURN_ETHREAD_LIMIT) {
++			/*
++			 * Out of threads in secure world, wait for a thread
++			 * become available.
++			 */
++			optee_cq_wait_for_completion(&optee->call_queue, &w);
++		} else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
++			cond_resched();
++			param.a0 = res.a0;
++			param.a1 = res.a1;
++			param.a2 = res.a2;
++			param.a3 = res.a3;
++			optee_handle_rpc(ctx, &param, &call_ctx);
++		} else {
++			rc = res.a0;
++			break;
++		}
++	}
++
++	optee_rpc_finalize_call(&call_ctx);
++	/*
++	 * We're done with our thread in secure world, if there's any
++	 * thread waiters wake up one.
++	 */
++	optee_cq_wait_final(&optee->call_queue, &w);
++
++	return rc;
++}
++
++/*
++ * 5. Driver initialization
++ *
++ * During driver inititialization is secure world probed to find out which
++ * features it supports so the driver can be initialized with a matching
++ * configuration. This involves for instance support for dynamic shared
++ * memory instead of a static memory carvout.
++ */
++
++static void optee_get_version(struct tee_device *teedev,
++			      struct tee_ioctl_version_data *vers)
++{
++	struct tee_ioctl_version_data v = {
++		.impl_id = TEE_IMPL_ID_OPTEE,
++		.impl_caps = TEE_OPTEE_CAP_TZ,
++		.gen_caps = TEE_GEN_CAP_GP,
++	};
++	struct optee *optee = tee_get_drvdata(teedev);
++
++	if (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
++		v.gen_caps |= TEE_GEN_CAP_REG_MEM;
++	if (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
++		v.gen_caps |= TEE_GEN_CAP_MEMREF_NULL;
++	*vers = v;
++}
++
++static int optee_smc_open(struct tee_context *ctx)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	u32 sec_caps = optee->smc.sec_caps;
++
++	return optee_open(ctx, sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL);
++}
++
++static const struct tee_driver_ops optee_clnt_ops = {
++	.get_version = optee_get_version,
++	.open = optee_smc_open,
++	.release = optee_release,
++	.open_session = optee_open_session,
++	.close_session = optee_close_session,
++	.invoke_func = optee_invoke_func,
++	.cancel_req = optee_cancel_req,
++	.shm_register = optee_shm_register,
++	.shm_unregister = optee_shm_unregister,
++};
++
++static const struct tee_desc optee_clnt_desc = {
++	.name = DRIVER_NAME "-clnt",
++	.ops = &optee_clnt_ops,
++	.owner = THIS_MODULE,
++};
++
++static const struct tee_driver_ops optee_supp_ops = {
++	.get_version = optee_get_version,
++	.open = optee_smc_open,
++	.release = optee_release_supp,
++	.supp_recv = optee_supp_recv,
++	.supp_send = optee_supp_send,
++	.shm_register = optee_shm_register_supp,
++	.shm_unregister = optee_shm_unregister_supp,
++};
++
++static const struct tee_desc optee_supp_desc = {
++	.name = DRIVER_NAME "-supp",
++	.ops = &optee_supp_ops,
++	.owner = THIS_MODULE,
++	.flags = TEE_DESC_PRIVILEGED,
++};
++
++static const struct optee_ops optee_ops = {
++	.do_call_with_arg = optee_smc_do_call_with_arg,
++	.to_msg_param = optee_to_msg_param,
++	.from_msg_param = optee_from_msg_param,
++};
++
++static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
++{
++	struct arm_smccc_res res;
++
++	invoke_fn(OPTEE_SMC_CALLS_UID, 0, 0, 0, 0, 0, 0, 0, &res);
++
++	if (res.a0 == OPTEE_MSG_UID_0 && res.a1 == OPTEE_MSG_UID_1 &&
++	    res.a2 == OPTEE_MSG_UID_2 && res.a3 == OPTEE_MSG_UID_3)
++		return true;
++	return false;
++}
++
++static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn)
++{
++	union {
++		struct arm_smccc_res smccc;
++		struct optee_smc_call_get_os_revision_result result;
++	} res = {
++		.result = {
++			.build_id = 0
++		}
++	};
++
++	invoke_fn(OPTEE_SMC_CALL_GET_OS_REVISION, 0, 0, 0, 0, 0, 0, 0,
++		  &res.smccc);
++
++	if (res.result.build_id)
++		pr_info("revision %lu.%lu (%08lx)", res.result.major,
++			res.result.minor, res.result.build_id);
++	else
++		pr_info("revision %lu.%lu", res.result.major, res.result.minor);
++}
++
++static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
++{
++	union {
++		struct arm_smccc_res smccc;
++		struct optee_smc_calls_revision_result result;
++	} res;
++
++	invoke_fn(OPTEE_SMC_CALLS_REVISION, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
++
++	if (res.result.major == OPTEE_MSG_REVISION_MAJOR &&
++	    (int)res.result.minor >= OPTEE_MSG_REVISION_MINOR)
++		return true;
++	return false;
++}
++
++static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn,
++					    u32 *sec_caps)
++{
++	union {
++		struct arm_smccc_res smccc;
++		struct optee_smc_exchange_capabilities_result result;
++	} res;
++	u32 a1 = 0;
++
++	/*
++	 * TODO This isn't enough to tell if it's UP system (from kernel
++	 * point of view) or not, is_smp() returns the information
++	 * needed, but can't be called directly from here.
++	 */
++	if (!IS_ENABLED(CONFIG_SMP) || nr_cpu_ids == 1)
++		a1 |= OPTEE_SMC_NSEC_CAP_UNIPROCESSOR;
++
++	invoke_fn(OPTEE_SMC_EXCHANGE_CAPABILITIES, a1, 0, 0, 0, 0, 0, 0,
++		  &res.smccc);
++
++	if (res.result.status != OPTEE_SMC_RETURN_OK)
++		return false;
++
++	*sec_caps = res.result.capabilities;
++	return true;
++}
++
++static struct tee_shm_pool *optee_config_dyn_shm(void)
++{
++	struct tee_shm_pool_mgr *priv_mgr;
++	struct tee_shm_pool_mgr *dmabuf_mgr;
++	void *rc;
++
++	rc = optee_shm_pool_alloc_pages();
++	if (IS_ERR(rc))
++		return rc;
++	priv_mgr = rc;
++
++	rc = optee_shm_pool_alloc_pages();
++	if (IS_ERR(rc)) {
++		tee_shm_pool_mgr_destroy(priv_mgr);
++		return rc;
++	}
++	dmabuf_mgr = rc;
++
++	rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr);
++	if (IS_ERR(rc)) {
++		tee_shm_pool_mgr_destroy(priv_mgr);
++		tee_shm_pool_mgr_destroy(dmabuf_mgr);
++	}
++
++	return rc;
++}
++
++static struct tee_shm_pool *
++optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm)
++{
++	union {
++		struct arm_smccc_res smccc;
++		struct optee_smc_get_shm_config_result result;
++	} res;
++	unsigned long vaddr;
++	phys_addr_t paddr;
++	size_t size;
++	phys_addr_t begin;
++	phys_addr_t end;
++	void *va;
++	struct tee_shm_pool_mgr *priv_mgr;
++	struct tee_shm_pool_mgr *dmabuf_mgr;
++	void *rc;
++	const int sz = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
++
++	invoke_fn(OPTEE_SMC_GET_SHM_CONFIG, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
++	if (res.result.status != OPTEE_SMC_RETURN_OK) {
++		pr_err("static shm service not available\n");
++		return ERR_PTR(-ENOENT);
++	}
++
++	if (res.result.settings != OPTEE_SMC_SHM_CACHED) {
++		pr_err("only normal cached shared memory supported\n");
++		return ERR_PTR(-EINVAL);
++	}
++
++	begin = roundup(res.result.start, PAGE_SIZE);
++	end = rounddown(res.result.start + res.result.size, PAGE_SIZE);
++	paddr = begin;
++	size = end - begin;
++
++	if (size < 2 * OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE) {
++		pr_err("too small shared memory area\n");
++		return ERR_PTR(-EINVAL);
++	}
++
++	va = memremap(paddr, size, MEMREMAP_WB);
++	if (!va) {
++		pr_err("shared memory ioremap failed\n");
++		return ERR_PTR(-EINVAL);
++	}
++	vaddr = (unsigned long)va;
++
++	rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, sz,
++					    3 /* 8 bytes aligned */);
++	if (IS_ERR(rc))
++		goto err_memunmap;
++	priv_mgr = rc;
++
++	vaddr += sz;
++	paddr += sz;
++	size -= sz;
++
++	rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, size, PAGE_SHIFT);
++	if (IS_ERR(rc))
++		goto err_free_priv_mgr;
++	dmabuf_mgr = rc;
++
++	rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr);
++	if (IS_ERR(rc))
++		goto err_free_dmabuf_mgr;
++
++	*memremaped_shm = va;
++
++	return rc;
++
++err_free_dmabuf_mgr:
++	tee_shm_pool_mgr_destroy(dmabuf_mgr);
++err_free_priv_mgr:
++	tee_shm_pool_mgr_destroy(priv_mgr);
++err_memunmap:
++	memunmap(va);
++	return rc;
++}
++
++/* Simple wrapper functions to be able to use a function pointer */
++static void optee_smccc_smc(unsigned long a0, unsigned long a1,
++			    unsigned long a2, unsigned long a3,
++			    unsigned long a4, unsigned long a5,
++			    unsigned long a6, unsigned long a7,
++			    struct arm_smccc_res *res)
++{
++	arm_smccc_smc(a0, a1, a2, a3, a4, a5, a6, a7, res);
++}
++
++static void optee_smccc_hvc(unsigned long a0, unsigned long a1,
++			    unsigned long a2, unsigned long a3,
++			    unsigned long a4, unsigned long a5,
++			    unsigned long a6, unsigned long a7,
++			    struct arm_smccc_res *res)
++{
++	arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res);
++}
++
++static optee_invoke_fn *get_invoke_func(struct device *dev)
++{
++	const char *method;
++
++	pr_info("probing for conduit method.\n");
++
++	if (device_property_read_string(dev, "method", &method)) {
++		pr_warn("missing \"method\" property\n");
++		return ERR_PTR(-ENXIO);
++	}
++
++	if (!strcmp("hvc", method))
++		return optee_smccc_hvc;
++	else if (!strcmp("smc", method))
++		return optee_smccc_smc;
++
++	pr_warn("invalid \"method\" property: %s\n", method);
++	return ERR_PTR(-EINVAL);
++}
++
++/* optee_remove - Device Removal Routine
++ * @pdev: platform device information struct
++ *
++ * optee_remove is called by platform subsystem to alert the driver
++ * that it should release the device
++ */
++static int optee_smc_remove(struct platform_device *pdev)
++{
++	struct optee *optee = platform_get_drvdata(pdev);
++
++	/*
++	 * Ask OP-TEE to free all cached shared memory objects to decrease
++	 * reference counters and also avoid wild pointers in secure world
++	 * into the old shared memory range.
++	 */
++	optee_disable_shm_cache(optee);
++
++	optee_remove_common(optee);
++
++	if (optee->smc.memremaped_shm)
++		memunmap(optee->smc.memremaped_shm);
++
++	kfree(optee);
++
++	return 0;
++}
++
++/* optee_shutdown - Device Removal Routine
++ * @pdev: platform device information struct
++ *
++ * platform_shutdown is called by the platform subsystem to alert
++ * the driver that a shutdown, reboot, or kexec is happening and
++ * device must be disabled.
++ */
++static void optee_shutdown(struct platform_device *pdev)
++{
++	optee_disable_shm_cache(platform_get_drvdata(pdev));
++}
++
++static int optee_probe(struct platform_device *pdev)
++{
++	optee_invoke_fn *invoke_fn;
++	struct tee_shm_pool *pool = ERR_PTR(-EINVAL);
++	struct optee *optee = NULL;
++	void *memremaped_shm = NULL;
++	struct tee_device *teedev;
++	u32 sec_caps;
++	int rc;
++
++	invoke_fn = get_invoke_func(&pdev->dev);
++	if (IS_ERR(invoke_fn))
++		return PTR_ERR(invoke_fn);
++
++	if (!optee_msg_api_uid_is_optee_api(invoke_fn)) {
++		pr_warn("api uid mismatch\n");
++		return -EINVAL;
++	}
++
++	optee_msg_get_os_revision(invoke_fn);
++
++	if (!optee_msg_api_revision_is_compatible(invoke_fn)) {
++		pr_warn("api revision mismatch\n");
++		return -EINVAL;
++	}
++
++	if (!optee_msg_exchange_capabilities(invoke_fn, &sec_caps)) {
++		pr_warn("capabilities mismatch\n");
++		return -EINVAL;
++	}
++
++	/*
++	 * Try to use dynamic shared memory if possible
++	 */
++	if (sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
++		pool = optee_config_dyn_shm();
++
++	/*
++	 * If dynamic shared memory is not available or failed - try static one
++	 */
++	if (IS_ERR(pool) && (sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM))
++		pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm);
++
++	if (IS_ERR(pool))
++		return PTR_ERR(pool);
++
++	optee = kzalloc(sizeof(*optee), GFP_KERNEL);
++	if (!optee) {
++		rc = -ENOMEM;
++		goto err;
++	}
++
++	optee->ops = &optee_ops;
++	optee->smc.invoke_fn = invoke_fn;
++	optee->smc.sec_caps = sec_caps;
++
++	teedev = tee_device_alloc(&optee_clnt_desc, NULL, pool, optee);
++	if (IS_ERR(teedev)) {
++		rc = PTR_ERR(teedev);
++		goto err;
++	}
++	optee->teedev = teedev;
++
++	teedev = tee_device_alloc(&optee_supp_desc, NULL, pool, optee);
++	if (IS_ERR(teedev)) {
++		rc = PTR_ERR(teedev);
++		goto err;
++	}
++	optee->supp_teedev = teedev;
++
++	rc = tee_device_register(optee->teedev);
++	if (rc)
++		goto err;
++
++	rc = tee_device_register(optee->supp_teedev);
++	if (rc)
++		goto err;
++
++	mutex_init(&optee->call_queue.mutex);
++	INIT_LIST_HEAD(&optee->call_queue.waiters);
++	optee_wait_queue_init(&optee->wait_queue);
++	optee_supp_init(&optee->supp);
++	optee->smc.memremaped_shm = memremaped_shm;
++	optee->pool = pool;
++
++	/*
++	 * Ensure that there are no pre-existing shm objects before enabling
++	 * the shm cache so that there's no chance of receiving an invalid
++	 * address during shutdown. This could occur, for example, if we're
++	 * kexec booting from an older kernel that did not properly cleanup the
++	 * shm cache.
++	 */
++	optee_disable_unmapped_shm_cache(optee);
++
++	optee_enable_shm_cache(optee);
++
++	if (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
++		pr_info("dynamic shared memory is enabled\n");
++
++	platform_set_drvdata(pdev, optee);
++
++	rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES);
++	if (rc) {
++		optee_smc_remove(pdev);
++		return rc;
++	}
++
++	pr_info("initialized driver\n");
++	return 0;
++err:
++	if (optee) {
++		/*
++		 * tee_device_unregister() is safe to call even if the
++		 * devices hasn't been registered with
++		 * tee_device_register() yet.
++		 */
++		tee_device_unregister(optee->supp_teedev);
++		tee_device_unregister(optee->teedev);
++		kfree(optee);
++	}
++	if (pool)
++		tee_shm_pool_free(pool);
++	if (memremaped_shm)
++		memunmap(memremaped_shm);
++	return rc;
++}
++
++static const struct of_device_id optee_dt_match[] = {
++	{ .compatible = "linaro,optee-tz" },
++	{},
++};
++MODULE_DEVICE_TABLE(of, optee_dt_match);
++
++static struct platform_driver optee_driver = {
++	.probe  = optee_probe,
++	.remove = optee_smc_remove,
++	.shutdown = optee_shutdown,
++	.driver = {
++		.name = "optee",
++		.of_match_table = optee_dt_match,
++	},
++};
++
++int optee_smc_abi_register(void)
++{
++	return platform_driver_register(&optee_driver);
++}
++
++void optee_smc_abi_unregister(void)
++{
++	platform_driver_unregister(&optee_driver);
++}
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0014-optee-add-FF-A-support.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0012-optee-add-FF-A-support.patch
similarity index 75%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0014-optee-add-FF-A-support.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0012-optee-add-FF-A-support.patch
index faf6cd0..089d1b6 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0014-optee-add-FF-A-support.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0012-optee-add-FF-A-support.patch
@@ -1,7 +1,7 @@
-From 5665ffd3fb8e94003abc1c0c05c9fa30d4028b67 Mon Sep 17 00:00:00 2001
+From 2e26d6cc12475b86cfc0a42d6c21146b5ce1fe4b Mon Sep 17 00:00:00 2001
 From: Jens Wiklander <jens.wiklander@linaro.org>
-Date: Thu, 25 Mar 2021 15:08:53 +0100
-Subject: [PATCH 19/22] optee: add FF-A support
+Date: Wed, 21 Jul 2021 17:45:21 +0200
+Subject: [PATCH 12/40] optee: add FF-A support
 
 Adds support for using FF-A [1] as transport to the OP-TEE driver.
 
@@ -14,45 +14,41 @@
 enabled.
 
 [1] https://developer.arm.com/documentation/den0077/latest
+Acked-by: Sumit Garg <sumit.garg@linaro.org>
 Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
- drivers/tee/optee/call.c          | 212 ++++++++++++-
- drivers/tee/optee/core.c          | 486 +++++++++++++++++++++++++++++-
- drivers/tee/optee/optee_ffa.h     | 153 ++++++++++
+ drivers/tee/optee/Makefile        |   1 +
+ drivers/tee/optee/call.c          |  13 +-
+ drivers/tee/optee/core.c          |  16 +-
+ drivers/tee/optee/ffa_abi.c       | 911 ++++++++++++++++++++++++++++++
+ drivers/tee/optee/optee_ffa.h     | 153 +++++
  drivers/tee/optee/optee_msg.h     |  27 +-
- drivers/tee/optee/optee_private.h |  52 ++++
- drivers/tee/optee/rpc.c           | 118 ++++++++
- 6 files changed, 1040 insertions(+), 8 deletions(-)
+ drivers/tee/optee/optee_private.h |  35 +-
+ 7 files changed, 1143 insertions(+), 13 deletions(-)
+ create mode 100644 drivers/tee/optee/ffa_abi.c
  create mode 100644 drivers/tee/optee/optee_ffa.h
 
+diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile
+index 97ac3ab3e1c0..66b8a17f14c4 100644
+--- a/drivers/tee/optee/Makefile
++++ b/drivers/tee/optee/Makefile
+@@ -6,6 +6,7 @@ optee-objs += rpc.o
+ optee-objs += supp.o
+ optee-objs += device.o
+ optee-objs += smc_abi.o
++optee-objs += ffa_abi.o
+ 
+ # for tracing framework to find optee_trace.h
+ CFLAGS_smc_abi.o := -I$(src)
 diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
-index e7b93153252c..cf91a81a242a 100644
+index 9ff4f0812825..b25cc1fac945 100644
 --- a/drivers/tee/optee/call.c
 +++ b/drivers/tee/optee/call.c
-@@ -3,15 +3,18 @@
-  * Copyright (c) 2015-2021, Linaro Limited
-  */
- #include <linux/arm-smccc.h>
-+#include <linux/arm_ffa.h>
- #include <linux/device.h>
- #include <linux/err.h>
- #include <linux/errno.h>
- #include <linux/mm.h>
- #include <linux/sched.h>
-+#include <linux/scatterlist.h>
- #include <linux/slab.h>
- #include <linux/tee_drv.h>
- #include <linux/types.h>
- #include <linux/uaccess.h>
-+#include "optee_ffa.h"
- #include "optee_private.h"
- #include "optee_smc.h"
- 
-@@ -180,11 +183,21 @@ int optee_do_call_with_arg(struct tee_context *ctx, struct tee_shm *arg)
- static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params,
- 				   struct optee_msg_arg **msg_arg)
+@@ -107,11 +107,20 @@ static struct optee_session *find_session(struct optee_context_data *ctxdata,
+ struct tee_shm *optee_get_msg_arg(struct tee_context *ctx, size_t num_params,
+ 				  struct optee_msg_arg **msg_arg)
  {
 +	struct optee *optee = tee_get_drvdata(ctx->teedev);
 +	size_t sz = OPTEE_MSG_GET_ARG_SIZE(num_params);
@@ -60,26 +56,592 @@
  	struct optee_msg_arg *ma;
  
 -	shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params),
--			    TEE_SHM_MAPPED);
+-			    TEE_SHM_MAPPED | TEE_SHM_PRIV);
 +	/*
 +	 * rpc_arg_count is set to the number of allocated parameters in
 +	 * the RPC argument struct if a second MSG arg struct is expected.
-+	 * The second arg struct will then be used for RPC. So far only
-+	 * enabled when using FF-A as transport layer.
++	 * The second arg struct will then be used for RPC.
 +	 */
 +	if (optee->rpc_arg_count)
 +		sz += OPTEE_MSG_GET_ARG_SIZE(optee->rpc_arg_count);
 +
-+	shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED);
++	shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
  	if (IS_ERR(shm))
  		return shm;
  
-@@ -673,3 +686,198 @@ int optee_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm)
- {
- 	return 0;
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
+index 27b855325b33..ab2edfcc6c70 100644
+--- a/drivers/tee/optee/core.c
++++ b/drivers/tee/optee/core.c
+@@ -172,6 +172,9 @@ void optee_remove_common(struct optee *optee)
+ 	mutex_destroy(&optee->call_queue.mutex);
  }
+ 
++static int smc_abi_rc;
++static int ffa_abi_rc;
 +
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
+ static int optee_core_init(void)
+ {
+ 	/*
+@@ -184,13 +187,22 @@ static int optee_core_init(void)
+ 	if (is_kdump_kernel())
+ 		return -ENODEV;
+ 
+-	return optee_smc_abi_register();
++	smc_abi_rc = optee_smc_abi_register();
++	ffa_abi_rc = optee_ffa_abi_register();
++
++	/* If both failed there's no point with this module */
++	if (smc_abi_rc && ffa_abi_rc)
++		return smc_abi_rc;
++	return 0;
+ }
+ module_init(optee_core_init);
+ 
+ static void optee_core_exit(void)
+ {
+-	optee_smc_abi_unregister();
++	if (!smc_abi_rc)
++		optee_smc_abi_unregister();
++	if (!ffa_abi_rc)
++		optee_ffa_abi_unregister();
+ }
+ module_exit(optee_core_exit);
+ 
+diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
+new file mode 100644
+index 000000000000..6defd1ec982a
+--- /dev/null
++++ b/drivers/tee/optee/ffa_abi.c
+@@ -0,0 +1,911 @@
++// SPDX-License-Identifier: GPL-2.0-only
++/*
++ * Copyright (c) 2021, Linaro Limited
++ */
++
++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++
++#include <linux/arm_ffa.h>
++#include <linux/errno.h>
++#include <linux/scatterlist.h>
++#include <linux/sched.h>
++#include <linux/slab.h>
++#include <linux/string.h>
++#include <linux/tee_drv.h>
++#include <linux/types.h>
++#include "optee_private.h"
++#include "optee_ffa.h"
++#include "optee_rpc_cmd.h"
++
++/*
++ * This file implement the FF-A ABI used when communicating with secure world
++ * OP-TEE OS via FF-A.
++ * This file is divided into the following sections:
++ * 1. Maintain a hash table for lookup of a global FF-A memory handle
++ * 2. Convert between struct tee_param and struct optee_msg_param
++ * 3. Low level support functions to register shared memory in secure world
++ * 4. Dynamic shared memory pool based on alloc_pages()
++ * 5. Do a normal scheduled call into secure world
++ * 6. Driver initialization.
++ */
++
++/*
++ * 1. Maintain a hash table for lookup of a global FF-A memory handle
++ *
++ * FF-A assigns a global memory handle for each piece shared memory.
++ * This handle is then used when communicating with secure world.
++ *
++ * Main functions are optee_shm_add_ffa_handle() and optee_shm_rem_ffa_handle()
++ */
++struct shm_rhash {
++	struct tee_shm *shm;
++	u64 global_id;
++	struct rhash_head linkage;
++};
++
++static void rh_free_fn(void *ptr, void *arg)
++{
++	kfree(ptr);
++}
++
++static const struct rhashtable_params shm_rhash_params = {
++	.head_offset = offsetof(struct shm_rhash, linkage),
++	.key_len     = sizeof(u64),
++	.key_offset  = offsetof(struct shm_rhash, global_id),
++	.automatic_shrinking = true,
++};
++
++static struct tee_shm *optee_shm_from_ffa_handle(struct optee *optee,
++						 u64 global_id)
++{
++	struct tee_shm *shm = NULL;
++	struct shm_rhash *r;
++
++	mutex_lock(&optee->ffa.mutex);
++	r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
++				   shm_rhash_params);
++	if (r)
++		shm = r->shm;
++	mutex_unlock(&optee->ffa.mutex);
++
++	return shm;
++}
++
++static int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm,
++				    u64 global_id)
++{
++	struct shm_rhash *r;
++	int rc;
++
++	r = kmalloc(sizeof(*r), GFP_KERNEL);
++	if (!r)
++		return -ENOMEM;
++	r->shm = shm;
++	r->global_id = global_id;
++
++	mutex_lock(&optee->ffa.mutex);
++	rc = rhashtable_lookup_insert_fast(&optee->ffa.global_ids, &r->linkage,
++					   shm_rhash_params);
++	mutex_unlock(&optee->ffa.mutex);
++
++	if (rc)
++		kfree(r);
++
++	return rc;
++}
++
++static int optee_shm_rem_ffa_handle(struct optee *optee, u64 global_id)
++{
++	struct shm_rhash *r;
++	int rc = -ENOENT;
++
++	mutex_lock(&optee->ffa.mutex);
++	r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
++				   shm_rhash_params);
++	if (r)
++		rc = rhashtable_remove_fast(&optee->ffa.global_ids,
++					    &r->linkage, shm_rhash_params);
++	mutex_unlock(&optee->ffa.mutex);
++
++	if (!rc)
++		kfree(r);
++
++	return rc;
++}
++
++/*
++ * 2. Convert between struct tee_param and struct optee_msg_param
++ *
++ * optee_ffa_from_msg_param() and optee_ffa_to_msg_param() are the main
++ * functions.
++ */
++
++static void from_msg_param_ffa_mem(struct optee *optee, struct tee_param *p,
++				   u32 attr, const struct optee_msg_param *mp)
++{
++	struct tee_shm *shm = NULL;
++	u64 offs_high = 0;
++	u64 offs_low = 0;
++
++	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
++		  attr - OPTEE_MSG_ATTR_TYPE_FMEM_INPUT;
++	p->u.memref.size = mp->u.fmem.size;
++
++	if (mp->u.fmem.global_id != OPTEE_MSG_FMEM_INVALID_GLOBAL_ID)
++		shm = optee_shm_from_ffa_handle(optee, mp->u.fmem.global_id);
++	p->u.memref.shm = shm;
++
++	if (shm) {
++		offs_low = mp->u.fmem.offs_low;
++		offs_high = mp->u.fmem.offs_high;
++	}
++	p->u.memref.shm_offs = offs_low | offs_high << 32;
++}
++
++/**
++ * optee_ffa_from_msg_param() - convert from OPTEE_MSG parameters to
++ *				struct tee_param
++ * @optee:	main service struct
++ * @params:	subsystem internal parameter representation
++ * @num_params:	number of elements in the parameter arrays
++ * @msg_params:	OPTEE_MSG parameters
++ *
++ * Returns 0 on success or <0 on failure
++ */
++static int optee_ffa_from_msg_param(struct optee *optee,
++				    struct tee_param *params, size_t num_params,
++				    const struct optee_msg_param *msg_params)
++{
++	size_t n;
++
++	for (n = 0; n < num_params; n++) {
++		struct tee_param *p = params + n;
++		const struct optee_msg_param *mp = msg_params + n;
++		u32 attr = mp->attr & OPTEE_MSG_ATTR_TYPE_MASK;
++
++		switch (attr) {
++		case OPTEE_MSG_ATTR_TYPE_NONE:
++			p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
++			memset(&p->u, 0, sizeof(p->u));
++			break;
++		case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
++		case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
++		case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
++			optee_from_msg_param_value(p, attr, mp);
++			break;
++		case OPTEE_MSG_ATTR_TYPE_FMEM_INPUT:
++		case OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT:
++		case OPTEE_MSG_ATTR_TYPE_FMEM_INOUT:
++			from_msg_param_ffa_mem(optee, p, attr, mp);
++			break;
++		default:
++			return -EINVAL;
++		}
++	}
++
++	return 0;
++}
++
++static int to_msg_param_ffa_mem(struct optee_msg_param *mp,
++				const struct tee_param *p)
++{
++	struct tee_shm *shm = p->u.memref.shm;
++
++	mp->attr = OPTEE_MSG_ATTR_TYPE_FMEM_INPUT + p->attr -
++		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
++
++	if (shm) {
++		u64 shm_offs = p->u.memref.shm_offs;
++
++		mp->u.fmem.internal_offs = shm->offset;
++
++		mp->u.fmem.offs_low = shm_offs;
++		mp->u.fmem.offs_high = shm_offs >> 32;
++		/* Check that the entire offset could be stored. */
++		if (mp->u.fmem.offs_high != shm_offs >> 32)
++			return -EINVAL;
++
++		mp->u.fmem.global_id = shm->sec_world_id;
++	} else {
++		memset(&mp->u, 0, sizeof(mp->u));
++		mp->u.fmem.global_id = OPTEE_MSG_FMEM_INVALID_GLOBAL_ID;
++	}
++	mp->u.fmem.size = p->u.memref.size;
++
++	return 0;
++}
++
++/**
++ * optee_ffa_to_msg_param() - convert from struct tee_params to OPTEE_MSG
++ *			      parameters
++ * @optee:	main service struct
++ * @msg_params:	OPTEE_MSG parameters
++ * @num_params:	number of elements in the parameter arrays
++ * @params:	subsystem itnernal parameter representation
++ * Returns 0 on success or <0 on failure
++ */
++static int optee_ffa_to_msg_param(struct optee *optee,
++				  struct optee_msg_param *msg_params,
++				  size_t num_params,
++				  const struct tee_param *params)
++{
++	size_t n;
++
++	for (n = 0; n < num_params; n++) {
++		const struct tee_param *p = params + n;
++		struct optee_msg_param *mp = msg_params + n;
++
++		switch (p->attr) {
++		case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
++			mp->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
++			memset(&mp->u, 0, sizeof(mp->u));
++			break;
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
++			optee_to_msg_param_value(mp, p);
++			break;
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
++		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
++			if (to_msg_param_ffa_mem(mp, p))
++				return -EINVAL;
++			break;
++		default:
++			return -EINVAL;
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * 3. Low level support functions to register shared memory in secure world
++ *
++ * Functions to register and unregister shared memory both for normal
++ * clients and for tee-supplicant.
++ */
++
++static int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm,
++				  struct page **pages, size_t num_pages,
++				  unsigned long start)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
++	struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
++	struct ffa_mem_region_attributes mem_attr = {
++		.receiver = ffa_dev->vm_id,
++		.attrs = FFA_MEM_RW,
++	};
++	struct ffa_mem_ops_args args = {
++		.use_txbuf = true,
++		.attrs = &mem_attr,
++		.nattrs = 1,
++	};
++	struct sg_table sgt;
++	int rc;
++
++	rc = optee_check_mem_type(start, num_pages);
++	if (rc)
++		return rc;
++
++	rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, 0,
++				       num_pages * PAGE_SIZE, GFP_KERNEL);
++	if (rc)
++		return rc;
++	args.sg = sgt.sgl;
++	rc = ffa_ops->memory_share(ffa_dev, &args);
++	sg_free_table(&sgt);
++	if (rc)
++		return rc;
++
++	rc = optee_shm_add_ffa_handle(optee, shm, args.g_handle);
++	if (rc) {
++		ffa_ops->memory_reclaim(args.g_handle, 0);
++		return rc;
++	}
++
++	shm->sec_world_id = args.g_handle;
++
++	return 0;
++}
++
++static int optee_ffa_shm_unregister(struct tee_context *ctx,
++				    struct tee_shm *shm)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
++	struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
++	u64 global_handle = shm->sec_world_id;
++	struct ffa_send_direct_data data = {
++		.data0 = OPTEE_FFA_UNREGISTER_SHM,
++		.data1 = (u32)global_handle,
++		.data2 = (u32)(global_handle >> 32)
++	};
++	int rc;
++
++	optee_shm_rem_ffa_handle(optee, global_handle);
++	shm->sec_world_id = 0;
++
++	rc = ffa_ops->sync_send_receive(ffa_dev, &data);
++	if (rc)
++		pr_err("Unregister SHM id 0x%llx rc %d\n", global_handle, rc);
++
++	rc = ffa_ops->memory_reclaim(global_handle, 0);
++	if (rc)
++		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
++
++	return rc;
++}
++
++static int optee_ffa_shm_unregister_supp(struct tee_context *ctx,
++					 struct tee_shm *shm)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
++	u64 global_handle = shm->sec_world_id;
++	int rc;
++
++	/*
++	 * We're skipping the OPTEE_FFA_YIELDING_CALL_UNREGISTER_SHM call
++	 * since this is OP-TEE freeing via RPC so it has already retired
++	 * this ID.
++	 */
++
++	optee_shm_rem_ffa_handle(optee, global_handle);
++	rc = ffa_ops->memory_reclaim(global_handle, 0);
++	if (rc)
++		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
++
++	shm->sec_world_id = 0;
++
++	return rc;
++}
++
++/*
++ * 4. Dynamic shared memory pool based on alloc_pages()
++ *
++ * Implements an OP-TEE specific shared memory pool.
++ * The main function is optee_ffa_shm_pool_alloc_pages().
++ */
++
++static int pool_ffa_op_alloc(struct tee_shm_pool_mgr *poolm,
++			     struct tee_shm *shm, size_t size)
++{
++	return optee_pool_op_alloc_helper(poolm, shm, size,
++					  optee_ffa_shm_register);
++}
++
++static void pool_ffa_op_free(struct tee_shm_pool_mgr *poolm,
++			     struct tee_shm *shm)
++{
++	optee_ffa_shm_unregister(shm->ctx, shm);
++	free_pages((unsigned long)shm->kaddr, get_order(shm->size));
++	shm->kaddr = NULL;
++}
++
++static void pool_ffa_op_destroy_poolmgr(struct tee_shm_pool_mgr *poolm)
++{
++	kfree(poolm);
++}
++
++static const struct tee_shm_pool_mgr_ops pool_ffa_ops = {
++	.alloc = pool_ffa_op_alloc,
++	.free = pool_ffa_op_free,
++	.destroy_poolmgr = pool_ffa_op_destroy_poolmgr,
++};
++
++/**
++ * optee_ffa_shm_pool_alloc_pages() - create page-based allocator pool
++ *
++ * This pool is used with OP-TEE over FF-A. In this case command buffers
++ * and such are allocated from kernel's own memory.
++ */
++static struct tee_shm_pool_mgr *optee_ffa_shm_pool_alloc_pages(void)
++{
++	struct tee_shm_pool_mgr *mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
++
++	if (!mgr)
++		return ERR_PTR(-ENOMEM);
++
++	mgr->ops = &pool_ffa_ops;
++
++	return mgr;
++}
++
++/*
++ * 5. Do a normal scheduled call into secure world
++ *
++ * The function optee_ffa_do_call_with_arg() performs a normal scheduled
++ * call into secure world. During this call may normal world request help
++ * from normal world using RPCs, Remote Procedure Calls. This includes
++ * delivery of non-secure interrupts to for instance allow rescheduling of
++ * the current task.
++ */
++
++static void handle_ffa_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
++					      struct optee_msg_arg *arg)
++{
++	struct tee_shm *shm;
++
++	if (arg->num_params != 1 ||
++	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		return;
++	}
++
++	switch (arg->params[0].u.value.a) {
++	case OPTEE_RPC_SHM_TYPE_APPL:
++		shm = optee_rpc_cmd_alloc_suppl(ctx, arg->params[0].u.value.b);
++		break;
++	case OPTEE_RPC_SHM_TYPE_KERNEL:
++		shm = tee_shm_alloc(ctx, arg->params[0].u.value.b,
++				    TEE_SHM_MAPPED | TEE_SHM_PRIV);
++		break;
++	default:
++		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++		return;
++	}
++
++	if (IS_ERR(shm)) {
++		arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
++		return;
++	}
++
++	arg->params[0] = (struct optee_msg_param){
++		.attr = OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT,
++		.u.fmem.size = tee_shm_get_size(shm),
++		.u.fmem.global_id = shm->sec_world_id,
++		.u.fmem.internal_offs = shm->offset,
++	};
++
++	arg->ret = TEEC_SUCCESS;
++}
++
++static void handle_ffa_rpc_func_cmd_shm_free(struct tee_context *ctx,
++					     struct optee *optee,
++					     struct optee_msg_arg *arg)
++{
++	struct tee_shm *shm;
++
++	if (arg->num_params != 1 ||
++	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT)
++		goto err_bad_param;
++
++	shm = optee_shm_from_ffa_handle(optee, arg->params[0].u.value.b);
++	if (!shm)
++		goto err_bad_param;
++	switch (arg->params[0].u.value.a) {
++	case OPTEE_RPC_SHM_TYPE_APPL:
++		optee_rpc_cmd_free_suppl(ctx, shm);
++		break;
++	case OPTEE_RPC_SHM_TYPE_KERNEL:
++		tee_shm_free(shm);
++		break;
++	default:
++		goto err_bad_param;
++	}
++	arg->ret = TEEC_SUCCESS;
++	return;
++
++err_bad_param:
++	arg->ret = TEEC_ERROR_BAD_PARAMETERS;
++}
++
++static void handle_ffa_rpc_func_cmd(struct tee_context *ctx,
++				    struct optee_msg_arg *arg)
++{
++	struct optee *optee = tee_get_drvdata(ctx->teedev);
++
++	arg->ret_origin = TEEC_ORIGIN_COMMS;
++	switch (arg->cmd) {
++	case OPTEE_RPC_CMD_SHM_ALLOC:
++		handle_ffa_rpc_func_cmd_shm_alloc(ctx, arg);
++		break;
++	case OPTEE_RPC_CMD_SHM_FREE:
++		handle_ffa_rpc_func_cmd_shm_free(ctx, optee, arg);
++		break;
++	default:
++		optee_rpc_cmd(ctx, optee, arg);
++	}
++}
++
++static void optee_handle_ffa_rpc(struct tee_context *ctx, u32 cmd,
++				 struct optee_msg_arg *arg)
++{
++	switch (cmd) {
++	case OPTEE_FFA_YIELDING_CALL_RETURN_RPC_CMD:
++		handle_ffa_rpc_func_cmd(ctx, arg);
++		break;
++	case OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT:
++		/* Interrupt delivered by now */
++		break;
++	default:
++		pr_warn("Unknown RPC func 0x%x\n", cmd);
++		break;
++	}
++}
++
 +static int optee_ffa_yielding_call(struct tee_context *ctx,
 +				   struct ffa_send_direct_data *data,
 +				   struct optee_msg_arg *rpc_arg)
@@ -164,7 +726,8 @@
 + * Returns return code from FF-A, 0 is OK
 + */
 +
-+int optee_ffa_do_call_with_arg(struct tee_context *ctx, struct tee_shm *shm)
++static int optee_ffa_do_call_with_arg(struct tee_context *ctx,
++				      struct tee_shm *shm)
 +{
 +	struct ffa_send_direct_data data = {
 +		.data0 = OPTEE_FFA_YIELDING_CALL_WITH_ARG,
@@ -179,365 +742,13 @@
 +	return optee_ffa_yielding_call(ctx, &data, rpc_arg);
 +}
 +
-+int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm,
-+			   struct page **pages, size_t num_pages,
-+			   unsigned long start)
-+{
-+	struct optee *optee = tee_get_drvdata(ctx->teedev);
-+	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
-+	struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
-+	struct ffa_mem_region_attributes mem_attr = {
-+		.receiver = ffa_dev->vm_id,
-+		.attrs = FFA_MEM_RW,
-+	};
-+	struct ffa_mem_ops_args args = {
-+		.use_txbuf = true,
-+		.attrs = &mem_attr,
-+		.nattrs = 1,
-+	};
-+	struct sg_table sgt;
-+	int rc;
-+
-+	rc = check_mem_type(start, num_pages);
-+	if (rc)
-+		return rc;
-+
-+	rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, 0,
-+				       num_pages * PAGE_SIZE, GFP_KERNEL);
-+	if (rc)
-+		return rc;
-+	args.sg = sgt.sgl;
-+	rc = ffa_ops->memory_share(ffa_dev, &args);
-+	sg_free_table(&sgt);
-+	if (rc)
-+		return rc;
-+
-+	rc = optee_shm_add_ffa_handle(optee, shm, args.g_handle);
-+	if (rc) {
-+		ffa_ops->memory_reclaim(args.g_handle, 0);
-+		return rc;
-+	}
-+
-+	shm->sec_world_id = args.g_handle;
-+
-+	return 0;
-+}
-+
-+int optee_ffa_shm_unregister(struct tee_context *ctx, struct tee_shm *shm)
-+{
-+	struct optee *optee = tee_get_drvdata(ctx->teedev);
-+	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
-+	struct ffa_device *ffa_dev = optee->ffa.ffa_dev;
-+	u64 global_handle = shm->sec_world_id;
-+	struct ffa_send_direct_data data = {
-+		.data0 = OPTEE_FFA_UNREGISTER_SHM,
-+		.data1 = (u32)global_handle,
-+		.data2 = (u32)(global_handle >> 32)
-+	};
-+	int rc;
-+
-+	optee_shm_rem_ffa_handle(optee, global_handle);
-+	shm->sec_world_id = 0;
-+
-+	rc = ffa_ops->sync_send_receive(ffa_dev, &data);
-+	if (rc)
-+		pr_err("Unregister SHM id 0x%llx rc %d\n", global_handle, rc);
-+
-+	rc = ffa_ops->memory_reclaim(global_handle, 0);
-+	if (rc)
-+		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
-+
-+	return rc;
-+}
-+
-+int optee_ffa_shm_unregister_supp(struct tee_context *ctx, struct tee_shm *shm)
-+{
-+	struct optee *optee = tee_get_drvdata(ctx->teedev);
-+	const struct ffa_dev_ops *ffa_ops = optee->ffa.ffa_ops;
-+	u64 global_handle = shm->sec_world_id;
-+	int rc;
-+
-+	/*
-+	 * We're skipping the OPTEE_FFA_YIELDING_CALL_UNREGISTER_SHM call
-+	 * since this is OP-TEE freeing via RPC so it has already retired
-+	 * this ID.
-+	 */
-+
-+	optee_shm_rem_ffa_handle(optee, global_handle);
-+	rc = ffa_ops->memory_reclaim(global_handle, 0);
-+	if (rc)
-+		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
-+
-+	shm->sec_world_id = 0;
-+
-+	return rc;
-+}
-+#endif /*CONFIG_ARM_FFA_TRANSPORT*/
-diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
-index ab602bb8e14a..b9719c60dc48 100644
---- a/drivers/tee/optee/core.c
-+++ b/drivers/tee/optee/core.c
-@@ -6,6 +6,7 @@
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
- 
- #include <linux/arm-smccc.h>
-+#include <linux/arm_ffa.h>
- #include <linux/errno.h>
- #include <linux/io.h>
- #include <linux/module.h>
-@@ -20,6 +21,7 @@
- #include <linux/workqueue.h>
- #include "optee_private.h"
- #include "optee_smc.h"
-+#include "optee_ffa.h"
- #include "shm_pool.h"
- 
- #define DRIVER_NAME "optee"
-@@ -299,10 +301,9 @@ static int optee_open(struct tee_context *ctx)
- 	mutex_init(&ctxdata->mutex);
- 	INIT_LIST_HEAD(&ctxdata->sess_list);
- 
--	if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL)
--		ctx->cap_memref_null  = true;
--	else
--		ctx->cap_memref_null = false;
-+	ctx->cap_memref_null = optee_is_ffa_based(optee) ||
-+			       (optee->sec_caps &
-+				OPTEE_SMC_SEC_CAP_MEMREF_NULL);
- 
- 	ctx->data = ctxdata;
- 	return 0;
-@@ -567,6 +568,472 @@ optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm)
- 	return rc;
- }
- 
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+static void optee_ffa_get_version(struct tee_device *teedev,
-+				  struct tee_ioctl_version_data *vers)
-+{
-+	struct tee_ioctl_version_data v = {
-+		.impl_id = TEE_IMPL_ID_OPTEE,
-+		.impl_caps = TEE_OPTEE_CAP_TZ,
-+		.gen_caps = TEE_GEN_CAP_GP | TEE_GEN_CAP_REG_MEM |
-+			    TEE_GEN_CAP_MEMREF_NULL,
-+	};
-+
-+	*vers = v;
-+}
-+
-+struct shm_rhash {
-+	struct tee_shm *shm;
-+	u64 global_id;
-+	struct rhash_head linkage;
-+};
-+
-+static void rh_free_fn(void *ptr, void *arg)
-+{
-+	kfree(ptr);
-+}
-+
-+static const struct rhashtable_params shm_rhash_params = {
-+	.head_offset = offsetof(struct shm_rhash, linkage),
-+	.key_len     = sizeof(u64),
-+	.key_offset  = offsetof(struct shm_rhash, global_id),
-+	.automatic_shrinking = true,
-+};
-+
-+struct tee_shm *optee_shm_from_ffa_handle(struct optee *optee, u64 global_id)
-+{
-+	struct tee_shm *shm = NULL;
-+	struct shm_rhash *r;
-+
-+	mutex_lock(&optee->ffa.mutex);
-+	r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
-+				   shm_rhash_params);
-+	if (r)
-+		shm = r->shm;
-+	mutex_unlock(&optee->ffa.mutex);
-+
-+	return shm;
-+}
-+
-+int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm,
-+			     u64 global_id)
-+{
-+	struct shm_rhash *r;
-+	int rc;
-+
-+	r = kmalloc(sizeof(*r), GFP_KERNEL);
-+	if (!r)
-+		return -ENOMEM;
-+	r->shm = shm;
-+	r->global_id = global_id;
-+
-+	mutex_lock(&optee->ffa.mutex);
-+	rc = rhashtable_lookup_insert_fast(&optee->ffa.global_ids, &r->linkage,
-+					   shm_rhash_params);
-+	mutex_unlock(&optee->ffa.mutex);
-+
-+	if (rc)
-+		kfree(r);
-+
-+	return rc;
-+}
-+
-+int optee_shm_rem_ffa_handle(struct optee *optee, u64 global_id)
-+{
-+	struct shm_rhash *r;
-+	int rc = -ENOENT;
-+
-+	mutex_lock(&optee->ffa.mutex);
-+	r = rhashtable_lookup_fast(&optee->ffa.global_ids, &global_id,
-+				   shm_rhash_params);
-+	if (r)
-+		rc = rhashtable_remove_fast(&optee->ffa.global_ids,
-+					    &r->linkage, shm_rhash_params);
-+	mutex_unlock(&optee->ffa.mutex);
-+
-+	if (!rc)
-+		kfree(r);
-+
-+	return rc;
-+}
-+
-+static void from_msg_param_ffa_mem(struct optee *optee, struct tee_param *p,
-+				   u32 attr, const struct optee_msg_param *mp)
-+{
-+	struct tee_shm *shm = NULL;
-+	u64 offs_high = 0;
-+	u64 offs_low = 0;
-+
-+	p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
-+		  attr - OPTEE_MSG_ATTR_TYPE_FMEM_INPUT;
-+	p->u.memref.size = mp->u.fmem.size;
-+
-+	if (mp->u.fmem.global_id != OPTEE_MSG_FMEM_INVALID_GLOBAL_ID)
-+		shm = optee_shm_from_ffa_handle(optee, mp->u.fmem.global_id);
-+	p->u.memref.shm = shm;
-+
-+	if (shm) {
-+		offs_low = mp->u.fmem.offs_low;
-+		offs_high = mp->u.fmem.offs_high;
-+	}
-+	p->u.memref.shm_offs = offs_low | offs_high << 32;
-+}
-+
-+/**
-+ * optee_ffa_from_msg_param() - convert from OPTEE_MSG parameters to
-+ *				struct tee_param
-+ * @optee:	main service struct
-+ * @params:	subsystem internal parameter representation
-+ * @num_params:	number of elements in the parameter arrays
-+ * @msg_params:	OPTEE_MSG parameters
++/*
++ * 6. Driver initialization
 + *
-+ * Returns 0 on success or <0 on failure
++ * During driver inititialization is the OP-TEE Secure Partition is probed
++ * to find out which features it supports so the driver can be initialized
++ * with a matching configuration.
 + */
-+static int optee_ffa_from_msg_param(struct optee *optee,
-+				    struct tee_param *params, size_t num_params,
-+				    const struct optee_msg_param *msg_params)
-+{
-+	size_t n;
-+
-+	for (n = 0; n < num_params; n++) {
-+		struct tee_param *p = params + n;
-+		const struct optee_msg_param *mp = msg_params + n;
-+		u32 attr = mp->attr & OPTEE_MSG_ATTR_TYPE_MASK;
-+
-+		switch (attr) {
-+		case OPTEE_MSG_ATTR_TYPE_NONE:
-+			p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
-+			memset(&p->u, 0, sizeof(p->u));
-+			break;
-+		case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
-+		case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
-+		case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
-+			from_msg_param_value(p, attr, mp);
-+			break;
-+		case OPTEE_MSG_ATTR_TYPE_FMEM_INPUT:
-+		case OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT:
-+		case OPTEE_MSG_ATTR_TYPE_FMEM_INOUT:
-+			from_msg_param_ffa_mem(optee, p, attr, mp);
-+			break;
-+		default:
-+			return -EINVAL;
-+		}
-+	}
-+
-+	return 0;
-+}
-+
-+static int to_msg_param_ffa_mem(struct optee_msg_param *mp,
-+				const struct tee_param *p)
-+{
-+	struct tee_shm *shm = p->u.memref.shm;
-+
-+	mp->attr = OPTEE_MSG_ATTR_TYPE_FMEM_INPUT + p->attr -
-+		   TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
-+
-+	if (shm) {
-+		u64 shm_offs = p->u.memref.shm_offs;
-+
-+		mp->u.fmem.internal_offs = shm->offset;
-+
-+		mp->u.fmem.offs_low = shm_offs;
-+		mp->u.fmem.offs_high = shm_offs >> 32;
-+		/* Check that the entire offset could be stored. */
-+		if (mp->u.fmem.offs_high != shm_offs >> 32)
-+			return -EINVAL;
-+
-+		mp->u.fmem.global_id = shm->sec_world_id;
-+	} else {
-+		memset(&mp->u, 0, sizeof(mp->u));
-+		mp->u.fmem.global_id = OPTEE_MSG_FMEM_INVALID_GLOBAL_ID;
-+	}
-+	mp->u.fmem.size = p->u.memref.size;
-+
-+	return 0;
-+}
-+
-+/**
-+ * optee_ffa_to_msg_param() - convert from struct tee_params to OPTEE_MSG
-+ *			      parameters
-+ * @optee:	main service struct
-+ * @msg_params:	OPTEE_MSG parameters
-+ * @num_params:	number of elements in the parameter arrays
-+ * @params:	subsystem itnernal parameter representation
-+ * Returns 0 on success or <0 on failure
-+ */
-+static int optee_ffa_to_msg_param(struct optee *optee,
-+				  struct optee_msg_param *msg_params,
-+				  size_t num_params,
-+				  const struct tee_param *params)
-+{
-+	size_t n;
-+
-+	for (n = 0; n < num_params; n++) {
-+		const struct tee_param *p = params + n;
-+		struct optee_msg_param *mp = msg_params + n;
-+
-+		switch (p->attr) {
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
-+			mp->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
-+			memset(&mp->u, 0, sizeof(mp->u));
-+			break;
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
-+			to_msg_param_value(mp, p);
-+			break;
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
-+		case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
-+			if (to_msg_param_ffa_mem(mp, p))
-+				return -EINVAL;
-+			break;
-+		default:
-+			return -EINVAL;
-+		}
-+	}
-+
-+	return 0;
-+}
 +
 +static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
 +					const struct ffa_dev_ops *ops)
@@ -576,7 +787,7 @@
 +
 +static bool optee_ffa_exchange_caps(struct ffa_device *ffa_dev,
 +				    const struct ffa_dev_ops *ops,
-+				    u32 *sec_caps, unsigned int *rpc_arg_count)
++				    unsigned int *rpc_arg_count)
 +{
 +	struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES };
 +	int rc;
@@ -591,7 +802,6 @@
 +		return false;
 +	}
 +
-+	*sec_caps = 0;
 +	*rpc_arg_count = (u8)data.data1;
 +
 +	return true;
@@ -624,9 +834,27 @@
 +	return rc;
 +}
 +
++static void optee_ffa_get_version(struct tee_device *teedev,
++				  struct tee_ioctl_version_data *vers)
++{
++	struct tee_ioctl_version_data v = {
++		.impl_id = TEE_IMPL_ID_OPTEE,
++		.impl_caps = TEE_OPTEE_CAP_TZ,
++		.gen_caps = TEE_GEN_CAP_GP | TEE_GEN_CAP_REG_MEM |
++			    TEE_GEN_CAP_MEMREF_NULL,
++	};
++
++	*vers = v;
++}
++
++static int optee_ffa_open(struct tee_context *ctx)
++{
++	return optee_open(ctx, true);
++}
++
 +static const struct tee_driver_ops optee_ffa_clnt_ops = {
 +	.get_version = optee_ffa_get_version,
-+	.open = optee_open,
++	.open = optee_ffa_open,
 +	.release = optee_release,
 +	.open_session = optee_open_session,
 +	.close_session = optee_close_session,
@@ -637,14 +865,14 @@
 +};
 +
 +static const struct tee_desc optee_ffa_clnt_desc = {
-+	.name = DRIVER_NAME "ffa-clnt",
++	.name = DRIVER_NAME "-ffa-clnt",
 +	.ops = &optee_ffa_clnt_ops,
 +	.owner = THIS_MODULE,
 +};
 +
 +static const struct tee_driver_ops optee_ffa_supp_ops = {
 +	.get_version = optee_ffa_get_version,
-+	.open = optee_open,
++	.open = optee_ffa_open,
 +	.release = optee_release_supp,
 +	.supp_recv = optee_supp_recv,
 +	.supp_send = optee_supp_send,
@@ -653,7 +881,7 @@
 +};
 +
 +static const struct tee_desc optee_ffa_supp_desc = {
-+	.name = DRIVER_NAME "ffa-supp",
++	.name = DRIVER_NAME "-ffa-supp",
 +	.ops = &optee_ffa_supp_ops,
 +	.owner = THIS_MODULE,
 +	.flags = TEE_DESC_PRIVILEGED,
@@ -667,7 +895,14 @@
 +
 +static void optee_ffa_remove(struct ffa_device *ffa_dev)
 +{
-+	(void)ffa_dev;
++	struct optee *optee = ffa_dev->dev.driver_data;
++
++	optee_remove_common(optee);
++
++	mutex_destroy(&optee->ffa.mutex);
++	rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
++
++	kfree(optee);
 +}
 +
 +static int optee_ffa_probe(struct ffa_device *ffa_dev)
@@ -676,7 +911,6 @@
 +	unsigned int rpc_arg_count;
 +	struct tee_device *teedev;
 +	struct optee *optee;
-+	u32 sec_caps;
 +	int rc;
 +
 +	ffa_ops = ffa_dev_ops_get(ffa_dev);
@@ -688,8 +922,7 @@
 +	if (!optee_ffa_api_is_compatbile(ffa_dev, ffa_ops))
 +		return -EINVAL;
 +
-+	if (!optee_ffa_exchange_caps(ffa_dev, ffa_ops, &sec_caps,
-+				     &rpc_arg_count))
++	if (!optee_ffa_exchange_caps(ffa_dev, ffa_ops, &rpc_arg_count))
 +		return -EINVAL;
 +
 +	optee = kzalloc(sizeof(*optee), GFP_KERNEL);
@@ -707,7 +940,6 @@
 +	optee->ops = &optee_ffa_ops;
 +	optee->ffa.ffa_dev = ffa_dev;
 +	optee->ffa.ffa_ops = ffa_ops;
-+	optee->sec_caps = sec_caps;
 +	optee->rpc_arg_count = rpc_arg_count;
 +
 +	teedev = tee_device_alloc(&optee_ffa_clnt_desc, NULL, optee->pool,
@@ -744,6 +976,12 @@
 +	optee_supp_init(&optee->supp);
 +	ffa_dev_set_drvdata(ffa_dev, optee);
 +
++	rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES);
++	if (rc) {
++		optee_ffa_remove(ffa_dev);
++		return rc;
++	}
++
 +	pr_info("initialized driver\n");
 +	return 0;
 +err:
@@ -774,37 +1012,19 @@
 +	.id_table = optee_ffa_device_id,
 +};
 +
-+module_ffa_driver(optee_ffa_driver);
-+#endif /*CONFIG_ARM_FFA_TRANSPORT*/
++int optee_ffa_abi_register(void)
++{
++	if (IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT))
++		return ffa_register(&optee_ffa_driver);
++	else
++		return -EOPNOTSUPP;
++}
 +
- /* Simple wrapper functions to be able to use a function pointer */
- static void optee_smccc_smc(unsigned long a0, unsigned long a1,
- 			    unsigned long a2, unsigned long a3,
-@@ -615,7 +1082,8 @@ static int optee_remove(struct platform_device *pdev)
- 	 * reference counters and also avoid wild pointers in secure world
- 	 * into the old shared memory range.
- 	 */
--	optee_disable_shm_cache(optee);
-+	if (!optee_is_ffa_based(optee))
-+		optee_disable_shm_cache(optee);
- 
- 	/*
- 	 * The two devices have to be unregistered before we can free the
-@@ -631,6 +1099,14 @@ static int optee_remove(struct platform_device *pdev)
- 	optee_supp_uninit(&optee->supp);
- 	mutex_destroy(&optee->call_queue.mutex);
- 
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+	if (optee->ffa.ffa_ops) {
-+		mutex_destroy(&optee->ffa.mutex);
-+		rhashtable_free_and_destroy(&optee->ffa.global_ids,
-+					    rh_free_fn, NULL);
-+	}
-+#endif /*CONFIG_ARM_FFA_TRANSPORT*/
-+
- 	kfree(optee);
- 
- 	return 0;
++void optee_ffa_abi_unregister(void)
++{
++	if (IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT))
++		ffa_unregister(&optee_ffa_driver);
++}
 diff --git a/drivers/tee/optee/optee_ffa.h b/drivers/tee/optee/optee_ffa.h
 new file mode 100644
 index 000000000000..ee3a03fc392c
@@ -965,7 +1185,7 @@
 +
 +#endif /*__OPTEE_FFA_H*/
 diff --git a/drivers/tee/optee/optee_msg.h b/drivers/tee/optee/optee_msg.h
-index 5bef6a0165db..1ee943980c68 100644
+index e3d72d09c484..2422e185d400 100644
 --- a/drivers/tee/optee/optee_msg.h
 +++ b/drivers/tee/optee/optee_msg.h
 @@ -28,6 +28,9 @@
@@ -1037,7 +1257,7 @@
  		u8 octets[24];
  	} u;
 diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
-index c5741e96e967..1ffe74e66d15 100644
+index 40af6b059b20..6660e05298db 100644
 --- a/drivers/tee/optee/optee_private.h
 +++ b/drivers/tee/optee/optee_private.h
 @@ -7,6 +7,7 @@
@@ -1048,7 +1268,7 @@
  #include <linux/semaphore.h>
  #include <linux/tee_drv.h>
  #include <linux/types.h>
-@@ -20,6 +21,7 @@
+@@ -22,6 +23,7 @@
  #define TEEC_ERROR_NOT_SUPPORTED	0xFFFF000A
  #define TEEC_ERROR_COMMUNICATION	0xFFFF000E
  #define TEEC_ERROR_OUT_OF_MEMORY	0xFFFF000C
@@ -1056,10 +1276,23 @@
  #define TEEC_ERROR_SHORT_BUFFER		0xFFFF0010
  
  #define TEEC_ORIGIN_COMMS		0x00000002
-@@ -66,6 +68,22 @@ struct optee_supp {
+@@ -73,19 +75,28 @@ struct optee_supp {
  	struct completion reqs_c;
  };
  
+-/**
+- * struct optee_smc - SMC ABI specifics
+- * @invoke_fn:		function to issue smc or hvc
+- * @memremaped_shm	virtual address of memory in shared memory pool
+- * @sec_caps:		secure world capabilities defined by
+- *			OPTEE_SMC_SEC_CAP_* in optee_smc.h
+- */
+ struct optee_smc {
+ 	optee_invoke_fn *invoke_fn;
+ 	void *memremaped_shm;
+ 	u32 sec_caps;
+ };
+ 
 +/**
 + * struct optee_ffa_data -  FFA communication struct
 + * @ffa_dev		FFA device, contains the destination id, the id of
@@ -1079,192 +1312,45 @@
  struct optee;
  
  /**
-@@ -113,11 +131,15 @@ struct optee {
+@@ -116,11 +127,13 @@ struct optee_ops {
+  *			world
+  * @teedev:		client device
+  * @smc:		specific to SMC ABI
++ * @ffa:		specific to FF-A ABI
+  * @call_queue:		queue of threads waiting to call @invoke_fn
+  * @wait_queue:		queue of threads from secure world waiting for a
+  *			secure world sync object
+  * @supp:		supplicant synchronization struct for RPC to supplicant
+  * @pool:		shared memory pool
++ * @rpc_arg_count:	If > 0 number of RPC parameters to make room for
+  * @scan_bus_done	flag if device registation was already done.
+  * @scan_bus_wq		workqueue to scan optee bus and register optee drivers
+  * @scan_bus_work	workq to scan optee bus and register optee drivers
+@@ -129,11 +142,15 @@ struct optee {
+ 	struct tee_device *supp_teedev;
  	struct tee_device *teedev;
  	const struct optee_ops *ops;
- 	optee_invoke_fn *invoke_fn;
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+	struct optee_ffa ffa;
-+#endif
+-	struct optee_smc smc;
++	union {
++		struct optee_smc smc;
++		struct optee_ffa ffa;
++	};
  	struct optee_call_queue call_queue;
  	struct optee_wait_queue wait_queue;
  	struct optee_supp supp;
  	struct tee_shm_pool *pool;
- 	void *memremaped_shm;
 +	unsigned int rpc_arg_count;
- 	u32 sec_caps;
  	bool   scan_bus_done;
  	struct workqueue_struct *scan_bus_wq;
-@@ -206,6 +228,36 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
- #define PTA_CMD_GET_DEVICES_SUPP	0x1
- int optee_enumerate_devices(u32 func);
+ 	struct work_struct scan_bus_work;
+@@ -266,5 +283,7 @@ static inline void reg_pair_from_64(u32 *reg0, u32 *reg1, u64 val)
+ /* Registration of the ABIs */
+ int optee_smc_abi_register(void);
+ void optee_smc_abi_unregister(void);
++int optee_ffa_abi_register(void);
++void optee_ffa_abi_unregister(void);
  
-+int optee_shm_add_ffa_handle(struct optee *optee, struct tee_shm *shm,
-+			     u64 global_id);
-+int optee_shm_rem_ffa_handle(struct optee *optee, u64 global_id);
-+
-+struct tee_shm *optee_shm_from_ffa_handle(struct optee *optee, u64 global_id);
-+
-+int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm,
-+			   struct page **pages, size_t num_pages,
-+			   unsigned long start);
-+int optee_ffa_shm_unregister(struct tee_context *ctx, struct tee_shm *shm);
-+int optee_ffa_shm_register_supp(struct tee_context *ctx, struct tee_shm *shm,
-+				struct page **pages, size_t num_pages,
-+				unsigned long start);
-+int optee_ffa_shm_unregister_supp(struct tee_context *ctx,
-+				  struct tee_shm *shm);
-+
-+int optee_ffa_do_call_with_arg(struct tee_context *ctx, struct tee_shm *arg);
-+int optee_ffa_rpc_shm_register(struct tee_context *ctx, struct tee_shm *shm);
-+void optee_handle_ffa_rpc(struct tee_context *ctx, u32 cmd,
-+			  struct optee_msg_arg *arg);
-+
-+static inline bool optee_is_ffa_based(struct optee *optee)
-+{
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+	return optee->ffa.ffa_ops;
-+#else
-+	return false;
-+#endif
-+}
-+
- /*
-  * Small helpers
-  */
-diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
-index 39562fb6841e..865a9ab3cf65 100644
---- a/drivers/tee/optee/rpc.c
-+++ b/drivers/tee/optee/rpc.c
-@@ -10,6 +10,7 @@
- #include <linux/i2c.h>
- #include <linux/slab.h>
- #include <linux/tee_drv.h>
-+#include "optee_ffa.h"
- #include "optee_private.h"
- #include "optee_smc.h"
- #include "optee_rpc_cmd.h"
-@@ -543,3 +544,120 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
- 
- 	param->a0 = OPTEE_SMC_CALL_RETURN_FROM_RPC;
- }
-+
-+#ifdef CONFIG_ARM_FFA_TRANSPORT
-+static void handle_ffa_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
-+					      struct optee_msg_arg *arg)
-+{
-+	struct tee_shm *shm;
-+
-+	if (arg->num_params != 1 ||
-+	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT) {
-+		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
-+		return;
-+	}
-+
-+	switch (arg->params[0].u.value.a) {
-+	case OPTEE_RPC_SHM_TYPE_APPL:
-+		shm = cmd_alloc_suppl(ctx, arg->params[0].u.value.b);
-+		break;
-+	case OPTEE_RPC_SHM_TYPE_KERNEL:
-+		shm = tee_shm_alloc(ctx, arg->params[0].u.value.b,
-+				    TEE_SHM_MAPPED);
-+		break;
-+	default:
-+		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
-+		return;
-+	}
-+
-+	if (IS_ERR(shm)) {
-+		arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
-+		return;
-+	}
-+
-+	arg->params[0] = (struct optee_msg_param){
-+		.attr = OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT,
-+		.u.fmem.size = tee_shm_get_size(shm),
-+		.u.fmem.global_id = shm->sec_world_id,
-+		.u.fmem.internal_offs = shm->offset,
-+	};
-+
-+	arg->ret = TEEC_SUCCESS;
-+}
-+
-+static void handle_ffa_rpc_func_cmd_shm_free(struct tee_context *ctx,
-+					     struct optee *optee,
-+					     struct optee_msg_arg *arg)
-+{
-+	struct tee_shm *shm;
-+
-+	if (arg->num_params != 1 ||
-+	    arg->params[0].attr != OPTEE_MSG_ATTR_TYPE_VALUE_INPUT)
-+		goto err_bad_param;
-+
-+	shm = optee_shm_from_ffa_handle(optee, arg->params[0].u.value.b);
-+	if (!shm)
-+		goto err_bad_param;
-+	switch (arg->params[0].u.value.a) {
-+	case OPTEE_RPC_SHM_TYPE_APPL:
-+		cmd_free_suppl(ctx, shm);
-+		break;
-+	case OPTEE_RPC_SHM_TYPE_KERNEL:
-+		tee_shm_free(shm);
-+		break;
-+	default:
-+		goto err_bad_param;
-+	}
-+	arg->ret = TEEC_SUCCESS;
-+	return;
-+
-+err_bad_param:
-+	arg->ret = TEEC_ERROR_BAD_PARAMETERS;
-+}
-+
-+static void handle_ffa_rpc_func_cmd(struct tee_context *ctx,
-+				    struct optee_msg_arg *arg)
-+{
-+	struct optee *optee = tee_get_drvdata(ctx->teedev);
-+
-+	arg->ret_origin = TEEC_ORIGIN_COMMS;
-+	switch (arg->cmd) {
-+	case OPTEE_RPC_CMD_GET_TIME:
-+		handle_rpc_func_cmd_get_time(arg);
-+		break;
-+	case OPTEE_RPC_CMD_WAIT_QUEUE:
-+		handle_rpc_func_cmd_wq(optee, arg);
-+		break;
-+	case OPTEE_RPC_CMD_SUSPEND:
-+		handle_rpc_func_cmd_wait(arg);
-+		break;
-+	case OPTEE_RPC_CMD_SHM_ALLOC:
-+		handle_ffa_rpc_func_cmd_shm_alloc(ctx, arg);
-+		break;
-+	case OPTEE_RPC_CMD_SHM_FREE:
-+		handle_ffa_rpc_func_cmd_shm_free(ctx, optee, arg);
-+		break;
-+	case OPTEE_RPC_CMD_I2C_TRANSFER:
-+		handle_rpc_func_cmd_i2c_transfer(ctx, arg);
-+		break;
-+	default:
-+		handle_rpc_supp_cmd(ctx, optee, arg);
-+	}
-+}
-+
-+void optee_handle_ffa_rpc(struct tee_context *ctx, u32 cmd,
-+			  struct optee_msg_arg *arg)
-+{
-+	switch (cmd) {
-+	case OPTEE_FFA_YIELDING_CALL_RETURN_RPC_CMD:
-+		handle_ffa_rpc_func_cmd(ctx, arg);
-+		break;
-+	case OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT:
-+		/* Interrupt delivered by now */
-+		break;
-+	default:
-+		pr_warn("Unknown RPC func 0x%x\n", cmd);
-+		break;
-+	}
-+}
-+#endif /*CONFIG_ARM_FFA_TRANSPORT*/
+ #endif /*OPTEE_PRIVATE_H*/
 -- 
-2.17.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0013-optee-smc_abi.c-add-missing-include-linux-mm.h.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0013-optee-smc_abi.c-add-missing-include-linux-mm.h.patch
new file mode 100644
index 0000000..a527fbc
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0013-optee-smc_abi.c-add-missing-include-linux-mm.h.patch
@@ -0,0 +1,63 @@
+From 61c33344f747deac2860571ef965c20f9170efea Mon Sep 17 00:00:00 2001
+From: Jens Wiklander <jens.wiklander@linaro.org>
+Date: Thu, 21 Oct 2021 14:55:39 +0200
+Subject: [PATCH 13/40] optee: smc_abi.c: add missing #include <linux/mm.h>
+
+Adds missing #include <linux/mm.h> drivers/tee/optee/smc_abi.c to fix
+compile errors like:
+drivers/tee/optee/smc_abi.c:405:15: error: implicit
+declaration of function 'page_to_section'
+[-Werror,-Wimplicit-function-declaration]
+        optee_page = page_to_phys(*pages) +
+                     ^
+arch/arm/include/asm/memory.h:148:43: note: expanded from
+macro 'page_to_phys'
+                                               ^
+include/asm-generic/memory_model.h:52:21: note: expanded
+from macro 'page_to_pfn'
+                    ^
+include/asm-generic/memory_model.h:35:14: note: expanded
+from macro '__page_to_pfn'
+        int __sec = page_to_section(__pg);                      \
+                    ^
+drivers/tee/optee/smc_abi.c:405:15: note: did you mean
+'__nr_to_section'?
+arch/arm/include/asm/memory.h:148:43: note: expanded from
+macro 'page_to_phys'
+                                               ^
+include/asm-generic/memory_model.h:52:21: note: expanded
+from macro 'page_to_pfn'
+                    ^
+include/asm-generic/memory_model.h:35:14: note: expanded
+from macro '__page_to_pfn'
+        int __sec = page_to_section(__pg);                      \
+                    ^
+include/linux/mmzone.h:1365:35: note: '__nr_to_section'
+declared here
+static inline struct mem_section *__nr_to_section(unsigned long nr)
+
+Fixes: c51a564a5b48 ("optee: isolate smc abi")
+Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
+Link: https://lore.kernel.org/r/20211021125539.3858495-1-jens.wiklander@linaro.org'
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Upstream-Status: Backport [https://lore.kernel.org/r/20211021125539.3858495-1-jens.wiklander@linaro.org]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
+---
+ drivers/tee/optee/smc_abi.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
+index 9a787fb4f5e5..6196d7c3888f 100644
+--- a/drivers/tee/optee/smc_abi.c
++++ b/drivers/tee/optee/smc_abi.c
+@@ -10,6 +10,7 @@
+ #include <linux/errno.h>
+ #include <linux/io.h>
+ #include <linux/sched.h>
++#include <linux/mm.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
+ #include <linux/of_platform.h>
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0014-optee-Fix-spelling-mistake-reclain-reclaim.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0014-optee-Fix-spelling-mistake-reclain-reclaim.patch
new file mode 100644
index 0000000..78b5d41
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0014-optee-Fix-spelling-mistake-reclain-reclaim.patch
@@ -0,0 +1,43 @@
+From bf890db9200464083c44987cd41c034b1019fc5a Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.i.king@googlemail.com>
+Date: Sat, 23 Oct 2021 12:52:09 +0100
+Subject: [PATCH 14/40] optee: Fix spelling mistake "reclain" -> "reclaim"
+
+There are spelling mistakes in pr_err error messages. Fix them.
+
+Fixes: 4615e5a34b95 ("optee: add FF-A support")
+Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
+[jw: added a fixes]
+Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ drivers/tee/optee/ffa_abi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
+index 6defd1ec982a..45424824e0f9 100644
+--- a/drivers/tee/optee/ffa_abi.c
++++ b/drivers/tee/optee/ffa_abi.c
+@@ -333,7 +333,7 @@ static int optee_ffa_shm_unregister(struct tee_context *ctx,
+ 
+ 	rc = ffa_ops->memory_reclaim(global_handle, 0);
+ 	if (rc)
+-		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
++		pr_err("mem_reclaim: 0x%llx %d", global_handle, rc);
+ 
+ 	return rc;
+ }
+@@ -355,7 +355,7 @@ static int optee_ffa_shm_unregister_supp(struct tee_context *ctx,
+ 	optee_shm_rem_ffa_handle(optee, global_handle);
+ 	rc = ffa_ops->memory_reclaim(global_handle, 0);
+ 	if (rc)
+-		pr_err("mem_reclain: 0x%llx %d", global_handle, rc);
++		pr_err("mem_reclaim: 0x%llx %d", global_handle, rc);
+ 
+ 	shm->sec_world_id = 0;
+ 
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0015-optee-fix-kfree-NULL-pointer.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0015-optee-fix-kfree-NULL-pointer.patch
new file mode 100644
index 0000000..60b6bf2
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0015-optee-fix-kfree-NULL-pointer.patch
@@ -0,0 +1,44 @@
+From 9f3b899a2e8bf79f572f408bfd86836578f46106 Mon Sep 17 00:00:00 2001
+From: Lv Ruyi <lv.ruyi@zte.com.cn>
+Date: Thu, 4 Nov 2021 11:30:47 +0000
+Subject: [PATCH 15/40] optee: fix kfree NULL pointer
+
+This patch fixes the following Coccinelle error:
+drivers/tee/optee/ffa_abi.c: 877: ERROR  optee is NULL but dereferenced.
+
+If memory allocation fails, optee is null pointer. the code will goto err
+and release optee.
+
+Fixes: 4615e5a34b95 ("optee: add FF-A support")
+Reported-by: Zeal Robot <zealci@zte.com.cn>
+Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
+Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
+[jw: removed the redundant braces]
+Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ drivers/tee/optee/ffa_abi.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
+index 45424824e0f9..d8c8683863aa 100644
+--- a/drivers/tee/optee/ffa_abi.c
++++ b/drivers/tee/optee/ffa_abi.c
+@@ -810,10 +810,9 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
+ 		return -EINVAL;
+ 
+ 	optee = kzalloc(sizeof(*optee), GFP_KERNEL);
+-	if (!optee) {
+-		rc = -ENOMEM;
+-		goto err;
+-	}
++	if (!optee)
++		return -ENOMEM;
++
+ 	optee->pool = optee_ffa_config_dyn_shm();
+ 	if (IS_ERR(optee->pool)) {
+ 		rc = PTR_ERR(optee->pool);
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0019-perf-arm-cmn-Account-for-NUMA-affinity.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0016-perf-arm-cmn-Account-for-NUMA-affinity.patch
similarity index 94%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0019-perf-arm-cmn-Account-for-NUMA-affinity.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0016-perf-arm-cmn-Account-for-NUMA-affinity.patch
index f93bff7..1530463 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0019-perf-arm-cmn-Account-for-NUMA-affinity.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0016-perf-arm-cmn-Account-for-NUMA-affinity.patch
@@ -1,7 +1,7 @@
-From c4b023618252ad8c03b7ae2cc411718af285bf66 Mon Sep 17 00:00:00 2001
+From a52e1e964aa4f2592ebffb30df048cc85fa5a02c Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:51 +0000
-Subject: [PATCH 03/14] perf/arm-cmn: Account for NUMA affinity
+Subject: [PATCH 16/40] perf/arm-cmn: Account for NUMA affinity
 
 On a system with multiple CMN meshes, ideally we'd want to access each
 PMU from within its own mesh, rather than with a long CML round-trip,
@@ -21,7 +21,7 @@
  1 file changed, 38 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index fe7f3e945481..2146d1c0103f 100644
+index 400eb7f579dc..02b898dbba91 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -1147,23 +1147,47 @@ static int arm_cmn_commit_txn(struct pmu *pmu)
@@ -103,5 +103,5 @@
  	if (ret < 0)
  		return ret;
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0020-perf-arm-cmn-Drop-compile-test-restriction.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0017-perf-arm-cmn-Drop-compile-test-restriction.patch
similarity index 93%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0020-perf-arm-cmn-Drop-compile-test-restriction.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0017-perf-arm-cmn-Drop-compile-test-restriction.patch
index 1a3e2d9..2a8e62a 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0020-perf-arm-cmn-Drop-compile-test-restriction.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0017-perf-arm-cmn-Drop-compile-test-restriction.patch
@@ -1,7 +1,7 @@
-From c3b11ad7a7e3e154a17f36c6768deab9227e28de Mon Sep 17 00:00:00 2001
+From 16cf1b5483d4cbad8ee52fcc9945abcea6492bd1 Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:52 +0000
-Subject: [PATCH 04/14] perf/arm-cmn: Drop compile-test restriction
+Subject: [PATCH 17/40] perf/arm-cmn: Drop compile-test restriction
 
 Although CMN is currently (and overwhelmingly likely to remain) deployed
 in arm64-only (modulo userspace) systems, the 64-bit "dependency" for
@@ -22,7 +22,7 @@
  2 files changed, 14 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig
-index 130327ff0b0e..828a042d6a07 100644
+index 77522e5efe11..e453915ebc84 100644
 --- a/drivers/perf/Kconfig
 +++ b/drivers/perf/Kconfig
 @@ -43,7 +43,7 @@ config ARM_CCN
@@ -35,7 +35,7 @@
  	  Support for PMU events monitoring on the Arm CMN-600 Coherent Mesh
  	  Network interconnect.
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 2146d1c0103f..e9af79b5f3de 100644
+index 02b898dbba91..1d52fcfe3a0d 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -7,6 +7,7 @@
@@ -85,5 +85,5 @@
  #define CMN_EVENT_WP_COMBINE(event)	FIELD_GET(CMN_CONFIG_WP_COMBINE, (event)->attr.config)
  #define CMN_EVENT_WP_DEV_SEL(event)	FIELD_GET(CMN_CONFIG_WP_DEV_SEL, (event)->attr.config)
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0021-perf-arm-cmn-Refactor-node-ID-handling.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0018-perf-arm-cmn-Refactor-node-ID-handling.patch
similarity index 96%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0021-perf-arm-cmn-Refactor-node-ID-handling.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0018-perf-arm-cmn-Refactor-node-ID-handling.patch
index ce4c2e5..6f2e80a 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0021-perf-arm-cmn-Refactor-node-ID-handling.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0018-perf-arm-cmn-Refactor-node-ID-handling.patch
@@ -1,7 +1,7 @@
-From 4f4a4cd7c79396fa72870ff712d15e82ebff80cf Mon Sep 17 00:00:00 2001
+From 762ba0fb54d97c08c35fbe2745c19fd4a74ded0d Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:53 +0000
-Subject: [PATCH 05/14] perf/arm-cmn: Refactor node ID handling
+Subject: [PATCH 18/40] perf/arm-cmn: Refactor node ID handling
 
 Add a bit more abstraction for the places where we decompose node IDs.
 This will help keep things nice and manageable when we come to add yet
@@ -21,7 +21,7 @@
  1 file changed, 56 insertions(+), 38 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index e9af79b5f3de..cee301fe0f7e 100644
+index 1d52fcfe3a0d..adf50d613734 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -255,6 +255,58 @@ struct arm_cmn {
@@ -151,5 +151,5 @@
  			if (arm_cmn_is_occup_event(type, CMN_EVENT_EVENTID(event))) {
  				int occupid = CMN_EVENT_OCCUPID(event);
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0022-perf-arm-cmn-Streamline-node-iteration.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0019-perf-arm-cmn-Streamline-node-iteration.patch
similarity index 95%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0022-perf-arm-cmn-Streamline-node-iteration.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0019-perf-arm-cmn-Streamline-node-iteration.patch
index fbe49b2..2fd7ba4 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0022-perf-arm-cmn-Streamline-node-iteration.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0019-perf-arm-cmn-Streamline-node-iteration.patch
@@ -1,7 +1,7 @@
-From 1b8e1ce0ebaa02c4cb7fa615b28c6905b0884e41 Mon Sep 17 00:00:00 2001
+From ca15b67dc746c13a8231d11a3e2925f128982a7d Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:54 +0000
-Subject: [PATCH 06/14] perf/arm-cmn: Streamline node iteration
+Subject: [PATCH 19/40] perf/arm-cmn: Streamline node iteration
 
 Refactor the places where we scan through the set of nodes to switch
 from explicit array indexing to pointer-based iteration. This leads to
@@ -21,7 +21,7 @@
  1 file changed, 20 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index cee301fe0f7e..77ebed7fae08 100644
+index adf50d613734..da7bf779fec2 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -299,11 +299,11 @@ static struct arm_cmn_node *arm_cmn_node_to_xp(struct arm_cmn_node *dn)
@@ -114,5 +114,5 @@
  	 * If mesh_x wasn't set during discovery then we never saw
  	 * an XP at (0,1), thus we must have an Nx1 configuration.
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0024-perf-arm-cmn-Refactor-DTM-handling.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0020-perf-arm-cmn-Refactor-DTM-handling.patch
similarity index 98%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0024-perf-arm-cmn-Refactor-DTM-handling.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0020-perf-arm-cmn-Refactor-DTM-handling.patch
index 6a68a79..6036b23 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0024-perf-arm-cmn-Refactor-DTM-handling.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0020-perf-arm-cmn-Refactor-DTM-handling.patch
@@ -1,7 +1,7 @@
-From 79bbc3eeee54b2e039dd4822e4a643e71adfbb04 Mon Sep 17 00:00:00 2001
+From a4c8c0c804b1a92373faceda9350512f2139562a Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:55 +0000
-Subject: [PATCH 08/14] perf/arm-cmn: Refactor DTM handling
+Subject: [PATCH 20/40] perf/arm-cmn: Refactor DTM handling
 
 Untangle DTMs from XPs into a dedicated abstraction. This helps make
 things a little more obvious and robust, but primarily paves the way
@@ -18,7 +18,7 @@
  1 file changed, 87 insertions(+), 82 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index e9f27f7776a2..2ae3e92690a7 100644
+index da7bf779fec2..8b98ca9666d0 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -35,14 +35,9 @@
@@ -402,5 +402,5 @@
  		child_count = FIELD_GET(CMN_CI_CHILD_COUNT, reg);
  		child_poff = FIELD_GET(CMN_CI_CHILD_PTR_OFFSET, reg);
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0025-perf-arm-cmn-Optimise-DTM-counter-reads.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0021-perf-arm-cmn-Optimise-DTM-counter-reads.patch
similarity index 91%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0025-perf-arm-cmn-Optimise-DTM-counter-reads.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0021-perf-arm-cmn-Optimise-DTM-counter-reads.patch
index af33468..07e0484 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0025-perf-arm-cmn-Optimise-DTM-counter-reads.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0021-perf-arm-cmn-Optimise-DTM-counter-reads.patch
@@ -1,7 +1,7 @@
-From a63878c01597e21451c2b3f239cbf0a2fbdeeadf Mon Sep 17 00:00:00 2001
+From 2919ec562ca976a0ae5f70b264379b3d45abdaf5 Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:56 +0000
-Subject: [PATCH 09/14] perf/arm-cmn: Optimise DTM counter reads
+Subject: [PATCH 21/40] perf/arm-cmn: Optimise DTM counter reads
 
 When multiple nodes of the same type are connected to the same XP
 (particularly in CAL configurations), it seems that they are likely
@@ -20,7 +20,7 @@
  1 file changed, 9 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 2ae3e92690a7..5fa31ebc1fce 100644
+index 8b98ca9666d0..005a0d83bcac 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -690,18 +690,19 @@ static void arm_cmn_pmu_disable(struct pmu *pmu)
@@ -52,5 +52,5 @@
  	return count;
  }
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0026-perf-arm-cmn-Optimise-DTC-counter-accesses.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0022-perf-arm-cmn-Optimise-DTC-counter-accesses.patch
similarity index 94%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0026-perf-arm-cmn-Optimise-DTC-counter-accesses.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0022-perf-arm-cmn-Optimise-DTC-counter-accesses.patch
index 56334e8..93a801b 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0026-perf-arm-cmn-Optimise-DTC-counter-accesses.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0022-perf-arm-cmn-Optimise-DTC-counter-accesses.patch
@@ -1,7 +1,7 @@
-From 782b7cd98e6a6b8c5fcd9e20f5c534617b1f04d3 Mon Sep 17 00:00:00 2001
+From 1cf0522e9b4cdad7609c6ce31e848c3d8f2932d5 Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:57 +0000
-Subject: [PATCH 10/14] perf/arm-cmn: Optimise DTC counter accesses
+Subject: [PATCH 22/40] perf/arm-cmn: Optimise DTC counter accesses
 
 In cases where we do know which DTC domain a node belongs to, we can
 skip initialising or reading the global count in DTCs where we know
@@ -23,7 +23,7 @@
  1 file changed, 12 insertions(+), 17 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 5fa31ebc1fce..2204d6500814 100644
+index 005a0d83bcac..acff8683af2c 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -193,7 +193,7 @@ struct arm_cmn_node {
@@ -107,5 +107,5 @@
  		arm_cmn_init_dtm(dtm++, xp);
  
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0027-perf-arm-cmn-Move-group-validation-data-off-stack.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0023-perf-arm-cmn-Move-group-validation-data-off-stack.patch
similarity index 94%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0027-perf-arm-cmn-Move-group-validation-data-off-stack.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0023-perf-arm-cmn-Move-group-validation-data-off-stack.patch
index 06adc56..b251779 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0027-perf-arm-cmn-Move-group-validation-data-off-stack.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0023-perf-arm-cmn-Move-group-validation-data-off-stack.patch
@@ -1,7 +1,7 @@
-From d919e8bcbb790018e097cb8a01e7c840dcdb82aa Mon Sep 17 00:00:00 2001
+From 118a6499d8c5d940210c6543309addc97b48122c Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:58 +0000
-Subject: [PATCH 11/14] perf/arm-cmn: Move group validation data off-stack
+Subject: [PATCH 23/40] perf/arm-cmn: Move group validation data off-stack
 
 With the value of CMN_MAX_DTMS increasing significantly, our validation
 data structure is set to get quite big. Technically we could pack it at
@@ -21,7 +21,7 @@
  1 file changed, 25 insertions(+), 18 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 2204d6500814..b89a081d26ff 100644
+index acff8683af2c..d2dd02f040b8 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -876,8 +876,8 @@ static int arm_cmn_validate_group(struct perf_event *event)
@@ -104,5 +104,5 @@
  
  static int arm_cmn_event_init(struct perf_event *event)
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0028-perf-arm-cmn-Demarcate-CMN-600-specifics.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0024-perf-arm-cmn-Demarcate-CMN-600-specifics.patch
similarity index 98%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0028-perf-arm-cmn-Demarcate-CMN-600-specifics.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0024-perf-arm-cmn-Demarcate-CMN-600-specifics.patch
index 0fbc5cb..c91e591 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0028-perf-arm-cmn-Demarcate-CMN-600-specifics.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0024-perf-arm-cmn-Demarcate-CMN-600-specifics.patch
@@ -1,7 +1,7 @@
-From 7400784247be42beb996f7538547c56acd6cfa0c Mon Sep 17 00:00:00 2001
+From 86d66852aa85254b823578537f8e125915375d0b Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:44:59 +0000
-Subject: [PATCH 12/14] perf/arm-cmn: Demarcate CMN-600 specifics
+Subject: [PATCH 24/40] perf/arm-cmn: Demarcate CMN-600 specifics
 
 In preparation for supporting newer CMN products, let's introduce a
 means to differentiate the features and events which are specific to a
@@ -21,7 +21,7 @@
  1 file changed, 162 insertions(+), 151 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index b89a081d26ff..92ff273fbe58 100644
+index d2dd02f040b8..ce94f923a607 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -151,7 +151,12 @@
@@ -462,5 +462,5 @@
  };
  MODULE_DEVICE_TABLE(acpi, arm_cmn_acpi_match);
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0029-perf-arm-cmn-Support-new-IP-features.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0025-perf-arm-cmn-Support-new-IP-features.patch
similarity index 95%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0029-perf-arm-cmn-Support-new-IP-features.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0025-perf-arm-cmn-Support-new-IP-features.patch
index fa0c5d9..fc9e583 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0029-perf-arm-cmn-Support-new-IP-features.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0025-perf-arm-cmn-Support-new-IP-features.patch
@@ -1,7 +1,7 @@
-From a10c446ba1f7516c16dd6400c9a7f5e203779a5d Mon Sep 17 00:00:00 2001
+From 821c1c36ba8883a8709bbbcdf4ebc716e69da991 Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:45:00 +0000
-Subject: [PATCH 13/14] perf/arm-cmn: Support new IP features
+Subject: [PATCH 25/40] perf/arm-cmn: Support new IP features
 
 The second generation of CMN IPs add new node types and significantly
 expand the configuration space with options for extra device ports on
@@ -13,13 +13,15 @@
 Signed-off-by: Robin Murphy <robin.murphy@arm.com>
 Link: https://lore.kernel.org/r/e58b495bcc7deec3882be4bac910ed0bf6979674.1638530442.git.robin.murphy@arm.com
 Signed-off-by: Will Deacon <will@kernel.org>
+Upstream-Status = Backport [https://lore.kernel.org/r/e58b495bcc7deec3882be4bac910ed0bf6979674.1638530442.git.robin.murphy@arm.com]
 Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
+Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 ---
- drivers/perf/arm-cmn.c | 222 ++++++++++++++++++++++++++++++++---------
- 1 file changed, 173 insertions(+), 49 deletions(-)
+ drivers/perf/arm-cmn.c | 218 ++++++++++++++++++++++++++++++++---------
+ 1 file changed, 171 insertions(+), 47 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 92ff273fbe58..871c86687379 100644
+index ce94f923a607..0a3f33a83c01 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -24,7 +24,10 @@
@@ -191,19 +193,15 @@
  {
  	return (type == CMN_TYPE_DVM && id == 0x05) ||
  	       (type == CMN_TYPE_HNF && id == 0x0f);
-@@ -375,9 +420,9 @@ static ssize_t arm_cmn_event_show(struct device *dev,
- 				"type=0x%x,eventid=0x%x,wp_dev_sel=?,wp_chn_sel=?,wp_grp=?,wp_val=?,wp_mask=?\n",
- 				eattr->type, eattr->eventid);
+@@ -375,7 +420,7 @@ static ssize_t arm_cmn_event_show(struct device *dev,
+ 				  "type=0x%x,eventid=0x%x,wp_dev_sel=?,wp_chn_sel=?,wp_grp=?,wp_val=?,wp_mask=?\n",
+ 				  eattr->type, eattr->eventid);
  
 -	if (arm_cmn_is_occup_event(eattr->type, eattr->eventid))
--		return snprintf(buf, PAGE_SIZE, "type=0x%x,eventid=0x%x,occupid=0x%x\n",
--				eattr->type, eattr->eventid, eattr->occupid);
 +	if (arm_cmn_is_occup_event(eattr->model, eattr->type, eattr->eventid))
-+		return sysfs_emit(buf, "type=0x%x,eventid=0x%x,occupid=0x%x\n",
-+				  eattr->type, eattr->eventid, eattr->occupid);
+ 		return sysfs_emit(buf, "type=0x%x,eventid=0x%x,occupid=0x%x\n",
+ 				  eattr->type, eattr->eventid, eattr->occupid);
  
- 	return snprintf(buf, PAGE_SIZE, "type=0x%x,eventid=0x%x\n",
- 			eattr->type, eattr->eventid);
 @@ -390,25 +435,36 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj,
  	struct device *dev = kobj_to_dev(kobj);
  	struct arm_cmn *cmn = to_cmn(dev_get_drvdata(dev));
@@ -545,5 +543,5 @@
  	return 0;
  }
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0030-perf-arm-cmn-Add-CI-700-Support.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0026-perf-arm-cmn-Add-CI-700-Support.patch
similarity index 96%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0030-perf-arm-cmn-Add-CI-700-Support.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0026-perf-arm-cmn-Add-CI-700-Support.patch
index a12911a..4e5bae4 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0030-perf-arm-cmn-Add-CI-700-Support.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0026-perf-arm-cmn-Add-CI-700-Support.patch
@@ -1,7 +1,7 @@
-From f5d0979c2385c3ef43d6f2af07c14ee897835e2c Mon Sep 17 00:00:00 2001
+From 806c281f4307dd321fe8a38ce557e8c983c3ce84 Mon Sep 17 00:00:00 2001
 From: Robin Murphy <robin.murphy@arm.com>
 Date: Fri, 3 Dec 2021 11:45:02 +0000
-Subject: [PATCH 14/14] perf/arm-cmn: Add CI-700 Support
+Subject: [PATCH 26/40] perf/arm-cmn: Add CI-700 Support
 
 Add the identifiers and events for the CI-700 coherent interconnect.
 
@@ -16,7 +16,7 @@
  1 file changed, 53 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
-index 871c86687379..e0f78b6c643c 100644
+index 0a3f33a83c01..28ab87a6cde4 100644
 --- a/drivers/perf/arm-cmn.c
 +++ b/drivers/perf/arm-cmn.c
 @@ -175,6 +175,7 @@
@@ -146,5 +146,5 @@
  };
  MODULE_DEVICE_TABLE(of, arm_cmn_of_match);
 -- 
-2.25.1
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0035-ANDROID-trusty-Backport-of-trusty-driver.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0027-ANDROID-trusty-Backport-of-trusty-driver.patch
similarity index 99%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0035-ANDROID-trusty-Backport-of-trusty-driver.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0027-ANDROID-trusty-Backport-of-trusty-driver.patch
index 290de51..b318760 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0035-ANDROID-trusty-Backport-of-trusty-driver.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0027-ANDROID-trusty-Backport-of-trusty-driver.patch
@@ -1,7 +1,7 @@
-From 3e1e61f54538e8ce4bcbb5a9a213624eafcae514 Mon Sep 17 00:00:00 2001
+From 8db3072225e852c2ef8bcc6c95f5b22f05104f35 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
 Date: Mon, 18 Nov 2013 20:46:48 -0800
-Subject: [PATCH 18/32] ANDROID: trusty: Backport of trusty driver
+Subject: [PATCH 27/40] ANDROID: trusty: Backport of trusty driver
 
 This adds Trusty driver from android-trusty-5.10
 
@@ -38,6 +38,7 @@
 Upstream-Status: Backport
 Change-Id: I91f71b891a1091383a298e7fb2f9030382a19ca5
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com>
 ---
  .../devicetree/bindings/trusty/trusty-irq.txt |   67 +
  .../devicetree/bindings/trusty/trusty-smc.txt |    6 +
@@ -507,10 +508,10 @@
 +# CONFIG_LTO_CLANG is not set
 +# CONFIG_LTO_CLANG_FULL is not set
 diff --git a/drivers/Kconfig b/drivers/Kconfig
-index dcecc9f6e33f..2e9abcc98126 100644
+index 0d399ddaa185..e346c35f42b4 100644
 --- a/drivers/Kconfig
 +++ b/drivers/Kconfig
-@@ -86,6 +86,8 @@ source "drivers/hwmon/Kconfig"
+@@ -85,6 +85,8 @@ source "drivers/hwmon/Kconfig"
  
  source "drivers/thermal/Kconfig"
  
@@ -520,10 +521,10 @@
  
  source "drivers/ssb/Kconfig"
 diff --git a/drivers/Makefile b/drivers/Makefile
-index 576228037718..7d15799dbe77 100644
+index a110338c860c..d3165b877622 100644
 --- a/drivers/Makefile
 +++ b/drivers/Makefile
-@@ -118,6 +118,7 @@ obj-$(CONFIG_W1)		+= w1/
+@@ -117,6 +117,7 @@ obj-$(CONFIG_W1)		+= w1/
  obj-y				+= power/
  obj-$(CONFIG_HWMON)		+= hwmon/
  obj-$(CONFIG_THERMAL)		+= thermal/
@@ -8083,17 +8084,17 @@
 +
 +#endif
 diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
-index b052355ac7a3..cf6b95d9a1ec 100644
+index 80d76b75bccd..909905cd7618 100644
 --- a/include/uapi/linux/virtio_ids.h
 +++ b/include/uapi/linux/virtio_ids.h
-@@ -39,6 +39,7 @@
- #define VIRTIO_ID_9P		9 /* 9p virtio console */
- #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
- #define VIRTIO_ID_CAIF	       12 /* Virtio caif */
-+#define VIRTIO_ID_TRUSTY_IPC   13 /* virtio trusty ipc */
- #define VIRTIO_ID_GPU          16 /* virtio GPU */
- #define VIRTIO_ID_INPUT        18 /* virtio input */
- #define VIRTIO_ID_VSOCK        19 /* virtio vsock transport */
+@@ -42,6 +42,7 @@
+ #define VIRTIO_ID_RPROC_SERIAL		11 /* virtio remoteproc serial link */
+ #define VIRTIO_ID_CAIF			12 /* Virtio caif */
+ #define VIRTIO_ID_MEMORY_BALLOON	13 /* virtio memory balloon */
++#define VIRTIO_ID_TRUSTY_IPC		13 /* virtio trusty ipc */
+ #define VIRTIO_ID_GPU			16 /* virtio GPU */
+ #define VIRTIO_ID_CLOCK			17 /* virtio clock/timer */
+ #define VIRTIO_ID_INPUT			18 /* virtio input */
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0036-ANDROID-trusty-Remove-FFA-specific-initilization.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0028-ANDROID-trusty-Remove-FFA-specific-initilization.patch
similarity index 99%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0036-ANDROID-trusty-Remove-FFA-specific-initilization.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0028-ANDROID-trusty-Remove-FFA-specific-initilization.patch
index 6dd8af2..83512f4 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0036-ANDROID-trusty-Remove-FFA-specific-initilization.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0028-ANDROID-trusty-Remove-FFA-specific-initilization.patch
@@ -1,7 +1,7 @@
-From 8318af58a0f5d29352d3c84be6b20fe6d1ca352f Mon Sep 17 00:00:00 2001
+From 1ecad11415cff1f4a1f098ddb224293fcc8df4a1 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 13:41:26 +0000
-Subject: [PATCH 23/32] ANDROID: trusty: Remove FFA specific initilization
+Subject: [PATCH 28/40] ANDROID: trusty: Remove FFA specific initilization
 
 Remove FFA specific initialization and its arm_ffa.h file from Trusty
 driver. These changes are done so that Trusty can use ARM FFA driver
@@ -10,6 +10,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Iaad473659de94930cdf78cd7201f016d59cee8d7
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/trusty-mem.c    |  37 ---
  drivers/trusty/trusty.c        | 286 +---------------
@@ -1072,5 +1073,5 @@
  };
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0037-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0029-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch
similarity index 97%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0037-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0029-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch
index a7bc060..8f061f7 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0037-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0029-ANDROID-trusty-Rename-transfer-memory-function-to-le.patch
@@ -1,7 +1,7 @@
-From 804ef860d9757cbe31b606fd5ec68cc5454c88f8 Mon Sep 17 00:00:00 2001
+From 162daf58abe2d00b9279fce143595b6ff546f803 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Tue, 18 Jan 2022 18:27:09 +0000
-Subject: [PATCH 24/32] ANDROID: trusty: Rename transfer memory function to
+Subject: [PATCH 29/40] ANDROID: trusty: Rename transfer memory function to
  lend memory
 
 Renaming trusty_transfer_memory to trusty_lend_memory allows Trusty
@@ -13,6 +13,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Ie165a609cc4398bb916967595d0b748d54d75faf
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/trusty-ipc.c    | 14 ++++++++----
  drivers/trusty/trusty-test.c   |  3 ++-
@@ -187,5 +188,5 @@
  #endif
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0038-ANDROID-trusty-Separate-out-SMC-based-transport.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0030-ANDROID-trusty-Separate-out-SMC-based-transport.patch
similarity index 98%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0038-ANDROID-trusty-Separate-out-SMC-based-transport.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0030-ANDROID-trusty-Separate-out-SMC-based-transport.patch
index c4ff31c..9854be1 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0038-ANDROID-trusty-Separate-out-SMC-based-transport.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0030-ANDROID-trusty-Separate-out-SMC-based-transport.patch
@@ -1,7 +1,7 @@
-From 844cdefb8b0f6b1f75cf4cbaa2d9260959a26e02 Mon Sep 17 00:00:00 2001
+From 41cab33091954ec655e7fe567c345f5a44fea122 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 14:02:39 +0000
-Subject: [PATCH 25/32] ANDROID: trusty: Separate out SMC based transport
+Subject: [PATCH 30/40] ANDROID: trusty: Separate out SMC based transport
 
 This commit refactors SMC based transport operation like
 smc_fastcalls, smc memory operations in a separate file.
@@ -9,6 +9,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Iebee505b7172f6247186e3bf1e0b50740b2e4dfa
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/Makefile         |   1 +
  drivers/trusty/trusty-private.h |  61 ++++++++++++++
@@ -491,5 +492,5 @@
  	s->dev->dma_parms = NULL;
  	kfree(s->version_str);
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0039-ANDROID-trusty-Modify-device-compatible-string.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0031-ANDROID-trusty-Modify-device-compatible-string.patch
similarity index 90%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0039-ANDROID-trusty-Modify-device-compatible-string.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0031-ANDROID-trusty-Modify-device-compatible-string.patch
index 8fd1c7c..7db4c84 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0039-ANDROID-trusty-Modify-device-compatible-string.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0031-ANDROID-trusty-Modify-device-compatible-string.patch
@@ -1,7 +1,7 @@
-From 5566c2a41443e26068fe3a8e4a8e4b0c3a4e8ed6 Mon Sep 17 00:00:00 2001
+From d022d0c3c6cadacf8a3a5fd2bb42c465834eef26 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 14:22:42 +0000
-Subject: [PATCH 26/32] ANDROID: trusty: Modify device compatible string
+Subject: [PATCH 31/40] ANDROID: trusty: Modify device compatible string
 
 Drop smc keyword from device tree node as Trusty can use SMC or FFA
 based transport.
@@ -9,6 +9,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Id99b52f32a2122434a22f1991c0b4cd52b0676ed
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  Documentation/devicetree/bindings/trusty/trusty-irq.txt | 2 +-
  Documentation/devicetree/bindings/trusty/trusty-smc.txt | 2 +-
@@ -52,5 +53,5 @@
  };
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0040-ANDROID-trusty-Add-transport-descriptor.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0032-ANDROID-trusty-Add-transport-descriptor.patch
similarity index 96%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0040-ANDROID-trusty-Add-transport-descriptor.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0032-ANDROID-trusty-Add-transport-descriptor.patch
index 53c76be..340e12d 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0040-ANDROID-trusty-Add-transport-descriptor.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0032-ANDROID-trusty-Add-transport-descriptor.patch
@@ -1,7 +1,7 @@
-From 27248b5c8cb5c1a59b08e46eb3ab918867282c1c Mon Sep 17 00:00:00 2001
+From e7fe12a5a7e3eac7a7d549ef9a7d88e9baba1832 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 17:52:33 +0000
-Subject: [PATCH 27/32] ANDROID: trusty: Add transport descriptor
+Subject: [PATCH 32/40] ANDROID: trusty: Add transport descriptor
 
 Use transport descriptor to hold transport specific operations. This
 helps to add new transport to Trusty core.
@@ -9,6 +9,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Ibbde50de0302f6d259a7d572f0910067ce712b37
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/trusty-private.h | 20 +++++++++-
  drivers/trusty/trusty-smc.c     |  6 +++
@@ -205,5 +206,5 @@
  };
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0041-ANDROID-trusty-Add-trusty-ffa-driver.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0033-ANDROID-trusty-Add-trusty-ffa-driver.patch
similarity index 97%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0041-ANDROID-trusty-Add-trusty-ffa-driver.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0033-ANDROID-trusty-Add-trusty-ffa-driver.patch
index a61d2c8..4c70e34 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0041-ANDROID-trusty-Add-trusty-ffa-driver.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0033-ANDROID-trusty-Add-trusty-ffa-driver.patch
@@ -1,7 +1,7 @@
-From 3104eb14f62df1c7c4b9038eb914514b0ff371dc Mon Sep 17 00:00:00 2001
+From 34236d8df51d00d1167481760fda5abb56850765 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Fri, 14 Jan 2022 18:47:08 +0000
-Subject: [PATCH 28/32] ANDROID: trusty: Add trusty-ffa driver
+Subject: [PATCH 33/40] ANDROID: trusty: Add trusty-ffa driver
 
 Initial changes related to FFA transport support
   - Adds FFA transport descriptor
@@ -14,6 +14,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: I78f72b85c20e4bad4c24cf0826e96f27dcf2ee1d
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/Makefile         |   1 +
  drivers/trusty/trusty-ffa.c     | 196 ++++++++++++++++++++++++++++++++
@@ -308,5 +309,5 @@
  };
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0042-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0034-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch
similarity index 95%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0042-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0034-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch
index 2b15009..3654bff 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0042-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0034-ANDROID-trusty-ffa-Add-support-for-FFA-memory-operat.patch
@@ -1,7 +1,7 @@
-From c552f8ed6bbd68e838732598ca74055bb696dcb3 Mon Sep 17 00:00:00 2001
+From 996e6bae70ec2ce04061daab23f20e9c353c4227 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Tue, 18 Jan 2022 15:11:46 +0000
-Subject: [PATCH 29/32] ANDROID: trusty-ffa: Add support for FFA memory
+Subject: [PATCH 34/40] ANDROID: trusty-ffa: Add support for FFA memory
  operations
 
 Initializes Trusty mem_ops with FFA memory operations for share,
@@ -10,6 +10,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Id3a1eb5ae8e4721cb983c624773d39bafe25a77d
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/trusty-ffa.c | 102 ++++++++++++++++++++++++++++++++++++
  drivers/trusty/trusty.c     |   5 ++
@@ -147,5 +148,5 @@
  static const trusty_transports_t trusty_transports[] = {
  	&trusty_smc_transport,
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0043-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0035-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch
similarity index 95%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0043-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0035-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch
index 2c1623a..eda8c64 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0043-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0035-ANDROID-trusty-ffa-Enable-FFA-transport-for-both-mem.patch
@@ -1,7 +1,7 @@
-From e67cd78142984c7c4120f15ef14e1e026746af5a Mon Sep 17 00:00:00 2001
+From 8612a35bb376a3d104fe81f07c7109a252dcd9bf Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Thu, 3 Feb 2022 11:19:38 +0000
-Subject: [PATCH 30/32] ANDROID: trusty-ffa: Enable FFA transport for both
+Subject: [PATCH 35/40] ANDROID: trusty-ffa: Enable FFA transport for both
  memory and message ops
 
 Adds new API version TRUSTY_API_VERSION_FFA and sets this as current
@@ -13,6 +13,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: I4a8b060f906a96935a7df10713026fb543e2b9a7
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/trusty-ffa.c   | 58 +++++++++++++++++++++++++++++++++++
  drivers/trusty/trusty.c       |  3 ++
@@ -138,5 +139,5 @@
  
  /* TRUSTED_OS entity calls */
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0044-ANDROID-trusty-Make-trusty-transports-configurable.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0036-ANDROID-trusty-Make-trusty-transports-configurable.patch
similarity index 96%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0044-ANDROID-trusty-Make-trusty-transports-configurable.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0036-ANDROID-trusty-Make-trusty-transports-configurable.patch
index 3076eca..0f9e64b 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/0044-ANDROID-trusty-Make-trusty-transports-configurable.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0036-ANDROID-trusty-Make-trusty-transports-configurable.patch
@@ -1,7 +1,7 @@
-From 088162ab1852aa0f2034199e97a327b6240231db Mon Sep 17 00:00:00 2001
+From f6ffd3bf7b561d603b350dc0274121886193fef0 Mon Sep 17 00:00:00 2001
 From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Date: Wed, 16 Mar 2022 11:14:09 +0000
-Subject: [PATCH 31/32] ANDROID: trusty: Make trusty transports configurable
+Subject: [PATCH 36/40] ANDROID: trusty: Make trusty transports configurable
 
 With TRUSTY_SMC_TRANSPORT set to 'y', SMC based message passing and
 memory sharing support will be compiled in to trusty core.
@@ -16,6 +16,7 @@
 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
 Change-Id: Ib5bbf0d39202e6897700264d14371ae33101c1d1
 Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
 ---
  drivers/trusty/Kconfig          | 30 ++++++++++++++++++++++++++++++
  drivers/trusty/Makefile         | 26 +++++++++++++++-----------
@@ -142,5 +143,5 @@
  }
  
 -- 
-2.30.2
+2.34.1
 
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0037-ANDROID-trusty-log-include-panic_notifier.h.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0037-ANDROID-trusty-log-include-panic_notifier.h.patch
new file mode 100644
index 0000000..8d57267
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0037-ANDROID-trusty-log-include-panic_notifier.h.patch
@@ -0,0 +1,27 @@
+From 71a99394b657019d234b43d9abacf9f86a3c4e4f Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Date: Thu, 19 May 2022 09:56:04 +0100
+Subject: [PATCH 37/40] ANDROID: trusty-log: include panic_notifier.h
+
+Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ drivers/trusty/trusty-log.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/trusty/trusty-log.c b/drivers/trusty/trusty-log.c
+index 7b279fe63766..1bd68278d0be 100644
+--- a/drivers/trusty/trusty-log.c
++++ b/drivers/trusty/trusty-log.c
+@@ -6,6 +6,7 @@
+ #include <linux/trusty/smcall.h>
+ #include <linux/trusty/trusty.h>
+ #include <linux/notifier.h>
++#include <linux/panic_notifier.h>
+ #include <linux/scatterlist.h>
+ #include <linux/slab.h>
+ #include <linux/mm.h>
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0038-ANDROID-trusty-ipc-fix-VIRTIO_ID_TRUSTY_IPC-ID.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0038-ANDROID-trusty-ipc-fix-VIRTIO_ID_TRUSTY_IPC-ID.patch
new file mode 100644
index 0000000..502a984
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0038-ANDROID-trusty-ipc-fix-VIRTIO_ID_TRUSTY_IPC-ID.patch
@@ -0,0 +1,30 @@
+From dfa152d399d7e6a285ab31bcc2172f61d5db907d Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Date: Thu, 19 May 2022 09:59:06 +0100
+Subject: [PATCH 38/40] ANDROID: trusty-ipc: fix VIRTIO_ID_TRUSTY_IPC ID
+
+Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ include/uapi/linux/virtio_ids.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
+index 909905cd7618..06ccbf2db5fa 100644
+--- a/include/uapi/linux/virtio_ids.h
++++ b/include/uapi/linux/virtio_ids.h
+@@ -42,6 +42,10 @@
+ #define VIRTIO_ID_RPROC_SERIAL		11 /* virtio remoteproc serial link */
+ #define VIRTIO_ID_CAIF			12 /* Virtio caif */
+ #define VIRTIO_ID_MEMORY_BALLOON	13 /* virtio memory balloon */
++/*
++ * todo: VIRTIO_ID_TRUSTY_IPC conflicts with VIRTIO_ID_MEMORY_BALLOON
++ * replace with unused ID and update trusty kernel header tipc_virtio_dev.h
++ */
+ #define VIRTIO_ID_TRUSTY_IPC		13 /* virtio trusty ipc */
+ #define VIRTIO_ID_GPU			16 /* virtio GPU */
+ #define VIRTIO_ID_CLOCK			17 /* virtio clock/timer */
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0039-gki_config-add-tc-disable_mpam.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0039-gki_config-add-tc-disable_mpam.patch
new file mode 100644
index 0000000..28dd383
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0039-gki_config-add-tc-disable_mpam.patch
@@ -0,0 +1,27 @@
+From 6de0622bb6880b5a8e8422f6e6e847cc43231a89 Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Date: Wed, 18 May 2022 18:47:55 +0100
+Subject: [PATCH 39/40] gki_config: add tc/disable_mpam
+
+Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ arch/arm64/configs/gki_defconfig | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig
+index 31d836eef904..0536759d1baa 100644
+--- a/arch/arm64/configs/gki_defconfig
++++ b/arch/arm64/configs/gki_defconfig
+@@ -60,7 +60,6 @@ CONFIG_ARMV8_DEPRECATED=y
+ CONFIG_SWP_EMULATION=y
+ CONFIG_CP15_BARRIER_EMULATION=y
+ CONFIG_SETEND_EMULATION=y
+-CONFIG_ARM64_MPAM=y
+ CONFIG_RANDOMIZE_BASE=y
+ # CONFIG_RANDOMIZE_MODULE_REGION_FULL is not set
+ CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure"
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0040-ANDROID-KVM-arm64-disable-FFA-driver-at-EL2.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0040-ANDROID-KVM-arm64-disable-FFA-driver-at-EL2.patch
new file mode 100644
index 0000000..2d6b675
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0040-ANDROID-KVM-arm64-disable-FFA-driver-at-EL2.patch
@@ -0,0 +1,52 @@
+From 2cdf0de8f42c4825f52618b9bbd2ec2084749de0 Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Date: Thu, 19 May 2022 16:44:13 +0100
+Subject: [PATCH 40/40] ANDROID: KVM: arm64: disable FFA driver at EL2
+
+Do not handle FFA calls
+
+Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
+Upstream-Status: Pending [Not submitted to upstream yet]
+Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com
+---
+ arch/arm64/kvm/hyp/nvhe/hyp-main.c | 3 +++
+ arch/arm64/kvm/hyp/nvhe/setup.c    | 4 +++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+index 49345929af0d..463cf27712c3 100644
+--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
++++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+@@ -1134,8 +1134,11 @@ static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
+ 	bool handled;
+ 
+ 	handled = kvm_host_psci_handler(host_ctxt);
++	/* do not handle ffa calls as EL2 FFA driver is not yet complete */
++#if 0
+ 	if (!handled)
+ 		handled = kvm_host_ffa_handler(host_ctxt);
++#endif
+ 	if (!handled)
+ 		default_host_smc_handler(host_ctxt);
+ 
+diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c
+index 1a6f3eba5035..ce84030426d0 100644
+--- a/arch/arm64/kvm/hyp/nvhe/setup.c
++++ b/arch/arm64/kvm/hyp/nvhe/setup.c
+@@ -317,10 +317,12 @@ void __noreturn __pkvm_init_finalise(void)
+ 	if (ret)
+ 		goto out;
+ 
++	/* skip ffa init at EL2, use EL1 driver instead */
++#if 0
+ 	ret = hyp_ffa_init(ffa_proxy_pages);
+ 	if (ret)
+ 		goto out;
+-
++#endif
+ 	hyp_shadow_table_init(shadow_table_base);
+ out:
+ 	/*
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0041-etherdevice-Adjust-ether_addr-prototypes-to-silence-.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0041-etherdevice-Adjust-ether_addr-prototypes-to-silence-.patch
new file mode 100644
index 0000000..b6da77d
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0041-etherdevice-Adjust-ether_addr-prototypes-to-silence-.patch
@@ -0,0 +1,66 @@
+From 37948a54f3e49fc2fef157f89d5bb52cefcfe68e Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Sat, 12 Feb 2022 09:14:49 -0800
+Subject: [PATCH] etherdevice: Adjust ether_addr* prototypes to silence
+ -Wstringop-overead
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With GCC 12, -Wstringop-overread was warning about an implicit cast from
+char[6] to char[8]. However, the extra 2 bytes are always thrown away,
+alignment doesn't matter, and the risk of hitting the edge of unallocated
+memory has been accepted, so this prototype can just be converted to a
+regular char *. Silences:
+
+net/core/dev.c: In function ‘bpf_prog_run_generic_xdp’: net/core/dev.c:4618:21: warning: ‘ether_addr_equal_64bits’ reading 8 bytes from a region of size 6 [-Wstringop-overread]
+ 4618 |         orig_host = ether_addr_equal_64bits(eth->h_dest, > skb->dev->dev_addr);
+      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+net/core/dev.c:4618:21: note: referencing argument 1 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’}
+net/core/dev.c:4618:21: note: referencing argument 2 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’}
+In file included from net/core/dev.c:91: include/linux/etherdevice.h:375:20: note: in a call to function ‘ether_addr_equal_64bits’
+  375 | static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
+      |                    ^~~~~~~~~~~~~~~~~~~~~~~
+
+Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Link: https://lore.kernel.org/netdev/20220212090811.uuzk6d76agw2vv73@pengutronix.de
+Cc: Jakub Kicinski <kuba@kernel.org>
+Cc: "David S. Miller" <davem@davemloft.net>
+Cc: netdev@vger.kernel.org
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+
+Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2618a0dae09ef37728dab89ff60418cbe25ae6bd]
+Change-Id: I41ed4ace65094964eacddf0c56f9fc779f7d4e0c
+Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
+---
+ include/linux/etherdevice.h | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
+index c58d50451485..7f28fa702bb7 100644
+--- a/include/linux/etherdevice.h
++++ b/include/linux/etherdevice.h
+@@ -127,7 +127,7 @@ static inline bool is_multicast_ether_addr(const u8 *addr)
+ #endif
+ }
+ 
+-static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2])
++static inline bool is_multicast_ether_addr_64bits(const u8 *addr)
+ {
+ #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+ #ifdef __BIG_ENDIAN
+@@ -364,8 +364,7 @@ static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+  * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits.
+  */
+ 
+-static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
+-					   const u8 addr2[6+2])
++static inline bool ether_addr_equal_64bits(const u8 *addr1, const u8 *addr2)
+ {
+ #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+ 	u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2);
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0042-mm-page_alloc-fix-building-error-on-Werror-array-com.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0042-mm-page_alloc-fix-building-error-on-Werror-array-com.patch
new file mode 100644
index 0000000..1267a82
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/0042-mm-page_alloc-fix-building-error-on-Werror-array-com.patch
@@ -0,0 +1,45 @@
+From 74979dd6327bbaa96ecb8525f8ea6025715d5ba7 Mon Sep 17 00:00:00 2001
+From: Xiongwei Song <sxwjean@gmail.com>
+Date: Fri, 14 Jan 2022 14:07:24 -0800
+Subject: [PATCH] mm: page_alloc: fix building error on -Werror=array-compare
+
+Arthur Marsh reported we would hit the error below when building kernel
+with gcc-12:
+
+  CC      mm/page_alloc.o
+  mm/page_alloc.c: In function `mem_init_print_info':
+  mm/page_alloc.c:8173:27: error: comparison between two arrays [-Werror=array-compare]
+   8173 |                 if (start <= pos && pos < end && size > adj) \
+        |
+
+In C++20, the comparision between arrays should be warned.
+
+Link: https://lkml.kernel.org/r/20211125130928.32465-1-sxwjean@me.com
+Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
+Reported-by: Arthur Marsh <arthur.marsh@internode.on.net>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
+Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ca831f29f8f25c97182e726429b38c0802200c8f]
+Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
+Change-Id: I11931013f1fd42f0f2a75375cdfb129cb3a9d5aa
+---
+ mm/page_alloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index 185fbddecc83..3affeeb194d4 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -8282,7 +8282,7 @@ void __init mem_init_print_info(void)
+ 	 */
+ #define adj_init_size(start, end, size, pos, adj) \
+ 	do { \
+-		if (start <= pos && pos < end && size > adj) \
++		if (&start[0] <= &pos[0] && &pos[0] < &end[0] && size > adj) \
+ 			size -= adj; \
+ 	} while (0)
+ 
+-- 
+2.34.1
+
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/gki_defconfig b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/gki_defconfig
similarity index 93%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/gki_defconfig
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/gki_defconfig
index 30bd964..31d836e 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/gki_defconfig
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/gki_defconfig
@@ -1,8 +1,13 @@
+CONFIG_UAPI_HEADER_TEST=y
 CONFIG_AUDIT=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_BPF_JIT=y
+CONFIG_BPF_JIT_ALWAYS_ON=y
 CONFIG_PREEMPT=y
 CONFIG_IRQ_TIME_ACCOUNTING=y
+CONFIG_TASKSTATS=y
 CONFIG_TASK_XACCT=y
 CONFIG_TASK_IO_ACCOUNTING=y
 CONFIG_PSI=y
@@ -34,8 +39,6 @@
 # CONFIG_SYSFS_SYSCALL is not set
 # CONFIG_FHANDLE is not set
 CONFIG_KALLSYMS_ALL=y
-CONFIG_BPF_SYSCALL=y
-CONFIG_BPF_JIT_ALWAYS_ON=y
 CONFIG_USERFAULTFD=y
 # CONFIG_RSEQ is not set
 CONFIG_EMBEDDED=y
@@ -45,23 +48,22 @@
 CONFIG_SLAB_FREELIST_HARDENED=y
 CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
 CONFIG_PROFILING=y
-# CONFIG_ZONE_DMA is not set
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_HISI=y
 CONFIG_ARCH_QCOM=y
-CONFIG_ARCH_SPRD=y
 CONFIG_SCHED_MC=y
 CONFIG_NR_CPUS=32
-CONFIG_PARAVIRT=y
+CONFIG_PARAVIRT_TIME_ACCOUNTING=y
 CONFIG_ARM64_SW_TTBR0_PAN=y
 CONFIG_COMPAT=y
 CONFIG_ARMV8_DEPRECATED=y
 CONFIG_SWP_EMULATION=y
 CONFIG_CP15_BARRIER_EMULATION=y
 CONFIG_SETEND_EMULATION=y
+CONFIG_ARM64_MPAM=y
 CONFIG_RANDOMIZE_BASE=y
 # CONFIG_RANDOMIZE_MODULE_REGION_FULL is not set
-CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure cgroup.memory=nokmem"
+CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure"
 CONFIG_CMDLINE_EXTEND=y
 # CONFIG_DMI is not set
 CONFIG_PM_WAKELOCKS=y
@@ -80,14 +82,11 @@
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
 CONFIG_ARM_SCPI_CPUFREQ=y
 CONFIG_ARM_SCMI_CPUFREQ=y
-CONFIG_ARM_SCMI_PROTOCOL=y
-# CONFIG_ARM_SCMI_POWER_DOMAIN is not set
-CONFIG_ARM_SCPI_PROTOCOL=y
-# CONFIG_ARM_SCPI_POWER_DOMAIN is not set
-# CONFIG_EFI_ARMSTUB_DTB_LOADER is not set
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM=y
+CONFIG_KVM_S2MPU=y
 CONFIG_CRYPTO_SHA2_ARM64_CE=y
+CONFIG_CRYPTO_SHA512_ARM64_CE=y
 CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
 CONFIG_KPROBES=y
 CONFIG_JUMP_LABEL=y
@@ -98,7 +97,8 @@
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODVERSIONS=y
 CONFIG_MODULE_SCMVERSION=y
-CONFIG_BLK_CGROUP_IOCOST=y
+CONFIG_MODULE_SIG=y
+CONFIG_MODULE_SIG_PROTECT=y
 CONFIG_BLK_INLINE_ENCRYPTION=y
 CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
 CONFIG_IOSCHED_BFQ=y
@@ -114,9 +114,10 @@
 CONFIG_CLEANCACHE=y
 CONFIG_CMA=y
 CONFIG_CMA_DEBUGFS=y
-CONFIG_CMA_SYSFS=y
 CONFIG_CMA_AREAS=16
-CONFIG_READ_ONLY_THP_FOR_FS=y
+# CONFIG_ZONE_DMA is not set
+CONFIG_ANON_VMA_NAME=y
+CONFIG_LRU_GEN=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -224,6 +225,7 @@
 CONFIG_TIPC=y
 CONFIG_L2TP=y
 CONFIG_BRIDGE=y
+CONFIG_VLAN_8021Q=y
 CONFIG_6LOWPAN=y
 CONFIG_IEEE802154=y
 CONFIG_IEEE802154_6LOWPAN=y
@@ -258,9 +260,9 @@
 CONFIG_NET_ACT_GACT=y
 CONFIG_NET_ACT_MIRRED=y
 CONFIG_NET_ACT_SKBEDIT=y
+CONFIG_NET_ACT_BPF=y
 CONFIG_VSOCKETS=y
 CONFIG_CGROUP_NET_PRIO=y
-CONFIG_BPF_JIT=y
 CONFIG_CAN=y
 CONFIG_BT=y
 CONFIG_BT_RFCOMM=y
@@ -271,6 +273,11 @@
 CONFIG_BT_HCIUART_LL=y
 CONFIG_BT_HCIUART_BCM=y
 CONFIG_BT_HCIUART_QCA=y
+CONFIG_CFG80211=y
+CONFIG_NL80211_TESTMODE=y
+# CONFIG_CFG80211_DEFAULT_PS is not set
+# CONFIG_CFG80211_CRDA_SUPPORT is not set
+CONFIG_MAC80211=y
 CONFIG_RFKILL=y
 CONFIG_NFC=y
 CONFIG_PCI=y
@@ -286,6 +293,11 @@
 # CONFIG_FW_CACHE is not set
 # CONFIG_SUN50I_DE2_BUS is not set
 # CONFIG_SUNXI_RSB is not set
+CONFIG_ARM_SCMI_PROTOCOL=y
+# CONFIG_ARM_SCMI_POWER_DOMAIN is not set
+CONFIG_ARM_SCPI_PROTOCOL=y
+# CONFIG_ARM_SCPI_POWER_DOMAIN is not set
+# CONFIG_EFI_ARMSTUB_DTB_LOADER is not set
 CONFIG_GNSS=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_LOOP_MIN_COUNT=16
@@ -303,7 +315,6 @@
 CONFIG_SCSI_UFS_HISI=y
 CONFIG_SCSI_UFS_BSG=y
 CONFIG_SCSI_UFS_CRYPTO=y
-CONFIG_SCSI_UFS_HPB=y
 CONFIG_MD=y
 CONFIG_BLK_DEV_DM=y
 CONFIG_DM_CRYPT=y
@@ -312,11 +323,11 @@
 CONFIG_DM_UEVENT=y
 CONFIG_DM_VERITY=y
 CONFIG_DM_VERITY_FEC=y
-CONFIG_DM_BOW=y
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=y
 CONFIG_WIREGUARD=y
 CONFIG_IFB=y
+CONFIG_MACSEC=y
 CONFIG_TUN=y
 CONFIG_VETH=y
 CONFIG_PPP=y
@@ -328,8 +339,6 @@
 CONFIG_USB_RTL8150=y
 CONFIG_USB_RTL8152=y
 CONFIG_USB_USBNET=y
-# CONFIG_USB_NET_AX8817X is not set
-# CONFIG_USB_NET_AX88179_178A is not set
 CONFIG_USB_NET_CDC_EEM=y
 # CONFIG_USB_NET_NET1080 is not set
 # CONFIG_USB_NET_CDC_SUBSET is not set
@@ -356,8 +365,6 @@
 # CONFIG_MOUSE_PS2 is not set
 CONFIG_INPUT_JOYSTICK=y
 CONFIG_JOYSTICK_XPAD=y
-CONFIG_JOYSTICK_XPAD_FF=y
-CONFIG_JOYSTICK_XPAD_LEDS=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_UINPUT=y
@@ -367,25 +374,29 @@
 # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
 CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_SERIAL_8250_EXAR is not set
+CONFIG_SERIAL_8250_RUNTIME_UARTS=0
+CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
 CONFIG_SERIAL_SAMSUNG=y
 CONFIG_SERIAL_SAMSUNG_CONSOLE=y
-CONFIG_SERIAL_MSM_GENI_EARLY_CONSOLE=y
+CONFIG_SERIAL_QCOM_GENI=y
+# CONFIG_SERIAL_QCOM_GENI_CONSOLE_DEFAULT_ENABLED is not set
+CONFIG_SERIAL_QCOM_GENI_CONSOLE=y
 CONFIG_SERIAL_SPRD=y
 CONFIG_SERIAL_SPRD_CONSOLE=y
 CONFIG_HVC_DCC=y
-CONFIG_HVC_DCC_SERIALIZE_SMP=y
 CONFIG_SERIAL_DEV_BUS=y
 CONFIG_HW_RANDOM=y
-# CONFIG_HW_RANDOM_CAVIUM is not set
 # CONFIG_DEVMEM is not set
 # CONFIG_DEVPORT is not set
+CONFIG_RANDOM_TRUST_CPU=y
 # CONFIG_I2C_COMPAT is not set
 # CONFIG_I2C_HELPER_AUTO is not set
 CONFIG_I3C=y
 CONFIG_SPI=y
+CONFIG_SPI_MEM=y
 CONFIG_SPMI=y
 # CONFIG_SPMI_MSM_PMIC_ARB is not set
 # CONFIG_PINCTRL_SUN8I_H3_R is not set
@@ -396,6 +407,7 @@
 # CONFIG_PINCTRL_SUN50I_H6_R is not set
 CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_POWER_RESET_HISI=y
+CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_THERMAL=y
 CONFIG_THERMAL_NETLINK=y
@@ -410,7 +422,6 @@
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_CORE=y
 CONFIG_MFD_ACT8945A=y
-CONFIG_MFD_SYSCON=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_RC_CORE=y
@@ -433,13 +444,12 @@
 CONFIG_V4L_MEM2MEM_DRIVERS=y
 # CONFIG_VGA_ARB is not set
 CONFIG_DRM=y
-# CONFIG_DRM_FBDEV_EMULATION is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_SOUND=y
 CONFIG_SND=y
 CONFIG_SND_HRTIMER=y
-CONFIG_SND_DYNAMIC_MINORS=y
 # CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_VERBOSE_PROCFS is not set
 # CONFIG_SND_DRIVERS is not set
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SND_SOC=y
@@ -447,7 +457,6 @@
 CONFIG_HIDRAW=y
 CONFIG_UHID=y
 CONFIG_HID_APPLE=y
-CONFIG_HID_BETOP_FF=y
 CONFIG_HID_PRODIKEYS=y
 CONFIG_HID_ELECOM=y
 CONFIG_HID_UCLOGIC=y
@@ -479,14 +488,12 @@
 CONFIG_USB_UAS=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_GADGET=y
-CONFIG_USB_DUMMY_HCD=y
 CONFIG_USB_CONFIGFS=y
 CONFIG_USB_CONFIGFS_UEVENT=y
 CONFIG_USB_CONFIGFS_SERIAL=y
 CONFIG_USB_CONFIGFS_ACM=y
 CONFIG_USB_CONFIGFS_NCM=y
 CONFIG_USB_CONFIGFS_ECM=y
-CONFIG_USB_CONFIGFS_RNDIS=y
 CONFIG_USB_CONFIGFS_EEM=y
 CONFIG_USB_CONFIGFS_MASS_STORAGE=y
 CONFIG_USB_CONFIGFS_F_FS=y
@@ -522,19 +529,15 @@
 CONFIG_ASHMEM=y
 CONFIG_DEBUG_KINFO=y
 CONFIG_COMMON_CLK_SCPI=y
-# CONFIG_SPRD_COMMON_CLK is not set
 # CONFIG_CLK_SUNXI is not set
 # CONFIG_SUNXI_CCU is not set
 CONFIG_HWSPINLOCK=y
-CONFIG_SUN4I_TIMER=y
 # CONFIG_SUN50I_ERRATUM_UNKNOWN1 is not set
-CONFIG_MTK_TIMER=y
 CONFIG_MAILBOX=y
-CONFIG_IOMMU_LIMIT_IOVA_ALIGNMENT=y
-CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y
 CONFIG_REMOTEPROC=y
 CONFIG_REMOTEPROC_CDEV=y
 CONFIG_RPMSG_CHAR=y
+CONFIG_QCOM_GENI_SE=y
 CONFIG_DEVFREQ_GOV_PERFORMANCE=y
 CONFIG_DEVFREQ_GOV_POWERSAVE=y
 CONFIG_DEVFREQ_GOV_USERSPACE=y
@@ -546,7 +549,6 @@
 CONFIG_PWM=y
 CONFIG_GENERIC_PHY=y
 CONFIG_POWERCAP=y
-CONFIG_DTPM=y
 CONFIG_ANDROID=y
 CONFIG_ANDROID_BINDER_IPC=y
 CONFIG_ANDROID_BINDERFS=y
@@ -637,21 +639,20 @@
 CONFIG_SECURITY_NETWORK=y
 CONFIG_HARDENED_USERCOPY=y
 # CONFIG_HARDENED_USERCOPY_FALLBACK is not set
-CONFIG_FORTIFY_SOURCE=y
 CONFIG_STATIC_USERMODEHELPER=y
 CONFIG_STATIC_USERMODEHELPER_PATH=""
 CONFIG_SECURITY_SELINUX=y
-CONFIG_INIT_STACK_ALL_ZERO=y
 CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
 CONFIG_CRYPTO_CHACHA20POLY1305=y
 CONFIG_CRYPTO_ADIANTUM=y
 CONFIG_CRYPTO_XCBC=y
 CONFIG_CRYPTO_BLAKE2B=y
 CONFIG_CRYPTO_MD5=y
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_LZ4=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_CRYPTO_ANSI_CPRNG=y
-CONFIG_CRC8=y
 CONFIG_XZ_DEC=y
 CONFIG_DMA_CMA=y
 CONFIG_STACK_HASH_ORDER=12
@@ -660,16 +661,19 @@
 CONFIG_DYNAMIC_DEBUG_CORE=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_INFO_DWARF4=y
-# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_MODULE_ALLOW_BTF_MISMATCH=y
 CONFIG_HEADERS_INSTALL=y
 # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_UBSAN=y
 CONFIG_UBSAN_TRAP=y
 CONFIG_UBSAN_LOCAL_BOUNDS=y
-# CONFIG_UBSAN_MISC is not set
+# CONFIG_UBSAN_SHIFT is not set
+# CONFIG_UBSAN_BOOL is not set
+# CONFIG_UBSAN_ENUM is not set
 CONFIG_PAGE_OWNER=y
-CONFIG_PAGE_PINNER=y
+CONFIG_DEBUG_STACK_USAGE=y
 CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_KASAN=y
 CONFIG_KASAN_HW_TAGS=y
@@ -678,12 +682,12 @@
 CONFIG_KFENCE_NUM_OBJECTS=63
 CONFIG_PANIC_ON_OOPS=y
 CONFIG_PANIC_TIMEOUT=-1
-CONFIG_DETECT_HUNG_TASK=y
+CONFIG_SOFTLOCKUP_DETECTOR=y
 CONFIG_WQ_WATCHDOG=y
 CONFIG_SCHEDSTATS=y
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_BUG_ON_DATA_CORRUPTION=y
 CONFIG_TRACE_MMIO_ACCESS=y
-CONFIG_TRACEFS_DISABLE_AUTOMOUNT=y
 CONFIG_HIST_TRIGGERS=y
+CONFIG_PID_IN_CONTEXTIDR=y
 # CONFIG_RUNTIME_TESTING_MENU is not set
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/init_disassemble_info-signature-changes-causes-compile-failures.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/init_disassemble_info-signature-changes-causes-compile-failures.patch
similarity index 100%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.10/tc/init_disassemble_info-signature-changes-causes-compile-failures.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack-5.15/tc/init_disassemble_info-signature-changes-causes-compile-failures.patch
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack_5.10.bbappend b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack_5.15.bbappend
similarity index 100%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack_5.10.bbappend
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-arm64-ack_5.15.bbappend
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch
similarity index 80%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch
index e1cbb80..188616f 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0001-iommu-arm-smmu-v3-workaround-for-ATC_INV_SIZE_ALL-in.patch
@@ -1,4 +1,4 @@
-From f88153a427046f92d52694708adc5ee0eefa8d55 Mon Sep 17 00:00:00 2001
+From 97caa9365f221b5aff93274a29ea894da55dce88 Mon Sep 17 00:00:00 2001
 From: Manoj Kumar <manoj.kumar3@arm.com>
 Date: Mon, 1 Feb 2021 21:36:43 +0530
 Subject: [PATCH] iommu/arm-smmu-v3: workaround for ATC_INV_SIZE_ALL in N1SDP
@@ -14,16 +14,18 @@
 
 Upstream-Status: Inappropriate [Workaround]
 Signed-off-by: Manoj Kumar <manoj.kumar3@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
 ---
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 +
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 +
  2 files changed, 2 insertions(+)
 
 diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
-index 79edfdca6607..ded17e199ee4 100644
+index 88817a3376ef..80e252d59a3a 100644
 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
 +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
-@@ -1725,6 +1725,7 @@ arm_smmu_atc_inv_to_cmd(int ssid, unsigned long iova, size_t size,
+@@ -1731,6 +1731,7 @@ arm_smmu_atc_inv_to_cmd(int ssid, unsigned long iova, size_t size,
  	};
  
  	if (!size) {
@@ -32,10 +34,10 @@
  		return;
  	}
 diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
-index 4cb136f07914..5615ffd24e46 100644
+index cd48590ada30..20892b2bfe1d 100644
 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
 +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
-@@ -473,6 +473,7 @@ struct arm_smmu_cmdq_ent {
+@@ -472,6 +472,7 @@ struct arm_smmu_cmdq_ent {
  
  		#define CMDQ_OP_ATC_INV		0x40
  		#define ATC_INV_SIZE_ALL	52
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch
similarity index 91%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch
index b4e2a8c..6fc83fb 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0002-n1sdp-pci_quirk-add-acs-override-for-PCI-devices.patch
@@ -1,4 +1,4 @@
-From 478d96ce8a4d30ef80975271a2ad89a77012c1b8 Mon Sep 17 00:00:00 2001
+From ba5ed426f6587d96418bc8bbe4ae908329d4a7a9 Mon Sep 17 00:00:00 2001
 From: Manoj Kumar <manoj.kumar3@arm.com>
 Date: Tue, 31 Aug 2021 16:15:38 +0000
 Subject: [PATCH] n1sdp: pci_quirk: add acs override for PCI devices
@@ -11,16 +11,18 @@
 
 Upstream-Status: Inappropriate [will not be submitted as its a workaround to address hardware issue]
 Signed-off-by: Khasim Syed Mohammed <khasim.mohammed@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
 ---
  .../admin-guide/kernel-parameters.txt         |   8 ++
  drivers/pci/quirks.c                          | 102 ++++++++++++++++++
  2 files changed, 110 insertions(+)
 
 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
-index 4445baac48c1..ee90aeeb1dbb 100644
+index 09836f2f1e74..b465592aa068 100644
 --- a/Documentation/admin-guide/kernel-parameters.txt
 +++ b/Documentation/admin-guide/kernel-parameters.txt
-@@ -3935,6 +3935,14 @@
+@@ -4084,6 +4084,14 @@
  		nomsi		[MSI] If the PCI_MSI kernel config parameter is
  				enabled, this kernel boot option can be used to
  				disable the use of MSI interrupts system-wide.
@@ -36,10 +38,10 @@
  				Safety option to keep boot IRQs enabled. This
  				should never be necessary.
 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
-index a531064233f9..ebe192134a97 100644
+index 2e68f50bc7ae..2d32fa0df411 100644
 --- a/drivers/pci/quirks.c
 +++ b/drivers/pci/quirks.c
-@@ -3600,6 +3600,107 @@ static void quirk_no_bus_reset(struct pci_dev *dev)
+@@ -3601,6 +3601,107 @@ static void quirk_no_bus_reset(struct pci_dev *dev)
  	dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
  }
  
@@ -147,7 +149,7 @@
  /*
   * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be
   * prevented for those affected devices.
-@@ -4968,6 +5069,7 @@ static const struct pci_dev_acs_enabled {
+@@ -4969,6 +5070,7 @@ static const struct pci_dev_acs_enabled {
  	{ PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs },
  	/* Zhaoxin Root/Downstream Ports */
  	{ PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch
similarity index 91%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch
index 4ffe347..ef2ad8d 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0003-pcie-Add-quirk-for-the-Arm-Neoverse-N1SDP-platform.patch
@@ -1,6 +1,6 @@
-From 4877796976647a24a3a9102facd0577586f5ac9a Mon Sep 17 00:00:00 2001
-From: Deepak Pandey <Deepak.Pandey@arm.com>
-Date: Fri, 31 May 2019 16:42:43 +0100
+From e88326f652ac6d126d5df8b3c0b2ac40e8b73797 Mon Sep 17 00:00:00 2001
+From: Vishnu Banavath <vishnu.banavath@arm.com>
+Date: Tue, 23 Aug 2022 15:17:28 +0100
 Subject: [PATCH] pcie: Add quirk for the Arm Neoverse N1SDP platform
 
 The Arm N1SDP SoC suffers from some PCIe integration issues, most
@@ -27,6 +27,8 @@
 
 Upstream-Status: Inappropriate [will not be submitted as its a workaround to address hardware issue]
 Signed-off-by: Deepak Pandey <Deepak.Pandey@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
 ---
  arch/arm64/configs/defconfig        |   1 +
  drivers/acpi/pci_mcfg.c             |   7 +
@@ -38,40 +40,40 @@
  create mode 100644 drivers/pci/controller/pcie-n1sdp.c
 
 diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
-index c27d0fed2ce2..70ed38cecee9 100644
+index 3ccbe378f875..1ce32678ccc7 100644
 --- a/arch/arm64/configs/defconfig
 +++ b/arch/arm64/configs/defconfig
-@@ -209,6 +209,7 @@ CONFIG_NFC_NCI=m
- CONFIG_NFC_S3FWRN5_I2C=m
- CONFIG_PCI=y
- CONFIG_PCIEPORTBUS=y
+@@ -236,6 +236,7 @@ CONFIG_PCIE_LAYERSCAPE_GEN4=y
+ CONFIG_PCI_ENDPOINT=y
+ CONFIG_PCI_ENDPOINT_CONFIGFS=y
+ CONFIG_PCI_EPF_TEST=m
 +CONFIG_PCI_QUIRKS=y
- CONFIG_PCI_IOV=y
- CONFIG_PCI_PASID=y
- CONFIG_HOTPLUG_PCI=y
+ CONFIG_DEVTMPFS=y
+ CONFIG_DEVTMPFS_MOUNT=y
+ CONFIG_FW_LOADER_USER_HELPER=y
 diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
-index 63b98eae5e75..67c34e6c24a7 100644
+index 63b98eae5e75..7700d36393ec 100644
 --- a/drivers/acpi/pci_mcfg.c
 +++ b/drivers/acpi/pci_mcfg.c
-@@ -152,6 +152,13 @@ static struct mcfg_fixup mcfg_quirks[] = {
- 	XGENE_V2_ECAM_MCFG(4, 1),
- 	XGENE_V2_ECAM_MCFG(4, 2),
- 
+@@ -171,6 +171,13 @@ static struct mcfg_fixup mcfg_quirks[] = {
+ 	ALTRA_ECAM_QUIRK(1, 13),
+ 	ALTRA_ECAM_QUIRK(1, 14),
+ 	ALTRA_ECAM_QUIRK(1, 15),
++
 +#define N1SDP_ECAM_MCFG(rev, seg, ops) \
 +	{"ARMLTD", "ARMN1SDP", rev, seg, MCFG_BUS_ANY, ops }
 +
 +	/* N1SDP SoC with v1 PCIe controller */
 +	N1SDP_ECAM_MCFG(0x20181101, 0, &pci_n1sdp_pcie_ecam_ops),
 +	N1SDP_ECAM_MCFG(0x20181101, 1, &pci_n1sdp_ccix_ecam_ops),
-+
- #define ALTRA_ECAM_QUIRK(rev, seg) \
- 	{ "Ampere", "Altra   ", rev, seg, MCFG_BUS_ANY, &pci_32b_read_ops }
+ #endif /* ARM64 */
+ };
  
 diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
-index 326f7d13024f..f9700d037c46 100644
+index b8d96d38064d..3c5a8a218442 100644
 --- a/drivers/pci/controller/Kconfig
 +++ b/drivers/pci/controller/Kconfig
-@@ -46,6 +46,17 @@ config PCI_IXP4XX
+@@ -50,6 +50,17 @@ config PCI_IXP4XX
  	  Say Y here if you want support for the PCI host controller found
  	  in the Intel IXP4xx XScale-based network processor SoC.
  
@@ -90,17 +92,17 @@
  	bool "NVIDIA Tegra PCIe controller"
  	depends on ARCH_TEGRA || COMPILE_TEST
 diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile
-index aaf30b3dcc14..2012ab2b7913 100644
+index 37c8663de7fe..5b8a9535a2f7 100644
 --- a/drivers/pci/controller/Makefile
 +++ b/drivers/pci/controller/Makefile
-@@ -37,6 +37,7 @@ obj-$(CONFIG_VMD) += vmd.o
- obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o
- obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
+@@ -39,6 +39,7 @@ obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
  obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o
+ obj-$(CONFIG_PCIE_APPLE) += pcie-apple.o
+ obj-$(CONFIG_PCIE_MT7621) += pcie-mt7621.o
 +obj-$(CONFIG_PCIE_HOST_N1SDP_ECAM) += pcie-n1sdp.o
+ 
  # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW
  obj-y				+= dwc/
- obj-y				+= mobiveil/
 diff --git a/drivers/pci/controller/pcie-n1sdp.c b/drivers/pci/controller/pcie-n1sdp.c
 new file mode 100644
 index 000000000000..408699b9dcb1
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
similarity index 87%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
index bd88fa4..10fae06 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0004-n1sdp-pcie-add-quirk-support-enabling-remote-chip-PC.patch
@@ -1,12 +1,13 @@
-From 7a5147f51f2eb80ecb6f62a28b8bd86aa5ceebf7 Mon Sep 17 00:00:00 2001
-From: Sayanta Pattanayak <sayanta.pattanayak@arm.com>
-Date: Wed, 9 Feb 2022 20:37:43 +0530
+From 74e052b7533827af9f43d093af8f430c99357eac Mon Sep 17 00:00:00 2001
+From: Vishnu Banavath <vishnu.banavath@arm.com>
+Date: Tue, 23 Aug 2022 15:18:38 +0100
 Subject: [PATCH] n1sdp: pcie: add quirk support enabling remote chip PCIe
 
 Base address mapping for remote chip Root PCIe ECAM space.
 
 When two N1SDP boards are coupled via the CCIX connection, the PCI host
-complex of the remote board appears as PCIe segment 2 on the primary board.
+complex of the remote board appears as PCIe segment 2 on the primary
+board.
 The resources of the secondary board, including the host complex, are
 mapped at offset 0x40000000000 into the address space of the primary
 board, so take that into account when accessing the remote PCIe segment.
@@ -19,6 +20,8 @@
 
 Upstream-Status: Inappropriate [will not be submitted as its an hack required to fix the hardware issue]
 Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
 ---
  drivers/acpi/pci_mcfg.c             |  1 +
  drivers/pci/controller/pcie-n1sdp.c | 32 +++++++++++++++++++++++++----
@@ -26,17 +29,17 @@
  3 files changed, 30 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
-index 67c34e6c24a7..4584a5a2ca20 100644
+index 7700d36393ec..806ed8dd0d81 100644
 --- a/drivers/acpi/pci_mcfg.c
 +++ b/drivers/acpi/pci_mcfg.c
-@@ -158,6 +158,7 @@ static struct mcfg_fixup mcfg_quirks[] = {
+@@ -178,6 +178,7 @@ static struct mcfg_fixup mcfg_quirks[] = {
  	/* N1SDP SoC with v1 PCIe controller */
  	N1SDP_ECAM_MCFG(0x20181101, 0, &pci_n1sdp_pcie_ecam_ops),
  	N1SDP_ECAM_MCFG(0x20181101, 1, &pci_n1sdp_ccix_ecam_ops),
 +	N1SDP_ECAM_MCFG(0x20181101, 2, &pci_n1sdp_remote_pcie_ecam_ops),
+ #endif /* ARM64 */
+ };
  
- #define ALTRA_ECAM_QUIRK(rev, seg) \
- 	{ "Ampere", "Altra   ", rev, seg, MCFG_BUS_ANY, &pci_32b_read_ops }
 diff --git a/drivers/pci/controller/pcie-n1sdp.c b/drivers/pci/controller/pcie-n1sdp.c
 index 408699b9dcb1..a03665dd056a 100644
 --- a/drivers/pci/controller/pcie-n1sdp.c
@@ -121,14 +124,14 @@
  	{ .compatible = "arm,n1sdp-pcie", .data = &pci_n1sdp_pcie_ecam_ops },
  	{ },
 diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
-index e6bbc037cef8..d936d3f14bce 100644
+index e6bbc037cef8..7bd8c1d702ee 100644
 --- a/include/linux/pci-ecam.h
 +++ b/include/linux/pci-ecam.h
-@@ -91,6 +91,7 @@ extern const struct pci_ecam_ops pci_n1sdp_pcie_ecam_ops; /* Arm N1SDP PCIe */
+@@ -89,6 +89,7 @@ extern const struct pci_ecam_ops al_pcie_ops;	/* Amazon Annapurna Labs PCIe */
+ extern const struct pci_ecam_ops tegra194_pcie_ops; /* Tegra194 PCIe */
+ extern const struct pci_ecam_ops pci_n1sdp_pcie_ecam_ops; /* Arm N1SDP PCIe */
  extern const struct pci_ecam_ops pci_n1sdp_ccix_ecam_ops; /* Arm N1SDP PCIe */
++extern const struct pci_ecam_ops pci_n1sdp_remote_pcie_ecam_ops; /* Arm N1SDP PCIe */
  #endif
  
-+extern const struct pci_ecam_ops pci_n1sdp_remote_pcie_ecam_ops; /* Arm N1SDP PCIe */
  #if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
- /* for DT-based PCI controllers that support ECAM */
- int pci_host_common_probe(struct platform_device *pdev);
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch
similarity index 79%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch
index b89c598..76518ae 100644
--- a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0005-arm64-kpti-Whitelist-early-Arm-Neoverse-N1-revisions.patch
@@ -1,4 +1,4 @@
-From 85581abbfc7e3df12091c5004788b0729cfd99f1 Mon Sep 17 00:00:00 2001
+From 748cb5125b381330563b5339a4573827b015b0e9 Mon Sep 17 00:00:00 2001
 From: Andre Przywara <andre.przywara@arm.com>
 Date: Fri, 17 May 2019 17:39:27 +0100
 Subject: [PATCH] arm64: kpti: Whitelist early Arm Neoverse N1 revisions
@@ -13,15 +13,17 @@
 
 Upstream-Status: Inappropriate
 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
 ---
  arch/arm64/kernel/cpufeature.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
-index 3e52a9e8b50b..2e64bc4689a0 100644
+index f34c9f8b9ee0..a778cf472d64 100644
 --- a/arch/arm64/kernel/cpufeature.c
 +++ b/arch/arm64/kernel/cpufeature.c
-@@ -1530,6 +1530,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
+@@ -1589,6 +1589,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
  		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_2XX_SILVER),
  		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER),
  		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER),
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0006-arm64-defconfig-disable-config-options-that-does-not.patch b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0006-arm64-defconfig-disable-config-options-that-does-not.patch
new file mode 100644
index 0000000..d761a71
--- /dev/null
+++ b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/0006-arm64-defconfig-disable-config-options-that-does-not.patch
@@ -0,0 +1,39 @@
+From ecd97611c3cc5169de45b8d0f87111ed5bb375b8 Mon Sep 17 00:00:00 2001
+From: Vishnu Banavath <vishnu.banavath@arm.com>
+Date: Wed, 21 Sep 2022 15:54:14 +0100
+Subject: [PATCH] arm64: defconfig: disable config options that does not apply
+ anymore
+
+Following config options should be not set to be more accurate and
+works with build system like yocto
+CONFIG_BT_HCIUART_MRVL
+CONFIG_BT_MRVL
+CONFIG_BT_MRVL_SDIO
+CONFIG_BT_QCOMSMD
+
+Upstream-Status: Pending [not submitted upstream yet]
+Signed-off-by: Adam Johnston <adam.johnston@arm.com>
+Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
+---
+ arch/arm64/configs/defconfig | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
+index 1ce32678ccc7..224b0fc152a4 100644
+--- a/arch/arm64/configs/defconfig
++++ b/arch/arm64/configs/defconfig
+@@ -191,10 +191,10 @@ CONFIG_BT_HCIUART=m
+ CONFIG_BT_HCIUART_LL=y
+ CONFIG_BT_HCIUART_BCM=y
+ CONFIG_BT_HCIUART_QCA=y
+-CONFIG_BT_HCIUART_MRVL=y
+-CONFIG_BT_MRVL=m
+-CONFIG_BT_MRVL_SDIO=m
+-CONFIG_BT_QCOMSMD=m
++# CONFIG_BT_HCIUART_MRVL is not set
++# CONFIG_BT_MRVL is not set
++# CONFIG_BT_MRVL_SDIO is not set
++# CONFIG_BT_QCOMSMD is not set
+ CONFIG_CFG80211=m
+ CONFIG_MAC80211=m
+ CONFIG_MAC80211_LEDS=y
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/enable-realtek-R8169.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/enable-realtek-R8169.cfg
similarity index 100%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/enable-realtek-R8169.cfg
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/enable-realtek-R8169.cfg
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/enable-usb_conn_gpio.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/enable-usb_conn_gpio.cfg
similarity index 100%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/enable-usb_conn_gpio.cfg
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/enable-usb_conn_gpio.cfg
diff --git a/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/usb_xhci_pci_renesas.cfg b/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/usb_xhci_pci_renesas.cfg
similarity index 100%
rename from meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.15/n1sdp/usb_xhci_pci_renesas.cfg
rename to meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto-5.19/n1sdp/usb_xhci_pci_renesas.cfg
diff --git a/meta-arm/meta-arm-bsp/recipes-security/optee/optee-spdevkit_3.10.0.bbappend b/meta-arm/meta-arm-bsp/recipes-security/optee/optee-spdevkit_3.10.0.bbappend
deleted file mode 100644
index cfc3023..0000000
--- a/meta-arm/meta-arm-bsp/recipes-security/optee/optee-spdevkit_3.10.0.bbappend
+++ /dev/null
@@ -1,5 +0,0 @@
-# Machine specific configurations
-
-MACHINE_OPTEE_SPDEVKIT_REQUIRE ?= ""
-
-require ${MACHINE_OPTEE_SPDEVKIT_REQUIRE}
diff --git a/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
index 244de26..92fb038 100644
--- a/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
+++ b/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
@@ -23,12 +23,15 @@
         last_line = stderr.splitlines()[-1]
         return last_line
 
-# Extract the YYYY.MM version
+# Extract the YYYY.MM or release version
 def eat_get_main_version(d):
     version = eat_get_version(d)
     bb.debug(2, 'Trying for parse version info from: %s' % version)
     if version != 'UNKNOWN':
-        if version.split()[4] == '(GNU':
+        if version.split()[4] == '(Arm':
+            # gcc version 11.3.1 20220712 (Arm GNU Toolchain 11.3.Rel1)
+            return version.split()[7].split(')')[0]
+        elif version.split()[4] == '(GNU':
             # gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
             # gcc version 8.2.1 20180802 (GNU Toolchain for the A-profile Architecture 8.2-2018.11 (arm-rel-8.26))
             return version.split()[10].split('-')[1]
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2.inc b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2.inc
deleted file mode 100644
index 04c6751..0000000
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2.inc
+++ /dev/null
@@ -1,121 +0,0 @@
-require recipes-devtools/gcc/gcc-common.inc
-
-# Third digit in PV should be incremented after a minor release
-ARM_GCC_VERSION = "11.2"
-PV = "arm-${ARM_GCC_VERSION}"
-CVE_VERSION = "11.2"
-
-# BINV should be incremented to a revision after a minor gcc release
-
-BINV = "11.2.1"
-
-MMYY = "22.02"
-RELEASE = "20${MMYY}"
-PR = "r${RELEASE}"
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-arm-${ARM_GCC_VERSION}:${FILE_DIRNAME}/gcc-arm-${ARM_GCC_VERSION}/backport:"
-
-DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
-NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native"
-
-LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
-
-LIC_FILES_CHKSUM = "\
-    file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
-    file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
-    file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
-    file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
-    file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
-"
-
-BASEURI ?= "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GCC_VERSION}-${RELEASE}/srcrel/gcc-arm-src-snapshot-${ARM_GCC_VERSION}-${RELEASE}.tar.xz"
-SRC_URI = "\
-           ${BASEURI} \
-           file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
-           file://0002-gcc-poison-system-directories.patch \
-           file://0004-64-bit-multilib-hack.patch \
-           file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
-           file://0009-cpp-honor-sysroot.patch \
-           file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
-           file://0012-gcc-Fix-argument-list-too-long-error.patch \
-           file://0014-libtool.patch \
-           file://0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
-           file://0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
-           file://0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
-           file://0018-export-CPP.patch \
-           file://0019-Ensure-target-gcc-headers-can-be-included.patch \
-           file://0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
-           file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
-           file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \
-           file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
-           file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
-           file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
-           file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
-           file://0030-sync-gcc-stddef.h-with-musl.patch \
-           file://0033-Re-introduce-spe-commandline-options.patch \
-           file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
-           file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
-           file://0036-mingw32-Enable-operation_not_supported.patch \
-           file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
-           file://0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch \
-           file://0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch \
-           file://0001-Fix-install-path-of-linux64.h.patch \
-           file://0001-CVE-2021-42574.patch \
-           file://0002-CVE-2021-42574.patch \
-           file://0003-CVE-2021-42574.patch \
-           file://0004-CVE-2021-42574.patch \
-           file://0001-CVE-2021-46195.patch \
-"
-SRC_URI[sha256sum] = "417662cd4e79e74b9fbac67bf1edac1c03d11ea58f10144487b7e25e58ff4931"
-
-S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-arm-src-snapshot-${ARM_GCC_VERSION}-${RELEASE}"
-
-# For dev release snapshotting
-#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
-#B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
-
-# Language Overrides
-FORTRAN = ""
-JAVA = ""
-
-SSP ?= "--disable-libssp"
-SSP:mingw32 = "--enable-libssp"
-
-EXTRA_OECONF_BASE = "\
-    ${SSP} \
-    --enable-libitm \
-    --enable-lto \
-    --disable-bootstrap \
-    --with-system-zlib \
-    ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
-    --enable-linker-build-id \
-    --with-ppl=no \
-    --with-cloog=no \
-    --enable-checking=release \
-    --enable-cheaders=c_global \
-    --without-isl \
-"
-
-EXTRA_OECONF_INITIAL = "\
-    --disable-libgomp \
-    --disable-libitm \
-    --disable-libquadmath \
-    --with-system-zlib \
-    --disable-lto \
-    --disable-plugin \
-    --enable-linker-build-id \
-    --enable-decimal-float=no \
-    --without-isl \
-    --disable-libssp \
-"
-
-EXTRA_OECONF:append_aarchilp32 = " --with-abi=ilp32"
-
-EXTRA_OECONF_PATHS = "\
-    --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
-    --with-sysroot=/not/exist \
-    --with-build-sysroot=${STAGING_DIR_TARGET} \
-"
-
-# Is a binutils 2.26 issue, not gcc
-CVE_CHECK_IGNORE += "CVE-2021-37322"
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0009-cpp-honor-sysroot.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0009-cpp-honor-sysroot.patch
deleted file mode 100644
index 37f26f0..0000000
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0009-cpp-honor-sysroot.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From: Richard Purdie <richard.purdie@linuxfoundation.org>
-Subject: [PATCH 5/5] gcc: Pass sysroot options to cpp for preprocessed source
-
-OpenEmbedded/Yocto Project extensively uses the --sysroot support within gcc.
-We discovered that when compiling preprocessed source (.i or .ii files), the
-compiler will try and access the builtin sysroot location rather than the
---sysroot option specified on the commandline. If access to that directory is
-permission denied (unreadable), gcc will error. This is particularly problematic
-when ccache is involved.
-
-This patch adds %I to the cpp-output spec macro so the default substitutions for
--iprefix, -isystem, -isysroot happen and the correct sysroot is used.
-
-2021-10-27 Richard Purdie <richard.purdie@linuxfoundation.org>
-
-gcc/cp/ChangeLog:
-
-    * lang-specs.h: Pass sysroot options to cpp for preprocessed source
-
-gcc/ChangeLog:
-
-    * gcc.c: Pass sysroot options to cpp for preprocessed source
-
-Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-
-[YOCTO #2074]
-
-Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582725.html]
----
- gcc/cp/lang-specs.h | 2 +-
- gcc/gcc.c           | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-Index: gcc-11.2.0/gcc/cp/lang-specs.h
-===================================================================
---- gcc-11.2.0.orig/gcc/cp/lang-specs.h
-+++ gcc-11.2.0/gcc/cp/lang-specs.h
-@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3.
-   {".ii", "@c++-cpp-output", 0, 0, 0},
-   {"@c++-cpp-output",
-       "%{!E:%{!M:%{!MM:"
--      "  cc1plus -fpreprocessed %i %(cc1_options) %2"
-+      "  cc1plus -fpreprocessed %i %I %(cc1_options) %2"
-       "  %{!fsyntax-only:"
-       "    %{fmodule-only:%{!S:-o %g.s%V}}"
-       "    %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
-Index: gcc-11.2.0/gcc/gcc.c
-===================================================================
---- gcc-11.2.0.orig/gcc/gcc.c
-+++ gcc-11.2.0/gcc/gcc.c
-@@ -1470,7 +1470,7 @@ static const struct compiler default_com
- 					   %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
-   {".i", "@cpp-output", 0, 0, 0},
-   {"@cpp-output",
--   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-+   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-   {".s", "@assembler", 0, 0, 0},
-   {"@assembler",
-    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0012-gcc-Fix-argument-list-too-long-error.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0012-gcc-Fix-argument-list-too-long-error.patch
deleted file mode 100644
index ebee30b..0000000
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0012-gcc-Fix-argument-list-too-long-error.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From: Richard Purdie <richard.purdie@linuxfoundation.org>
-Subject: [PATCH 2/5] gcc: Fix "argument list too long" from install-plugins
-
-When building in longer build paths (200+ characters), the
-"echo $(PLUGIN_HEADERS)" from the install-plugins target would cause an
-"argument list too long error" on some systems.
-
-Avoid this by calling make's sort function on the list which removes
-duplicates and stops the overflow from reaching the echo command.
-The original sort is left to handle the the .h and .def files.
-
-2021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
-
-gcc/ChangeLog:
-
-    * Makefile.in: Fix "argument list too long" from install-plugins
-
-Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-
-Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582722.html]
-Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=66e157188bd2f789809e17e85f917534c9381599]
----
- gcc/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: gcc-11.2.0/gcc/Makefile.in
-===================================================================
---- gcc-11.2.0.orig/gcc/Makefile.in
-+++ gcc-11.2.0/gcc/Makefile.in
-@@ -3678,7 +3678,7 @@ install-plugin: installdirs lang.install
- # We keep the directory structure for files in config, common/config or
- # c-family and .def files. All other files are flattened to a single directory.
- 	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
--	headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
-+	headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
- 	srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
- 	for file in $$headers; do \
- 	  if [ -f $$file ] ; then \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
deleted file mode 100644
index 97c2713..0000000
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Richard Purdie <richard.purdie@linuxfoundation.org>
-Subject: [PATCH 4/5] gcc/nios2: Define the musl linker
-
-Add a definition of the musl linker used on the nios2 platform.
-
-2021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org>
-
-gcc/ChangeLog:
-
-    * config/nios2/linux.h (MUSL_DYNAMIC_LINKER): Add musl linker
-
-Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-
-Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582723.html]
-Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e5ddbbf992b909d8e38851bd3179d29389e6ac97]
----
- gcc/config/nios2/linux.h | 1 +
- 1 file changed, 1 insertion(+)
-
-Index: gcc-11.2.0/gcc/config/nios2/linux.h
-===================================================================
---- gcc-11.2.0.orig/gcc/config/nios2/linux.h
-+++ gcc-11.2.0/gcc/config/nios2/linux.h
-@@ -30,6 +30,7 @@
- #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
- 
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
-+#define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-nios2.so.1"
- 
- #undef LINK_SPEC
- #define LINK_SPEC LINK_SPEC_ENDIAN \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3.inc b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3.inc
new file mode 100644
index 0000000..8eba959
--- /dev/null
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3.inc
@@ -0,0 +1,123 @@
+require recipes-devtools/gcc/gcc-common.inc
+
+# Third digit in PV should be incremented after a minor release
+ARM_GCC_VERSION = "11.3"
+ARM_GCC_SUB_VERSION = "rel1"
+PV = "arm-${ARM_GCC_VERSION}"
+CVE_VERSION = "11.3"
+
+# BINV should be incremented to a revision after a minor gcc release
+
+BINV = "11.3.1"
+
+MMYY = "22.08"
+RELEASE = "20${MMYY}"
+PR = "r${RELEASE}"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-arm-${ARM_GCC_VERSION}:${FILE_DIRNAME}/gcc-arm-${ARM_GCC_VERSION}/backport:"
+
+DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
+
+LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
+
+LIC_FILES_CHKSUM = "\
+    file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+    file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+    file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+    file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+    file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
+"
+
+BASEURI ?= "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GCC_VERSION}.${ARM_GCC_SUB_VERSION}/srcrel/arm-gnu-toolchain-src-snapshot-${ARM_GCC_VERSION}.${ARM_GCC_SUB_VERSION}.tar.xz"
+SRC_URI = "\
+           ${BASEURI} \
+           file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
+           file://0002-gcc-poison-system-directories.patch \
+           file://0003-64-bit-multilib-hack.patch \
+           file://0004-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
+           file://0005-cpp-honor-sysroot.patch \
+           file://0006-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
+           file://0007-gcc-Fix-argument-list-too-long-error.patch \
+           file://0008-libtool.patch \
+           file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
+           file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
+           file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
+           file://0012-Ensure-target-gcc-headers-can-be-included.patch \
+           file://0013-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
+           file://0014-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
+           file://0015-Makefile.in-Ensure-build-CPP-CPPFLAGS-is-used-for-bu.patch \
+           file://0016-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch \
+           file://0017-handle-sysroot-support-for-nativesdk-gcc.patch \
+           file://0018-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
+           file://0019-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
+           file://0020-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
+           file://0021-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
+           file://0022-sync-gcc-stddef.h-with-musl.patch \
+           file://0023-Re-introduce-spe-commandline-options.patch \
+           file://0024-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
+           file://0025-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
+           file://0026-mingw32-Enable-operation_not_supported.patch \
+           file://0027-libatomic-Do-not-enforce-march-on-aarch64.patch \
+           file://0028-debug-101473-apply-debug-prefix-maps-before-checksum.patch \
+           file://0029-Fix-install-path-of-linux64.h.patch \
+           file://0030-rust-recursion-limit.patch \
+           file://0001-CVE-2021-42574.patch \
+           file://0002-CVE-2021-42574.patch \
+           file://0003-CVE-2021-42574.patch \
+           file://0004-CVE-2021-42574.patch \
+           file://0001-CVE-2021-46195.patch \
+"
+SRC_URI[sha256sum] = "4fb9a3c58c94deb91bd75bc503962fae347f05d4d47a0e079141350f08919fb5"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/arm-gnu-toolchain-src-snapshot-${ARM_GCC_VERSION}.${ARM_GCC_SUB_VERSION}"
+
+# For dev release snapshotting
+#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
+#B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+SSP ?= "--disable-libssp"
+SSP:mingw32 = "--enable-libssp"
+
+EXTRA_OECONF_BASE = "\
+    ${SSP} \
+    --enable-libitm \
+    --enable-lto \
+    --disable-bootstrap \
+    --with-system-zlib \
+    ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
+    --enable-linker-build-id \
+    --with-ppl=no \
+    --with-cloog=no \
+    --enable-checking=release \
+    --enable-cheaders=c_global \
+    --without-isl \
+"
+
+EXTRA_OECONF_INITIAL = "\
+    --disable-libgomp \
+    --disable-libitm \
+    --disable-libquadmath \
+    --with-system-zlib \
+    --disable-lto \
+    --disable-plugin \
+    --enable-linker-build-id \
+    --enable-decimal-float=no \
+    --without-isl \
+    --disable-libssp \
+"
+
+EXTRA_OECONF:append_aarchilp32 = " --with-abi=ilp32"
+
+EXTRA_OECONF_PATHS = "\
+    --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
+    --with-sysroot=/not/exist \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+"
+
+# Is a binutils 2.26 issue, not gcc
+CVE_CHECK_IGNORE += "CVE-2021-37322"
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-CVE-2021-42574.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-CVE-2021-42574.patch
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-CVE-2021-42574.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-CVE-2021-42574.patch
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-CVE-2021-46195.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-CVE-2021-46195.patch
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-CVE-2021-46195.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-CVE-2021-46195.patch
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
similarity index 84%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
index 0a108ee..0bf8834 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -1,4 +1,4 @@
-From 368eaf1846733a9920c7cf5bc547a377e7167785 Mon Sep 17 00:00:00 2001
+From 6badb97389cae4ff9a533d38dc7cceefe21b97a8 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 08:37:11 +0400
 Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
@@ -12,10 +12,10 @@
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/configure b/configure
-index 504f6410274..bcebad264ec 100755
+index e218a19e333..45744e6e471 100755
 --- a/configure
 +++ b/configure
-@@ -9728,7 +9728,7 @@ fi
+@@ -9750,7 +9750,7 @@ fi
  # for target_alias and gcc doesn't manage it consistently.
  target_configargs="--cache-file=./config.cache ${target_configargs}"
  
@@ -25,10 +25,10 @@
   *" newlib "*)
    case " $target_configargs " in
 diff --git a/configure.ac b/configure.ac
-index 088e735c5db..1289fe08760 100644
+index 7e8e628b325..bf66b51373c 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -3240,7 +3240,7 @@ fi
+@@ -3255,7 +3255,7 @@ fi
  # for target_alias and gcc doesn't manage it consistently.
  target_configargs="--cache-file=./config.cache ${target_configargs}"
  
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0002-CVE-2021-42574.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0002-CVE-2021-42574.patch
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0002-CVE-2021-42574.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0002-CVE-2021-42574.patch
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0002-gcc-poison-system-directories.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0002-gcc-poison-system-directories.patch
similarity index 92%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0002-gcc-poison-system-directories.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0002-gcc-poison-system-directories.patch
index 18a9fb8..d19cefb 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0002-gcc-poison-system-directories.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0002-gcc-poison-system-directories.patch
@@ -1,4 +1,4 @@
-From 118c6f054711d437167ff125a88c9236bfc8099c Mon Sep 17 00:00:00 2001
+From 863f1f9dc78839ecd021b2cb01d501e8c9e00ef7 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 8 Mar 2021 16:04:20 -0800
 Subject: [PATCH] gcc: poison-system-directories
@@ -25,7 +25,7 @@
  7 files changed, 86 insertions(+), 2 deletions(-)
 
 diff --git a/gcc/common.opt b/gcc/common.opt
-index c75dd36843e..49acbd6ed44 100644
+index a75b44ee47e..d15105a73f3 100644
 --- a/gcc/common.opt
 +++ b/gcc/common.opt
 @@ -683,6 +683,10 @@ Wreturn-local-addr
@@ -40,10 +40,10 @@
  Common Var(warn_shadow) Warning
  Warn when one variable shadows another.  Same as -Wshadow=global.
 diff --git a/gcc/config.in b/gcc/config.in
-index 10a13cde586..8848284da41 100644
+index 048bf52e8c2..4f973f7906a 100644
 --- a/gcc/config.in
 +++ b/gcc/config.in
-@@ -218,6 +218,16 @@
+@@ -230,6 +230,16 @@
  #endif
  
  
@@ -61,10 +61,10 @@
     optimizer and back end) to be checked for dynamic type safety at runtime.
     This is quite expensive. */
 diff --git a/gcc/configure b/gcc/configure
-index 9bb436ce7bd..3f0734bff11 100755
+index 7218b0c331a..d7445339f9a 100755
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -1020,6 +1020,7 @@ enable_maintainer_mode
+@@ -1019,6 +1019,7 @@ enable_maintainer_mode
  enable_link_mutex
  enable_link_serialization
  enable_version_specific_runtime_libs
@@ -72,7 +72,7 @@
  enable_plugin
  enable_host_shared
  enable_libquadmath_support
-@@ -1782,6 +1783,8 @@ Optional Features:
+@@ -1781,6 +1782,8 @@ Optional Features:
    --enable-version-specific-runtime-libs
                            specify that runtime libraries should be installed
                            in a compiler-specific directory
@@ -81,7 +81,7 @@
    --enable-plugin         enable plugin support
    --enable-host-shared    build host code as shared libraries
    --disable-libquadmath-support
-@@ -31325,6 +31328,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
+@@ -31932,6 +31935,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
  fi
  
  
@@ -105,10 +105,10 @@
  
  
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index caa611933df..54e21764b3e 100644
+index 49f043ed29b..fe488f2232b 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -7123,6 +7123,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
+@@ -7393,6 +7393,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
                  [specify that runtime libraries should be
                   installed in a compiler-specific directory])])
  
@@ -132,7 +132,7 @@
  AC_SUBST(subdirs)
  AC_SUBST(srcdir)
 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 7a368959e5e..6659a903bf0 100644
+index 35508efb4ef..40f798eac78 100644
 --- a/gcc/doc/invoke.texi
 +++ b/gcc/doc/invoke.texi
 @@ -369,6 +369,7 @@ Objective-C and Objective-C++ Dialects}.
@@ -143,7 +143,7 @@
  -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
  -Wrestrict  -Wno-return-local-addr  -Wreturn-type @gol
  -Wno-scalar-storage-order  -Wsequence-point @gol
-@@ -7735,6 +7736,14 @@ made up of data only and thus requires no special treatment.  But, for
+@@ -7728,6 +7729,14 @@ made up of data only and thus requires no special treatment.  But, for
  most targets, it is made up of code and thus requires the stack to be
  made executable in order for the program to work properly.
  
@@ -159,7 +159,7 @@
  @opindex Wfloat-equal
  @opindex Wno-float-equal
 diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 7837553958b..19c75b6e20d 100644
+index 0af888c7d78..b047fc31c2f 100644
 --- a/gcc/gcc.c
 +++ b/gcc/gcc.c
 @@ -1152,6 +1152,8 @@ proper position among the other output files.  */
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0004-64-bit-multilib-hack.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0003-64-bit-multilib-hack.patch
similarity index 98%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0004-64-bit-multilib-hack.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0003-64-bit-multilib-hack.patch
index 5f14dd2..c0e8cbd 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0004-64-bit-multilib-hack.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0003-64-bit-multilib-hack.patch
@@ -1,4 +1,4 @@
-From 2fa5c93641b75a662839c1b6eee172b6c481c70e Mon Sep 17 00:00:00 2001
+From b87a3ac51df372128be2fda992238c5aab4a719a Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:10:06 +0400
 Subject: [PATCH] 64-bit multilib hack.
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0003-CVE-2021-42574.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0003-CVE-2021-42574.patch
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0003-CVE-2021-42574.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0003-CVE-2021-42574.patch
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0004-CVE-2021-42574.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0004-CVE-2021-42574.patch
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0004-CVE-2021-42574.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0004-CVE-2021-42574.patch
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0004-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
similarity index 91%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0004-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
index 9844c2a..55a5885 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0004-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -1,4 +1,4 @@
-From e64342df647829d3e1c52fd480a5be7c1281ced0 Mon Sep 17 00:00:00 2001
+From 1766cf28fd7d917df510b1c262c47211b9ea70fa Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:17:25 +0400
 Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
@@ -26,7 +26,7 @@
  4 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 8a5fb3fd99c..7da6f439fff 100644
+index 7bfd6ce653f..95962ae37b6 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -552,7 +552,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
@@ -39,10 +39,10 @@
  TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
  TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
 diff --git a/gcc/configure b/gcc/configure
-index 3f0734bff11..c5d3bc4ee2d 100755
+index d7445339f9a..f5b99d1cf7d 100755
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -13090,8 +13090,8 @@ for f in $tm_file; do
+@@ -13131,8 +13131,8 @@ for f in $tm_file; do
         tm_include_list="${tm_include_list} $f"
         ;;
      defaults.h )
@@ -54,10 +54,10 @@
      * )
         tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 54e21764b3e..f83420326d6 100644
+index fe488f2232b..29005f6d18f 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -2263,8 +2263,8 @@ for f in $tm_file; do
+@@ -2294,8 +2294,8 @@ for f in $tm_file; do
         tm_include_list="${tm_include_list} $f"
         ;;
      defaults.h )
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0005-cpp-honor-sysroot.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0005-cpp-honor-sysroot.patch
new file mode 100644
index 0000000..f2883fe
--- /dev/null
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0005-cpp-honor-sysroot.patch
@@ -0,0 +1,53 @@
+From e6a820a19c4cd115d8af7c235c5f9700c7a24730 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 09:22:00 +0400
+Subject: [PATCH] cpp: honor sysroot.
+
+Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
+preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
+rather than the --sysroot option specified on the commandline. If access to that directory is
+permission denied (unreadable), gcc will error.
+
+This happens when ccache is in use due to the fact it uses preprocessed source files.
+
+The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
+-isystem, -isysroot happen and the correct sysroot is used.
+
+[YOCTO #2074]
+
+RP 2012/04/13
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582725.html]
+---
+ gcc/cp/lang-specs.h | 2 +-
+ gcc/gcc.c           | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
+index 8902ae1d2ed..e99e2fcd6ad 100644
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3.  If not see
+   {".ii", "@c++-cpp-output", 0, 0, 0},
+   {"@c++-cpp-output",
+       "%{!E:%{!M:%{!MM:"
+-      "  cc1plus -fpreprocessed %i %(cc1_options) %2"
++      "  cc1plus -fpreprocessed %i %I %(cc1_options) %2"
+       "  %{!fsyntax-only:"
+       "    %{fmodule-only:%{!S:-o %g.s%V}}"
+       "    %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index b047fc31c2f..bdee2671532 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1469,7 +1469,7 @@ static const struct compiler default_compilers[] =
+ 					   %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
+   {".i", "@cpp-output", 0, 0, 0},
+   {"@cpp-output",
+-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   {".s", "@assembler", 0, 0, 0},
+   {"@assembler",
+    "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0006-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
similarity index 81%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0006-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
index 0884730..ef19eef 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0006-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -1,4 +1,4 @@
-From 8e9d6efecdc8c42f47e3a012dee764b13c3dad59 Mon Sep 17 00:00:00 2001
+From 84dd8ea4c982fc2c82af642293d29e9c1880de5b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:24:50 +0400
 Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
@@ -12,25 +12,43 @@
 
 Removes the do_headerfix task in metadata
 
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
 Upstream-Status: Inappropriate [OE configuration]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
- gcc/config/alpha/linux-elf.h |  4 ++--
- gcc/config/arm/linux-eabi.h  |  4 ++--
- gcc/config/arm/linux-elf.h   |  2 +-
- gcc/config/i386/linux.h      |  2 +-
- gcc/config/i386/linux64.h    |  6 +++---
- gcc/config/linux.h           |  8 ++++----
- gcc/config/mips/linux.h      | 12 ++++++------
- gcc/config/riscv/linux.h     |  2 +-
- gcc/config/rs6000/linux64.h  | 15 +++++----------
- gcc/config/sh/linux.h        |  2 +-
- gcc/config/sparc/linux.h     |  2 +-
- gcc/config/sparc/linux64.h   |  4 ++--
- 12 files changed, 29 insertions(+), 34 deletions(-)
+ gcc/config/aarch64/aarch64-linux.h |  4 ++--
+ gcc/config/alpha/linux-elf.h       |  4 ++--
+ gcc/config/arm/linux-eabi.h        |  4 ++--
+ gcc/config/arm/linux-elf.h         |  2 +-
+ gcc/config/i386/linux.h            |  2 +-
+ gcc/config/i386/linux64.h          |  6 +++---
+ gcc/config/linux.h                 |  8 ++++----
+ gcc/config/mips/linux.h            | 12 ++++++------
+ gcc/config/riscv/linux.h           |  2 +-
+ gcc/config/rs6000/linux64.h        | 15 +++++----------
+ gcc/config/sh/linux.h              |  2 +-
+ gcc/config/sparc/linux.h           |  2 +-
+ gcc/config/sparc/linux64.h         |  4 ++--
+ 13 files changed, 31 insertions(+), 36 deletions(-)
 
-unchanged:
+diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
+index 7f2529a2a1d..4bcae7f3110 100644
+--- a/gcc/config/aarch64/aarch64-linux.h
++++ b/gcc/config/aarch64/aarch64-linux.h
+@@ -21,10 +21,10 @@
+ #ifndef GCC_AARCH64_LINUX_H
+ #define GCC_AARCH64_LINUX_H
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++#define GLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+ 
+ #undef MUSL_DYNAMIC_LINKER
+-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++#define MUSL_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+ 
+ #undef  ASAN_CC1_SPEC
+ #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
+diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
+index c1dae8ca2cf..3ce2b76c1a4 100644
 --- a/gcc/config/alpha/linux-elf.h
 +++ b/gcc/config/alpha/linux-elf.h
 @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  If not see
@@ -44,7 +62,8 @@
  #if DEFAULT_LIBC == LIBC_UCLIBC
  #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  #elif DEFAULT_LIBC == LIBC_GLIBC
-unchanged:
+diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
+index 85d0136e76e..6bd95855827 100644
 --- a/gcc/config/arm/linux-eabi.h
 +++ b/gcc/config/arm/linux-eabi.h
 @@ -65,8 +65,8 @@
@@ -58,7 +77,8 @@
  #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
  
  #define GLIBC_DYNAMIC_LINKER \
-unchanged:
+diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
+index 0c1c4e70b6b..6bd643ade11 100644
 --- a/gcc/config/arm/linux-elf.h
 +++ b/gcc/config/arm/linux-elf.h
 @@ -60,7 +60,7 @@
@@ -70,7 +90,8 @@
  
  #define LINUX_TARGET_LINK_SPEC  "%{h*} \
     %{static:-Bstatic} \
-unchanged:
+diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
+index 04b274f1654..7aafcf3ac2d 100644
 --- a/gcc/config/i386/linux.h
 +++ b/gcc/config/i386/linux.h
 @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.  If not see
@@ -82,7 +103,8 @@
  
  #undef MUSL_DYNAMIC_LINKER
  #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
-unchanged:
+diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
+index b3822ced528..92d303e80d6 100644
 --- a/gcc/config/i386/linux64.h
 +++ b/gcc/config/i386/linux64.h
 @@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
@@ -98,7 +120,8 @@
  
  #undef MUSL_DYNAMIC_LINKER32
  #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-unchanged:
+diff --git a/gcc/config/linux.h b/gcc/config/linux.h
+index 4e1db60fced..87efc5f69fe 100644
 --- a/gcc/config/linux.h
 +++ b/gcc/config/linux.h
 @@ -94,10 +94,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
@@ -116,7 +139,8 @@
  #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
  #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
  #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
-unchanged:
+diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
+index 44a85e410d9..8d41b5574f6 100644
 --- a/gcc/config/mips/linux.h
 +++ b/gcc/config/mips/linux.h
 @@ -22,20 +22,20 @@ along with GCC; see the file COPYING3.  If not see
@@ -146,7 +170,8 @@
  
  #undef MUSL_DYNAMIC_LINKER32
  #define MUSL_DYNAMIC_LINKER32 \
-unchanged:
+diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
+index fce5b896e6e..03aa55cb5ab 100644
 --- a/gcc/config/riscv/linux.h
 +++ b/gcc/config/riscv/linux.h
 @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
@@ -158,7 +183,8 @@
  
  #define MUSL_ABI_SUFFIX \
    "%{mabi=ilp32:-sf}" \
-unchanged:
+diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
+index e3f2cd254f6..a11e01faa3d 100644
 --- a/gcc/config/rs6000/linux64.h
 +++ b/gcc/config/rs6000/linux64.h
 @@ -336,24 +336,19 @@ extern int dot_symbols;
@@ -191,7 +217,8 @@
  
  #undef  DEFAULT_ASM_ENDIAN
  #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
-unchanged:
+diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
+index 7558d2f7195..3aaa6c3a078 100644
 --- a/gcc/config/sh/linux.h
 +++ b/gcc/config/sh/linux.h
 @@ -64,7 +64,7 @@ along with GCC; see the file COPYING3.  If not see
@@ -203,7 +230,8 @@
  
  #undef SUBTARGET_LINK_EMUL_SUFFIX
  #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
-unchanged:
+diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
+index 2550d7ee8f0..a94f4cd8ba2 100644
 --- a/gcc/config/sparc/linux.h
 +++ b/gcc/config/sparc/linux.h
 @@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
@@ -215,7 +243,8 @@
  
  #undef  LINK_SPEC
  #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
-unchanged:
+diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
+index 95af8afa9b5..63127afb074 100644
 --- a/gcc/config/sparc/linux64.h
 +++ b/gcc/config/sparc/linux64.h
 @@ -78,8 +78,8 @@ along with GCC; see the file COPYING3.  If not see
@@ -229,19 +258,3 @@
  
  #ifdef SPARC_BI_ARCH
  
-diff -u b/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
---- b/gcc/config/aarch64/aarch64-linux.h
-+++ b/gcc/config/aarch64/aarch64-linux.h
-@@ -21,10 +21,10 @@
- #ifndef GCC_AARCH64_LINUX_H
- #define GCC_AARCH64_LINUX_H
- 
--#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
-+#define GLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
- 
- #undef MUSL_DYNAMIC_LINKER
--#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
-+#define MUSL_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
- 
- #undef  ASAN_CC1_SPEC
- #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0007-gcc-Fix-argument-list-too-long-error.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0007-gcc-Fix-argument-list-too-long-error.patch
new file mode 100644
index 0000000..9f9f8cc
--- /dev/null
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0007-gcc-Fix-argument-list-too-long-error.patch
@@ -0,0 +1,42 @@
+From 768e9075e88d811b00207d991123438bb996e4ea Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 09:26:37 +0400
+Subject: [PATCH] gcc: Fix argument list too long error.
+
+There would be an "Argument list too long" error when the
+build directory is longer than 200, this is caused by:
+
+headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`
+
+The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle
+it, use the $(sort list) of GNU make which can handle the too long list
+would fix the problem, the header would be short enough after sorted.
+The "tr ' ' '\012'" was used for translating the space to "\n", the
+$(sort list) doesn't need this.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+RP: gcc then added *.h and *.def additions to this list, breaking the original
+fix. Add the sort to the original gcc code, leaving the tr+sort to fix the original
+issue but include the new files too as reported by Zhuang <qiuguang.zqg@alibaba-inc.com>
+
+Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=66e157188bd2f789809e17e85f917534c9381599]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gcc/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 95962ae37b6..d1d4512bba3 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -3671,7 +3671,7 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
+ # We keep the directory structure for files in config, common/config or
+ # c-family and .def files. All other files are flattened to a single directory.
+ 	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+-	headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
++	headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
+ 	srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
+ 	for file in $$headers; do \
+ 	  if [ -f $$file ] ; then \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0014-libtool.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0008-libtool.patch
similarity index 94%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0014-libtool.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0008-libtool.patch
index f2b8924..358e1d7 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0014-libtool.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0008-libtool.patch
@@ -1,4 +1,4 @@
-From a5b984db9669cf38a7bd76c3fcdb41c086f740db Mon Sep 17 00:00:00 2001
+From b19700ef0103f9414416b9a779a64d6138c58b1f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:29:11 +0400
 Subject: [PATCH] libtool
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
similarity index 95%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
index 1ccf39c..ac13954 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -1,4 +1,4 @@
-From 0ae7090dec149cb2ff0c87eef87c043d4000ece1 Mon Sep 17 00:00:00 2001
+From 10d23d93697167396e223711bf6210e1642ee926 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:30:32 +0400
 Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
similarity index 89%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
index bde7ec6..4912fa9 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -1,4 +1,4 @@
-From 5ce8aa4615a3816d12c43752323154744517ae9f Mon Sep 17 00:00:00 2001
+From 5970fb3fadccd8c43f7f7030e6ff51e0295731ef Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 29 Mar 2013 09:33:04 +0400
 Subject: [PATCH] Use the multilib config files from ${B} instead of using the
@@ -18,10 +18,10 @@
  2 files changed, 36 insertions(+), 8 deletions(-)
 
 diff --git a/gcc/configure b/gcc/configure
-index 5160917d73e..e663052cad2 100755
+index f5b99d1cf7d..ec3c24482df 100755
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -13070,10 +13070,20 @@ done
+@@ -13111,10 +13111,20 @@ done
  tmake_file_=
  for f in ${tmake_file}
  do
@@ -46,7 +46,7 @@
  done
  tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
  
-@@ -13084,6 +13094,10 @@ tm_file_list="options.h"
+@@ -13125,6 +13135,10 @@ tm_file_list="options.h"
  tm_include_list="options.h insn-constants.h"
  for f in $tm_file; do
    case $f in
@@ -58,10 +58,10 @@
         f=`echo $f | sed 's/^..//'`
         tm_file_list="${tm_file_list} $f"
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 50f78308e8a..2b84875b028 100644
+index 29005f6d18f..ea794cd1763 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -2243,10 +2243,20 @@ done
+@@ -2274,10 +2274,20 @@ done
  tmake_file_=
  for f in ${tmake_file}
  do
@@ -86,7 +86,7 @@
  done
  tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
  
-@@ -2257,6 +2267,10 @@ tm_file_list="options.h"
+@@ -2288,6 +2298,10 @@ tm_file_list="options.h"
  tm_include_list="options.h insn-constants.h"
  for f in $tm_file; do
    case $f in
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
similarity index 92%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
index 3e0a1b4..e3e3594 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -1,4 +1,4 @@
-From 75a1ce0265ca123f74f17a40ad8bd8f26d9c2ab3 Mon Sep 17 00:00:00 2001
+From 2af537b9ff0018945a27a7f89efad736a0f647d4 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 09:39:38 +0000
 Subject: [PATCH] Avoid using libdir from .la which usually points to a host
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0019-Ensure-target-gcc-headers-can-be-included.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0012-Ensure-target-gcc-headers-can-be-included.patch
similarity index 96%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0019-Ensure-target-gcc-headers-can-be-included.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0012-Ensure-target-gcc-headers-can-be-included.patch
index 120d5a2..d33925e 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0019-Ensure-target-gcc-headers-can-be-included.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0012-Ensure-target-gcc-headers-can-be-included.patch
@@ -1,4 +1,4 @@
-From 6f410ed8fb7eee11ba7a25634c2257666b98ef52 Mon Sep 17 00:00:00 2001
+From 9427c6cedf88e15f747c48cb4fcf9eda6f5c4555 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 20 Feb 2015 10:25:11 +0000
 Subject: [PATCH] Ensure target gcc headers can be included
@@ -25,7 +25,7 @@
  4 files changed, 22 insertions(+)
 
 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 59c45c81393..9b17d120aa1 100644
+index d1d4512bba3..06eb0d27a28 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -630,6 +630,7 @@ libexecdir = @libexecdir@
@@ -36,7 +36,7 @@
  # Directory in which the compiler finds executables
  libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
  # Directory in which all plugin resources are installed
-@@ -3016,6 +3017,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
+@@ -3009,6 +3010,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
  
  PREPROCESSOR_DEFINES = \
    -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0013-Don-t-search-host-directory-during-relink-if-inst_pr.patch
similarity index 93%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0013-Don-t-search-host-directory-during-relink-if-inst_pr.patch
index bb2a367..5b5d229 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0013-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -1,4 +1,4 @@
-From cd09adb1e7f2a7e81a9f595a17c36f24911b90ac Mon Sep 17 00:00:00 2001
+From ab6e6af5deca6f4b35b089a6b197776df38780e6 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 3 Mar 2015 08:21:19 +0000
 Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0014-libcc1-fix-libcc1-s-install-path-and-rpath.patch
similarity index 90%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0014-libcc1-fix-libcc1-s-install-path-and-rpath.patch
index fb4511c..b82277c 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0014-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -1,4 +1,4 @@
-From 2cfc5ee38b3f5ec1d7965aae0991bcd48b5dc2e6 Mon Sep 17 00:00:00 2001
+From fd862c8c112067d8613d921ae89c99056aca54a1 Mon Sep 17 00:00:00 2001
 From: Robert Yang <liezhi.yang@windriver.com>
 Date: Sun, 5 Jul 2015 20:25:18 -0700
 Subject: [PATCH] libcc1: fix libcc1's install path and rpath
@@ -20,10 +20,10 @@
  2 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
-index f148fdd7aa2..0b6eb8f2855 100644
+index 3b75e7d9290..d3a4c4f9ddf 100644
 --- a/libcc1/Makefile.am
 +++ b/libcc1/Makefile.am
-@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
+@@ -41,8 +41,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
  	    $(Wc)$(libiberty_normal)))
  libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
  
@@ -35,7 +35,7 @@
  if ENABLE_PLUGIN
  plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
 diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
-index 753d435c9cb..455627b0a3b 100644
+index 07fa9d94c83..a9f737d78f2 100644
 --- a/libcc1/Makefile.in
 +++ b/libcc1/Makefile.in
 @@ -398,8 +398,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0018-export-CPP.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0015-Makefile.in-Ensure-build-CPP-CPPFLAGS-is-used-for-bu.patch
similarity index 79%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0018-export-CPP.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0015-Makefile.in-Ensure-build-CPP-CPPFLAGS-is-used-for-bu.patch
index 86ab657..45953f8 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0018-export-CPP.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0015-Makefile.in-Ensure-build-CPP-CPPFLAGS-is-used-for-bu.patch
@@ -1,5 +1,8 @@
+From 667b302f637be0a4b6ef714b5eb0026c54425386 Mon Sep 17 00:00:00 2001
 From: Richard Purdie <richard.purdie@linuxfoundation.org>
-Subject: [PATCH 1/5] Makefile.in: Ensure build CPP/CPPFLAGS is used for build targets
+Date: Sun, 31 Oct 2021 17:40:12 -0700
+Subject: [PATCH] Makefile.in: Ensure build CPP/CPPFLAGS is used for build
+ targets
 
 During cross compiling, CPP is being set to the target compiler even for
 build targets. As an example, when building a cross compiler targetting
@@ -42,6 +45,8 @@
 
 Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582727.html]
 Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=84401ce5fb4ecab55decb472b168100e7593e01f]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
  Makefile.in      | 6 ++++++
  Makefile.tpl     | 6 ++++++
@@ -51,41 +56,10 @@
  gcc/configure.ac | 2 +-
  6 files changed, 22 insertions(+), 2 deletions(-)
 
-Index: gcc-11.2.0/Makefile.in
-===================================================================
---- gcc-11.2.0.orig/Makefile.in
-+++ gcc-11.2.0/Makefile.in
-@@ -151,6 +151,8 @@ BUILD_EXPORTS = \
- 	CC="$(CC_FOR_BUILD)"; export CC; \
- 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
- 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
-+	CPP="$(CPP_FOR_BUILD)"; export CPP; \
-+	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
- 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
- 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
- 	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
-@@ -198,6 +200,8 @@ HOST_EXPORTS = \
- 	AR="$(AR)"; export AR; \
- 	AS="$(AS)"; export AS; \
- 	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
-+	CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
-+	CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
- 	CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
- 	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
- 	LD="$(LD)"; export LD; \
-@@ -353,6 +357,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
- AS_FOR_BUILD = @AS_FOR_BUILD@
- CC_FOR_BUILD = @CC_FOR_BUILD@
- CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
-+CPP_FOR_BUILD = @CPP_FOR_BUILD@
-+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
- CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
- CXX_FOR_BUILD = @CXX_FOR_BUILD@
- DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
-Index: gcc-11.2.0/Makefile.tpl
-===================================================================
---- gcc-11.2.0.orig/Makefile.tpl
-+++ gcc-11.2.0/Makefile.tpl
+diff --git a/Makefile.in b/Makefile.in
+index 20cbbe2906d..33476d53327 100644
+--- a/Makefile.in
++++ b/Makefile.in
 @@ -154,6 +154,8 @@ BUILD_EXPORTS = \
  	CC="$(CC_FOR_BUILD)"; export CC; \
  	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
@@ -95,7 +69,7 @@
  	CXX="$(CXX_FOR_BUILD)"; export CXX; \
  	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
  	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
-@@ -201,6 +203,8 @@ HOST_EXPORTS = \
+@@ -202,6 +204,8 @@ HOST_EXPORTS = \
  	AR="$(AR)"; export AR; \
  	AS="$(AS)"; export AS; \
  	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -103,8 +77,8 @@
 +	CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
  	CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
  	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
- 	LD="$(LD)"; export LD; \
-@@ -356,6 +360,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
+ 	DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
+@@ -360,6 +364,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
  AS_FOR_BUILD = @AS_FOR_BUILD@
  CC_FOR_BUILD = @CC_FOR_BUILD@
  CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
@@ -113,11 +87,42 @@
  CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
  CXX_FOR_BUILD = @CXX_FOR_BUILD@
  DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
-Index: gcc-11.2.0/configure
-===================================================================
---- gcc-11.2.0.orig/configure
-+++ gcc-11.2.0/configure
-@@ -652,6 +652,8 @@ GFORTRAN_FOR_BUILD
+diff --git a/Makefile.tpl b/Makefile.tpl
+index 9adf4f94728..e39d85d1109 100644
+--- a/Makefile.tpl
++++ b/Makefile.tpl
+@@ -157,6 +157,8 @@ BUILD_EXPORTS = \
+ 	CC="$(CC_FOR_BUILD)"; export CC; \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ 	CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
++	CPP="$(CPP_FOR_BUILD)"; export CPP; \
++	CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
+ 	CXX="$(CXX_FOR_BUILD)"; export CXX; \
+ 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
+ 	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
+@@ -205,6 +207,8 @@ HOST_EXPORTS = \
+ 	AR="$(AR)"; export AR; \
+ 	AS="$(AS)"; export AS; \
+ 	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
++	CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
++	CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
+ 	CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
+ 	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
+ 	DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
+@@ -363,6 +367,8 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
+ AS_FOR_BUILD = @AS_FOR_BUILD@
+ CC_FOR_BUILD = @CC_FOR_BUILD@
+ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++CPP_FOR_BUILD = @CPP_FOR_BUILD@
++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+ CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
+ CXX_FOR_BUILD = @CXX_FOR_BUILD@
+ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
+diff --git a/configure b/configure
+index 45744e6e471..ff0de8a68b4 100755
+--- a/configure
++++ b/configure
+@@ -655,6 +655,8 @@ DSYMUTIL_FOR_BUILD
  DLLTOOL_FOR_BUILD
  CXX_FOR_BUILD
  CXXFLAGS_FOR_BUILD
@@ -126,15 +131,15 @@
  CFLAGS_FOR_BUILD
  CC_FOR_BUILD
  AS_FOR_BUILD
-@@ -4092,6 +4094,7 @@ if test "${build}" != "${host}" ; then
+@@ -4100,6 +4102,7 @@ if test "${build}" != "${host}" ; then
    AR_FOR_BUILD=${AR_FOR_BUILD-ar}
    AS_FOR_BUILD=${AS_FOR_BUILD-as}
    CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
 +  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
    CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
+   DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
    GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
-   GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
-@@ -9809,6 +9812,7 @@ esac
+@@ -9831,6 +9834,7 @@ esac
  # our build compiler if desired.
  if test x"${build}" = x"${host}" ; then
    CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
@@ -142,19 +147,19 @@
    CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
    LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
  fi
-Index: gcc-11.2.0/configure.ac
-===================================================================
---- gcc-11.2.0.orig/configure.ac
-+++ gcc-11.2.0/configure.ac
+diff --git a/configure.ac b/configure.ac
+index bf66b51373c..09fa3896dc7 100644
+--- a/configure.ac
++++ b/configure.ac
 @@ -1347,6 +1347,7 @@ if test "${build}" != "${host}" ; then
    AR_FOR_BUILD=${AR_FOR_BUILD-ar}
    AS_FOR_BUILD=${AS_FOR_BUILD-as}
    CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
 +  CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CPP)}"
    CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
+   DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
    GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
-   GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
-@@ -3321,6 +3322,7 @@ esac
+@@ -3336,6 +3337,7 @@ esac
  # our build compiler if desired.
  if test x"${build}" = x"${host}" ; then
    CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
@@ -162,7 +167,7 @@
    CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
    LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
  fi
-@@ -3387,6 +3389,8 @@ AC_SUBST(AR_FOR_BUILD)
+@@ -3402,6 +3404,8 @@ AC_SUBST(AR_FOR_BUILD)
  AC_SUBST(AS_FOR_BUILD)
  AC_SUBST(CC_FOR_BUILD)
  AC_SUBST(CFLAGS_FOR_BUILD)
@@ -171,11 +176,11 @@
  AC_SUBST(CXXFLAGS_FOR_BUILD)
  AC_SUBST(CXX_FOR_BUILD)
  AC_SUBST(DLLTOOL_FOR_BUILD)
-Index: gcc-11.2.0/gcc/configure
-===================================================================
---- gcc-11.2.0.orig/gcc/configure
-+++ gcc-11.2.0/gcc/configure
-@@ -12699,7 +12699,7 @@ else
+diff --git a/gcc/configure b/gcc/configure
+index ec3c24482df..31a460dc9d0 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -12740,7 +12740,7 @@ else
  	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
  	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
  	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
@@ -184,11 +189,11 @@
  	${realsrcdir}/configure \
  		--enable-languages=${enable_languages-all} \
  		${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
-Index: gcc-11.2.0/gcc/configure.ac
-===================================================================
---- gcc-11.2.0.orig/gcc/configure.ac
-+++ gcc-11.2.0/gcc/configure.ac
-@@ -2023,7 +2023,7 @@ else
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index ea794cd1763..b965eb036bc 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -2054,7 +2054,7 @@ else
  	CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
  	CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
  	LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0016-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
similarity index 68%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0016-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
index 98a1bb2..7f807a9 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0006-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0016-If-CXXFLAGS-contains-something-unsupported-by-the-bu.patch
@@ -1,8 +1,8 @@
-From e700190743fa29ddaebd6ee075298a24b1688773 Mon Sep 17 00:00:00 2001
+From 2c2a92573598ddbc33c023fe5d499191491fb523 Mon Sep 17 00:00:00 2001
 From: Richard Purdie <richard.purdie@linuxfoundation.org>
 Date: Thu, 28 Oct 2021 11:33:40 +0100
-Subject: [PATCH 6/6] If CXXFLAGS contains something unsupported by the build
- CXX, we see build failures (e.g. using -fmacro-prefix-map for the target).
+Subject: [PATCH] If CXXFLAGS contains something unsupported by the build CXX,
+ we see build failures (e.g. using -fmacro-prefix-map for the target).
 
 Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these errors.
 
@@ -13,19 +13,20 @@
     * Makefile.in: Regenerate.
     * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
 
+Upstream-Status: Pending [should be submittable]
+
 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
  Makefile.in  | 2 ++
  Makefile.tpl | 2 ++
  2 files changed, 4 insertions(+)
 
-Upstream-Status: Pending [should be submittable]
-
-Index: gcc-11.2.0/Makefile.in
-===================================================================
---- gcc-11.2.0.orig/Makefile.in
-+++ gcc-11.2.0/Makefile.in
-@@ -172,6 +172,7 @@ BUILD_EXPORTS = \
+diff --git a/Makefile.in b/Makefile.in
+index 33476d53327..b949dffee0e 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -176,6 +176,7 @@ BUILD_EXPORTS = \
  # built for the build system to override those in BASE_FLAGS_TO_PASS.
  EXTRA_BUILD_FLAGS = \
  	CFLAGS="$(CFLAGS_FOR_BUILD)" \
@@ -33,19 +34,19 @@
  	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
  
  # This is the list of directories to built for the host system.
-@@ -203,6 +204,7 @@ HOST_EXPORTS = \
+@@ -207,6 +208,7 @@ HOST_EXPORTS = \
  	CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
  	CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
  	CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
 +	CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
  	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
+ 	DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
  	LD="$(LD)"; export LD; \
- 	LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
-Index: gcc-11.2.0/Makefile.tpl
-===================================================================
---- gcc-11.2.0.orig/Makefile.tpl
-+++ gcc-11.2.0/Makefile.tpl
-@@ -175,6 +175,7 @@ BUILD_EXPORTS = \
+diff --git a/Makefile.tpl b/Makefile.tpl
+index e39d85d1109..d8520cbb164 100644
+--- a/Makefile.tpl
++++ b/Makefile.tpl
+@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
  # built for the build system to override those in BASE_FLAGS_TO_PASS.
  EXTRA_BUILD_FLAGS = \
  	CFLAGS="$(CFLAGS_FOR_BUILD)" \
@@ -53,11 +54,11 @@
  	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
  
  # This is the list of directories to built for the host system.
-@@ -206,6 +207,7 @@ HOST_EXPORTS = \
+@@ -210,6 +211,7 @@ HOST_EXPORTS = \
  	CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
  	CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
  	CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
 +	CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
  	DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
+ 	DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
  	LD="$(LD)"; export LD; \
- 	LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0024-handle-sysroot-support-for-nativesdk-gcc.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0017-handle-sysroot-support-for-nativesdk-gcc.patch
similarity index 97%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0024-handle-sysroot-support-for-nativesdk-gcc.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0017-handle-sysroot-support-for-nativesdk-gcc.patch
index b1054fa..5d86e4c 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0024-handle-sysroot-support-for-nativesdk-gcc.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0017-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -1,4 +1,4 @@
-From 354682ad8f71f62643dcd83f64b51b5979615a0c Mon Sep 17 00:00:00 2001
+From 68802ca536b01ab21cfa58e11ef332e30d9a3c5e Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 7 Dec 2015 23:39:54 +0000
 Subject: [PATCH] handle sysroot support for nativesdk-gcc
@@ -46,10 +46,10 @@
  8 files changed, 94 insertions(+), 72 deletions(-)
 
 diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
-index 89e05a4c551..5577383665d 100644
+index 6f001e0bb6c..55ab07c278f 100644
 --- a/gcc/c-family/c-opts.c
 +++ b/gcc/c-family/c-opts.c
-@@ -1436,8 +1436,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
+@@ -1438,8 +1438,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
    size_t prefix_len, suffix_len;
  
    suffix_len = strlen (suffix);
@@ -378,7 +378,7 @@
     subdirectory of the actual installation.  */
  extern const char *gcc_exec_prefix;
 diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 8737bae5353..aa6fbe43965 100644
+index bdee2671532..36e8af38630 100644
 --- a/gcc/gcc.c
 +++ b/gcc/gcc.c
 @@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
@@ -398,7 +398,7 @@
   %S     process STARTFILE_SPEC as a spec.  A capital S is actually used here.
   %E     process ENDFILE_SPEC as a spec.  A capital E is actually used here.
   %C     process CPP_SPEC as a spec.
-@@ -1621,10 +1624,10 @@ static const char *gcc_libexec_prefix;
+@@ -1620,10 +1623,10 @@ static const char *gcc_libexec_prefix;
     gcc_exec_prefix is set because, in that case, we know where the
     compiler has been installed, and use paths relative to that
     location instead.  */
@@ -413,7 +413,7 @@
  
  /* For native compilers, these are well-known paths containing
     components that may be provided by the system.  For cross
-@@ -1632,9 +1635,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+@@ -1631,9 +1634,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
  static const char *md_exec_prefix = MD_EXEC_PREFIX;
  static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
  static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
@@ -425,7 +425,7 @@
    = STANDARD_STARTFILE_PREFIX_2;
  
  /* A relative path to be used in finding the location of tools
-@@ -6564,6 +6567,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
+@@ -6570,6 +6573,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
  	      }
  	    break;
  
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0018-Search-target-sysroot-gcc-version-specific-dirs-with.patch
similarity index 92%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0018-Search-target-sysroot-gcc-version-specific-dirs-with.patch
index ff622b1..0f43e98 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0018-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -1,4 +1,4 @@
-From c55e24459370ad96577496ecd87475e3a9de7dad Mon Sep 17 00:00:00 2001
+From 14291076874b133e7fb67ef1714b768a2c48ea44 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 7 Dec 2015 23:41:45 +0000
 Subject: [PATCH] Search target sysroot gcc version specific dirs with
@@ -51,10 +51,10 @@
  1 file changed, 28 insertions(+), 1 deletion(-)
 
 diff --git a/gcc/gcc.c b/gcc/gcc.c
-index aa6fbe43965..f8a71a13826 100644
+index 36e8af38630..d1faa788d60 100644
 --- a/gcc/gcc.c
 +++ b/gcc/gcc.c
-@@ -2811,7 +2811,7 @@ for_each_path (const struct path_prefix *paths,
+@@ -2810,7 +2810,7 @@ for_each_path (const struct path_prefix *paths,
        if (path == NULL)
  	{
  	  len = paths->max_len + extra_space + 1;
@@ -63,7 +63,7 @@
  	  path = XNEWVEC (char, len);
  	}
  
-@@ -2823,6 +2823,33 @@ for_each_path (const struct path_prefix *paths,
+@@ -2822,6 +2822,33 @@ for_each_path (const struct path_prefix *paths,
  	  /* Look first in MACHINE/VERSION subdirectory.  */
  	  if (!skip_multi_dir)
  	    {
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0019-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0019-nios2-Define-MUSL_DYNAMIC_LINKER.patch
new file mode 100644
index 0000000..76ebfd7
--- /dev/null
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0019-nios2-Define-MUSL_DYNAMIC_LINKER.patch
@@ -0,0 +1,25 @@
+From 9ec4db8e910d9a51ae43f6b20d4bf1dac2d8cca8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 2 Feb 2016 10:26:10 -0800
+Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER
+
+Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e5ddbbf992b909d8e38851bd3179d29389e6ac97]
+
+Signed-off-by: Marek Vasut <marex@denx.de>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gcc/config/nios2/linux.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
+index 08edf1521f6..15696d86241 100644
+--- a/gcc/config/nios2/linux.h
++++ b/gcc/config/nios2/linux.h
+@@ -30,6 +30,7 @@
+ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+ 
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
++#define MUSL_DYNAMIC_LINKER  "/lib/ld-musl-nios2.so.1"
+ 
+ #undef LINK_SPEC
+ #define LINK_SPEC LINK_SPEC_ENDIAN \
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0020-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
similarity index 83%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0020-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
index 9c616d2..b82fa44 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0020-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -1,4 +1,4 @@
-From 745a2ac7825c73102b888226c54397d21512f86b Mon Sep 17 00:00:00 2001
+From af72a47a677ce98c08cb73444bdd741ca8e28422 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 27 Jun 2017 18:10:54 -0700
 Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
@@ -22,9 +22,11 @@
  gcc/config/rs6000/linux64.h | 10 ++++++++++
  3 files changed, 27 insertions(+)
 
+diff --git a/gcc/config/linux.h b/gcc/config/linux.h
+index ba02c013e30..8fcaa0c9faf 100644
 --- a/gcc/config/linux.h
 +++ b/gcc/config/linux.h
-@@ -203,6 +203,13 @@ see the files COPYING3 and COPYING.RUNTI
+@@ -203,6 +203,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 },		\
      { 0, 0, 0, 0, 0, 0 }				\
    }
@@ -38,6 +40,8 @@
  #endif
  
  #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
+diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
+index 47c9d9ac0b6..d065f88b377 100644
 --- a/gcc/config/rs6000/linux.h
 +++ b/gcc/config/rs6000/linux.h
 @@ -94,6 +94,16 @@
@@ -57,6 +61,8 @@
  #undef LINK_OS_LINUX_SPEC
  #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
    %{!static-pie: \
+diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
+index a11e01faa3d..ce464f3626b 100644
 --- a/gcc/config/rs6000/linux64.h
 +++ b/gcc/config/rs6000/linux64.h
 @@ -369,6 +369,16 @@ extern int dot_symbols;
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0021-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
similarity index 93%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0021-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
index b74aeb8..9b7c5c5 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0021-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch
@@ -1,4 +1,4 @@
-From 695adb4dffb23c6f5cbc757e05cf4187a2bd6528 Mon Sep 17 00:00:00 2001
+From 79a568dec47baa264eb6290fed3df3244450a92e Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 4 May 2016 21:11:34 -0700
 Subject: [PATCH] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0030-sync-gcc-stddef.h-with-musl.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0022-sync-gcc-stddef.h-with-musl.patch
similarity index 97%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0030-sync-gcc-stddef.h-with-musl.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0022-sync-gcc-stddef.h-with-musl.patch
index fd7d604..86fb22f 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0030-sync-gcc-stddef.h-with-musl.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0022-sync-gcc-stddef.h-with-musl.patch
@@ -1,4 +1,4 @@
-From a9173429ae256c4b4a3ab4d758a6adf42f8c4239 Mon Sep 17 00:00:00 2001
+From 07a06aa8e8285c1bb06d0bebeaa9ad04eb76f2e2 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Fri, 3 Feb 2017 12:56:00 -0800
 Subject: [PATCH] sync gcc stddef.h with musl
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0033-Re-introduce-spe-commandline-options.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0023-Re-introduce-spe-commandline-options.patch
similarity index 90%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0033-Re-introduce-spe-commandline-options.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0023-Re-introduce-spe-commandline-options.patch
index 129f555..23cf02a 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0033-Re-introduce-spe-commandline-options.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0023-Re-introduce-spe-commandline-options.patch
@@ -1,4 +1,4 @@
-From 0b900d6410b7c1938e86eceb87b032fd538566a9 Mon Sep 17 00:00:00 2001
+From ca73043041c3c7aa86af9a3d4f316abc87eb3254 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 6 Jun 2018 12:10:22 -0700
 Subject: [PATCH] Re-introduce spe commandline options
@@ -14,7 +14,7 @@
  1 file changed, 13 insertions(+)
 
 diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
-index 0dbdf753673..b273eb65c35 100644
+index 6b0a3e27529..1bd2e356ac9 100644
 --- a/gcc/config/rs6000/rs6000.opt
 +++ b/gcc/config/rs6000/rs6000.opt
 @@ -352,6 +352,19 @@ mdebug=
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0024-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
similarity index 94%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0024-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
index 3f666dc..f915f28 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0024-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -1,4 +1,4 @@
-From ea9154338cb3acbd75945fddde4202e73c20dd1a Mon Sep 17 00:00:00 2001
+From b3957bc1fd52ec427a1b71b10055905cab4bbc7c Mon Sep 17 00:00:00 2001
 From: Szabolcs Nagy <nsz@port70.net>
 Date: Sat, 24 Oct 2015 20:09:53 +0000
 Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
@@ -39,10 +39,10 @@
  3 files changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
-index ac69eed4d32..ffaa44a16fc 100644
+index 31eae75d277..ec7e858ec83 100644
 --- a/gcc/config/i386/i386-expand.c
 +++ b/gcc/config/i386/i386-expand.c
-@@ -11038,10 +11038,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
+@@ -11066,10 +11066,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
      {
      case IX86_BUILTIN_CPU_INIT:
        {
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0025-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
similarity index 98%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0025-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
index 874cd77..f33193e 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0025-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -1,4 +1,4 @@
-From 520411cf364ee4b0b5a8f0857498aaabd790afb3 Mon Sep 17 00:00:00 2001
+From 5fd90d243ae14034a4699443110070dafc0d4d30 Mon Sep 17 00:00:00 2001
 From: Richard Purdie <richard.purdie@linuxfoundation.org>
 Date: Tue, 10 Mar 2020 08:26:53 -0700
 Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
@@ -17,7 +17,7 @@
  2 files changed, 19 insertions(+), 19 deletions(-)
 
 diff --git a/gcc/gengtype.c b/gcc/gengtype.c
-index 5f50242e857..cbaca9b8cd0 100644
+index 98d4626f87e..f602da8b501 100644
 --- a/gcc/gengtype.c
 +++ b/gcc/gengtype.c
 @@ -991,7 +991,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0036-mingw32-Enable-operation_not_supported.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0026-mingw32-Enable-operation_not_supported.patch
similarity index 93%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0036-mingw32-Enable-operation_not_supported.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0026-mingw32-Enable-operation_not_supported.patch
index 3a7618c..b46bde1 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0036-mingw32-Enable-operation_not_supported.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0026-mingw32-Enable-operation_not_supported.patch
@@ -1,4 +1,4 @@
-From 96d895c8d5dc895d24fe37aa2b4f201a2566b4cc Mon Sep 17 00:00:00 2001
+From 7bc34769f0b055e25286576e4ba6d211e8159834 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 12 May 2020 10:39:09 -0700
 Subject: [PATCH] mingw32: Enable operation_not_supported
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0037-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0027-libatomic-Do-not-enforce-march-on-aarch64.patch
similarity index 85%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0037-libatomic-Do-not-enforce-march-on-aarch64.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0027-libatomic-Do-not-enforce-march-on-aarch64.patch
index 4c9a79c..85b1251 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0037-libatomic-Do-not-enforce-march-on-aarch64.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0027-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -1,4 +1,4 @@
-From 36d4fdbc99e69f9d70a29e2bada40cc3c1534557 Mon Sep 17 00:00:00 2001
+From df1c63bbd7a520e8c6d0d0692b4d8bff56952394 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 13 May 2020 15:10:38 -0700
 Subject: [PATCH] libatomic: Do not enforce march on aarch64
@@ -17,7 +17,7 @@
  2 files changed, 2 deletions(-)
 
 diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
-index 0f3cd6f7121..c8124c1d5aa 100644
+index ab8c2da24a1..f614a46b34d 100644
 --- a/libatomic/Makefile.am
 +++ b/libatomic/Makefile.am
 @@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
@@ -29,14 +29,14 @@
  endif
  if ARCH_ARM_LINUX
 diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
-index 0a51bd55f01..6d5b1581706 100644
+index 80d25653dc7..7377689ab34 100644
 --- a/libatomic/Makefile.in
 +++ b/libatomic/Makefile.in
-@@ -432,7 +432,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
+@@ -434,7 +434,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
  libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
  	_$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
  	$(am__append_3) $(am__append_4)
 -@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
  @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
  @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
- @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16
+ @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0028-debug-101473-apply-debug-prefix-maps-before-checksum.patch
similarity index 81%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0028-debug-101473-apply-debug-prefix-maps-before-checksum.patch
index c8dcd74..de06793 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0041-apply-debug-prefix-maps-before-checksumming-DIEs.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0028-debug-101473-apply-debug-prefix-maps-before-checksum.patch
@@ -1,7 +1,8 @@
-From 7cc2df084b7977653a9b59cbc34a9ad500ae619c Mon Sep 17 00:00:00 2001
+From 49008eeedc97014f44e12afe179d3785e4438372 Mon Sep 17 00:00:00 2001
 From: Richard Biener <rguenther@suse.de>
 Date: Tue, 20 Jul 2021 11:00:33 +0200
-Subject: [PATCH] debug/101473 - apply debug prefix maps before checksumming DIEs
+Subject: [PATCH] debug/101473 - apply debug prefix maps before checksumming
+ DIEs
 
 The following makes sure to apply the debug prefix maps to filenames
 before checksumming DIEs to create the global symbol for the CU DIE
@@ -36,10 +37,15 @@
 this version of gcc.
 
 Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
-diff -urpN a/gcc/dwarf2out.c b/gcc/dwarf2out.c
---- a/gcc/dwarf2out.c	2021-04-27 06:00:13.000000000 -0400
-+++ b/gcc/dwarf2out.c	2021-07-23 16:40:06.141886167 -0400
+ gcc/dwarf2out.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
+index e5d3ce4966d..41ac3008507 100644
+--- a/gcc/dwarf2out.c
++++ b/gcc/dwarf2out.c
 @@ -1283,6 +1283,7 @@ dwarf2out_switch_text_section (void)
  
  /* Data about a single source file.  */
@@ -48,7 +54,7 @@
    const char * filename;
    int emitted_number;
  };
-@@ -12334,7 +12335,7 @@ file_name_acquire (dwarf_file_data **slo
+@@ -12335,7 +12336,7 @@ file_name_acquire (dwarf_file_data **slot, file_name_acquire_data *fnad)
  
    fi = fnad->files + fnad->used_files++;
  
@@ -57,7 +63,7 @@
  
    /* Skip all leading "./".  */
    while (f[0] == '.' && IS_DIR_SEPARATOR (f[1]))
-@@ -27231,13 +27232,13 @@ dwarf2out_ignore_block (const_tree block
+@@ -27259,13 +27260,13 @@ dwarf2out_ignore_block (const_tree block)
  bool
  dwarf_file_hasher::equal (dwarf_file_data *p1, const char *p2)
  {
@@ -73,7 +79,7 @@
  }
  
  /* Lookup FILE_NAME (in the list of filenames that we know about here in
-@@ -27267,7 +27268,8 @@ lookup_filename (const char *file_name)
+@@ -27295,7 +27296,8 @@ lookup_filename (const char *file_name)
      return *slot;
  
    created = ggc_alloc<dwarf_file_data> ();
@@ -83,7 +89,7 @@
    created->emitted_number = 0;
    *slot = created;
    return created;
-@@ -27293,8 +27295,7 @@ maybe_emit_file (struct dwarf_file_data
+@@ -27321,8 +27323,7 @@ maybe_emit_file (struct dwarf_file_data * fd)
        if (output_asm_line_debug_info ())
  	{
  	  fprintf (asm_out_file, "\t.file %u ", fd->emitted_number);
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-Fix-install-path-of-linux64.h.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0029-Fix-install-path-of-linux64.h.patch
similarity index 81%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-Fix-install-path-of-linux64.h.patch
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0029-Fix-install-path-of-linux64.h.patch
index 5bf895d..d7e156e 100644
--- a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.2/0001-Fix-install-path-of-linux64.h.patch
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0029-Fix-install-path-of-linux64.h.patch
@@ -1,4 +1,4 @@
-From 58211c7ceb0510b2a11a7f1da3c7fa968c658749 Mon Sep 17 00:00:00 2001
+From 8a62cc0a64670e39f462c1dbbf82e04d2f03b89e Mon Sep 17 00:00:00 2001
 From: Andrei Gherzan <andrei.gherzan@huawei.com>
 Date: Wed, 22 Dec 2021 12:49:25 +0100
 Subject: [PATCH] Fix install path of linux64.h
@@ -11,15 +11,16 @@
 Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
 
 Upstream-Status: Inappropriate [configuration]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
  gcc/Makefile.in | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 9b17d120a..d175ec4e3 100644
+index 06eb0d27a28..a8678ca24ed 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
-@@ -3693,6 +3693,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
+@@ -3686,6 +3686,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
  	  "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
  	  | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
  	    base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
@@ -28,6 +29,3 @@
  	  *) base=`basename $$path` ;; \
  	  esac; \
  	  dest=$(plugin_includedir)/$$base; \
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0030-rust-recursion-limit.patch b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0030-rust-recursion-limit.patch
new file mode 100644
index 0000000..bbe2f18
--- /dev/null
+++ b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-arm-11.3/0030-rust-recursion-limit.patch
@@ -0,0 +1,92 @@
+From 9234cdca6ee88badfc00297e72f13dac4e540c79 Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Fri, 1 Jul 2022 15:58:52 +0100
+Subject: [PATCH] Add a recursion limit to the demangle_const function in the
+ Rust demangler.
+
+libiberty/
+	PR demangler/105039
+	* rust-demangle.c (demangle_const): Add recursion limit.
+
+Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9234cdca6ee88badfc00297e72f13dac4e540c79]
+---
+ libiberty/rust-demangle.c | 29 ++++++++++++++++++++---------
+ 1 file changed, 20 insertions(+), 9 deletions(-)
+
+diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
+index bb58d900e27..36afcfae278 100644
+--- a/libiberty/rust-demangle.c
++++ b/libiberty/rust-demangle.c
+@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm)
+     return 0;
+ 
+   x = 0;
+-  while (!eat (rdm, '_'))
++  while (!eat (rdm, '_') && !rdm->errored)
+     {
+       c = next (rdm);
+       x *= 62;
+@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm)
+   if (rdm->errored)
+     return;
+ 
++  if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
++    {
++      ++ rdm->recursion;
++      if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
++	/* FIXME: There ought to be a way to report
++	   that the recursion limit has been reached.  */
++	goto fail_return;
++    }
++
+   if (eat (rdm, 'B'))
+     {
+       backref = parse_integer_62 (rdm);
+@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm)
+           demangle_const (rdm);
+           rdm->next = old_next;
+         }
+-      return;
++      goto pass_return;
+     }
+ 
+   ty_tag = next (rdm);
+@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm)
+     /* Placeholder. */
+     case 'p':
+       PRINT ("_");
+-      return;
++      goto pass_return;
+ 
+     /* Unsigned integer types. */
+     case 'h':
+@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm)
+       break;
+ 
+     default:
+-      rdm->errored = 1;
+-      return;
++      goto fail_return;
+     }
+ 
+-  if (rdm->errored)
+-    return;
+-
+-  if (rdm->verbose)
++  if (!rdm->errored && rdm->verbose)
+     {
+       PRINT (": ");
+       PRINT (basic_type (ty_tag));
+     }
++
++ fail_return:
++  rdm->errored = 1;
++ pass_return:
++  if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
++    -- rdm->recursion;
+ }
+ 
+ static void
+-- 
+2.31.1
+
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross-canadian_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross-canadian_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross-canadian_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross-canadian_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-cross_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-crosssdk_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-crosssdk_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-crosssdk_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-crosssdk_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-runtime_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-runtime_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-runtime_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-runtime_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-sanitizers_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-sanitizers_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-sanitizers_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-sanitizers_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-source_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-source_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-source_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc-source_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/gcc_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc-initial_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc-initial_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc-initial_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc-initial_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgcc_arm-11.3.bb
diff --git a/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgfortran_arm-11.2.bb b/meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgfortran_arm-11.3.bb
similarity index 100%
rename from meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgfortran_arm-11.2.bb
rename to meta-arm/meta-arm-toolchain/recipes-devtools/gcc/libgfortran_arm-11.3.bb
diff --git a/meta-arm/meta-arm/lib/fvp/runner.py b/meta-arm/meta-arm/lib/fvp/runner.py
index c5c795d..28351a3 100644
--- a/meta-arm/meta-arm/lib/fvp/runner.py
+++ b/meta-arm/meta-arm/lib/fvp/runner.py
@@ -108,7 +108,10 @@
             console.expect(pexpect.EOF, timeout=5.0)
             console.close()
 
-        if self._fvp_process and self._fvp_process.returncode:
+        if self._fvp_process and self._fvp_process.returncode and \
+                self._fvp_process.returncode > 0:
+            # Return codes < 0 indicate that the process was explicitly
+            # terminated above.
             self._logger.info(f"FVP quit with code {self._fvp_process.returncode}")
             return self._fvp_process.returncode
         else:
diff --git a/meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.10.bb b/meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.15.bb
similarity index 64%
rename from meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.10.bb
rename to meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.15.bb
index 7865b25..c3c9b4d 100644
--- a/meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.10.bb
+++ b/meta-arm/meta-arm/recipes-kernel/linux/linux-arm64-ack_5.15.bb
@@ -1,14 +1,14 @@
 # SPDX-License-Identifier: Apache-2.0
 #
-# Copyright (c) 2021 Arm Limited
+# Copyright (c) 2022 Arm Limited
 #
 require linux-arm64-ack.inc
 
 SRC_URI = " \
-    git://android.googlesource.com/kernel/common.git;protocol=https;branch=android12-5.10-lts \
+    git://android.googlesource.com/kernel/common.git;protocol=https;branch=android13-5.15-lts \
     file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \
     file://0002-vt-conmakehash-improve-reproducibility.patch \
     "
 
-# tag: ASB-2021-09-05_12-5.10
-SRCREV = "3d371f087c953c0e08a228169d4e5c44aea99416"
+# tag: ASB-2022-05-05_13-5.15-93-ge8b3f31d7a60
+SRCREV = "e8b3f31d7a60648343ecbd45ab58dbcfc425b22c"
diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-spdevkit_3.10.0.bb b/meta-arm/meta-arm/recipes-security/optee/optee-spdevkit_3.10.0.bb
deleted file mode 100644
index 7608cec..0000000
--- a/meta-arm/meta-arm/recipes-security/optee/optee-spdevkit_3.10.0.bb
+++ /dev/null
@@ -1,305 +0,0 @@
-SUMMARY = "OP-TEE Secure Partion Development Kit"
-DESCRIPTION = "Open Portable Trusted Execution Environment - Development Kit to run secure partitions"
-HOMEPAGE = "https://www.op-tee.org/"
-
-LICENSE = "BSD-2-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
-
-inherit deploy python3native
-require optee.inc
-FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os:"
-
-CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os"
-
-DEPENDS = "python3-pyelftools-native"
-
-DEPENDS:append:toolchain-clang = " compiler-rt"
-
-# spdevkit isn't yet merged to master
-SRC_URI = "git://git.trustedfirmware.org/OP-TEE/optee_os.git;protocol=https;branch=psa-development \
-    file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
-    file://0007-allow-setting-sysroot-for-clang.patch \
-"
-SRCREV = "f9de2c9520ed97b89760cc4c99424aae440b63f4"
-PV = "3.10+git${SRCPV}"
-
-S = "${WORKDIR}/git"
-B = "${WORKDIR}/build"
-
-EXTRA_OEMAKE += " \
-    PLATFORM=${OPTEEMACHINE} \
-    CFG_${OPTEE_CORE}_core=y \
-    CROSS_COMPILE_core=${HOST_PREFIX} \
-    CROSS_COMPILE_sp_${OPTEE_ARCH}=${HOST_PREFIX} \
-    CFG_CORE_FFA=y \
-    CFG_WITH_SP=y \
-    O=${B} \
-"
-
-CFLAGS[unexport] = "1"
-LDFLAGS[unexport] = "1"
-CPPFLAGS[unexport] = "1"
-AS[unexport] = "1"
-LD[unexport] = "1"
-
-do_configure[noexec] = "1"
-
-do_compile() {
-    oe_runmake -C ${S} sp_dev_kit
-}
-do_compile[cleandirs] = "${B}"
-
-do_install() {
-    #install SP devkit
-    install -d ${D}${includedir}/optee/export-user_sp/
-    for f in ${B}/export-sp_${OPTEE_ARCH}/* ; do
-        cp -aR $f ${D}${includedir}/optee/export-user_sp/
-    done
-    cat > ${D}${includedir}/optee/export-user_sp/include/stddef.h <<'EOF'
-#ifndef STDDEF_H
-#define STDDEF_H
-
-#include <stddef_.h>
-
-#ifndef _PTRDIFF_T
-typedef long ptrdiff_t;
-#define _PTRDIFF_T
-#endif
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define offsetof(st, m) __builtin_offsetof(st, m)
-
-#endif /* STDDEF_H */
-EOF
-    cat > ${D}${includedir}/optee/export-user_sp/include/stddef_.h <<'EOF'
-#ifndef STDDEF__H
-#define STDDEF__H
-
-#ifndef SIZET_
-typedef unsigned long size_t;
-#define SIZET_
-#endif
-
-#endif /* STDDEF__H */
-EOF
-    cat > ${D}${includedir}/optee/export-user_sp/include/stdarg.h <<'EOF'
-#ifndef STDARG_H
-#define STDARG_H
-
-#define va_list __builtin_va_list
-#define va_start(ap, last) __builtin_va_start(ap, last)
-#define va_end(ap) __builtin_va_end(ap)
-#define va_copy(to, from) __builtin_va_copy(to, from)
-#define va_arg(to, type) __builtin_va_arg(to, type)
-
-#endif /* STDARG_H */
-EOF
-    cat > ${D}${includedir}/optee/export-user_sp/include/stdbool.h <<'EOF'
-#ifndef STDBOOL_H
-#define STDBOOL_H
-
-#define bool	_Bool
-
-#define true	1
-#define false	0
-
-#define __bool_true_false_are_defined	1
-
-#endif /* STDBOOL_H */
-EOF
-
-cat > ${D}${includedir}/optee/export-user_sp/include/features.h <<'EOF'
-    #ifndef _FEATURES_H
-    #define _FEATURES_H
-    #if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
-    #define _GNU_SOURCE 1
-#endif
-    #if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
-    #define _BSD_SOURCE 1
-#endif
-    #if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
-     && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
-     && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
-    #define _BSD_SOURCE 1
-    #define _XOPEN_SOURCE 700
-#endif
-    #if __STDC_VERSION__ >= 199901L
-    #define __restrict restrict
-    #elif !defined(__GNUC__)
-    #define __restrict
-#endif
-    #if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
-    #define __inline inline
-    #elif !defined(__GNUC__)
-    #define __inline
-#endif
-    #if __STDC_VERSION__ >= 201112L
-    #elif defined(__GNUC__)
-    #define _Noreturn __attribute__((__noreturn__))
-#else
-    #define _Noreturn
-#endif
-    #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
-#endif
-EOF
-cat > ${D}${includedir}/optee/export-user_sp/include/errno.h <<'EOF'
-    #ifndef _ERRNO_H
-    #define _ERRNO_H
-    #include <features.h>
-    #define EPERM            1
-    #define ENOENT           2
-    #define ESRCH            3
-    #define EINTR            4
-    #define EIO              5
-    #define ENXIO            6
-    #define E2BIG            7
-    #define ENOEXEC          8
-    #define EBADF            9
-    #define ECHILD          10
-    #define EAGAIN          11
-    #define ENOMEM          12
-    #define EACCES          13
-    #define EFAULT          14
-    #define ENOTBLK         15
-    #define EBUSY           16
-    #define EEXIST          17
-    #define EXDEV           18
-    #define ENODEV          19
-    #define ENOTDIR         20
-    #define EISDIR          21
-    #define EINVAL          22
-    #define ENFILE          23
-    #define EMFILE          24
-    #define ENOTTY          25
-    #define ETXTBSY         26
-    #define EFBIG           27
-    #define ENOSPC          28
-    #define ESPIPE          29
-    #define EROFS           30
-    #define EMLINK          31
-    #define EPIPE           32
-    #define EDOM            33
-    #define ERANGE          34
-    #define EDEADLK         35
-    #define ENAMETOOLONG    36
-    #define ENOLCK          37
-    #define ENOSYS          38
-    #define ENOTEMPTY       39
-    #define ELOOP           40
-    #define EWOULDBLOCK     EAGAIN
-    #define ENOMSG          42
-    #define EIDRM           43
-    #define ECHRNG          44
-    #define EL2NSYNC        45
-    #define EL3HLT          46
-    #define EL3RST          47
-    #define ELNRNG          48
-    #define EUNATCH         49
-    #define ENOCSI          50
-    #define EL2HLT          51
-    #define EBADE           52
-    #define EBADR           53
-    #define EXFULL          54
-    #define ENOANO          55
-    #define EBADRQC         56
-    #define EBADSLT         57
-    #define EDEADLOCK       EDEADLK
-    #define EBFONT          59
-    #define ENOSTR          60
-    #define ENODATA         61
-    #define ETIME           62
-    #define ENOSR           63
-    #define ENONET          64
-    #define ENOPKG          65
-    #define EREMOTE         66
-    #define ENOLINK         67
-    #define EADV            68
-    #define ESRMNT          69
-    #define ECOMM           70
-    #define EPROTO          71
-    #define EMULTIHOP       72
-    #define EDOTDOT         73
-    #define EBADMSG         74
-    #define EOVERFLOW       75
-    #define ENOTUNIQ        76
-    #define EBADFD          77
-    #define EREMCHG         78
-    #define ELIBACC         79
-    #define ELIBBAD         80
-    #define ELIBSCN         81
-    #define ELIBMAX         82
-    #define ELIBEXEC        83
-    #define EILSEQ          84
-    #define ERESTART        85
-    #define ESTRPIPE        86
-    #define EUSERS          87
-    #define ENOTSOCK        88
-    #define EDESTADDRREQ    89
-    #define EMSGSIZE        90
-    #define EPROTOTYPE      91
-    #define ENOPROTOOPT     92
-    #define EPROTONOSUPPORT 93
-    #define ESOCKTNOSUPPORT 94
-    #define EOPNOTSUPP      95
-    #define ENOTSUP         EOPNOTSUPP
-    #define EPFNOSUPPORT    96
-    #define EAFNOSUPPORT    97
-    #define EADDRINUSE      98
-    #define EADDRNOTAVAIL   99
-    #define ENETDOWN        100
-    #define ENETUNREACH     101
-    #define ENETRESET       102
-    #define ECONNABORTED    103
-    #define ECONNRESET      104
-    #define ENOBUFS         105
-    #define EISCONN         106
-    #define ENOTCONN        107
-    #define ESHUTDOWN       108
-    #define ETOOMANYREFS    109
-    #define ETIMEDOUT       110
-    #define ECONNREFUSED    111
-    #define EHOSTDOWN       112
-    #define EHOSTUNREACH    113
-    #define EALREADY        114
-    #define EINPROGRESS     115
-    #define ESTALE          116
-    #define EUCLEAN         117
-    #define ENOTNAM         118
-    #define ENAVAIL         119
-    #define EISNAM          120
-    #define EREMOTEIO       121
-    #define EDQUOT          122
-    #define ENOMEDIUM       123
-    #define EMEDIUMTYPE     124
-    #define ECANCELED       125
-    #define ENOKEY          126
-    #define EKEYEXPIRED     127
-    #define EKEYREVOKED     128
-    #define EKEYREJECTED    129
-    #define EOWNERDEAD      130
-    #define ENOTRECOVERABLE 131
-    #define ERFKILL         132
-    #define EHWPOISON       133
-    #ifdef __GNUC__
-    __attribute__((const))
-#endif
-    int *__errno_location(void);
-    #define errno (*__errno_location())
-    #ifdef _GNU_SOURCE
-    extern char *program_invocation_short_name, *program_invocation_name;
-#endif
-#endif
-EOF
-}
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-COMPATIBLE_HOST = "aarch64.*-linux"
-
-# optee-spdevkit static library is part of optee-os image. No need to package this library in a staticdev package
-INSANE_SKIP:${PN}-dev = "staticdev"
-# Build paths are currently embedded
-INSANE_SKIP:${PN}-dev += "buildpaths"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0001-Pass-Yocto-build-settings-to-psa-arch-tests-native.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0001-Pass-Yocto-build-settings-to-psa-arch-tests-native.patch
new file mode 100644
index 0000000..516aa55
--- /dev/null
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/files/0001-Pass-Yocto-build-settings-to-psa-arch-tests-native.patch
@@ -0,0 +1,32 @@
+From 3f9b148fe3cad9f1bc6eb08ff8807c54dec5b8d9 Mon Sep 17 00:00:00 2001
+From: Anton Antonov <Anton.Antonov@arm.com>
+Date: Tue, 11 Oct 2022 16:17:15 +0100
+Subject: [PATCH] Pass Yocto build settings to psa-arch-tests native build
+
+PSA-arch-tests need to build a native executable as a part of target build.
+The patch defines correct toolchain settings for native builds.
+
+Upstream-Status: Inappropriate [Yocto build specific change]
+Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
+---
+ api-tests/tools/scripts/target_cfg/CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/api-tests/tools/scripts/target_cfg/CMakeLists.txt b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
+index 259eb9c..fec1fb8 100644
+--- a/api-tests/tools/scripts/target_cfg/CMakeLists.txt
++++ b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
+@@ -26,7 +26,9 @@ include("common/CMakeSettings")
+ include("common/Utils")
+ 
+ # Causes toolchain to be re-evaluated
+-unset(ENV{CC})
++set(ENV{CC} $ENV{BUILD_CC})
++set(ENV{CFLAGS} $ENV{BUILD_CFLAGS})
++set(ENV{LDFLAGS} $ENV{BUILD_LDFLAGS})
+ 
+ # Let the CMake look for C compiler
+ project(TargetConfigGen LANGUAGES C)
+-- 
+2.25.1
+
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0004-correctly-find-headers-dir.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0004-correctly-find-headers-dir.patch
deleted file mode 100644
index b73b5dc..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0004-correctly-find-headers-dir.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 1b9c8d4a7c9519c6085827da8be6546ce80ee711 Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:05:14 +0100
-Subject: [PATCH 1/4] Allow to find libgcc headers
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- external/newlib/newlib.cmake | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/external/newlib/newlib.cmake b/external/newlib/newlib.cmake
-index fff5e2a..13eb78c 100644
---- a/external/newlib/newlib.cmake
-+++ b/external/newlib/newlib.cmake
-@@ -82,7 +82,10 @@ message(STATUS "libgcc.a is used from ${LIBGCC_PATH}")
- # Moreover the GCC specific header file include directory is also required.
- # Specify LIBGCC_INCLUDE_DIRS in the command line to manually override the libgcc relative location below.
- if(NOT DEFINED LIBGCC_INCLUDE_DIRS)
--	get_filename_component(_TMP_VAR "${LIBGCC_PATH}" DIRECTORY)
-+
-+	# "libgcc.a" lib location in ${LIBGCC_PATH} might not contain a correct path to headers
-+	# We can get the correct path if we ask for a location without a library name
-+	gcc_get_lib_location(LIBRARY_NAME "" RES _TMP_VAR)
- 	set(LIBGCC_INCLUDE_DIRS
- 		"${_TMP_VAR}/include"
- 		"${_TMP_VAR}/include-fixed" CACHE STRING "GCC specific include PATHs")
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0005-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0005-setting-sysroot-for-libgcc-lookup.patch
deleted file mode 100644
index b226bc4..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0005-setting-sysroot-for-libgcc-lookup.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0fbf81d10e0f2aabb80105fabe4ffdf87e28e664 Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:06:07 +0100
-Subject: [PATCH 2/4] Allow setting sysroot for libgcc lookup
-
-Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching
-for the compiler libraries.
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- tools/cmake/compiler/GCC.cmake | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/cmake/compiler/GCC.cmake b/tools/cmake/compiler/GCC.cmake
-index 5a8fa59..d591c44 100644
---- a/tools/cmake/compiler/GCC.cmake
-+++ b/tools/cmake/compiler/GCC.cmake
-@@ -268,7 +268,7 @@ function(gcc_get_lib_location)
- 	cmake_parse_arguments(MY "${options}" "${oneValueArgs}"
- 						"${multiValueArgs}" ${ARGN} )
- 	execute_process(
--		COMMAND ${CMAKE_C_COMPILER} "--print-file-name=${MY_LIBRARY_NAME}"
-+		COMMAND ${CMAKE_C_COMPILER} ${LIBGCC_LOCATE_CFLAGS} --print-file-name=${MY_LIBRARY_NAME}
- 		OUTPUT_VARIABLE _RES
- 		RESULT_VARIABLE _GCC_ERROR_CODE
- 		OUTPUT_STRIP_TRAILING_WHITESPACE
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0006-applying-lowercase-project-convention.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0006-applying-lowercase-project-convention.patch
deleted file mode 100644
index 09f38c0..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0006-applying-lowercase-project-convention.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 37559c70443fe85e246f1f652045f0cd3c78012b Mon Sep 17 00:00:00 2001
-From: Vishnu Banavath <vishnu.banavath@arm.com>
-Date: Sat, 13 Nov 2021 07:47:44 +0000
-Subject: [PATCH] tools/cmake/common: applying lowercase project convention
-
-Lowercase convention should only apply on the paths inside TS
-source-code.
-Host build paths should not be lowercased. Otherwise, builds
-with uppercase paths will break.
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
-diff --git a/tools/cmake/common/AddPlatform.cmake b/tools/cmake/common/AddPlatform.cmake
-index ae34c6e..31bcd8c 100644
---- a/tools/cmake/common/AddPlatform.cmake
-+++ b/tools/cmake/common/AddPlatform.cmake
-@@ -37,8 +37,8 @@ function(add_platform)
- 	set(TGT ${MY_PARAMS_TARGET} CACHE STRING "")
- 
- 	# Ensure file path conforms to lowercase project convention
--	string(TOLOWER "${TS_PLATFORM_ROOT}/${TS_PLATFORM}/platform.cmake" _platdef)
--	include(${_platdef})
-+	string(TOLOWER "${TS_PLATFORM}/platform.cmake" _platdef)
-+	include(${TS_PLATFORM_ROOT}/${_platdef})
- 	set(CMAKE_CONFIGURE_DEPENDS ${_platdef})
- 
- 	unset(TGT CACHE)
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0009-PSA-CRYPTO-API-INCLUDE.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0009-PSA-CRYPTO-API-INCLUDE.patch
deleted file mode 100644
index 9054f1c..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0009-PSA-CRYPTO-API-INCLUDE.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 7f254bf14a97d14d19e61e2b8f8359bc238f3f1b Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:07:51 +0100
-Subject: [PATCH 3/4] Always define PSA_CRYPTO_API_INCLUDE
-
-PSA_CRYPTO_API_INCLUDE is not defined when pre-built mbedtls was used.
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- external/MbedTLS/MbedTLS.cmake | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/external/MbedTLS/MbedTLS.cmake b/external/MbedTLS/MbedTLS.cmake
-index 3193a07..f15e25d 100644
---- a/external/MbedTLS/MbedTLS.cmake
-+++ b/external/MbedTLS/MbedTLS.cmake
-@@ -96,8 +96,6 @@ if (NOT MBEDCRYPTO_LIB_FILE)
- 	#Configure Mbed TLS to build only mbedcrypto lib
- 	execute_process(COMMAND ${Python3_EXECUTABLE} scripts/config.py crypto WORKING_DIRECTORY ${MBEDTLS_SOURCE_DIR})
- 
--	# Advertise Mbed TLS as the provider of the psa crypto API
--	set(PSA_CRYPTO_API_INCLUDE "${MBEDTLS_INSTALL_DIR}/include" CACHE STRING "PSA Crypto API include path")
- 
- 	include(${TS_ROOT}/tools/cmake/common/PropertyCopy.cmake)
- 
-@@ -157,6 +155,9 @@ if (NOT MBEDCRYPTO_LIB_FILE)
- 	set(MBEDCRYPTO_LIB_FILE "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
- endif()
- 
-+# Advertise Mbed TLS as the provider of the psa crypto API
-+set(PSA_CRYPTO_API_INCLUDE "${MBEDTLS_INSTALL_DIR}/include" CACHE STRING "PSA Crypto API include path")
-+
- #Create an imported target to have clean abstraction in the build-system.
- add_library(mbedcrypto STATIC IMPORTED)
- set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${MBEDCRYPTO_LIB_FILE})
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0010-change-libts-to-export-CMake-package.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0010-change-libts-to-export-CMake-package.patch
deleted file mode 100644
index 169ef59..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0010-change-libts-to-export-CMake-package.patch
+++ /dev/null
@@ -1,346 +0,0 @@
-From 0ff5a6163bd2760bb6a61fd5a185a2b92da5e86b Mon Sep 17 00:00:00 2001
-From: Gyorgy Szing <Gyorgy.Szing@arm.com>
-Date: Wed, 20 Jul 2022 12:36:52 +0000
-Subject: [PATCH] Fix: change libts to export a CMake package
-
-libts install content was not compatible to find_module() which made
-using a pre-built libts binary from CMake less than ideal.
-
-This change adds the missing files and updates export and install
-commands to make libts generate a proper CMake package.
-
-From now on an external project will be able to use find_module() to
-integrate libts into its build.
-
-Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
-Change-Id: I9e86e02030f6fb3c86af45252110f939cb82670c
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
-
-diff --git a/components/messaging/ffa/libsp/component.cmake b/components/messaging/ffa/libsp/component.cmake
-index a21c630..ec4cf6c 100644
---- a/components/messaging/ffa/libsp/component.cmake
-+++ b/components/messaging/ffa/libsp/component.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -21,7 +21,7 @@
- 	"${CMAKE_CURRENT_LIST_DIR}/sp_rxtx.c"
- 	)
- 
--set_property(TARGET ${TGT} PROPERTY PUBLIC_HEADER
-+set_property(TARGET ${TGT} APPEND PROPERTY PUBLIC_HEADER
- 	${CMAKE_CURRENT_LIST_DIR}/include/ffa_api.h
- 	${CMAKE_CURRENT_LIST_DIR}/include/ffa_api_defines.h
- 	${CMAKE_CURRENT_LIST_DIR}/include/ffa_api_types.h
-@@ -49,5 +49,5 @@
- target_include_directories(${TGT}
- 	 PUBLIC
- 		"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
--		"$<INSTALL_INTERFACE:include>"
-+		"$<INSTALL_INTERFACE:${TS_ENV}/include">
- 	)
-diff --git a/components/rpc/common/interface/component.cmake b/components/rpc/common/interface/component.cmake
-index d567602..e4b2477 100644
---- a/components/rpc/common/interface/component.cmake
-+++ b/components/rpc/common/interface/component.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -8,11 +8,12 @@
- 	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
- endif()
- 
--set_property(TARGET ${TGT} PROPERTY RPC_CALLER_PUBLIC_HEADER_FILES
-+set_property(TARGET ${TGT} APPEND PROPERTY PUBLIC_HEADER
- 	"${CMAKE_CURRENT_LIST_DIR}/rpc_caller.h"
- 	"${CMAKE_CURRENT_LIST_DIR}/rpc_status.h"
- 	)
- 
- target_include_directories(${TGT} PUBLIC
--	"${CMAKE_CURRENT_LIST_DIR}"
-+	"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
-+	"$<INSTALL_INTERFACE:${TS_ENV}/include>"
- 	)
-diff --git a/components/service/locator/interface/component.cmake b/components/service/locator/interface/component.cmake
-index b5aefa3..84a4d75 100644
---- a/components/service/locator/interface/component.cmake
-+++ b/components/service/locator/interface/component.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -8,10 +8,11 @@
- 	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
- endif()
- 
--set_property(TARGET ${TGT} PROPERTY SERVICE_LOCATOR_PUBLIC_HEADER_FILES
-+set_property(TARGET ${TGT} APPEND PROPERTY PUBLIC_HEADER
- 	"${CMAKE_CURRENT_LIST_DIR}/service_locator.h"
- 	)
- 
- target_include_directories(${TGT} PUBLIC
--	"${CMAKE_CURRENT_LIST_DIR}"
-+	"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
-+	"$<INSTALL_INTERFACE:${TS_ENV}/include>"
- 	)
-diff --git a/deployments/libts/libts-import.cmake b/deployments/libts/libts-import.cmake
-index dcabc45..fcfc2ac 100644
---- a/deployments/libts/libts-import.cmake
-+++ b/deployments/libts/libts-import.cmake
-@@ -11,48 +11,18 @@
- # CMake build file allows libts to be built and installed into the binary
- # directory of the dependent.
- #-------------------------------------------------------------------------------
--
--# Determine the number of processes to run while running parallel builds.
--# Pass -DPROCESSOR_COUNT=<n> to cmake to override.
--if(NOT DEFINED PROCESSOR_COUNT)
--	include(ProcessorCount)
--	ProcessorCount(PROCESSOR_COUNT)
--	set(PROCESSOR_COUNT ${PROCESSOR_COUNT} CACHE STRING "Number of cores to use for parallel builds.")
-+option(CFG_FORCE_PREBUILT_LIBTS Off)
-+# Try to find a pre-build package.
-+find_package(libts "1.0.0" QUIET)
-+if(NOT libts_FOUND)
-+	if (CFG_FORCE_PREBUILT_LIBTS)
-+		string(CONCAT _msg "find_package() failed to find the \"libts\" package. Please set libts_DIR or"
-+		                   " CMAKE_FIND_ROOT_PATH properly.\n"
-+						   "If you wish to debug the search process pass -DCMAKE_FIND_DEBUG_MODE=ON to cmake.")
-+		message(FATAL_ERROR ${_msg})
-+	endif()
-+	# If not successful, build libts as a sub-project.
-+	add_subdirectory(${TS_ROOT}/deployments/libts/${TS_ENV} ${CMAKE_BINARY_DIR}/libts)
-+else()
-+	message(STATUS "Using prebuilt libts from ${libts_DIR}")
- endif()
--
--set(LIBTS_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/libts_install" CACHE PATH "libts installation directory")
--set(LIBTS_PACKAGE_PATH "${LIBTS_INSTALL_PATH}/lib/cmake" CACHE PATH "libts CMake package directory")
--set(LIBTS_SOURCE_DIR "${TS_ROOT}/deployments/libts/${TS_ENV}" CACHE PATH "libts source directory")
--set(LIBTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/libts-build" CACHE PATH "libts binary directory")
--
--file(MAKE_DIRECTORY ${LIBTS_BINARY_DIR})
--
--#Configure the library
--execute_process(COMMAND
--	${CMAKE_COMMAND}
--		-DCMAKE_INSTALL_PREFIX=${LIBTS_INSTALL_PATH}
--		-GUnix\ Makefiles
--		-S ${LIBTS_SOURCE_DIR}
--		-B ${LIBTS_BINARY_DIR}
--	RESULT_VARIABLE _exec_error
--)
--
--if (_exec_error)
--	message(FATAL_ERROR "Configuration step of libts failed with ${_exec_error}.")
--endif()
--
--#Build the library
--execute_process(COMMAND
--	${CMAKE_COMMAND} --build ${LIBTS_BINARY_DIR} --parallel ${PROCESSOR_COUNT} --target install
--	RESULT_VARIABLE _exec_error
--)
--
--if (_exec_error)
--	message(FATAL_ERROR "Build step of libts failed with ${_exec_error}.")
--endif()
--
--# Import the built library
--include(${LIBTS_INSTALL_PATH}/${TS_ENV}/lib/cmake/libts_targets.cmake)
--add_library(libts SHARED IMPORTED)
--set_property(TARGET libts PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${LIBTS_INSTALL_PATH}/${TS_ENV}/include")
--set_property(TARGET libts PROPERTY IMPORTED_LOCATION "${LIBTS_INSTALL_PATH}/${TS_ENV}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}ts${CMAKE_SHARED_LIBRARY_SUFFIX}")
-diff --git a/deployments/libts/libts.cmake b/deployments/libts/libts.cmake
-index 6463ca1..7f278fd 100644
---- a/deployments/libts/libts.cmake
-+++ b/deployments/libts/libts.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -18,12 +18,11 @@
- 					MAJOR _major MINOR _minor PATCH _patch)
- set_target_properties(ts PROPERTIES VERSION "${_major}.${_minor}.${_patch}")
- set_target_properties(ts PROPERTIES SOVERSION "${_major}")
--unset(_major)
--unset(_minor)
--unset(_patch)
-+
-+add_library(libts::ts ALIAS ts)
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-@@ -53,19 +52,13 @@
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/tools/cmake/common/ExportLibrary.cmake REQUIRED)
- 
--# Select public header files to export
--get_property(_rpc_caller_public_header_files TARGET ts
--	PROPERTY RPC_CALLER_PUBLIC_HEADER_FILES
--)
--
--get_property(_service_locator_public_header_files TARGET ts
--	PROPERTY SERVICE_LOCATOR_PUBLIC_HEADER_FILES
--)
-+get_property(_tmp TARGET ts PROPERTY PUBLIC_HEADER)
- 
- # Exports library information in preparation for install
- export_library(
- 	TARGET "ts"
- 	LIB_NAME "libts"
-+	PKG_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/libtsConfig.cmake.in"
- 	INTERFACE_FILES
- 		${_rpc_caller_public_header_files}
- 		${_service_locator_public_header_files}
-diff --git a/deployments/libts/libtsConfig.cmake.in b/deployments/libts/libtsConfig.cmake.in
-new file mode 100644
-index 0000000..4860135
---- /dev/null
-+++ b/deployments/libts/libtsConfig.cmake.in
-@@ -0,0 +1,10 @@
-+#
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+
-+@PACKAGE_INIT@
-+
-+include("${CMAKE_CURRENT_LIST_DIR}/libtsTargets.cmake")
-+
-diff --git a/tools/cmake/common/ExportLibrary.cmake b/tools/cmake/common/ExportLibrary.cmake
-index fed4e75..4fcf481 100644
---- a/tools/cmake/common/ExportLibrary.cmake
-+++ b/tools/cmake/common/ExportLibrary.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -26,17 +26,29 @@
- #]===]
- function(export_library)
- 	set(options  )
--	set(oneValueArgs TARGET LIB_NAME)
-+	set(oneValueArgs TARGET LIB_NAME PKG_CONFIG_FILE)
- 	set(multiValueArgs INTERFACE_FILES)
- 	cmake_parse_arguments(MY_PARAMS "${options}" "${oneValueArgs}"
- 						"${multiValueArgs}" ${ARGN} )
- 
--	if(NOT DEFINED MY_PARAMS_TARGET)
--		message(FATAL_ERROR "export_library: mandatory parameter TARGET not defined!")
-+	foreach(_param IN ITEMS MY_PARAMS_TARGET MY_PARAMS_LIB_NAME MY_PARAMS_PKG_CONFIG_FILE)
-+		if(NOT DEFINED ${_param})
-+			list(APPEND _miss_params "${_param}" )
-+		endif()
-+	endforeach()
-+
-+	if (_miss_params)
-+		string(REPLACE ";" ", " _miss_params "${_miss_params}")
-+		message(FATAL_ERROR "export_library: mandatory parameter(s) ${_miss_params} not defined!")
- 	endif()
--	if(NOT DEFINED MY_PARAMS_LIB_NAME)
--		message(FATAL_ERROR "export_library: mandatory parameter LIB_NAME not defined!")
--	endif()
-+
-+
-+	string(TOUPPER "${MY_PARAMS_LIB_NAME}" UC_LIB_NAME)
-+	string(TOLOWER "${MY_PARAMS_LIB_NAME}" LC_LIB_NAME)
-+	string(SUBSTRING "${UC_LIB_NAME}" 0 1 CAP_LIB_NAME)
-+	string(SUBSTRING "${LC_LIB_NAME}" 1 -1 _tmp)
-+	string(APPEND CAP_LIB_NAME "${_tmp}")
-+
- 
- 	# Set default install location if none specified
- 	if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-@@ -55,6 +67,42 @@
- 			DESTINATION ${TS_ENV}/include
- 	)
- 
-+	# Create a config file package.
-+	include(CMakePackageConfigHelpers)
-+	get_target_property(_ver ${MY_PARAMS_TARGET} VERSION)
-+	write_basic_package_version_file(
-+		"${CMAKE_CURRENT_BINARY_DIR}/${LC_LIB_NAME}ConfigVersion.cmake"
-+		VERSION "${_ver}"
-+		COMPATIBILITY SameMajorVersion
-+	)
-+
-+	# Create targets file.
-+	export(
-+		EXPORT
-+			${MY_PARAMS_LIB_NAME}_targets
-+		FILE
-+			"${CMAKE_CURRENT_BINARY_DIR}/${MY_PARAMS_LIB_NAME}Targets.cmake"
-+		NAMESPACE
-+			${MY_PARAMS_LIB_NAME}::
-+	)
-+
-+	# Finalize config file.
-+	# Config package location relative to install root.
-+	set(ConfigPackageLocation ${TS_ENV}/lib/cmake)
-+	# Config package location ??
-+	get_filename_component(ConfigPackageLocationRel ${ConfigPackageLocation} PATH)
-+
-+	get_filename_component(_configured_pkgcfg_name "${MY_PARAMS_PKG_CONFIG_FILE}" NAME_WLE)
-+	set(_configured_pkgcfg_name "${CMAKE_CURRENT_BINARY_DIR}/${_configured_pkgcfg_name}")
-+	configure_package_config_file(
-+			"${MY_PARAMS_PKG_CONFIG_FILE}"
-+			"${_configured_pkgcfg_name}"
-+		PATH_VARS
-+
-+		INSTALL_DESTINATION
-+			${ConfigPackageLocationRel}
-+	)
-+
- 	# Install library header files files
- 	install(
- 		FILES ${MY_PARAMS_INTERFACE_FILES}
-@@ -64,9 +112,21 @@
- 	# Install the export details
- 	install(
- 		EXPORT ${MY_PARAMS_LIB_NAME}_targets
--		FILE ${MY_PARAMS_LIB_NAME}_targets.cmake
-+		FILE ${MY_PARAMS_LIB_NAME}Targets.cmake
- 		NAMESPACE ${MY_PARAMS_LIB_NAME}::
--		DESTINATION ${TS_ENV}/lib/cmake
-+		DESTINATION ${ConfigPackageLocation}
- 		COMPONENT ${MY_PARAMS_LIB_NAME}
- 	)
-+
-+
-+	# install config and version files
-+	install(
-+		FILES
-+			"${_configured_pkgcfg_name}"
-+			"${CMAKE_CURRENT_BINARY_DIR}/${LC_LIB_NAME}ConfigVersion.cmake"
-+		DESTINATION
-+			${ConfigPackageLocation}
-+		COMPONENT
-+			${MY_PARAMS_LIB_NAME}
-+	)
- endfunction()
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0011-Adapt-deployments-to-libts-changes.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0011-Adapt-deployments-to-libts-changes.patch
deleted file mode 100644
index 34b1035..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0011-Adapt-deployments-to-libts-changes.patch
+++ /dev/null
@@ -1,197 +0,0 @@
-From dfadca01ff028f9fc935937cdaf92b0effff2b90 Mon Sep 17 00:00:00 2001
-From: Gyorgy Szing <Gyorgy.Szing@arm.com>
-Date: Wed, 20 Jul 2022 16:49:39 +0000
-Subject: [PATCH] Adapt deployments to libts changes
-
-Update deployments and restore compatibility to libts build-system
-interface changes.
-
-Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
-Change-Id: Iffd38f92fe628a2a6aaff60224986f22ec3a8a2a
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
-
-diff --git a/deployments/platform-inspect/platform-inspect.cmake b/deployments/platform-inspect/platform-inspect.cmake
-index ef4ba4b..b1b316d 100644
---- a/deployments/platform-inspect/platform-inspect.cmake
-+++ b/deployments/platform-inspect/platform-inspect.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -12,14 +12,14 @@
- 
- #-------------------------------------------------------------------------------
- #  Use libts for locating and accessing trusted services. An appropriate version
--#  of libts will be imported for the enviroment in which platform-inspect is
-+#  of libts will be imported for the environment in which platform-inspect is
- #  built.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(platform-inspect PRIVATE libts)
-+target_link_libraries(platform-inspect PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-diff --git a/deployments/psa-api-test/psa-api-test.cmake b/deployments/psa-api-test/psa-api-test.cmake
-index d58620f..5c3469c 100644
---- a/deployments/psa-api-test/psa-api-test.cmake
-+++ b/deployments/psa-api-test/psa-api-test.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -12,14 +12,14 @@
- 
- #-------------------------------------------------------------------------------
- #  Use libts for locating and accessing services. An appropriate version of
--#  libts will be imported for the enviroment in which service tests are
-+#  libts will be imported for the environment in which service tests are
- #  deployed.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(${PROJECT_NAME} PRIVATE libts)
-+target_link_libraries(${PROJECT_NAME} PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-diff --git a/deployments/ts-demo/ts-demo.cmake b/deployments/ts-demo/ts-demo.cmake
-index 3e7cca0..9fd8585 100644
---- a/deployments/ts-demo/ts-demo.cmake
-+++ b/deployments/ts-demo/ts-demo.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -13,11 +13,11 @@
- 
- #-------------------------------------------------------------------------------
- #  Use libts for locating and accessing services. An appropriate version of
--#  libts will be imported for the enviroment in which service tests are
-+#  libts will be imported for the environment in which service tests are
- #  deployed.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(ts-demo PRIVATE libts)
-+target_link_libraries(ts-demo PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
- #  Common main for all deployments
-@@ -28,7 +28,7 @@
- )
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-diff --git a/deployments/ts-remote-test/ts-remote-test.cmake b/deployments/ts-remote-test/ts-remote-test.cmake
-index 0f35bb2..c310445 100644
---- a/deployments/ts-remote-test/ts-remote-test.cmake
-+++ b/deployments/ts-remote-test/ts-remote-test.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -13,11 +13,11 @@
- 
- #-------------------------------------------------------------------------------
- #  Use libts for locating and accessing services. An appropriate version of
--#  libts will be imported for the enviroment in which tests are
-+#  libts will be imported for the environment in which tests are
- #  deployed.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(ts-remote-test PRIVATE libts)
-+target_link_libraries(ts-remote-test PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
- #  Common main for all deployments
-@@ -28,7 +28,7 @@
- )
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-diff --git a/deployments/ts-service-test/ts-service-test.cmake b/deployments/ts-service-test/ts-service-test.cmake
-index 4a8c59c..3e33757 100644
---- a/deployments/ts-service-test/ts-service-test.cmake
-+++ b/deployments/ts-service-test/ts-service-test.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -8,19 +8,19 @@
- #-------------------------------------------------------------------------------
- #  The base build file shared between deployments of 'ts-service-test' for
- #  different environments.  Used for running end-to-end service-level tests
--#  where test cases excerise trusted service client interfaces.
-+#  where test cases exercise trusted service client interfaces.
- #-------------------------------------------------------------------------------
- 
- #-------------------------------------------------------------------------------
- #  Use libts for locating and accessing services. An appropriate version of
--#  libts will be imported for the enviroment in which service tests are
-+#  libts will be imported for the environment in which service tests are
- #  deployed.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(ts-service-test PRIVATE libts)
-+target_link_libraries(ts-service-test PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
--#  Components that are common accross all deployments
-+#  Components that are common across all deployments
- #
- #-------------------------------------------------------------------------------
- add_components(
-diff --git a/deployments/uefi-test/uefi-test.cmake b/deployments/uefi-test/uefi-test.cmake
-index ea678d0..2f47891 100644
---- a/deployments/uefi-test/uefi-test.cmake
-+++ b/deployments/uefi-test/uefi-test.cmake
-@@ -1,5 +1,5 @@
- #-------------------------------------------------------------------------------
--# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -18,7 +18,7 @@
- #  deployed.
- #-------------------------------------------------------------------------------
- include(${TS_ROOT}/deployments/libts/libts-import.cmake)
--target_link_libraries(uefi-test PRIVATE libts)
-+target_link_libraries(uefi-test PRIVATE libts::ts)
- 
- #-------------------------------------------------------------------------------
- #  Components that are common accross all deployments
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0012-psa-arch-test-toolchain.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0012-psa-arch-test-toolchain.patch
deleted file mode 100644
index 7d07fca..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0012-psa-arch-test-toolchain.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 1ce8fcde17a6d2c5cb2e00901d485c91eda776fd Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:09:17 +0100
-Subject: [PATCH 4/4] Pass Yocto build settings to psa-arch-tests native build
-
-PSA-arch-tests need to build a native executable as a part of target build.
-The patch defines correct toolchain settings for native builds.
-
-Upstream-Status: Inappropriate [Yocto build specific change]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- .../psa_arch_tests/modify_attest_config.patch     | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/external/psa_arch_tests/modify_attest_config.patch b/external/psa_arch_tests/modify_attest_config.patch
-index ebe8c44..b5d5e88 100644
---- a/external/psa_arch_tests/modify_attest_config.patch
-+++ b/external/psa_arch_tests/modify_attest_config.patch
-@@ -11,3 +11,18 @@ index 6112ba7..1cdf581 100755
-  
-  /*
-   * Include of PSA defined Header files
-+diff --git a/api-tests/tools/scripts/target_cfg/CMakeLists.txt b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
-+index 259eb9c..fec1fb8 100644
-+--- a/api-tests/tools/scripts/target_cfg/CMakeLists.txt
-++++ b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
-+@@ -26,7 +26,9 @@ include("common/CMakeSettings")
-+ include("common/Utils")
-+ 
-+ # Causes toolchain to be re-evaluated
-+-unset(ENV{CC})
-++set(ENV{CC} $ENV{BUILD_CC})
-++set(ENV{CFLAGS} $ENV{BUILD_CFLAGS})
-++set(ENV{LDFLAGS} $ENV{BUILD_LDFLAGS})
-+ 
-+ # Let the CMake look for C compiler
-+ project(TargetConfigGen LANGUAGES C)
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0017-Move-libsp-mocks-into-separate-component.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0017-Move-libsp-mocks-into-separate-component.patch
deleted file mode 100644
index d6da370..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0017-Move-libsp-mocks-into-separate-component.patch
+++ /dev/null
@@ -1,349 +0,0 @@
-From 2cd802030ab59787a34c0f6684c16848befabafa Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Wed, 15 Jun 2022 12:47:37 +0200
-Subject: [PATCH 17/24] Move libsp mocks into separate component
-
-Enable deployments to include libsp mocks in tests by simply adding
-the newly created libsp mock component.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I40805fd49362c6cc71b5b34f9ba888d27ce01ed8
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../messaging/ffa/libsp/mock/component.cmake  | 27 ++++++++++
- .../ffa/libsp/{test => mock}/mock_assert.cpp  |  0
- .../ffa/libsp/{test => mock}/mock_assert.h    |  0
- .../ffa/libsp/{test => mock}/mock_ffa_api.cpp |  0
- .../ffa/libsp/{test => mock}/mock_ffa_api.h   |  0
- .../{test => mock}/mock_ffa_internal_api.cpp  |  0
- .../{test => mock}/mock_ffa_internal_api.h    |  0
- .../ffa/libsp/{test => mock}/mock_sp_rxtx.cpp |  0
- .../ffa/libsp/{test => mock}/mock_sp_rxtx.h   |  0
- .../{ => mock}/test/test_mock_assert.cpp      |  0
- .../{ => mock}/test/test_mock_ffa_api.cpp     |  0
- .../test/test_mock_ffa_internal_api.cpp       |  0
- .../{ => mock}/test/test_mock_sp_rxtx.cpp     |  0
- components/messaging/ffa/libsp/tests.cmake    | 51 +++++++++++--------
- .../mm_communicate/endpoint/sp/tests.cmake    |  6 +--
- .../frontend/mm_communicate/tests.cmake       |  6 +--
- 16 files changed, 64 insertions(+), 26 deletions(-)
- create mode 100644 components/messaging/ffa/libsp/mock/component.cmake
- rename components/messaging/ffa/libsp/{test => mock}/mock_assert.cpp (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_assert.h (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_ffa_api.cpp (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_ffa_api.h (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_ffa_internal_api.cpp (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_ffa_internal_api.h (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_sp_rxtx.cpp (100%)
- rename components/messaging/ffa/libsp/{test => mock}/mock_sp_rxtx.h (100%)
- rename components/messaging/ffa/libsp/{ => mock}/test/test_mock_assert.cpp (100%)
- rename components/messaging/ffa/libsp/{ => mock}/test/test_mock_ffa_api.cpp (100%)
- rename components/messaging/ffa/libsp/{ => mock}/test/test_mock_ffa_internal_api.cpp (100%)
- rename components/messaging/ffa/libsp/{ => mock}/test/test_mock_sp_rxtx.cpp (100%)
-
-diff --git a/components/messaging/ffa/libsp/mock/component.cmake b/components/messaging/ffa/libsp/mock/component.cmake
-new file mode 100644
-index 0000000..03b8006
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/component.cmake
-@@ -0,0 +1,27 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+if (NOT DEFINED TGT)
-+	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
-+endif()
-+
-+target_sources(${TGT} PRIVATE
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_assert.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_api.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_internal_api.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_rxtx.cpp"
-+	)
-+
-+target_include_directories(${TGT}
-+	PUBLIC
-+		${CMAKE_CURRENT_LIST_DIR}
-+		${CMAKE_CURRENT_LIST_DIR}/../include
-+)
-+
-+target_compile_definitions(${TGT}
-+	PUBLIC
-+		"ARM64=1"
-+)
-\ No newline at end of file
-diff --git a/components/messaging/ffa/libsp/test/mock_assert.cpp b/components/messaging/ffa/libsp/mock/mock_assert.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_assert.cpp
-rename to components/messaging/ffa/libsp/mock/mock_assert.cpp
-diff --git a/components/messaging/ffa/libsp/test/mock_assert.h b/components/messaging/ffa/libsp/mock/mock_assert.h
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_assert.h
-rename to components/messaging/ffa/libsp/mock/mock_assert.h
-diff --git a/components/messaging/ffa/libsp/test/mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_ffa_api.cpp
-rename to components/messaging/ffa/libsp/mock/mock_ffa_api.cpp
-diff --git a/components/messaging/ffa/libsp/test/mock_ffa_api.h b/components/messaging/ffa/libsp/mock/mock_ffa_api.h
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_ffa_api.h
-rename to components/messaging/ffa/libsp/mock/mock_ffa_api.h
-diff --git a/components/messaging/ffa/libsp/test/mock_ffa_internal_api.cpp b/components/messaging/ffa/libsp/mock/mock_ffa_internal_api.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_ffa_internal_api.cpp
-rename to components/messaging/ffa/libsp/mock/mock_ffa_internal_api.cpp
-diff --git a/components/messaging/ffa/libsp/test/mock_ffa_internal_api.h b/components/messaging/ffa/libsp/mock/mock_ffa_internal_api.h
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_ffa_internal_api.h
-rename to components/messaging/ffa/libsp/mock/mock_ffa_internal_api.h
-diff --git a/components/messaging/ffa/libsp/test/mock_sp_rxtx.cpp b/components/messaging/ffa/libsp/mock/mock_sp_rxtx.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_sp_rxtx.cpp
-rename to components/messaging/ffa/libsp/mock/mock_sp_rxtx.cpp
-diff --git a/components/messaging/ffa/libsp/test/mock_sp_rxtx.h b/components/messaging/ffa/libsp/mock/mock_sp_rxtx.h
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/mock_sp_rxtx.h
-rename to components/messaging/ffa/libsp/mock/mock_sp_rxtx.h
-diff --git a/components/messaging/ffa/libsp/test/test_mock_assert.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_assert.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/test_mock_assert.cpp
-rename to components/messaging/ffa/libsp/mock/test/test_mock_assert.cpp
-diff --git a/components/messaging/ffa/libsp/test/test_mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/test_mock_ffa_api.cpp
-rename to components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp
-diff --git a/components/messaging/ffa/libsp/test/test_mock_ffa_internal_api.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_internal_api.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/test_mock_ffa_internal_api.cpp
-rename to components/messaging/ffa/libsp/mock/test/test_mock_ffa_internal_api.cpp
-diff --git a/components/messaging/ffa/libsp/test/test_mock_sp_rxtx.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_sp_rxtx.cpp
-similarity index 100%
-rename from components/messaging/ffa/libsp/test/test_mock_sp_rxtx.cpp
-rename to components/messaging/ffa/libsp/mock/test/test_mock_sp_rxtx.cpp
-diff --git a/components/messaging/ffa/libsp/tests.cmake b/components/messaging/ffa/libsp/tests.cmake
-index d851442..296ae46 100644
---- a/components/messaging/ffa/libsp/tests.cmake
-+++ b/components/messaging/ffa/libsp/tests.cmake
-@@ -1,5 +1,5 @@
- #
--# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
-+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -9,10 +9,11 @@ include(UnitTest)
- unit_test_add_suite(
- 	NAME libsp_mock_assert
- 	SOURCES
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_assert.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_assert.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_assert.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_assert.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -21,10 +22,11 @@ unit_test_add_suite(
- unit_test_add_suite(
- 	NAME libsp_mock_ffa_internal_api
- 	SOURCES
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_internal_api.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_ffa_internal_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_internal_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_ffa_internal_api.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -35,12 +37,13 @@ unit_test_add_suite(
- 	SOURCES
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_ffa_api.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_ffa_memory_descriptors.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_internal_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_internal_api.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/ffa.c
- 		${CMAKE_CURRENT_LIST_DIR}/ffa_memory_descriptors.c
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_assert.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_assert.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -49,10 +52,11 @@ unit_test_add_suite(
- unit_test_add_suite(
- 	NAME libsp_mock_ffa_api
- 	SOURCES
--		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_ffa_api.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -62,10 +66,11 @@ unit_test_add_suite(
- 	NAME libsp_sp_rxtx
- 	SOURCES
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_rxtx.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/sp_rxtx.c
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -74,10 +79,11 @@ unit_test_add_suite(
- unit_test_add_suite(
- 	NAME libsp_mock_sp_rxtx
- 	SOURCES
--		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_sp_rxtx.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_sp_rxtx.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_sp_rxtx.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_rxtx.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -88,10 +94,11 @@ unit_test_add_suite(
- 	SOURCES
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_discovery.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/sp_discovery.c
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_sp_rxtx.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_rxtx.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -103,11 +110,12 @@ unit_test_add_suite(
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_memory_management.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/sp_memory_management.c
- 		${CMAKE_CURRENT_LIST_DIR}/ffa_memory_descriptors.c
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_assert.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_sp_rxtx.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_assert.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_rxtx.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -119,9 +127,10 @@ unit_test_add_suite(
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_memory_management_internals.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/test/sp_memory_management_internals.yml
- 		${CMAKE_CURRENT_LIST_DIR}/ffa_memory_descriptors.c
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_assert.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_assert.cpp
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -131,10 +140,11 @@ unit_test_add_suite(
- 	NAME libsp_sp_messaging
- 	SOURCES
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_messaging.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/sp_messaging.c
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-@@ -144,11 +154,12 @@ unit_test_add_suite(
- 	NAME libsp_sp_messaging_with_routing_extension
- 	SOURCES
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_sp_messaging.cpp
--		${CMAKE_CURRENT_LIST_DIR}/test/mock_ffa_api.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_ffa_api.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/sp_messaging.c
- 		${CMAKE_CURRENT_LIST_DIR}/ffa_direct_msg_routing_extension.c
- 	INCLUDE_DIRECTORIES
- 		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 	COMPILE_DEFINITIONS
- 		-DARM64
-diff --git a/components/rpc/mm_communicate/endpoint/sp/tests.cmake b/components/rpc/mm_communicate/endpoint/sp/tests.cmake
-index 318f14d..c68a0c7 100644
---- a/components/rpc/mm_communicate/endpoint/sp/tests.cmake
-+++ b/components/rpc/mm_communicate/endpoint/sp/tests.cmake
-@@ -1,5 +1,5 @@
- #
--# Copyright (c) 2021, Arm Limited. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -13,12 +13,12 @@ unit_test_add_suite(
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_mm_communicate_call_ep.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/test/mock_mm_service.cpp
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_mm_service.cpp
--		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/test/mock_assert.cpp
-+		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/mock/mock_assert.cpp
- 	INCLUDE_DIRECTORIES
- 		${UNIT_TEST_PROJECT_PATH}
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/include
--		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/test
-+		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/rpc/common/interface
- 	COMPILE_DEFINITIONS
- 		-DARM64
-diff --git a/components/service/smm_variable/frontend/mm_communicate/tests.cmake b/components/service/smm_variable/frontend/mm_communicate/tests.cmake
-index d1f930c..50b0b9a 100644
---- a/components/service/smm_variable/frontend/mm_communicate/tests.cmake
-+++ b/components/service/smm_variable/frontend/mm_communicate/tests.cmake
-@@ -1,5 +1,5 @@
- #
--# Copyright (c) 2021, Arm Limited. All rights reserved.
-+# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
- #
- # SPDX-License-Identifier: BSD-3-Clause
- #
-@@ -12,13 +12,13 @@ unit_test_add_suite(
- 		${CMAKE_CURRENT_LIST_DIR}/smm_variable_mm_service.c
- 		${CMAKE_CURRENT_LIST_DIR}/test/test_smm_variable_mm_service.cpp
- 		${UNIT_TEST_PROJECT_PATH}/components/rpc/common/test/mock_rpc_interface.cpp
--		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/test/mock_assert.cpp
-+		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/mock/mock_assert.cpp
- 	INCLUDE_DIRECTORIES
- 		${UNIT_TEST_PROJECT_PATH}
- 		${UNIT_TEST_PROJECT_PATH}/components/rpc/mm_communicate/endpoint/sp
- 		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
- 		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/include
--		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/test
-+		${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp/mock
- 		${UNIT_TEST_PROJECT_PATH}/components/rpc/common/interface
- 	COMPILE_DEFINITIONS
- 		-DARM64
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0018-Add-mock-for-libsp-sp_discovery.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0018-Add-mock-for-libsp-sp_discovery.patch
deleted file mode 100644
index b385b7a..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0018-Add-mock-for-libsp-sp_discovery.patch
+++ /dev/null
@@ -1,339 +0,0 @@
-From e9ff55c03e06c044eb9c13f2a3315bf7e35f3659 Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Fri, 17 Jun 2022 13:51:21 +0200
-Subject: [PATCH 18/24] Add mock for libsp/sp_discovery
-
-Add mock_sp_discovery for mocking sp_discovery part of libsp.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I94460dc03dd6dcd27f6865f852cc9a0d85f4b583
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../messaging/ffa/libsp/mock/component.cmake  |   1 +
- .../ffa/libsp/mock/mock_sp_discovery.cpp      | 109 +++++++++++++++++
- .../ffa/libsp/mock/mock_sp_discovery.h        |  37 ++++++
- .../mock/test/test_mock_sp_discovery.cpp      | 111 ++++++++++++++++++
- components/messaging/ffa/libsp/tests.cmake    |  13 ++
- 5 files changed, 271 insertions(+)
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_discovery.cpp
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_discovery.h
- create mode 100644 components/messaging/ffa/libsp/mock/test/test_mock_sp_discovery.cpp
-
-diff --git a/components/messaging/ffa/libsp/mock/component.cmake b/components/messaging/ffa/libsp/mock/component.cmake
-index 03b8006..15db85a 100644
---- a/components/messaging/ffa/libsp/mock/component.cmake
-+++ b/components/messaging/ffa/libsp/mock/component.cmake
-@@ -12,6 +12,7 @@ target_sources(${TGT} PRIVATE
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_assert.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_api.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_internal_api.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_discovery.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_rxtx.cpp"
- 	)
- 
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_discovery.cpp b/components/messaging/ffa/libsp/mock/mock_sp_discovery.cpp
-new file mode 100644
-index 0000000..47f4ef7
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_discovery.cpp
-@@ -0,0 +1,109 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include "mock_sp_discovery.h"
-+
-+void expect_sp_discovery_ffa_version_get(const uint16_t *major,
-+					 const uint16_t *minor,
-+					 sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_discovery_ffa_version_get")
-+		.withOutputParameterReturning("major", major, sizeof(*major))
-+		.withOutputParameterReturning("minor", minor, sizeof(*minor))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_discovery_ffa_version_get(uint16_t *major, uint16_t *minor)
-+{
-+	return mock()
-+		.actualCall("sp_discovery_ffa_version_get")
-+		.withOutputParameter("major", major)
-+		.withOutputParameter("minor", minor)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_discovery_own_id_get(const uint16_t *id, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_discovery_own_id_get")
-+		.withOutputParameterReturning("id", id, sizeof(*id))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_discovery_own_id_get(uint16_t *id)
-+{
-+	return mock()
-+		.actualCall("sp_discovery_own_id_get")
-+		.withOutputParameter("id", id)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_discovery_partition_id_get(const struct sp_uuid *uuid,
-+					  const uint16_t *id, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_discovery_partition_id_get")
-+		.withMemoryBufferParameter("uuid", (const unsigned char *)uuid,
-+					   sizeof(*uuid))
-+		.withOutputParameterReturning("id", id, sizeof(*id))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_discovery_partition_id_get(const struct sp_uuid *uuid,
-+					uint16_t *id)
-+{
-+	return mock()
-+		.actualCall("sp_discovery_partition_id_get")
-+		.withMemoryBufferParameter("uuid", (const unsigned char *)uuid,
-+					   sizeof(*uuid))
-+		.withOutputParameter("id", id)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_discovery_partition_info_get(const struct sp_uuid *uuid,
-+					  const struct sp_partition_info *info,
-+					  sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_discovery_partition_info_get")
-+		.withMemoryBufferParameter("uuid", (const unsigned char *)uuid,
-+					   sizeof(*uuid))
-+		.withOutputParameterReturning("info", info, sizeof(*info))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_discovery_partition_info_get(const struct sp_uuid *uuid,
-+					  struct sp_partition_info *info)
-+{
-+	return mock()
-+		.actualCall("sp_discovery_partition_info_get")
-+		.withMemoryBufferParameter("uuid", (const unsigned char *)uuid,
-+					   sizeof(*uuid))
-+		.withOutputParameter("info", info)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_discovery_partition_info_get_all(const struct sp_partition_info info[],
-+						const uint32_t *count,
-+						sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_discovery_partition_info_get_all")
-+		.withOutputParameterReturning("info", info, sizeof(*info) * *count)
-+		.withOutputParameterReturning("count", count, sizeof(*count))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_discovery_partition_info_get_all(struct sp_partition_info info[],
-+					      uint32_t *count)
-+{
-+	return mock()
-+		.actualCall("sp_discovery_partition_info_get_all")
-+		.withOutputParameter("info", info)
-+		.withOutputParameter("count", count)
-+		.returnIntValue();
-+}
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_discovery.h b/components/messaging/ffa/libsp/mock/mock_sp_discovery.h
-new file mode 100644
-index 0000000..a71ce18
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_discovery.h
-@@ -0,0 +1,37 @@
-+/* SPDX-License-Identifier: BSD-3-Clause */
-+/*
-+ * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
-+ */
-+
-+#ifndef LIBSP_MOCK_MOCK_SP_DISCOVERY_H_
-+#define LIBSP_MOCK_MOCK_SP_DISCOVERY_H_
-+
-+#include "../include/sp_discovery.h"
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+void expect_sp_discovery_ffa_version_get(const uint16_t *major,
-+					 const uint16_t *minor,
-+					 sp_result result);
-+
-+void expect_sp_discovery_own_id_get(const uint16_t *id, sp_result result);
-+
-+void expect_sp_discovery_partition_id_get(const struct sp_uuid *uuid,
-+					  const uint16_t *id, sp_result result);
-+
-+
-+void expect_sp_discovery_partition_info_get(const struct sp_uuid *uuid,
-+					    const struct sp_partition_info *info,
-+					    sp_result result);
-+
-+void expect_sp_discovery_partition_info_get_all(const struct sp_partition_info info[],
-+						const uint32_t *count,
-+						sp_result result);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif /* LIBSP_MOCK_MOCK_SP_DISCOVERY_H_ */
-diff --git a/components/messaging/ffa/libsp/mock/test/test_mock_sp_discovery.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_sp_discovery.cpp
-new file mode 100644
-index 0000000..bb4bf07
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/test/test_mock_sp_discovery.cpp
-@@ -0,0 +1,111 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include <CppUTest/TestHarness.h>
-+#include "mock_sp_discovery.h"
-+#include <stdint.h>
-+#include <stdlib.h>
-+
-+
-+
-+
-+TEST_GROUP(mock_sp_discovery) {
-+	TEST_TEARDOWN()
-+	{
-+		mock().checkExpectations();
-+		mock().clear();
-+	}
-+
-+	static const sp_result result = -1;
-+};
-+
-+TEST(mock_sp_discovery, sp_discovery_ffa_version_get)
-+{
-+	const uint16_t expected_major = 0xabcd;
-+	const uint16_t expected_minor = 0xef01;
-+	uint16_t major = 0, minor = 0;
-+
-+	expect_sp_discovery_ffa_version_get(&expected_major, &expected_minor,
-+					    result);
-+	LONGS_EQUAL(result, sp_discovery_ffa_version_get(&major, &minor));
-+	UNSIGNED_LONGS_EQUAL(expected_major, major);
-+	UNSIGNED_LONGS_EQUAL(expected_minor, minor);
-+}
-+
-+TEST(mock_sp_discovery, sp_discovery_own_id_get)
-+{
-+	const uint16_t expected_id = 0x8765;
-+	uint16_t id = 0;
-+
-+	expect_sp_discovery_own_id_get(&expected_id, result);
-+	LONGS_EQUAL(result, sp_discovery_own_id_get(&id));
-+	UNSIGNED_LONGS_EQUAL(expected_id, id);
-+}
-+
-+TEST(mock_sp_discovery, sp_discovery_partition_id_get)
-+{
-+	const struct sp_uuid expected_uuid = {
-+		.uuid = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-+			 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}};
-+	const uint16_t expected_id = 0xc1ca;
-+
-+	struct sp_uuid uuid = expected_uuid;
-+	uint16_t id = 0;
-+
-+	expect_sp_discovery_partition_id_get(&expected_uuid, &expected_id,
-+					       result);
-+	LONGS_EQUAL(result, sp_discovery_partition_id_get(&uuid, &id));
-+	UNSIGNED_LONGS_EQUAL(expected_id, id);
-+}
-+
-+TEST(mock_sp_discovery, sp_discovery_partition_info_get)
-+{
-+	const struct sp_uuid expected_uuid = {
-+		.uuid = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-+			 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}};
-+	const struct sp_partition_info expected_info = {
-+		.partition_id = 0x1234,
-+		.execution_context_count = 0xffff,
-+		.supports_direct_requests = true,
-+		.can_send_direct_requests = true,
-+		.supports_indirect_requests = false
-+	};
-+
-+	struct sp_uuid uuid = expected_uuid;
-+	struct sp_partition_info info = {0};
-+
-+	expect_sp_discovery_partition_info_get(&expected_uuid, &expected_info,
-+					       result);
-+	LONGS_EQUAL(result, sp_discovery_partition_info_get(&uuid, &info));
-+	MEMCMP_EQUAL(&expected_info, &info, sizeof(&expected_info));
-+}
-+
-+TEST(mock_sp_discovery, sp_discovery_partition_info_get_all)
-+{
-+	const uint32_t expected_count = 2;
-+	const struct sp_partition_info expected_info[expected_count] = {{
-+		.partition_id = 0x5678,
-+		.execution_context_count = 0x1111,
-+		.supports_direct_requests = false,
-+		.can_send_direct_requests = false,
-+		.supports_indirect_requests = true
-+	}, {
-+		.partition_id = 0x1234,
-+		.execution_context_count = 0xffff,
-+		.supports_direct_requests = true,
-+		.can_send_direct_requests = true,
-+		.supports_indirect_requests = false
-+	}};
-+
-+	struct sp_partition_info info[expected_count] = {0};
-+	uint32_t count = 0;
-+
-+	expect_sp_discovery_partition_info_get_all(expected_info,
-+						   &expected_count, result);
-+	LONGS_EQUAL(result, sp_discovery_partition_info_get_all(info, &count));
-+	MEMCMP_EQUAL(&expected_info, &info, sizeof(&expected_info));
-+	UNSIGNED_LONGS_EQUAL(expected_count, count);
-+}
-\ No newline at end of file
-diff --git a/components/messaging/ffa/libsp/tests.cmake b/components/messaging/ffa/libsp/tests.cmake
-index 296ae46..7b52248 100644
---- a/components/messaging/ffa/libsp/tests.cmake
-+++ b/components/messaging/ffa/libsp/tests.cmake
-@@ -104,6 +104,19 @@ unit_test_add_suite(
- 		-DARM64
- )
- 
-+unit_test_add_suite(
-+	NAME libsp_mock_sp_discovery
-+	SOURCES
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_sp_discovery.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_discovery.cpp
-+	INCLUDE_DIRECTORIES
-+		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
-+		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
-+	COMPILE_DEFINITIONS
-+		-DARM64
-+)
-+
- unit_test_add_suite(
- 	NAME libsp_sp_memory_management
- 	SOURCES
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0019-Add-mock-for-libsp-sp_memory_management.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0019-Add-mock-for-libsp-sp_memory_management.patch
deleted file mode 100644
index cf50389..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0019-Add-mock-for-libsp-sp_memory_management.patch
+++ /dev/null
@@ -1,977 +0,0 @@
-From b592a22dbce521522931f8e3d79d6e16f2d334fa Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Fri, 17 Jun 2022 14:42:04 +0200
-Subject: [PATCH 19/24] Add mock for libsp/sp_memory_management
-
-Add mock_sp_memory_management for mocking sp_memory_management part of
-libsp.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I9f74142bc3568dfc59f820ec2c2af81deba0d0da
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../ffa/libsp/include/sp_memory_management.h  |   2 +-
- .../messaging/ffa/libsp/mock/component.cmake  |   1 +
- .../libsp/mock/mock_sp_memory_management.cpp  | 523 ++++++++++++++++++
- .../libsp/mock/mock_sp_memory_management.h    |  98 ++++
- .../test/test_mock_sp_memory_management.cpp   | 260 +++++++++
- components/messaging/ffa/libsp/tests.cmake    |  13 +
- 6 files changed, 896 insertions(+), 1 deletion(-)
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_memory_management.cpp
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_memory_management.h
- create mode 100644 components/messaging/ffa/libsp/test/test_mock_sp_memory_management.cpp
-
-diff --git a/components/messaging/ffa/libsp/include/sp_memory_management.h b/components/messaging/ffa/libsp/include/sp_memory_management.h
-index 58a6cc1..ec76a3d 100644
---- a/components/messaging/ffa/libsp/include/sp_memory_management.h
-+++ b/components/messaging/ffa/libsp/include/sp_memory_management.h
-@@ -381,7 +381,7 @@ sp_result sp_memory_share_dynamic_is_supported(bool *supported);
-  *
-  * @param[in]      descriptor        The memory descriptor
-  * @param[in,out]  acc_desc          Access descriptor
-- * @param[in,out   regions           Memory region array
-+ * @param[in,out]  regions           Memory region array
-  * @param[in]      in_region_count   Count of the specified regions, can be 0
-  * @param[in,out]  out_region_count  Count of the reserved space of in the
-  *                                   regions buffer for retrieved regions. After
-diff --git a/components/messaging/ffa/libsp/mock/component.cmake b/components/messaging/ffa/libsp/mock/component.cmake
-index 15db85a..eb0d28c 100644
---- a/components/messaging/ffa/libsp/mock/component.cmake
-+++ b/components/messaging/ffa/libsp/mock/component.cmake
-@@ -13,6 +13,7 @@ target_sources(${TGT} PRIVATE
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_api.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_internal_api.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_discovery.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_memory_management.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_rxtx.cpp"
- 	)
- 
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_memory_management.cpp b/components/messaging/ffa/libsp/mock/mock_sp_memory_management.cpp
-new file mode 100644
-index 0000000..9eb0aaa
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_memory_management.cpp
-@@ -0,0 +1,523 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include "mock_sp_memory_management.h"
-+
-+void expect_sp_memory_donate(const struct sp_memory_descriptor *descriptor,
-+			     const struct sp_memory_access_descriptor *acc_desc,
-+			     const struct sp_memory_region regions[],
-+			     uint32_t region_count, const uint64_t *handle,
-+			     sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_donate")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_donate(struct sp_memory_descriptor *descriptor,
-+			   struct sp_memory_access_descriptor *acc_desc,
-+			   struct sp_memory_region regions[],
-+			   uint32_t region_count, uint64_t *handle)
-+{
-+	return mock()
-+		.actualCall("sp_memory_donate")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_donate_dynamic(const struct sp_memory_descriptor *descriptor,
-+				     const struct sp_memory_access_descriptor *acc_desc,
-+				     const struct sp_memory_region regions[],
-+				     uint32_t region_count, const uint64_t *handle,
-+				     sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_donate_dynamic")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_donate_dynamic(struct sp_memory_descriptor *descriptor,
-+				   struct sp_memory_access_descriptor *acc_desc,
-+				   struct sp_memory_region regions[],
-+				   uint32_t region_count, uint64_t *handle,
-+				   struct ffa_mem_transaction_buffer *buffer)
-+{
-+	if (buffer == NULL) { // LCOV_EXCL_BR_LINE
-+		FAIL("ffa_mem_transaction_buffer is NULL"); // LCOV_EXCL_LINE
-+	}
-+
-+	return mock()
-+		.actualCall("sp_memory_donate_dynamic")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_donate_dynamic_is_supported(const bool *supported, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_lend_dynamic_is_supported")
-+		.withOutputParameterReturning("supported", supported, sizeof(*supported))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_donate_dynamic_is_supported(bool *supported)
-+{
-+	return mock()
-+		.actualCall("sp_memory_lend_dynamic_is_supported")
-+		.withOutputParameter("supported", supported)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_lend(const struct sp_memory_descriptor *descriptor,
-+			   const struct sp_memory_access_descriptor acc_desc[],
-+			   uint32_t acc_desc_count,
-+			   const struct sp_memory_region regions[],
-+			   uint32_t region_count, const uint64_t *handle,
-+			   sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_lend")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_lend(struct sp_memory_descriptor *descriptor,
-+			 struct sp_memory_access_descriptor acc_desc[],
-+			 uint32_t acc_desc_count,
-+			 struct sp_memory_region regions[],
-+			 uint32_t region_count, uint64_t *handle)
-+{
-+	return mock()
-+		.actualCall("sp_memory_lend")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_lend_dynamic(const struct sp_memory_descriptor *descriptor,
-+				   const struct sp_memory_access_descriptor acc_desc[],
-+				   uint32_t acc_desc_count,
-+				   const struct sp_memory_region regions[],
-+				   const uint32_t region_count, const uint64_t *handle,
-+				   sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_lend")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_lend_dynamic(struct sp_memory_descriptor *descriptor,
-+				 struct sp_memory_access_descriptor acc_desc[],
-+				 uint32_t acc_desc_count,
-+				 struct sp_memory_region regions[],
-+				 uint32_t region_count, uint64_t *handle,
-+				 struct ffa_mem_transaction_buffer *buffer)
-+{
-+	if (buffer == NULL) { // LCOV_EXCL_BR_LINE
-+		FAIL("ffa_mem_transaction_buffer is NULL"); // LCOV_EXCL_LINE
-+	}
-+
-+	return mock()
-+		.actualCall("sp_memory_lend")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_lend_dynamic_is_supported(const bool *supported, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_lend_dynamic_is_supported")
-+		.withOutputParameterReturning("supported", supported, sizeof(*supported))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_lend_dynamic_is_supported(bool *supported)
-+{
-+	return mock()
-+		.actualCall("sp_memory_lend_dynamic_is_supported")
-+		.withOutputParameter("supported", supported)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_share(const struct sp_memory_descriptor *descriptor,
-+			    const struct sp_memory_access_descriptor acc_desc[],
-+			    uint32_t acc_desc_count,
-+			    const struct sp_memory_region regions[],
-+			    uint32_t region_count, const uint64_t *handle,
-+			    sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_share")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_share(struct sp_memory_descriptor *descriptor,
-+			  struct sp_memory_access_descriptor acc_desc[],
-+			  uint32_t acc_desc_count,
-+			  struct sp_memory_region regions[],
-+			  uint32_t region_count, uint64_t *handle)
-+{
-+	return mock()
-+		.actualCall("sp_memory_share")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_share_dynamic(const struct sp_memory_descriptor *descriptor,
-+				    const struct sp_memory_access_descriptor acc_desc[],
-+				    uint32_t acc_desc_count,
-+				    const struct sp_memory_region regions[],
-+				    uint32_t region_count, const uint64_t *handle,
-+				    sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_share_dynamic")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameterReturning("handle", handle, sizeof(*handle))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_share_dynamic(struct sp_memory_descriptor *descriptor,
-+				  struct sp_memory_access_descriptor acc_desc[],
-+				  uint32_t acc_desc_count,
-+				  struct sp_memory_region regions[],
-+				  uint32_t region_count, uint64_t *handle,
-+				  struct ffa_mem_transaction_buffer *buffer)
-+{
-+	if (buffer == NULL) { // LCOV_EXCL_BR_LINE
-+		FAIL("ffa_mem_transaction_buffer is NULL"); // LCOV_EXCL_LINE
-+	}
-+
-+	return mock()
-+		.actualCall("sp_memory_share_dynamic")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(*descriptor))
-+		.withMemoryBufferParameter("acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc) * acc_desc_count)
-+		.withUnsignedIntParameter("acc_desc_count", acc_desc_count)
-+		.withMemoryBufferParameter("regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * region_count)
-+		.withUnsignedIntParameter("region_count", region_count)
-+		.withOutputParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_share_dynamic_is_supported(const bool *supported, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_share_dynamic_is_supported")
-+		.withOutputParameterReturning("supported", supported, sizeof(*supported))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_share_dynamic_is_supported(bool *supported)
-+{
-+	return mock()
-+		.actualCall("sp_memory_share_dynamic_is_supported")
-+		.withOutputParameter("supported", supported)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_retrieve(const struct sp_memory_descriptor *descriptor,
-+			       const struct sp_memory_access_descriptor *req_acc_desc,
-+			       const struct sp_memory_access_descriptor *resp_acc_desc,
-+			       const struct sp_memory_region in_regions[],
-+			       const struct sp_memory_region out_regions[],
-+			       uint32_t in_region_count,
-+			       const uint32_t *out_region_count, uint64_t handle,
-+			       sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_retrieve")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(descriptor))
-+		.withMemoryBufferParameter("req_acc_desc", (const unsigned char *)req_acc_desc,
-+					   sizeof(*req_acc_desc))
-+		.withOutputParameterReturning("resp_acc_desc",
-+					      (const unsigned char *)resp_acc_desc,
-+					      sizeof(*resp_acc_desc))
-+		.withMemoryBufferParameter("in_regions", (const unsigned char *)in_regions,
-+					   sizeof(*in_regions) * in_region_count)
-+		.withOutputParameterReturning("out_regions", out_regions,
-+					      sizeof(*out_regions) * *out_region_count)
-+		.withUnsignedIntParameter("in_region_count", in_region_count)
-+		.withOutputParameterReturning("out_region_count", out_region_count,
-+					      sizeof(*out_region_count))
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.andReturnValue(result);
-+
-+}
-+
-+sp_result sp_memory_retrieve(struct sp_memory_descriptor *descriptor,
-+			     struct sp_memory_access_descriptor *acc_desc,
-+			     struct sp_memory_region regions[],
-+			     uint32_t in_region_count,
-+			     uint32_t *out_region_count, uint64_t handle)
-+{
-+	return mock()
-+		.actualCall("sp_memory_retrieve")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(descriptor))
-+		.withMemoryBufferParameter("req_acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withOutputParameter("resp_acc_desc", acc_desc)
-+		.withMemoryBufferParameter("in_regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * in_region_count)
-+		.withOutputParameter("out_regions", regions)
-+		.withUnsignedIntParameter("in_region_count", in_region_count)
-+		.withOutputParameter("out_region_count", out_region_count)
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_retrieve_dynamic(const struct sp_memory_descriptor *descriptor,
-+				       const struct sp_memory_access_descriptor *req_acc_desc,
-+				       const struct sp_memory_access_descriptor *resp_acc_desc,
-+				       const struct sp_memory_region in_regions[],
-+				       const struct sp_memory_region out_regions[],
-+				       uint32_t in_region_count,
-+				       const uint32_t *out_region_count, uint64_t handle,
-+				       sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_retrieve")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(descriptor))
-+		.withMemoryBufferParameter("req_acc_desc", (const unsigned char *)req_acc_desc,
-+					   sizeof(*req_acc_desc))
-+		.withOutputParameterReturning("resp_acc_desc",
-+					      (const unsigned char *)resp_acc_desc,
-+					      sizeof(*resp_acc_desc))
-+		.withMemoryBufferParameter("in_regions", (const unsigned char *)in_regions,
-+					   sizeof(*in_regions) * in_region_count)
-+		.withOutputParameterReturning("out_regions", out_regions,
-+					      sizeof(*out_regions) * *out_region_count)
-+		.withUnsignedIntParameter("in_region_count", in_region_count)
-+		.withOutputParameterReturning("out_region_count", out_region_count,
-+					      sizeof(*out_region_count))
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.andReturnValue(result);
-+}
-+
-+sp_result
-+sp_memory_retrieve_dynamic(struct sp_memory_descriptor *descriptor,
-+			   struct sp_memory_access_descriptor *acc_desc,
-+			   struct sp_memory_region regions[],
-+			   uint32_t in_region_count, uint32_t *out_region_count,
-+			   uint64_t handle,
-+			   struct ffa_mem_transaction_buffer *buffer)
-+{
-+	if (buffer == NULL) { // LCOV_EXCL_BR_LINE
-+		FAIL("ffa_mem_transaction_buffer is NULL"); // LCOV_EXCL_LINE
-+	}
-+
-+	return mock()
-+		.actualCall("sp_memory_retrieve")
-+		.withMemoryBufferParameter("descriptor", (const unsigned char *)descriptor,
-+					   sizeof(descriptor))
-+		.withMemoryBufferParameter("req_acc_desc", (const unsigned char *)acc_desc,
-+					   sizeof(*acc_desc))
-+		.withOutputParameter("resp_acc_desc", acc_desc)
-+		.withMemoryBufferParameter("in_regions", (const unsigned char *)regions,
-+					   sizeof(*regions) * in_region_count)
-+		.withOutputParameter("out_regions", regions)
-+		.withUnsignedIntParameter("in_region_count", in_region_count)
-+		.withOutputParameter("out_region_count", out_region_count)
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_retrieve_dynamic_is_supported(const bool *supported, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_retrieve_dynamic_is_supported")
-+		.withOutputParameterReturning("supported", supported, sizeof(*supported))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_retrieve_dynamic_is_supported(bool *supported)
-+{
-+	return mock()
-+		.actualCall("sp_memory_retrieve_dynamic_is_supported")
-+		.withOutputParameter("supported", supported)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_relinquish(uint64_t handle, const uint16_t endpoints[],
-+			         uint32_t endpoint_count,
-+			         const struct sp_memory_transaction_flags *flags,
-+				 sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_relinquish")
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.withMemoryBufferParameter("endpoints", (const unsigned char *)endpoints,
-+					   sizeof(*endpoints) * endpoint_count)
-+		.withMemoryBufferParameter("flags", (const unsigned char *)flags, sizeof(*flags))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_relinquish(uint64_t handle, const uint16_t endpoints[],
-+			       uint32_t endpoint_count,
-+			       struct sp_memory_transaction_flags *flags)
-+{
-+	return mock()
-+		.actualCall("sp_memory_relinquish")
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.withMemoryBufferParameter("endpoints", (const unsigned char *)endpoints,
-+					   sizeof(*endpoints) * endpoint_count)
-+		.withMemoryBufferParameter("flags", (const unsigned char *)flags, sizeof(*flags))
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_reclaim(uint64_t handle, uint32_t flags, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_reclaim")
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.withUnsignedIntParameter("flags", flags)
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_reclaim(uint64_t handle, uint32_t flags)
-+{
-+	return mock()
-+		.actualCall("sp_memory_reclaim")
-+		.withUnsignedLongIntParameter("handle", handle)
-+		.withUnsignedIntParameter("flags", flags)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_permission_get(const void *base_address, const struct sp_mem_perm *mem_perm,
-+				     sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_permission_set")
-+		.withConstPointerParameter("base_address", base_address)
-+		.withOutputParameterReturning("mem_perm", mem_perm,
-+					      sizeof(*mem_perm))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_permission_get(const void *base_address,
-+				   struct sp_mem_perm *mem_perm)
-+{
-+	return mock()
-+		.actualCall("sp_memory_permission_set")
-+		.withConstPointerParameter("base_address", base_address)
-+		.withOutputParameter("mem_perm", mem_perm)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_memory_permission_set(const void *base_address, size_t region_size,
-+				     const struct sp_mem_perm *mem_perm, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_memory_permission_set")
-+		.withConstPointerParameter("base_address", base_address)
-+		.withUnsignedLongIntParameter("region_size", region_size)
-+		.withMemoryBufferParameter("mem_perm", (const unsigned char *)mem_perm,
-+					   sizeof(*mem_perm))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_memory_permission_set(const void *base_address, size_t region_size,
-+				   const struct sp_mem_perm *mem_perm)
-+{
-+	return mock()
-+		.actualCall("sp_memory_permission_set")
-+		.withConstPointerParameter("base_address", base_address)
-+		.withUnsignedLongIntParameter("region_size", region_size)
-+		.withMemoryBufferParameter("mem_perm", (const unsigned char *)mem_perm,
-+					   sizeof(*mem_perm))
-+		.returnIntValue();
-+}
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_memory_management.h b/components/messaging/ffa/libsp/mock/mock_sp_memory_management.h
-new file mode 100644
-index 0000000..458d2af
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_memory_management.h
-@@ -0,0 +1,98 @@
-+/* SPDX-License-Identifier: BSD-3-Clause */
-+/*
-+ * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
-+ */
-+
-+#ifndef LIBSP_MOCK_MOCK_SP_MEMORY_MANAGEMENT_H_
-+#define LIBSP_MOCK_MOCK_SP_MEMORY_MANAGEMENT_H_
-+
-+#include "../include/sp_memory_management.h"
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+void expect_sp_memory_donate(const struct sp_memory_descriptor *descriptor,
-+			     const struct sp_memory_access_descriptor *acc_desc,
-+			     const struct sp_memory_region regions[],
-+			     uint32_t region_count, const uint64_t *handle,
-+			     sp_result result);
-+
-+void expect_sp_memory_donate_dynamic(const struct sp_memory_descriptor *descriptor,
-+				     const struct sp_memory_access_descriptor *acc_desc,
-+				     const struct sp_memory_region regions[],
-+				     uint32_t region_count, const uint64_t *handle,
-+				     sp_result result);
-+
-+void expect_sp_memory_donate_dynamic_is_supported(const bool *supported, sp_result result);
-+
-+void expect_sp_memory_lend(const struct sp_memory_descriptor *descriptor,
-+			   const struct sp_memory_access_descriptor acc_desc[],
-+			   uint32_t acc_desc_count,
-+			   const struct sp_memory_region regions[],
-+			   uint32_t region_count, const uint64_t *handle,
-+			   sp_result result);
-+
-+void expect_sp_memory_lend_dynamic(const struct sp_memory_descriptor *descriptor,
-+				   const struct sp_memory_access_descriptor acc_desc[],
-+				   uint32_t acc_desc_count,
-+				   const struct sp_memory_region regions[],
-+				   const uint32_t region_count, const uint64_t *handle,
-+				   sp_result result);
-+
-+void expect_sp_memory_lend_dynamic_is_supported(const bool *supported, sp_result result);
-+
-+void expect_sp_memory_share(const struct sp_memory_descriptor *descriptor,
-+			    const struct sp_memory_access_descriptor acc_desc[],
-+			    uint32_t acc_desc_count,
-+			    const struct sp_memory_region regions[],
-+			    uint32_t region_count, const uint64_t *handle,
-+			    sp_result result);
-+
-+void expect_sp_memory_share_dynamic(const struct sp_memory_descriptor *descriptor,
-+				    const struct sp_memory_access_descriptor acc_desc[],
-+				    uint32_t acc_desc_count,
-+				    const struct sp_memory_region regions[],
-+				    uint32_t region_count, const uint64_t *handle,
-+				    sp_result result);
-+
-+void expect_sp_memory_share_dynamic_is_supported(const bool *supported, sp_result result);
-+
-+void expect_sp_memory_retrieve(const struct sp_memory_descriptor *descriptor,
-+			       const struct sp_memory_access_descriptor *req_acc_desc,
-+			       const struct sp_memory_access_descriptor *resp_acc_desc,
-+			       const struct sp_memory_region in_regions[],
-+			       const struct sp_memory_region out_regions[],
-+			       uint32_t in_region_count,
-+			       const uint32_t *out_region_count, uint64_t handle,
-+			       sp_result result);
-+
-+void expect_sp_memory_retrieve_dynamic(const struct sp_memory_descriptor *descriptor,
-+				       const struct sp_memory_access_descriptor *req_acc_desc,
-+				       const struct sp_memory_access_descriptor *resp_acc_desc,
-+				       const struct sp_memory_region in_regions[],
-+				       const struct sp_memory_region out_regions[],
-+				       uint32_t in_region_count,
-+				       const uint32_t *out_region_count, uint64_t handle,
-+				       sp_result result);
-+
-+void expect_sp_memory_retrieve_dynamic_is_supported(const bool *supported, sp_result result);
-+
-+void expect_sp_memory_relinquish(uint64_t handle, const uint16_t endpoints[],
-+				 uint32_t endpoint_count,
-+				 const struct sp_memory_transaction_flags *flags,
-+				 sp_result result);
-+
-+void expect_sp_memory_reclaim(uint64_t handle, uint32_t flags, sp_result result);
-+
-+void expect_sp_memory_permission_get(const void *base_address, const struct sp_mem_perm *mem_perm,
-+				     sp_result result);
-+
-+void expect_sp_memory_permission_set(const void *base_address, size_t region_size,
-+				     const struct sp_mem_perm *mem_perm, sp_result result);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif /* LIBSP_MOCK_MOCK_SP_MEMORY_MANAGEMENT_H_ */
-diff --git a/components/messaging/ffa/libsp/test/test_mock_sp_memory_management.cpp b/components/messaging/ffa/libsp/test/test_mock_sp_memory_management.cpp
-new file mode 100644
-index 0000000..387b50f
---- /dev/null
-+++ b/components/messaging/ffa/libsp/test/test_mock_sp_memory_management.cpp
-@@ -0,0 +1,260 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include <CppUTest/TestHarness.h>
-+#include "mock_sp_memory_management.h"
-+#include <stdint.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+static const struct sp_memory_descriptor expected_descriptor = {
-+	.sender_id = 0xfedc,
-+	.memory_type = sp_memory_type_normal_memory,
-+	.mem_region_attr = {.normal_memory = {
-+		.cacheability = sp_cacheability_write_back,
-+		.shareability = sp_shareability_inner_shareable
-+	}},
-+	.flags = {
-+		.zero_memory = true,
-+		.operation_time_slicing = true,
-+		.zero_memory_after_relinquish = true,
-+		.transaction_type = sp_memory_transaction_type_relayer_specified,
-+		.alignment_hint = 0x2000
-+	},
-+	.tag = 0x0123456789abcdefULL
-+};
-+static const struct sp_memory_access_descriptor expected_acc_desc[] = {
-+	{
-+		.receiver_id = 0xfafa,
-+		.instruction_access = sp_instruction_access_executable,
-+		.data_access = sp_data_access_read_only
-+	}, {
-+		.receiver_id = 0xc1ca,
-+		.instruction_access = sp_instruction_access_not_executable,
-+		.data_access = sp_data_access_read_write
-+	}
-+};
-+static const struct sp_memory_region expected_regions[2] = {
-+	{.address = (void *)0x01234567, .page_count = 0x89abcdef},
-+	{.address = (void *)0x12345670, .page_count = 0x9abcdef8},
-+};
-+static const uint64_t expected_handle = 0xabcdef0123456789ULL;
-+static const void *expected_address = (const void *)0x234567879;
-+static const struct sp_mem_perm expected_mem_perm = {
-+	.data_access = sp_mem_perm_data_perm_read_write,
-+	.instruction_access = sp_mem_perm_instruction_perm_non_executable,
-+};
-+
-+TEST_GROUP(mock_sp_memory_management)
-+{
-+	TEST_SETUP()
-+	{
-+		memset(&descriptor, 0x00, sizeof(descriptor));
-+		memset(&acc_desc, 0x00, sizeof(acc_desc));
-+		memset(&regions, 0x00, sizeof(regions));
-+		handle = 0;
-+		supported = false;
-+	}
-+
-+	TEST_TEARDOWN()
-+	{
-+		mock().checkExpectations();
-+		mock().clear();
-+	}
-+
-+	struct sp_memory_descriptor descriptor;
-+	struct sp_memory_access_descriptor acc_desc[2];
-+	struct sp_memory_region regions[2];
-+	uint64_t handle;
-+	bool supported;
-+	struct ffa_mem_transaction_buffer tr_buffer;
-+
-+	static const sp_result result = -1;
-+};
-+
-+TEST(mock_sp_memory_management, sp_memory_donate)
-+{
-+	descriptor = expected_descriptor;
-+	acc_desc[0] = expected_acc_desc[0];
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_donate(&expected_descriptor, expected_acc_desc, expected_regions, 2,
-+				&expected_handle, result);
-+	LONGS_EQUAL(result, sp_memory_donate(&descriptor, acc_desc, regions, 2, &handle));
-+
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_donate_dynamic)
-+{
-+	descriptor = expected_descriptor;
-+	acc_desc[0] = expected_acc_desc[0];
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_donate_dynamic(&expected_descriptor, expected_acc_desc, expected_regions,
-+					2, &expected_handle, result);
-+	LONGS_EQUAL(result, sp_memory_donate_dynamic(&descriptor, acc_desc, regions, 2, &handle,
-+						     &tr_buffer));
-+
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_donate_dynamic_is_supported)
-+{
-+	const bool expected_supported = true;
-+	expect_sp_memory_donate_dynamic_is_supported(&expected_supported, result);
-+	LONGS_EQUAL(result, sp_memory_donate_dynamic_is_supported(&supported));
-+	CHECK_TRUE(supported);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_lend)
-+{
-+	descriptor = expected_descriptor;
-+	memcpy(acc_desc, expected_acc_desc, sizeof(acc_desc));
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_lend(&descriptor, acc_desc, 2, regions, 2, &expected_handle, result);
-+	LONGS_EQUAL(result, sp_memory_lend(&descriptor, acc_desc, 2, regions, 2, &handle));
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_lend_dynamic)
-+{
-+	descriptor = expected_descriptor;
-+	memcpy(acc_desc, expected_acc_desc, sizeof(acc_desc));
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_lend_dynamic(&descriptor, acc_desc, 2, regions, 2, &expected_handle,
-+				      result);
-+	LONGS_EQUAL(result, sp_memory_lend_dynamic(&descriptor, acc_desc, 2, regions, 2, &handle,
-+						   &tr_buffer));
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_lend_dynamic_is_supported)
-+{
-+	const bool expected_supported = true;
-+	expect_sp_memory_lend_dynamic_is_supported(&expected_supported, result);
-+	LONGS_EQUAL(result, sp_memory_lend_dynamic_is_supported(&supported));
-+	CHECK_TRUE(supported);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_share)
-+{
-+	descriptor = expected_descriptor;
-+	memcpy(acc_desc, expected_acc_desc, sizeof(acc_desc));
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_share(&descriptor, acc_desc, 2, regions, 2, &expected_handle, result);
-+	LONGS_EQUAL(result, sp_memory_share(&descriptor, acc_desc, 2, regions, 2, &handle));
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_share_dynamic)
-+{
-+	descriptor = expected_descriptor;
-+	memcpy(acc_desc, expected_acc_desc, sizeof(acc_desc));
-+	memcpy(regions, expected_regions, sizeof(regions));
-+
-+	expect_sp_memory_share_dynamic(&descriptor, acc_desc, 2, regions, 2, &expected_handle,
-+				      result);
-+	LONGS_EQUAL(result, sp_memory_share_dynamic(&descriptor, acc_desc, 2, regions, 2, &handle,
-+						   &tr_buffer));
-+	UNSIGNED_LONGLONGS_EQUAL(expected_handle, handle);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_share_dynamic_is_supported)
-+{
-+	const bool expected_supported = true;
-+	expect_sp_memory_share_dynamic_is_supported(&expected_supported, result);
-+	LONGS_EQUAL(result, sp_memory_share_dynamic_is_supported(&supported));
-+	CHECK_TRUE(supported);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_retrieve)
-+{
-+	const uint32_t expected_region_count = 1;
-+	struct sp_memory_access_descriptor acc_desc = expected_acc_desc[0];
-+	struct sp_memory_region region = expected_regions[0];
-+	uint32_t out_region_count = 0;
-+
-+	descriptor = expected_descriptor;
-+
-+	expect_sp_memory_retrieve(&expected_descriptor, &expected_acc_desc[0],
-+				  &expected_acc_desc[1], &expected_regions[0],
-+				  &expected_regions[1], 1, &expected_region_count, expected_handle,
-+				  result);
-+	LONGS_EQUAL(result, sp_memory_retrieve(&descriptor, &acc_desc, &region, 1,
-+					       &out_region_count, expected_handle));
-+	MEMCMP_EQUAL(&acc_desc, &expected_acc_desc[1], sizeof(acc_desc));
-+	MEMCMP_EQUAL(&region, &expected_regions[1], sizeof(region));
-+	UNSIGNED_LONGS_EQUAL(expected_region_count, out_region_count);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_retrieve_dynamic)
-+{
-+	const uint32_t expected_region_count = 1;
-+	struct sp_memory_access_descriptor acc_desc = expected_acc_desc[0];
-+	struct sp_memory_region region = expected_regions[0];
-+	uint32_t out_region_count = 0;
-+
-+	descriptor = expected_descriptor;
-+
-+	expect_sp_memory_retrieve_dynamic(&expected_descriptor, &expected_acc_desc[0],
-+					  &expected_acc_desc[1], &expected_regions[0],
-+					  &expected_regions[1], 1, &expected_region_count,
-+					  expected_handle, result);
-+	LONGS_EQUAL(result, sp_memory_retrieve_dynamic(&descriptor, &acc_desc, &region, 1,
-+						       &out_region_count, expected_handle,
-+						       &tr_buffer));
-+	MEMCMP_EQUAL(&acc_desc, &expected_acc_desc[1], sizeof(acc_desc));
-+	MEMCMP_EQUAL(&region, &expected_regions[1], sizeof(region));
-+	UNSIGNED_LONGS_EQUAL(expected_region_count, out_region_count);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_retrieve_dynamic_is_supported)
-+{
-+	const bool expected_supported = true;
-+	expect_sp_memory_retrieve_dynamic_is_supported(&expected_supported, result);
-+	LONGS_EQUAL(result, sp_memory_retrieve_dynamic_is_supported(&supported));
-+	CHECK_TRUE(supported);
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_relinquish)
-+{
-+	uint16_t endpoints[3] = {1, 2, 3};
-+	struct sp_memory_transaction_flags flags = {0}; // TODO: flags
-+
-+	expect_sp_memory_relinquish(expected_handle, endpoints, 3, &flags, result);
-+	LONGS_EQUAL(result, sp_memory_relinquish(expected_handle, endpoints, 3, &flags));
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_reclaim)
-+{
-+	uint32_t flags = 0xffffffff;
-+
-+	expect_sp_memory_reclaim(expected_handle, flags, result);
-+	LONGS_EQUAL(result, sp_memory_reclaim(expected_handle, flags));
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_permission_get)
-+{
-+	struct sp_mem_perm mem_perm;
-+
-+	memset(&mem_perm, 0x00, sizeof(mem_perm));
-+
-+	expect_sp_memory_permission_get(expected_address, &expected_mem_perm, result);
-+	LONGS_EQUAL(result, sp_memory_permission_get(expected_address, &mem_perm));
-+	MEMCMP_EQUAL(&expected_mem_perm, &mem_perm, sizeof(expected_mem_perm));
-+}
-+
-+TEST(mock_sp_memory_management, sp_memory_permission_set)
-+{
-+	size_t size = 0x7654;
-+
-+	expect_sp_memory_permission_set(expected_address, size, &expected_mem_perm, result);
-+	LONGS_EQUAL(result, sp_memory_permission_set(expected_address, size, &expected_mem_perm));
-+}
-diff --git a/components/messaging/ffa/libsp/tests.cmake b/components/messaging/ffa/libsp/tests.cmake
-index 7b52248..63abb57 100644
---- a/components/messaging/ffa/libsp/tests.cmake
-+++ b/components/messaging/ffa/libsp/tests.cmake
-@@ -134,6 +134,19 @@ unit_test_add_suite(
- 		-DARM64
- )
- 
-+unit_test_add_suite(
-+	NAME libsp_mock_sp_memory_management
-+	SOURCES
-+		${CMAKE_CURRENT_LIST_DIR}/test/test_mock_sp_memory_management.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_memory_management.cpp
-+	INCLUDE_DIRECTORIES
-+		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
-+		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
-+	COMPILE_DEFINITIONS
-+		-DARM64
-+)
-+
- unit_test_add_suite(
- 	NAME libsp_sp_memory_management_internals
- 	SOURCES
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0020-Add-mock-for-libsp-sp_messaging.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0020-Add-mock-for-libsp-sp_messaging.patch
deleted file mode 100644
index 3057051..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0020-Add-mock-for-libsp-sp_messaging.patch
+++ /dev/null
@@ -1,284 +0,0 @@
-From 1e5ce152214e22a7cd9617a5059e42c370351354 Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Fri, 17 Jun 2022 15:40:18 +0200
-Subject: [PATCH 20/24] Add mock for libsp/sp_messaging
-
-Add mock_sp_messaging for mocking sp_messaging part of libsp.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I87478027c61b41028682b10e2535a7e14cf6922f
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../messaging/ffa/libsp/mock/component.cmake  |  1 +
- .../ffa/libsp/mock/mock_sp_messaging.cpp      | 86 +++++++++++++++++++
- .../ffa/libsp/mock/mock_sp_messaging.h        | 39 +++++++++
- .../mock/test/test_mock_sp_messaging.cpp      | 77 +++++++++++++++++
- components/messaging/ffa/libsp/tests.cmake    | 14 +++
- 5 files changed, 217 insertions(+)
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_messaging.cpp
- create mode 100644 components/messaging/ffa/libsp/mock/mock_sp_messaging.h
- create mode 100644 components/messaging/ffa/libsp/mock/test/test_mock_sp_messaging.cpp
-
-diff --git a/components/messaging/ffa/libsp/mock/component.cmake b/components/messaging/ffa/libsp/mock/component.cmake
-index eb0d28c..375cb46 100644
---- a/components/messaging/ffa/libsp/mock/component.cmake
-+++ b/components/messaging/ffa/libsp/mock/component.cmake
-@@ -14,6 +14,7 @@ target_sources(${TGT} PRIVATE
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_ffa_internal_api.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_discovery.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_memory_management.cpp"
-+	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_messaging.cpp"
- 	"${CMAKE_CURRENT_LIST_DIR}/mock_sp_rxtx.cpp"
- 	)
- 
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_messaging.cpp b/components/messaging/ffa/libsp/mock/mock_sp_messaging.cpp
-new file mode 100644
-index 0000000..522abb3
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_messaging.cpp
-@@ -0,0 +1,86 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include "mock_sp_messaging.h"
-+
-+void expect_sp_msg_wait(const struct sp_msg *msg, sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_msg_wait")
-+		.withOutputParameterReturning("msg", msg, sizeof(*msg))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_msg_wait(struct sp_msg *msg)
-+{
-+	return mock()
-+		.actualCall("sp_msg_wait")
-+		.withOutputParameter("msg", msg)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_msg_send_direct_req(const struct sp_msg *req,
-+				   const struct sp_msg *resp,
-+				   sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_msg_send_direct_req")
-+		.withMemoryBufferParameter("req", (const unsigned char *)req, sizeof(*req))
-+		.withOutputParameterReturning("resp", resp, sizeof(*resp))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp)
-+{
-+	return mock()
-+		.actualCall("sp_msg_send_direct_req")
-+		.withMemoryBufferParameter("req", (const unsigned char *)req, sizeof(*req))
-+		.withOutputParameter("resp", resp)
-+		.returnIntValue();
-+}
-+
-+void expect_sp_msg_send_direct_resp(const struct sp_msg *resp,
-+				    const struct sp_msg *req,
-+				    sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_msg_send_direct_resp")
-+		.withMemoryBufferParameter("resp", (const unsigned char *)resp, sizeof(*resp))
-+		.withOutputParameterReturning("req", req, sizeof(*req))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_msg_send_direct_resp(const struct sp_msg *resp,
-+				  struct sp_msg *req)
-+{
-+	return mock()
-+		.actualCall("sp_msg_send_direct_resp")
-+		.withMemoryBufferParameter("resp", (const unsigned char *)resp, sizeof(*resp))
-+		.withOutputParameter("req", req)
-+		.returnIntValue();
-+}
-+
-+#if FFA_DIRECT_MSG_ROUTING_EXTENSION
-+void expect_sp_msg_send_rc_req(const struct sp_msg *req,
-+			       const struct sp_msg *resp,
-+			       sp_result result)
-+{
-+	mock()
-+		.expectOneCall("sp_msg_send_rc_req")
-+		.withMemoryBufferParameter("req", (const unsigned char *)req, sizeof(*req))
-+		.withOutputParameterReturning("resp", resp, sizeof(*resp))
-+		.andReturnValue(result);
-+}
-+
-+sp_result sp_msg_send_rc_req(const struct sp_msg *req, struct sp_msg *resp)
-+{
-+	return mock()
-+		.actualCall("sp_msg_send_rc_req")
-+		.withMemoryBufferParameter("req", (const unsigned char *)req, sizeof(*req))
-+		.withOutputParameter("resp", resp)
-+		.returnIntValue();
-+}
-+#endif /* FFA_DIRECT_MSG_ROUTING_EXTENSION */
-diff --git a/components/messaging/ffa/libsp/mock/mock_sp_messaging.h b/components/messaging/ffa/libsp/mock/mock_sp_messaging.h
-new file mode 100644
-index 0000000..8183012
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/mock_sp_messaging.h
-@@ -0,0 +1,39 @@
-+/* SPDX-License-Identifier: BSD-3-Clause */
-+/*
-+ * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
-+ */
-+
-+#ifndef LIBSP_MOCK_MOCK_SP_MESSAGING_H_
-+#define LIBSP_MOCK_MOCK_SP_MESSAGING_H_
-+
-+#include "../include/sp_messaging.h"
-+
-+#include <stdint.h>
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+void expect_sp_msg_wait(const struct sp_msg *msg, sp_result result);
-+
-+
-+void expect_sp_msg_send_direct_req(const struct sp_msg *req,
-+				   const struct sp_msg *resp,
-+				   sp_result result);
-+
-+
-+void expect_sp_msg_send_direct_resp(const struct sp_msg *resp,
-+				    const struct sp_msg *req,
-+				    sp_result result);
-+
-+#if FFA_DIRECT_MSG_ROUTING_EXTENSION
-+void expect_sp_msg_send_rc_req(const struct sp_msg *req,
-+			       const struct sp_msg *resp,
-+			       sp_result result);
-+#endif /* FFA_DIRECT_MSG_ROUTING_EXTENSION */
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif /* LIBSP_MOCK_MOCK_SP_MESSAGING_H_ */
-diff --git a/components/messaging/ffa/libsp/mock/test/test_mock_sp_messaging.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_sp_messaging.cpp
-new file mode 100644
-index 0000000..bfc7959
---- /dev/null
-+++ b/components/messaging/ffa/libsp/mock/test/test_mock_sp_messaging.cpp
-@@ -0,0 +1,77 @@
-+// SPDX-License-Identifier: BSD-3-Clause
-+/*
-+ * Copyright (c) 2022, Arm Limited. All rights reserved.
-+ */
-+
-+#include <CppUTestExt/MockSupport.h>
-+#include <CppUTest/TestHarness.h>
-+#include "mock_sp_messaging.h"
-+#include <stdint.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+static const struct sp_msg expected_req = {
-+	.source_id = 0x0123,
-+	.destination_id = 0x4567,
-+	.args = {0x89abcdef, 0xfedcba98, 0x76543210, 0xabcdef01}
-+};
-+static const struct sp_msg expected_resp = {
-+	.source_id = 0x1234,
-+	.destination_id = 0x5678,
-+	.args = {0x9abcdef8, 0xedcba98f, 0x65432107, 0xbcdef01a}
-+};
-+
-+TEST_GROUP(mock_sp_messaging)
-+{
-+	TEST_SETUP()
-+	{
-+		memset(&req, 0x00, sizeof(req));
-+		memset(&resp, 0x00, sizeof(resp));
-+	}
-+
-+	TEST_TEARDOWN()
-+	{
-+		mock().checkExpectations();
-+		mock().clear();
-+	}
-+
-+	struct sp_msg req;
-+	struct sp_msg resp;
-+	static const sp_result result = -1;
-+};
-+
-+TEST(mock_sp_messaging, sp_msg_wait)
-+{
-+	expect_sp_msg_wait(&expected_req, result);
-+	LONGS_EQUAL(result, sp_msg_wait(&req));
-+	MEMCMP_EQUAL(&expected_req, &req, sizeof(expected_req));
-+}
-+
-+TEST(mock_sp_messaging, sp_msg_send_direct_req)
-+{
-+	req = expected_req;
-+
-+	expect_sp_msg_send_direct_req(&expected_req, &expected_resp, result);
-+	LONGS_EQUAL(result, sp_msg_send_direct_req(&req, &resp));
-+	MEMCMP_EQUAL(&expected_resp, &resp, sizeof(expected_resp));
-+}
-+
-+TEST(mock_sp_messaging, sp_msg_send_direct_resp)
-+{
-+	resp = expected_resp;
-+
-+	expect_sp_msg_send_direct_resp(&expected_resp, &expected_req, result);
-+	LONGS_EQUAL(result, sp_msg_send_direct_resp(&resp, &req));
-+	MEMCMP_EQUAL(&expected_req, &req, sizeof(expected_req));
-+}
-+
-+#if FFA_DIRECT_MSG_ROUTING_EXTENSION
-+TEST(mock_sp_messaging, sp_msg_send_rc_req)
-+{
-+	req = expected_req;
-+
-+	expect_sp_msg_send_rc_req(&expected_req, &expected_resp, result);
-+	LONGS_EQUAL(result, sp_msg_send_rc_req(&req, &resp));
-+	MEMCMP_EQUAL(&expected_resp, &resp, sizeof(expected_resp));
-+}
-+#endif /* FFA_DIRECT_MSG_ROUTING_EXTENSION */
-diff --git a/components/messaging/ffa/libsp/tests.cmake b/components/messaging/ffa/libsp/tests.cmake
-index 63abb57..eb0b41e 100644
---- a/components/messaging/ffa/libsp/tests.cmake
-+++ b/components/messaging/ffa/libsp/tests.cmake
-@@ -176,6 +176,20 @@ unit_test_add_suite(
- 		-DARM64
- )
- 
-+unit_test_add_suite(
-+	NAME libsp_mock_sp_messaging
-+	SOURCES
-+		${CMAKE_CURRENT_LIST_DIR}/mock/test/test_mock_sp_messaging.cpp
-+		${CMAKE_CURRENT_LIST_DIR}/mock/mock_sp_messaging.cpp
-+	INCLUDE_DIRECTORIES
-+		${CMAKE_CURRENT_LIST_DIR}/include/
-+		${CMAKE_CURRENT_LIST_DIR}/mock
-+		${UNIT_TEST_PROJECT_PATH}/components/common/utils/include
-+	COMPILE_DEFINITIONS
-+		-DARM64
-+		-DFFA_DIRECT_MSG_ROUTING_EXTENSION=1
-+)
-+
- unit_test_add_suite(
- 	NAME libsp_sp_messaging_with_routing_extension
- 	SOURCES
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0021-Add-64-bit-direct-message-handling-to-libsp.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0021-Add-64-bit-direct-message-handling-to-libsp.patch
deleted file mode 100644
index a037c27..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0021-Add-64-bit-direct-message-handling-to-libsp.patch
+++ /dev/null
@@ -1,2552 +0,0 @@
-From a9edc50077d72cdd7e40ba3f03aee974848cd532 Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Tue, 19 Jul 2022 17:38:00 +0200
-Subject: [PATCH 21/24] Add 64 bit direct message handling to libsp
-
-* Change direct message struct to allow 64 bit arguments
-* Add 64 bit direct message req/resp functions to FF-A layer
-* Distinguish 32/64 bit messages on SP layer by field in sp_msg
-* Update tests and mocks
-
-The FF-A direct message response must match the request's 32/64bit mode
-which is the responsibility of the callee and it should be validated by
-the SPMC.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: Ibbd64ca0291dfe142a23471a649a07ba1a036824
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- components/messaging/ffa/libsp/ffa.c          |  84 ++-
- .../libsp/ffa_direct_msg_routing_extension.c  |  28 +-
- .../messaging/ffa/libsp/include/ffa_api.h     |  58 +-
- .../ffa/libsp/include/ffa_api_defines.h       |   5 +
- .../ffa/libsp/include/ffa_api_types.h         |   7 +-
- .../ffa/libsp/include/sp_messaging.h          |   9 +-
- .../messaging/ffa/libsp/mock/mock_ffa_api.cpp | 100 +++-
- .../messaging/ffa/libsp/mock/mock_ffa_api.h   |  34 +-
- .../ffa/libsp/mock/test/test_mock_ffa_api.cpp |  50 +-
- components/messaging/ffa/libsp/sp_messaging.c |  74 ++-
- .../messaging/ffa/libsp/test/test_ffa_api.cpp | 337 ++++++++++--
- .../ffa/libsp/test/test_sp_messaging.cpp      | 498 ++++++++++--------
- .../rpc/ffarpc/caller/sp/ffarpc_caller.c      |  31 +-
- .../rpc/ffarpc/endpoint/ffarpc_call_ep.c      |   4 +-
- .../endpoint/sp/mm_communicate_call_ep.c      |  16 +-
- .../smm-gateway/common/smm_gateway_sp.c       |   8 +-
- 16 files changed, 961 insertions(+), 382 deletions(-)
-
-diff --git a/components/messaging/ffa/libsp/ffa.c b/components/messaging/ffa/libsp/ffa.c
-index 374e940..caacc79 100644
---- a/components/messaging/ffa/libsp/ffa.c
-+++ b/components/messaging/ffa/libsp/ffa.c
-@@ -33,11 +33,20 @@ static inline void ffa_unpack_direct_msg(struct ffa_params *svc_result,
- 	msg->function_id = svc_result->a0;
- 	msg->source_id = (svc_result->a1 >> 16);
- 	msg->destination_id = svc_result->a1;
--	msg->args[0] = svc_result->a3;
--	msg->args[1] = svc_result->a4;
--	msg->args[2] = svc_result->a5;
--	msg->args[3] = svc_result->a6;
--	msg->args[4] = svc_result->a7;
-+
-+	if (FFA_IS_32_BIT_FUNC(msg->function_id)) {
-+		msg->args.args32[0] = svc_result->a3;
-+		msg->args.args32[1] = svc_result->a4;
-+		msg->args.args32[2] = svc_result->a5;
-+		msg->args.args32[3] = svc_result->a6;
-+		msg->args.args32[4] = svc_result->a7;
-+	} else {
-+		msg->args.args64[0] = svc_result->a3;
-+		msg->args.args64[1] = svc_result->a4;
-+		msg->args.args64[2] = svc_result->a5;
-+		msg->args.args64[3] = svc_result->a6;
-+		msg->args.args64[4] = svc_result->a7;
-+	}
- }
- 
- /*
-@@ -217,7 +226,7 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg)
- 
- 	if (result.a0 == FFA_ERROR) {
- 		return ffa_get_errorcode(&result);
--	} else if (result.a0 == FFA_MSG_SEND_DIRECT_REQ_32) {
-+	} else if (FFA_TO_32_BIT_FUNC(result.a0) == FFA_MSG_SEND_DIRECT_REQ_32) {
- 		ffa_unpack_direct_msg(&result, msg);
- 	} else {
- 		assert(result.a0 == FFA_SUCCESS_32);
-@@ -227,13 +236,15 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg)
- 	return FFA_OK;
- }
- 
--ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
--				   uint32_t a1, uint32_t a2, uint32_t a3,
--				   uint32_t a4, struct ffa_direct_msg *msg)
-+static ffa_result ffa_msg_send_direct_req(uint32_t function_id, uint32_t resp_id,
-+					  uint16_t source, uint16_t dest,
-+					  uint64_t a0, uint64_t a1, uint64_t a2,
-+					  uint64_t a3, uint64_t a4,
-+					  struct ffa_direct_msg *msg)
- {
- 	struct ffa_params result = {0};
- 
--	ffa_svc(FFA_MSG_SEND_DIRECT_REQ_32,
-+	ffa_svc(function_id,
- 		SHIFT_U32(source, FFA_MSG_SEND_DIRECT_REQ_SOURCE_ID_SHIFT) |
- 		dest, FFA_PARAM_MBZ, a0, a1, a2, a3, a4, &result);
- 
-@@ -244,7 +255,7 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
- 
- 	if (result.a0 == FFA_ERROR) {
- 		return ffa_get_errorcode(&result);
--	} else if (result.a0 == FFA_MSG_SEND_DIRECT_RESP_32) {
-+	} else if (result.a0 == resp_id) {
- 		ffa_unpack_direct_msg(&result, msg);
- 	} else {
- 		assert(result.a0 == FFA_SUCCESS_32);
-@@ -254,13 +265,36 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
- 	return FFA_OK;
- }
- 
--ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
--				    uint32_t a1, uint32_t a2, uint32_t a3,
--				    uint32_t a4, struct ffa_direct_msg *msg)
-+ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest,
-+				      uint32_t a0, uint32_t a1, uint32_t a2,
-+				      uint32_t a3, uint32_t a4,
-+				      struct ffa_direct_msg *msg)
-+{
-+	return ffa_msg_send_direct_req(FFA_MSG_SEND_DIRECT_REQ_32,
-+				       FFA_MSG_SEND_DIRECT_RESP_32,
-+				       source, dest, a0, a1, a2, a3, a4, msg);
-+}
-+
-+ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest,
-+				      uint64_t a0, uint64_t a1, uint64_t a2,
-+				      uint64_t a3, uint64_t a4,
-+				      struct ffa_direct_msg *msg)
-+{
-+	return ffa_msg_send_direct_req(FFA_MSG_SEND_DIRECT_REQ_64,
-+				       FFA_MSG_SEND_DIRECT_RESP_64,
-+				       source, dest, a0, a1, a2, a3, a4, msg);
-+}
-+
-+static ffa_result ffa_msg_send_direct_resp(uint32_t function_id,
-+					   uint16_t source, uint16_t dest,
-+					   uint64_t a0, uint64_t a1,
-+					   uint64_t a2, uint64_t a3,
-+					   uint64_t a4,
-+					   struct ffa_direct_msg *msg)
- {
- 	struct ffa_params result = {0};
- 
--	ffa_svc(FFA_MSG_SEND_DIRECT_RESP_32,
-+	ffa_svc(function_id,
- 		SHIFT_U32(source, FFA_MSG_SEND_DIRECT_RESP_SOURCE_ID_SHIFT) |
- 		dest, FFA_PARAM_MBZ, a0, a1, a2, a3, a4, &result);
- 
-@@ -271,7 +305,7 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
- 
- 	if (result.a0 == FFA_ERROR) {
- 		return ffa_get_errorcode(&result);
--	} else if (result.a0 == FFA_MSG_SEND_DIRECT_REQ_32) {
-+	} else if (FFA_TO_32_BIT_FUNC(result.a0) == FFA_MSG_SEND_DIRECT_REQ_32) {
- 		ffa_unpack_direct_msg(&result, msg);
- 	} else {
- 		assert(result.a0 == FFA_SUCCESS_32);
-@@ -281,6 +315,24 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
- 	return FFA_OK;
- }
- 
-+ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest,
-+				       uint32_t a0, uint32_t a1, uint32_t a2,
-+				       uint32_t a3, uint32_t a4,
-+				       struct ffa_direct_msg *msg)
-+{
-+	return ffa_msg_send_direct_resp(FFA_MSG_SEND_DIRECT_RESP_32, source,
-+					dest, a0, a1, a2, a3, a4, msg);
-+}
-+
-+ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest,
-+				      uint64_t a0, uint64_t a1, uint64_t a2,
-+				      uint64_t a3, uint64_t a4,
-+				      struct ffa_direct_msg *msg)
-+{
-+	return ffa_msg_send_direct_resp(FFA_MSG_SEND_DIRECT_RESP_64, source,
-+					dest, a0, a1, a2, a3, a4, msg);
-+}
-+
- ffa_result ffa_mem_donate(uint32_t total_length, uint32_t fragment_length,
- 			  void *buffer_address, uint32_t page_count,
- 			  uint64_t *handle)
-diff --git a/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c b/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c
-index 6813573..03a372f 100644
---- a/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c
-+++ b/components/messaging/ffa/libsp/ffa_direct_msg_routing_extension.c
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include "ffa_direct_msg_routing_extension.h"
-@@ -20,23 +20,23 @@ static uint16_t callee_id = SP_ID_INVALID;
- 
- static bool is_rc_message(const struct ffa_direct_msg *msg)
- {
--	return msg->args[0] & FFA_ROUTING_EXT_RC_BIT;
-+	return msg->args.args32[0] & FFA_ROUTING_EXT_RC_BIT;
- }
- 
- static bool is_error_message(const struct ffa_direct_msg *msg)
- {
--	return msg->args[0] & FFA_ROUTING_EXT_ERROR_BIT;
-+	return msg->args.args32[0] & FFA_ROUTING_EXT_ERROR_BIT;
- }
- 
- static ffa_result get_error_code_from_message(const struct ffa_direct_msg *msg)
- {
--	return (ffa_result)msg->args[1];
-+	return (ffa_result)msg->args.args32[1];
- }
- 
- static ffa_result send_rc_error_message(struct ffa_direct_msg *req,
- 					ffa_result error_code)
- {
--	return ffa_msg_send_direct_resp(req->destination_id, req->source_id,
-+	return ffa_msg_send_direct_resp_32(req->destination_id, req->source_id,
- 					(FFA_ROUTING_EXT_ERROR_BIT |
- 					 FFA_ROUTING_EXT_RC_BIT),
- 					error_code, 0, 0, 0, req);
-@@ -45,7 +45,7 @@ static ffa_result send_rc_error_message(struct ffa_direct_msg *req,
- static ffa_result send_rc_error_message_to_rc_root(struct ffa_direct_msg *resp,
- 						   ffa_result error_code)
- {
--	return ffa_msg_send_direct_req(own_id, callee_id,
-+	return ffa_msg_send_direct_req_32(own_id, callee_id,
- 				       (FFA_ROUTING_EXT_RC_BIT |
- 					FFA_ROUTING_EXT_ERROR_BIT),
- 				       error_code, 0, 0, 0, resp);
-@@ -128,10 +128,10 @@ ffa_result ffa_direct_msg_routing_ext_req_post_hook(struct ffa_direct_msg *resp)
- 		/* Forwarding RC request towards the root (normal world) */
- 		state = forwarding;
- 
--		ffa_res = ffa_msg_send_direct_resp(own_id, caller_id,
--						   resp->args[0], resp->args[1],
--						   resp->args[2], resp->args[3],
--						   resp->args[4], &rc_resp);
-+		ffa_res = ffa_msg_send_direct_resp_32(own_id, caller_id,
-+						   resp->args.args32[0], resp->args.args32[1],
-+						   resp->args.args32[2], resp->args.args32[3],
-+						   resp->args.args32[4], &rc_resp);
- 		if (ffa_res != FFA_OK)
- 			goto forward_ffa_error_to_rc_root;
- 
-@@ -145,9 +145,9 @@ ffa_result ffa_direct_msg_routing_ext_req_post_hook(struct ffa_direct_msg *resp)
- 
- 		/* Forwarding RC response towards the RC root. */
- 		state = internal;
--		ffa_res = ffa_msg_send_direct_req(
--			own_id, callee_id, rc_resp.args[0], rc_resp.args[1],
--			rc_resp.args[2], rc_resp.args[3], rc_resp.args[4],
-+		ffa_res = ffa_msg_send_direct_req_32(
-+			own_id, callee_id, rc_resp.args.args32[0], rc_resp.args.args32[1],
-+			rc_resp.args.args32[2], rc_resp.args.args32[3], rc_resp.args.args32[4],
- 			resp);
- 
- 		goto break_on_ffa_error;
-@@ -197,7 +197,7 @@ void ffa_direct_msg_routing_ext_resp_error_hook(void)
- 
- void ffa_direct_msg_routing_ext_rc_req_pre_hook(struct ffa_direct_msg *req)
- {
--	req->args[0] = FFA_ROUTING_EXT_RC_BIT;
-+	req->args.args32[0] = FFA_ROUTING_EXT_RC_BIT;
- 	state = rc_root;
- }
- 
-diff --git a/components/messaging/ffa/libsp/include/ffa_api.h b/components/messaging/ffa/libsp/include/ffa_api.h
-index ec5cb04..4b7073b 100644
---- a/components/messaging/ffa/libsp/include/ffa_api.h
-+++ b/components/messaging/ffa/libsp/include/ffa_api.h
-@@ -126,8 +126,8 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg);
- /** Messaging interfaces */
- 
- /**
-- * @brief      Sends a partition message in parameter registers as a request and
-- *             blocks until the response is available.
-+ * @brief      Sends a 32 bit partition message in parameter registers as a
-+ *             request and blocks until the response is available.
-  * @note       The ffa_interrupt_handler function can be called during the
-  *             execution of this function
-  *
-@@ -138,13 +138,14 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg);
-  *
-  * @return     The FF-A error status code
-  */
--ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
--				   uint32_t a1, uint32_t a2, uint32_t a3,
--				   uint32_t a4, struct ffa_direct_msg *msg);
-+ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest,
-+				      uint32_t a0, uint32_t a1, uint32_t a2,
-+				      uint32_t a3, uint32_t a4,
-+				      struct ffa_direct_msg *msg);
- 
- /**
-- * @brief      Sends a partition message in parameter registers as a response
-- *             and blocks until the response is available.
-+ * @brief      Sends a 64 bit partition message in parameter registers as a
-+ *             request and blocks until the response is available.
-  * @note       The ffa_interrupt_handler function can be called during the
-  *             execution of this function
-  *
-@@ -155,9 +156,46 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
-  *
-  * @return     The FF-A error status code
-  */
--ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
--				    uint32_t a1, uint32_t a2, uint32_t a3,
--				    uint32_t a4, struct ffa_direct_msg *msg);
-+ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest,
-+				      uint64_t a0, uint64_t a1, uint64_t a2,
-+				      uint64_t a3, uint64_t a4,
-+				      struct ffa_direct_msg *msg);
-+
-+/**
-+ * @brief      Sends a 32 bit partition message in parameter registers as a
-+ *             response and blocks until the response is available.
-+ * @note       The ffa_interrupt_handler function can be called during the
-+ *             execution of this function
-+ *
-+ * @param[in]  source            Source endpoint ID
-+ * @param[in]  dest              Destination endpoint ID
-+ * @param[in]  a0,a1,a2,a3,a4    Implementation defined message values
-+ * @param[out] msg               The response message
-+ *
-+ * @return     The FF-A error status code
-+ */
-+ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest,
-+				       uint32_t a0, uint32_t a1, uint32_t a2,
-+				       uint32_t a3, uint32_t a4,
-+				       struct ffa_direct_msg *msg);
-+
-+/**
-+ * @brief      Sends a 64 bit partition message in parameter registers as a
-+ *             response and blocks until the response is available.
-+ * @note       The ffa_interrupt_handler function can be called during the
-+ *             execution of this function
-+ *
-+ * @param[in]  source            Source endpoint ID
-+ * @param[in]  dest              Destination endpoint ID
-+ * @param[in]  a0,a1,a2,a3,a4    Implementation defined message values
-+ * @param[out] msg               The response message
-+ *
-+ * @return     The FF-A error status code
-+ */
-+ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest,
-+				       uint64_t a0, uint64_t a1, uint64_t a2,
-+				       uint64_t a3, uint64_t a4,
-+				       struct ffa_direct_msg *msg);
- 
- /**
-  * Memory management interfaces
-diff --git a/components/messaging/ffa/libsp/include/ffa_api_defines.h b/components/messaging/ffa/libsp/include/ffa_api_defines.h
-index 95bcb0c..163a0cd 100644
---- a/components/messaging/ffa/libsp/include/ffa_api_defines.h
-+++ b/components/messaging/ffa/libsp/include/ffa_api_defines.h
-@@ -58,6 +58,11 @@
- #define FFA_MEM_PERM_GET		UINT32_C(0x84000088)
- #define FFA_MEM_PERM_SET		UINT32_C(0x84000089)
- 
-+/* Utility macros */
-+#define FFA_TO_32_BIT_FUNC(x)		((x) & (~UINT32_C(0x40000000)))
-+#define FFA_IS_32_BIT_FUNC(x)		(((x) & UINT32_C(0x40000000)) == 0)
-+#define FFA_IS_64_BIT_FUNC(x)		(((x) & UINT32_C(0x40000000)) != 0)
-+
- /* Special value for MBZ parameters */
- #define FFA_PARAM_MBZ			UINT32_C(0x0)
- 
-diff --git a/components/messaging/ffa/libsp/include/ffa_api_types.h b/components/messaging/ffa/libsp/include/ffa_api_types.h
-index 3686e2e..b1be7ac 100644
---- a/components/messaging/ffa/libsp/include/ffa_api_types.h
-+++ b/components/messaging/ffa/libsp/include/ffa_api_types.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: BSD-3-Clause */
- /*
-- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #ifndef LIBSP_INCLUDE_FFA_API_TYPES_H_
-@@ -80,7 +80,10 @@ struct ffa_direct_msg {
- 	uint32_t function_id;
- 	uint16_t source_id;
- 	uint16_t destination_id;
--	uint32_t args[5];
-+	union {
-+		uint32_t args32[5];
-+		uint64_t args64[5];
-+	} args;
- };
- 
- /**
-diff --git a/components/messaging/ffa/libsp/include/sp_messaging.h b/components/messaging/ffa/libsp/include/sp_messaging.h
-index 4bb45f7..7173a92 100644
---- a/components/messaging/ffa/libsp/include/sp_messaging.h
-+++ b/components/messaging/ffa/libsp/include/sp_messaging.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: BSD-3-Clause */
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #ifndef LIBSP_INCLUDE_SP_MESSAGING_H_
-@@ -9,6 +9,7 @@
- #include "sp_api_defines.h"
- #include "sp_api_types.h"
- 
-+#include <stdbool.h>
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -23,7 +24,11 @@ extern "C" {
- struct sp_msg {
- 	uint16_t source_id;
- 	uint16_t destination_id;
--	uint32_t args[SP_MSG_ARG_COUNT];
-+	bool is_64bit_message;
-+	union {
-+		uint32_t args32[SP_MSG_ARG_COUNT];
-+		uint64_t args64[SP_MSG_ARG_COUNT];
-+	} args;
- };
- 
- /**
-diff --git a/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp
-index ceebcbf..a01848c 100644
---- a/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp
-+++ b/components/messaging/ffa/libsp/mock/mock_ffa_api.cpp
-@@ -140,13 +140,13 @@ ffa_result ffa_msg_wait(struct ffa_direct_msg *msg)
- 		.returnIntValue();
- }
- 
--void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
--				    uint32_t a1, uint32_t a2, uint32_t a3,
--				    uint32_t a4,
--				    const struct ffa_direct_msg *msg,
--				    ffa_result result)
-+void expect_ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest,
-+				       uint32_t a0, uint32_t a1, uint32_t a2,
-+				       uint32_t a3, uint32_t a4,
-+				       const struct ffa_direct_msg *msg,
-+				       ffa_result result)
- {
--	mock().expectOneCall("ffa_msg_send_direct_req")
-+	mock().expectOneCall("ffa_msg_send_direct_req_32")
- 		.withUnsignedIntParameter("source", source)
- 		.withUnsignedIntParameter("dest", dest)
- 		.withUnsignedIntParameter("a0", a0)
-@@ -158,12 +158,13 @@ void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
- 		.andReturnValue(result);
- }
- 
--ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
--				   uint32_t a1, uint32_t a2, uint32_t a3,
--				   uint32_t a4, struct ffa_direct_msg *msg)
-+ffa_result ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest,
-+				      uint32_t a0, uint32_t a1, uint32_t a2,
-+				      uint32_t a3,uint32_t a4,
-+				      struct ffa_direct_msg *msg)
- {
- 	return mock()
--		.actualCall("ffa_msg_send_direct_req")
-+		.actualCall("ffa_msg_send_direct_req_32")
- 		.withUnsignedIntParameter("source", source)
- 		.withUnsignedIntParameter("dest", dest)
- 		.withUnsignedIntParameter("a0", a0)
-@@ -175,13 +176,49 @@ ffa_result ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
- 		.returnIntValue();
- }
- 
--void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest,
-+void expect_ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest,
-+				       uint64_t a0, uint64_t a1, uint64_t a2,
-+				       uint64_t a3, uint64_t a4,
-+				       const struct ffa_direct_msg *msg,
-+				       ffa_result result)
-+{
-+	mock().expectOneCall("ffa_msg_send_direct_req_64")
-+		.withUnsignedIntParameter("source", source)
-+		.withUnsignedIntParameter("dest", dest)
-+		.withUnsignedLongIntParameter("a0", a0)
-+		.withUnsignedLongIntParameter("a1", a1)
-+		.withUnsignedLongIntParameter("a2", a2)
-+		.withUnsignedLongIntParameter("a3", a3)
-+		.withUnsignedLongIntParameter("a4", a4)
-+		.withOutputParameterReturning("msg", msg, sizeof(*msg))
-+		.andReturnValue(result);
-+}
-+
-+ffa_result ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest,
-+				      uint64_t a0, uint64_t a1, uint64_t a2,
-+				      uint64_t a3, uint64_t a4,
-+				      struct ffa_direct_msg *msg)
-+{
-+	return mock()
-+		.actualCall("ffa_msg_send_direct_req_64")
-+		.withUnsignedIntParameter("source", source)
-+		.withUnsignedIntParameter("dest", dest)
-+		.withUnsignedLongIntParameter("a0", a0)
-+		.withUnsignedLongIntParameter("a1", a1)
-+		.withUnsignedLongIntParameter("a2", a2)
-+		.withUnsignedLongIntParameter("a3", a3)
-+		.withUnsignedLongIntParameter("a4", a4)
-+		.withOutputParameter("msg", msg)
-+		.returnIntValue();
-+}
-+
-+void expect_ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest,
- 				     uint32_t a0, uint32_t a1, uint32_t a2,
- 				     uint32_t a3, uint32_t a4,
- 				     const struct ffa_direct_msg *msg,
- 				     ffa_result result)
- {
--	mock().expectOneCall("ffa_msg_send_direct_resp")
-+	mock().expectOneCall("ffa_msg_send_direct_resp_32")
- 		.withUnsignedIntParameter("source", source)
- 		.withUnsignedIntParameter("dest", dest)
- 		.withUnsignedIntParameter("a0", a0)
-@@ -193,12 +230,12 @@ void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest,
- 		.andReturnValue(result);
- }
- 
--ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
-+ffa_result ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest, uint32_t a0,
- 				    uint32_t a1, uint32_t a2, uint32_t a3,
- 				    uint32_t a4, struct ffa_direct_msg *msg)
- {
- 	return mock()
--		.actualCall("ffa_msg_send_direct_resp")
-+		.actualCall("ffa_msg_send_direct_resp_32")
- 		.withUnsignedIntParameter("source", source)
- 		.withUnsignedIntParameter("dest", dest)
- 		.withUnsignedIntParameter("a0", a0)
-@@ -210,6 +247,41 @@ ffa_result ffa_msg_send_direct_resp(uint16_t source, uint16_t dest, uint32_t a0,
- 		.returnIntValue();
- }
- 
-+void expect_ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest,
-+				     uint64_t a0, uint64_t a1, uint64_t a2,
-+				     uint64_t a3, uint64_t a4,
-+				     const struct ffa_direct_msg *msg,
-+				     ffa_result result)
-+{
-+	mock().expectOneCall("ffa_msg_send_direct_resp_64")
-+		.withUnsignedIntParameter("source", source)
-+		.withUnsignedIntParameter("dest", dest)
-+		.withUnsignedLongIntParameter("a0", a0)
-+		.withUnsignedLongIntParameter("a1", a1)
-+		.withUnsignedLongIntParameter("a2", a2)
-+		.withUnsignedLongIntParameter("a3", a3)
-+		.withUnsignedLongIntParameter("a4", a4)
-+		.withOutputParameterReturning("msg", msg, sizeof(*msg))
-+		.andReturnValue(result);
-+}
-+
-+ffa_result ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest, uint64_t a0,
-+				    uint64_t a1, uint64_t a2, uint64_t a3,
-+				    uint64_t a4, struct ffa_direct_msg *msg)
-+{
-+	return mock()
-+		.actualCall("ffa_msg_send_direct_resp_64")
-+		.withUnsignedIntParameter("source", source)
-+		.withUnsignedIntParameter("dest", dest)
-+		.withUnsignedLongIntParameter("a0", a0)
-+		.withUnsignedLongIntParameter("a1", a1)
-+		.withUnsignedLongIntParameter("a2", a2)
-+		.withUnsignedLongIntParameter("a3", a3)
-+		.withUnsignedLongIntParameter("a4", a4)
-+		.withOutputParameter("msg", msg)
-+		.returnIntValue();
-+}
-+
- void expect_ffa_mem_donate(uint32_t total_length, uint32_t fragment_length,
- 			   void *buffer_address, uint32_t page_count,
- 			   const uint64_t *handle, ffa_result result)
-diff --git a/components/messaging/ffa/libsp/mock/mock_ffa_api.h b/components/messaging/ffa/libsp/mock/mock_ffa_api.h
-index b1c794f..4213ccb 100644
---- a/components/messaging/ffa/libsp/mock/mock_ffa_api.h
-+++ b/components/messaging/ffa/libsp/mock/mock_ffa_api.h
-@@ -30,17 +30,29 @@ void expect_ffa_id_get(const uint16_t *id, ffa_result result);
- 
- void expect_ffa_msg_wait(const struct ffa_direct_msg *msg, ffa_result result);
- 
--void expect_ffa_msg_send_direct_req(uint16_t source, uint16_t dest, uint32_t a0,
--				    uint32_t a1, uint32_t a2, uint32_t a3,
--				    uint32_t a4,
--				    const struct ffa_direct_msg *msg,
--				    ffa_result result);
--
--void expect_ffa_msg_send_direct_resp(uint16_t source, uint16_t dest,
--				     uint32_t a0, uint32_t a1, uint32_t a2,
--				     uint32_t a3, uint32_t a4,
--				     const struct ffa_direct_msg *msg,
--				     ffa_result result);
-+void expect_ffa_msg_send_direct_req_32(uint16_t source, uint16_t dest,
-+				       uint32_t a0, uint32_t a1, uint32_t a2,
-+				       uint32_t a3, uint32_t a4,
-+				       const struct ffa_direct_msg *msg,
-+				       ffa_result result);
-+
-+void expect_ffa_msg_send_direct_req_64(uint16_t source, uint16_t dest,
-+				       uint64_t a0, uint64_t a1, uint64_t a2,
-+				       uint64_t a3, uint64_t a4,
-+				       const struct ffa_direct_msg *msg,
-+				       ffa_result result);
-+
-+void expect_ffa_msg_send_direct_resp_32(uint16_t source, uint16_t dest,
-+					uint32_t a0, uint32_t a1, uint32_t a2,
-+					uint32_t a3, uint32_t a4,
-+					const struct ffa_direct_msg *msg,
-+					ffa_result result);
-+
-+void expect_ffa_msg_send_direct_resp_64(uint16_t source, uint16_t dest,
-+					uint64_t a0, uint64_t a1, uint64_t a2,
-+					uint64_t a3, uint64_t a4,
-+					const struct ffa_direct_msg *msg,
-+					ffa_result result);
- 
- void expect_ffa_mem_donate(uint32_t total_length, uint32_t fragment_length,
- 			   void *buffer_address, uint32_t page_count,
-diff --git a/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp
-index ab33649..c1cbdd6 100644
---- a/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp
-+++ b/components/messaging/ffa/libsp/mock/test/test_mock_ffa_api.cpp
-@@ -105,7 +105,7 @@ TEST(mock_ffa_api, ffa_msg_wait)
- 	MEMCMP_EQUAL(&expected_msg, &msg, sizeof(expected_msg));
- }
- 
--TEST(mock_ffa_api, ffa_msg_send_direct_req)
-+TEST(mock_ffa_api, ffa_msg_send_direct_req_32)
- {
- 	const uint16_t source = 0x1122;
- 	const uint16_t dest = 0x2233;
-@@ -116,13 +116,30 @@ TEST(mock_ffa_api, ffa_msg_send_direct_req)
- 	const uint32_t a4 = 0x89124567;
- 	struct ffa_direct_msg msg = { 0 };
- 
--	expect_ffa_msg_send_direct_req(source, dest, a0, a1, a2, a3, a4,
-+	expect_ffa_msg_send_direct_req_32(source, dest, a0, a1, a2, a3, a4,
-+				          &expected_msg, result);
-+	LONGS_EQUAL(result, ffa_msg_send_direct_req_32(source, dest, a0, a1, a2,
-+						       a3, a4, &msg));
-+}
-+
-+TEST(mock_ffa_api, ffa_msg_send_direct_req_64)
-+{
-+	const uint16_t source = 0x1122;
-+	const uint16_t dest = 0x2233;
-+	const uint64_t a0 = 0x4567891221987654;
-+	const uint64_t a1 = 0x5678912442198765;
-+	const uint64_t a2 = 0x6789124554219876;
-+	const uint64_t a3 = 0x7891245665421987;
-+	const uint64_t a4 = 0x8912456776542198;
-+	struct ffa_direct_msg msg = { 0 };
-+
-+	expect_ffa_msg_send_direct_req_64(source, dest, a0, a1, a2, a3, a4,
- 				       &expected_msg, result);
--	LONGS_EQUAL(result, ffa_msg_send_direct_req(source, dest, a0, a1, a2,
--						    a3, a4, &msg));
-+	LONGS_EQUAL(result, ffa_msg_send_direct_req_64(source, dest, a0, a1, a2,
-+						       a3, a4, &msg));
- }
- 
--TEST(mock_ffa_api, ffa_msg_send_direct_resp)
-+TEST(mock_ffa_api, ffa_msg_send_direct_resp_32)
- {
- 	const uint16_t source = 0x1122;
- 	const uint16_t dest = 0x2233;
-@@ -133,10 +150,27 @@ TEST(mock_ffa_api, ffa_msg_send_direct_resp)
- 	const uint32_t a4 = 0x89124567;
- 	struct ffa_direct_msg msg = { 0 };
- 
--	expect_ffa_msg_send_direct_resp(source, dest, a0, a1, a2, a3, a4,
-+	expect_ffa_msg_send_direct_resp_32(source, dest, a0, a1, a2, a3, a4,
- 					&expected_msg, result);
--	LONGS_EQUAL(result, ffa_msg_send_direct_resp(source, dest, a0, a1, a2,
--						     a3, a4, &msg));
-+	LONGS_EQUAL(result, ffa_msg_send_direct_resp_32(source, dest, a0, a1,
-+							a2, a3, a4, &msg));
-+}
-+
-+TEST(mock_ffa_api, ffa_msg_send_direct_resp_64)
-+{
-+	const uint16_t source = 0x1122;
-+	const uint16_t dest = 0x2233;
-+	const uint64_t a0 = 0x4567891221987654;
-+	const uint64_t a1 = 0x5678912442198765;
-+	const uint64_t a2 = 0x6789124554219876;
-+	const uint64_t a3 = 0x7891245665421987;
-+	const uint64_t a4 = 0x8912456776542198;
-+	struct ffa_direct_msg msg = { 0 };
-+
-+	expect_ffa_msg_send_direct_resp_64(source, dest, a0, a1, a2, a3, a4,
-+					  &expected_msg, result);
-+	LONGS_EQUAL(result, ffa_msg_send_direct_resp_64(source, dest, a0, a1,
-+							a2, a3, a4, &msg));
- }
- 
- TEST(mock_ffa_api, ffa_mem_donate)
-diff --git a/components/messaging/ffa/libsp/sp_messaging.c b/components/messaging/ffa/libsp/sp_messaging.c
-index f7223aa..392006b 100644
---- a/components/messaging/ffa/libsp/sp_messaging.c
-+++ b/components/messaging/ffa/libsp/sp_messaging.c
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include "ffa_api.h"
-@@ -20,22 +20,40 @@ static void pack_ffa_direct_msg(const struct sp_msg *msg,
- 	ffa_msg->source_id = msg->source_id;
- 	ffa_msg->destination_id = msg->destination_id;
- 
--	ffa_msg->args[0] = 0;
--	memcpy(&ffa_msg->args[SP_MSG_ARG_OFFSET], msg->args, sizeof(msg->args));
-+	ffa_msg->args.args64[0] = 0;
-+	if (msg->is_64bit_message)
-+		memcpy(&ffa_msg->args.args64[SP_MSG_ARG_OFFSET],
-+		       msg->args.args64, sizeof(msg->args.args64));
-+	else
-+		memcpy(&ffa_msg->args.args32[SP_MSG_ARG_OFFSET],
-+		       msg->args.args32, sizeof(msg->args.args32));
- }
- 
- static void unpack_ffa_direct_msg(const struct ffa_direct_msg *ffa_msg,
- 				  struct sp_msg *msg)
- {
--	if (ffa_msg->function_id != FFA_SUCCESS_32) {
-+	if (ffa_msg->function_id == FFA_MSG_SEND_DIRECT_REQ_32 ||
-+	    ffa_msg->function_id == FFA_MSG_SEND_DIRECT_RESP_32) {
- 		/*
--		 * Handling request or response (error is handled before call)
-+		 * Handling 32 bit request or response
- 		 */
- 		msg->source_id = ffa_msg->source_id;
- 		msg->destination_id = ffa_msg->destination_id;
-+		msg->is_64bit_message = FFA_IS_64_BIT_FUNC(ffa_msg->function_id);
- 
--		memcpy(msg->args, &ffa_msg->args[SP_MSG_ARG_OFFSET],
--		       sizeof(msg->args));
-+		memcpy(msg->args.args32, &ffa_msg->args.args32[SP_MSG_ARG_OFFSET],
-+		       sizeof(msg->args.args32));
-+	} else if (ffa_msg->function_id == FFA_MSG_SEND_DIRECT_REQ_64 ||
-+		   ffa_msg->function_id == FFA_MSG_SEND_DIRECT_RESP_64) {
-+		/*
-+		 * Handling 64 bit request or response
-+		 */
-+		msg->source_id = ffa_msg->source_id;
-+		msg->destination_id = ffa_msg->destination_id;
-+		msg->is_64bit_message = FFA_IS_64_BIT_FUNC(ffa_msg->function_id);
-+
-+		memcpy(msg->args.args64, &ffa_msg->args.args64[SP_MSG_ARG_OFFSET],
-+		       sizeof(msg->args.args64));
- 	} else {
- 		/* Success has no message parameters */
- 		*msg = (struct sp_msg){ 0 };
-@@ -89,11 +107,18 @@ sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp)
- 	ffa_direct_msg_routing_ext_req_pre_hook(&ffa_req);
- #endif
- 
--	ffa_res = ffa_msg_send_direct_req(ffa_req.source_id,
--					  ffa_req.destination_id,
--					  ffa_req.args[0], ffa_req.args[1],
--					  ffa_req.args[2], ffa_req.args[3],
--					  ffa_req.args[4], &ffa_resp);
-+	if (req->is_64bit_message)
-+		ffa_res = ffa_msg_send_direct_req_64(
-+			ffa_req.source_id, ffa_req.destination_id,
-+			ffa_req.args.args64[0], ffa_req.args.args64[1],
-+			ffa_req.args.args64[2], ffa_req.args.args64[3],
-+			ffa_req.args.args64[4], &ffa_resp);
-+	else
-+		ffa_res = ffa_msg_send_direct_req_32(
-+			ffa_req.source_id, ffa_req.destination_id,
-+			ffa_req.args.args32[0], ffa_req.args.args32[1],
-+			ffa_req.args.args32[2], ffa_req.args.args32[3],
-+			ffa_req.args.args32[4], &ffa_resp);
- 
- 	if (ffa_res != FFA_OK) {
- #if FFA_DIRECT_MSG_ROUTING_EXTENSION
-@@ -136,11 +161,18 @@ sp_result sp_msg_send_direct_resp(const struct sp_msg *resp, struct sp_msg *req)
- 	ffa_direct_msg_routing_ext_resp_pre_hook(&ffa_resp);
- #endif
- 
--	ffa_res = ffa_msg_send_direct_resp(ffa_resp.source_id,
--					   ffa_resp.destination_id,
--					   ffa_resp.args[0], ffa_resp.args[1],
--					   ffa_resp.args[2], ffa_resp.args[3],
--					   ffa_resp.args[4], &ffa_req);
-+	if (resp->is_64bit_message)
-+		ffa_res = ffa_msg_send_direct_resp_64(
-+			ffa_resp.source_id, ffa_resp.destination_id,
-+			ffa_resp.args.args64[0], ffa_resp.args.args64[1],
-+			ffa_resp.args.args64[2], ffa_resp.args.args64[3],
-+			ffa_resp.args.args64[4], &ffa_req);
-+	else
-+		ffa_res = ffa_msg_send_direct_resp_32(
-+			ffa_resp.source_id, ffa_resp.destination_id,
-+			ffa_resp.args.args32[0], ffa_resp.args.args32[1],
-+			ffa_resp.args.args32[2], ffa_resp.args.args32[3],
-+			ffa_resp.args.args32[4], &ffa_req);
- 
- 	if (ffa_res != FFA_OK) {
- #if FFA_DIRECT_MSG_ROUTING_EXTENSION
-@@ -182,11 +214,11 @@ sp_result sp_msg_send_rc_req(const struct sp_msg *req, struct sp_msg *resp)
- 
- 	ffa_direct_msg_routing_ext_rc_req_pre_hook(&ffa_req);
- 
--	ffa_res = ffa_msg_send_direct_resp(ffa_req.source_id,
-+	ffa_res = ffa_msg_send_direct_resp_32(ffa_req.source_id,
- 					   ffa_req.destination_id,
--					   ffa_req.args[0], ffa_req.args[1],
--					   ffa_req.args[2], ffa_req.args[3],
--					   ffa_req.args[4], &ffa_resp);
-+					   ffa_req.args.args32[0], ffa_req.args.args32[1],
-+					   ffa_req.args.args32[2], ffa_req.args.args32[3],
-+					   ffa_req.args.args32[4], &ffa_resp);
- 
- 	if (ffa_res != FFA_OK) {
- 		ffa_direct_msg_routing_ext_rc_req_error_hook();
-diff --git a/components/messaging/ffa/libsp/test/test_ffa_api.cpp b/components/messaging/ffa/libsp/test/test_ffa_api.cpp
-index 8fa261e..6cca085 100644
---- a/components/messaging/ffa/libsp/test/test_ffa_api.cpp
-+++ b/components/messaging/ffa/libsp/test/test_ffa_api.cpp
-@@ -43,20 +43,35 @@ TEST_GROUP(ffa_api)
- 		svc_result.a2 = (uint32_t)error_code;
- 	}
- 
--	void msg_equal(uint32_t func_id, uint16_t source_id, uint16_t dest_id,
--			uint32_t arg0, uint32_t arg1, uint32_t arg2,
--			uint32_t arg3, uint32_t arg4)
-+	void msg_equal_32(uint32_t func_id, uint16_t source_id, uint16_t dest_id,
-+			  uint32_t arg0, uint32_t arg1, uint32_t arg2,
-+			  uint32_t arg3, uint32_t arg4)
- 	{
- 		UNSIGNED_LONGS_EQUAL(func_id, msg.function_id);
- 		UNSIGNED_LONGS_EQUAL(source_id, msg.source_id);
- 		UNSIGNED_LONGS_EQUAL(dest_id, msg.destination_id);
--		UNSIGNED_LONGS_EQUAL(arg0, msg.args[0]);
--		UNSIGNED_LONGS_EQUAL(arg1, msg.args[1]);
--		UNSIGNED_LONGS_EQUAL(arg2, msg.args[2]);
--		UNSIGNED_LONGS_EQUAL(arg3, msg.args[3]);
--		UNSIGNED_LONGS_EQUAL(arg4, msg.args[4]);
-+		UNSIGNED_LONGS_EQUAL(arg0, msg.args.args32[0]);
-+		UNSIGNED_LONGS_EQUAL(arg1, msg.args.args32[1]);
-+		UNSIGNED_LONGS_EQUAL(arg2, msg.args.args32[2]);
-+		UNSIGNED_LONGS_EQUAL(arg3, msg.args.args32[3]);
-+		UNSIGNED_LONGS_EQUAL(arg4, msg.args.args32[4]);
- 	}
- 
-+	void msg_equal_64(uint32_t func_id, uint16_t source_id, uint16_t dest_id,
-+			  uint64_t arg0, uint64_t arg1, uint64_t arg2,
-+			  uint64_t arg3, uint64_t arg4)
-+	{
-+		UNSIGNED_LONGS_EQUAL(func_id, msg.function_id);
-+		UNSIGNED_LONGS_EQUAL(source_id, msg.source_id);
-+		UNSIGNED_LONGS_EQUAL(dest_id, msg.destination_id);
-+		UNSIGNED_LONGLONGS_EQUAL(arg0, msg.args.args64[0]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg1, msg.args.args64[1]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg2, msg.args.args64[2]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg3, msg.args.args64[3]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg4, msg.args.args64[4]);
-+	}
-+
-+
- 	struct ffa_params svc_result;
- 	struct ffa_direct_msg msg;
- };
-@@ -360,7 +375,7 @@ TEST(ffa_api, ffa_msg_wait_success)
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
- 	ffa_result result = ffa_msg_wait(&msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
- TEST(ffa_api, ffa_msg_wait_error)
-@@ -369,10 +384,10 @@ TEST(ffa_api, ffa_msg_wait_error)
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
- 	ffa_result result = ffa_msg_wait(&msg);
- 	LONGS_EQUAL(-1, result);
--	msg_equal(0, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_wait_direct_req)
-+TEST(ffa_api, ffa_msg_wait_direct_req_32)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -392,7 +407,31 @@ TEST(ffa_api, ffa_msg_wait_direct_req)
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
- 	ffa_result result = ffa_msg_wait(&msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x8400006F, source_id, dest_id, arg0, arg1, arg2, arg3,
-+	msg_equal_32(0x8400006F, source_id, dest_id, arg0, arg1, arg2, arg3,
-+		   arg4);
-+}
-+
-+TEST(ffa_api, ffa_msg_wait_direct_req_64)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint64_t arg0 = 0x0123456776543210ULL;
-+	const uint64_t arg1 = 0x1234567887654321ULL;
-+	const uint64_t arg2 = 0x2345678998765432ULL;
-+	const uint64_t arg3 = 0x3456789aa9876543ULL;
-+	const uint64_t arg4 = 0x456789abba987654ULL;
-+
-+	svc_result.a0 = 0xC400006F;
-+	svc_result.a1 = ((uint32_t)source_id) << 16 | dest_id;
-+	svc_result.a3 = arg0;
-+	svc_result.a4 = arg1;
-+	svc_result.a5 = arg2;
-+	svc_result.a6 = arg3;
-+	svc_result.a7 = arg4;
-+	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
-+	ffa_result result = ffa_msg_wait(&msg);
-+	LONGS_EQUAL(0, result);
-+	msg_equal_64(0xC400006F, source_id, dest_id, arg0, arg1, arg2, arg3,
- 		   arg4);
- }
- 
-@@ -410,7 +449,7 @@ TEST(ffa_api, ffa_msg_wait_one_interrupt_success)
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
- 	ffa_result result = ffa_msg_wait(&msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
- TEST(ffa_api, ffa_msg_wait_two_interrupt_success)
-@@ -434,7 +473,7 @@ TEST(ffa_api, ffa_msg_wait_two_interrupt_success)
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
- 	ffa_result result = ffa_msg_wait(&msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
- TEST(ffa_api, ffa_msg_wait_unknown_response)
-@@ -448,7 +487,7 @@ TEST(ffa_api, ffa_msg_wait_unknown_response)
- 	}
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_success)
-+TEST(ffa_api, ffa_msg_send_direct_req_32_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -461,13 +500,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_success)
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_req(
-+	ffa_result result = ffa_msg_send_direct_req_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_error)
-+TEST(ffa_api, ffa_msg_send_direct_req_32_error)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -480,13 +519,48 @@ TEST(ffa_api, ffa_msg_send_direct_req_error)
- 	setup_error_response(-1);
- 	expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_req(
-+	ffa_result result = ffa_msg_send_direct_req_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(-1, result);
--	msg_equal(0, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0);
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_req_32_get_resp_64)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint32_t arg0 = 0x01234567ULL;
-+	const uint32_t arg1 = 0x12345678ULL;
-+	const uint32_t arg2 = 0x23456789ULL;
-+	const uint32_t arg3 = 0x3456789aULL;
-+	const uint32_t arg4 = 0x456789abULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint64_t resp_arg0 = 0x9012345665432109ULL;
-+	const uint64_t resp_arg1 = 0xa12345677654321aULL;
-+	const uint64_t resp_arg2 = 0xb23456788765432bULL;
-+	const uint64_t resp_arg3 = 0xc34567899876543cULL;
-+	const uint64_t resp_arg4 = 0xd456789aa987654dULL;
-+	assert_environment_t assert_env;
-+
-+	svc_result.a0 = 0xC4000070;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+
-+	expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+
-+	if (SETUP_ASSERT_ENVIRONMENT(assert_env)) {
-+		ffa_msg_send_direct_req_32(source_id, dest_id, arg0, arg1, arg2,
-+					arg3, arg4, &msg);
-+	}
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_direct_resp)
-+TEST(ffa_api, ffa_msg_send_direct_req_32_direct_resp)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -512,14 +586,82 @@ TEST(ffa_api, ffa_msg_send_direct_req_direct_resp)
- 	svc_result.a7 = resp_arg4;
- 	expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_req(
-+	ffa_result result = ffa_msg_send_direct_req_32(
-+		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
-+	LONGS_EQUAL(0, result);
-+	msg_equal_32(0x84000070, resp_source_id, resp_dest_id, resp_arg0,
-+		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_req_64_success)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint64_t arg0 = 0x0123456776543210ULL;
-+	const uint64_t arg1 = 0x1234567887654321ULL;
-+	const uint64_t arg2 = 0x2345678998765432ULL;
-+	const uint64_t arg3 = 0x3456789aa9876543ULL;
-+	const uint64_t arg4 = 0x456789abba987654ULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint64_t resp_arg0 = 0x9012345665432109ULL;
-+	const uint64_t resp_arg1 = 0xa12345677654321aULL;
-+	const uint64_t resp_arg2 = 0xb23456788765432bULL;
-+	const uint64_t resp_arg3 = 0xc34567899876543cULL;
-+	const uint64_t resp_arg4 = 0xd456789aa987654dULL;
-+
-+	svc_result.a0 = 0xC4000070;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+	expect_ffa_svc(0xC400006F, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+	ffa_result result = ffa_msg_send_direct_req_64(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000070, resp_source_id, resp_dest_id, resp_arg0,
-+	msg_equal_64(0xC4000070, resp_source_id, resp_dest_id, resp_arg0,
- 		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_one_interrupt_success)
-+TEST(ffa_api, ffa_msg_send_direct_req_64_get_resp_32)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint64_t arg0 = 0x9012345665432109ULL;
-+	const uint64_t arg1 = 0xa12345677654321aULL;
-+	const uint64_t arg2 = 0xb23456788765432bULL;
-+	const uint64_t arg3 = 0xc34567899876543cULL;
-+	const uint64_t arg4 = 0xd456789aa987654dULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint32_t resp_arg0 = 0x01234567ULL;
-+	const uint32_t resp_arg1 = 0x12345678ULL;
-+	const uint32_t resp_arg2 = 0x23456789ULL;
-+	const uint32_t resp_arg3 = 0x3456789aULL;
-+	const uint32_t resp_arg4 = 0x456789abULL;
-+	assert_environment_t assert_env;
-+
-+	svc_result.a0 = 0x84000070;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+
-+	expect_ffa_svc(0xC400006F, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+
-+	if (SETUP_ASSERT_ENVIRONMENT(assert_env)) {
-+		ffa_msg_send_direct_req_64(source_id, dest_id, arg0, arg1, arg2,
-+					arg3, arg4, &msg);
-+	}
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_req_32_one_interrupt_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -539,13 +681,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_one_interrupt_success)
- 
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
--	ffa_result result = ffa_msg_send_direct_req(
-+	ffa_result result = ffa_msg_send_direct_req_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_two_interrupt_success)
-+TEST(ffa_api, ffa_msg_send_direct_req_32_two_interrupt_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -573,13 +715,13 @@ TEST(ffa_api, ffa_msg_send_direct_req_two_interrupt_success)
- 
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
--	ffa_result result = ffa_msg_send_direct_req(
-+	ffa_result result = ffa_msg_send_direct_req_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_req_unknown_response)
-+TEST(ffa_api, ffa_msg_send_direct_req_32_unknown_response)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -594,12 +736,12 @@ TEST(ffa_api, ffa_msg_send_direct_req_unknown_response)
- 	expect_ffa_svc(0x8400006F, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
- 	if (SETUP_ASSERT_ENVIRONMENT(assert_env)) {
--		ffa_msg_send_direct_req(source_id, dest_id, arg0, arg1, arg2,
-+		ffa_msg_send_direct_req_32(source_id, dest_id, arg0, arg1, arg2,
- 					arg3, arg4, &msg);
- 	}
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_success)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -612,13 +754,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_success)
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_resp(
-+	ffa_result result = ffa_msg_send_direct_resp_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_error)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_error)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -631,13 +773,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_error)
- 	setup_error_response(-1);
- 	expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_resp(
-+	ffa_result result = ffa_msg_send_direct_resp_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(-1, result);
--	msg_equal(0, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_then_get_direct_req_as_response)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_then_get_direct_req_32_as_response)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -663,14 +805,113 @@ TEST(ffa_api, ffa_msg_send_direct_resp_then_get_direct_req_as_response)
- 	svc_result.a7 = resp_arg4;
- 	expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
--	ffa_result result = ffa_msg_send_direct_resp(
-+	ffa_result result = ffa_msg_send_direct_resp_32(
-+		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
-+	LONGS_EQUAL(0, result);
-+	msg_equal_32(0x8400006F, resp_source_id, resp_dest_id, resp_arg0,
-+		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_then_get_direct_req_64_as_response)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint32_t arg0 = 0x01234567ULL;
-+	const uint32_t arg1 = 0x12345678ULL;
-+	const uint32_t arg2 = 0x23456789ULL;
-+	const uint32_t arg3 = 0x3456789aULL;
-+	const uint32_t arg4 = 0x456789abULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint64_t resp_arg0 = 0x9012345665432109ULL;
-+	const uint64_t resp_arg1 = 0xa12345677654321aULL;
-+	const uint64_t resp_arg2 = 0xb23456788765432bULL;
-+	const uint64_t resp_arg3 = 0xc34567899876543cULL;
-+	const uint64_t resp_arg4 = 0xd456789aa987654dULL;
-+
-+	svc_result.a0 = 0xC400006F;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+	expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+	ffa_result result = ffa_msg_send_direct_resp_32(
-+		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
-+	LONGS_EQUAL(0, result);
-+	msg_equal_64(0xC400006F, resp_source_id, resp_dest_id, resp_arg0,
-+		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_resp_64_then_get_direct_req_32_as_response)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint64_t arg0 = 0x9012345665432109ULL;
-+	const uint64_t arg1 = 0xa12345677654321aULL;
-+	const uint64_t arg2 = 0xb23456788765432bULL;
-+	const uint64_t arg3 = 0xc34567899876543cULL;
-+	const uint64_t arg4 = 0xd456789aa987654dULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint32_t resp_arg0 = 0x01234567ULL;
-+	const uint32_t resp_arg1 = 0x12345678ULL;
-+	const uint32_t resp_arg2 = 0x23456789ULL;
-+	const uint32_t resp_arg3 = 0x3456789aULL;
-+	const uint32_t resp_arg4 = 0x456789abULL;
-+
-+	svc_result.a0 = 0x8400006F;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+	expect_ffa_svc(0xC4000070, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+	ffa_result result = ffa_msg_send_direct_resp_64(
-+		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
-+	LONGS_EQUAL(0, result);
-+	msg_equal_32(0x8400006F, resp_source_id, resp_dest_id, resp_arg0,
-+		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
-+}
-+
-+TEST(ffa_api, ffa_msg_send_direct_resp_64_then_get_direct_req_64_as_response)
-+{
-+	const uint16_t source_id = 0x1122;
-+	const uint16_t dest_id = 0x3344;
-+	const uint64_t arg0 = 0x0123456776543210ULL;
-+	const uint64_t arg1 = 0x1234567887654321ULL;
-+	const uint64_t arg2 = 0x2345678998765432ULL;
-+	const uint64_t arg3 = 0x3456789aa9876543ULL;
-+	const uint64_t arg4 = 0x456789abba987654ULL;
-+	const uint16_t resp_source_id = 0x1221;
-+	const uint16_t resp_dest_id = 0x3443;
-+	const uint64_t resp_arg0 = 0x9012345665432109ULL;
-+	const uint64_t resp_arg1 = 0xa12345677654321aULL;
-+	const uint64_t resp_arg2 = 0xb23456788765432bULL;
-+	const uint64_t resp_arg3 = 0xc34567899876543cULL;
-+	const uint64_t resp_arg4 = 0xd456789aa987654dULL;
-+
-+	svc_result.a0 = 0xC400006F;
-+	svc_result.a1 = ((uint32_t)resp_source_id) << 16 | resp_dest_id;
-+	svc_result.a3 = resp_arg0;
-+	svc_result.a4 = resp_arg1;
-+	svc_result.a5 = resp_arg2;
-+	svc_result.a6 = resp_arg3;
-+	svc_result.a7 = resp_arg4;
-+	expect_ffa_svc(0xC4000070, ((uint32_t)source_id << 16) | dest_id, 0,
-+		       arg0, arg1, arg2, arg3, arg4, &svc_result);
-+	ffa_result result = ffa_msg_send_direct_resp_64(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x8400006F, resp_source_id, resp_dest_id, resp_arg0,
-+	msg_equal_64(0xC400006F, resp_source_id, resp_dest_id, resp_arg0,
- 		   resp_arg1, resp_arg2, resp_arg3, resp_arg4);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_one_interrupt_success)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_one_interrupt_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -690,13 +931,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_one_interrupt_success)
- 
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
--	ffa_result result = ffa_msg_send_direct_resp(
-+	ffa_result result = ffa_msg_send_direct_resp_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_two_interrupt_success)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_two_interrupt_success)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -724,13 +965,13 @@ TEST(ffa_api, ffa_msg_send_direct_resp_two_interrupt_success)
- 
- 	svc_result.a0 = 0x84000061;
- 	expect_ffa_svc(0x8400006B, 0, 0, 0, 0, 0, 0, 0, &svc_result);
--	ffa_result result = ffa_msg_send_direct_resp(
-+	ffa_result result = ffa_msg_send_direct_resp_32(
- 		source_id, dest_id, arg0, arg1, arg2, arg3, arg4, &msg);
- 	LONGS_EQUAL(0, result);
--	msg_equal(0x84000061, 0, 0, 0, 0, 0, 0, 0);
-+	msg_equal_32(0x84000061, 0, 0, 0, 0, 0, 0, 0);
- }
- 
--TEST(ffa_api, ffa_msg_send_direct_resp_unknown_response)
-+TEST(ffa_api, ffa_msg_send_direct_resp_32_unknown_response)
- {
- 	const uint16_t source_id = 0x1122;
- 	const uint16_t dest_id = 0x3344;
-@@ -745,7 +986,7 @@ TEST(ffa_api, ffa_msg_send_direct_resp_unknown_response)
- 	expect_ffa_svc(0x84000070, ((uint32_t)source_id << 16) | dest_id, 0,
- 		       arg0, arg1, arg2, arg3, arg4, &svc_result);
- 	if (SETUP_ASSERT_ENVIRONMENT(assert_env)) {
--		ffa_msg_send_direct_resp(source_id, dest_id, arg0, arg1, arg2,
-+		ffa_msg_send_direct_resp_32(source_id, dest_id, arg0, arg1, arg2,
- 					 arg3, arg4, &msg);
- 	}
- }
-diff --git a/components/messaging/ffa/libsp/test/test_sp_messaging.cpp b/components/messaging/ffa/libsp/test/test_sp_messaging.cpp
-index 78bf8bf..786f66e 100644
---- a/components/messaging/ffa/libsp/test/test_sp_messaging.cpp
-+++ b/components/messaging/ffa/libsp/test/test_sp_messaging.cpp
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
-  */
- 
- #include <CppUTest/TestHarness.h>
-@@ -32,7 +32,7 @@ TEST_GROUP(sp_messaging)
- 		mock().clear();
- 	}
- 
--	void copy_sp_to_ffa_args(const uint32_t sp_args[], uint32_t ffa_args[])
-+	void copy_sp_to_ffa_args_32(const uint32_t sp_args[], uint32_t ffa_args[])
- 	{
- 		int i = 0;
- 
-@@ -41,7 +41,16 @@ TEST_GROUP(sp_messaging)
- 		}
- 	}
- 
--	void fill_ffa_msg(struct ffa_direct_msg * msg)
-+	void copy_sp_to_ffa_args_64(const uint64_t sp_args[], uint64_t ffa_args[])
-+	{
-+		int i = 0;
-+
-+		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
-+			ffa_args[i + SP_MSG_ARG_OFFSET] = sp_args[i];
-+		}
-+	}
-+
-+	void fill_ffa_msg_32(struct ffa_direct_msg * msg)
- 	{
- 		int i = 0;
- 
-@@ -49,20 +58,47 @@ TEST_GROUP(sp_messaging)
- 		msg->source_id = source_id;
- 		msg->destination_id = dest_id;
- 
--		msg->args[0] = 0;
-+		msg->args.args32[0] = 0;
- 		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
--			msg->args[i + SP_MSG_ARG_OFFSET] = args[i];
-+			msg->args.args32[i + SP_MSG_ARG_OFFSET] = args32[i];
- 		}
- 	}
- 
--	void fill_sp_msg(struct sp_msg * msg)
-+	void fill_ffa_msg_64(struct ffa_direct_msg * msg)
- 	{
- 		int i = 0;
- 
-+		msg->function_id = FFA_MSG_SEND_DIRECT_REQ_64;
- 		msg->source_id = source_id;
- 		msg->destination_id = dest_id;
-+
-+		msg->args.args64[0] = 0;
- 		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
--			msg->args[i] = args[i + SP_MSG_ARG_OFFSET];
-+			msg->args.args64[i + SP_MSG_ARG_OFFSET] = args64[i];
-+		}
-+	}
-+
-+	void fill_sp_msg_32(struct sp_msg * msg)
-+	{
-+		int i = 0;
-+
-+		msg->source_id = source_id;
-+		msg->destination_id = dest_id;
-+		msg->is_64bit_message = false;
-+		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
-+			msg->args.args32[i] = args32[i + SP_MSG_ARG_OFFSET];
-+		}
-+	}
-+
-+	void fill_sp_msg_64(struct sp_msg * msg)
-+	{
-+		int i = 0;
-+
-+		msg->source_id = source_id;
-+		msg->destination_id = dest_id;
-+		msg->is_64bit_message = true;
-+		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
-+			msg->args.args64[i] = args64[i + SP_MSG_ARG_OFFSET];
- 		}
- 	}
- 
-@@ -74,10 +110,19 @@ TEST_GROUP(sp_messaging)
- 		UNSIGNED_LONGS_EQUAL(ffa_msg->source_id, sp_msg->source_id);
- 		UNSIGNED_LONGS_EQUAL(ffa_msg->destination_id,
- 				     sp_msg->destination_id);
--		for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
--			UNSIGNED_LONGS_EQUAL(
--				ffa_msg->args[i + SP_MSG_ARG_OFFSET],
--				sp_msg->args[i]);
-+		CHECK_EQUAL(FFA_IS_64_BIT_FUNC(ffa_msg->function_id), sp_msg->is_64bit_message);
-+		if (sp_msg->is_64bit_message) {
-+			for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
-+				UNSIGNED_LONGS_EQUAL(
-+					ffa_msg->args.args64[i + SP_MSG_ARG_OFFSET],
-+					sp_msg->args.args64[i]);
-+			}
-+		} else {
-+			for (i = 0; i < SP_MSG_ARG_COUNT; i++) {
-+				UNSIGNED_LONGS_EQUAL(
-+					ffa_msg->args.args32[i + SP_MSG_ARG_OFFSET],
-+					sp_msg->args.args32[i]);
-+			}
- 		}
- 	}
- 
-@@ -87,7 +132,7 @@ TEST_GROUP(sp_messaging)
- 		struct ffa_direct_msg expected_ffa_req = { 0 };
- 		struct sp_msg req = { 0 };
- 
--		fill_ffa_msg(&expected_ffa_req);
-+		fill_ffa_msg_32(&expected_ffa_req);
- 		expected_ffa_req.source_id = source_id;
- 		expected_ffa_req.destination_id = dest_id;
- 		expect_ffa_msg_wait(&expected_ffa_req, FFA_OK);
-@@ -103,8 +148,10 @@ TEST_GROUP(sp_messaging)
- 
- 	const uint16_t source_id = 0x1234;
- 	const uint16_t dest_id = 0x5678;
--	const uint32_t args[SP_MSG_ARG_COUNT] = { 0x01234567, 0x12345678,
--						  0x23456789, 0x3456789a };
-+	const uint32_t args32[SP_MSG_ARG_COUNT] = { 0x01234567, 0x12345678,
-+						    0x23456789, 0x3456789a };
-+	const uint64_t args64[SP_MSG_ARG_COUNT] = { 0x0123456776543210, 0x1234567887654321,
-+						    0x2345678998765432, 0x3456789aa9876543 };
- 	const sp_result result = -1;
- 	const sp_msg empty_sp_msg = (const sp_msg){ 0 };
- };
-@@ -126,7 +173,7 @@ TEST(sp_messaging, sp_msg_wait_ffa_error)
- 
- TEST(sp_messaging, sp_msg_wait)
- {
--	fill_ffa_msg(&ffa_msg);
-+	fill_ffa_msg_32(&ffa_msg);
- 	expect_ffa_msg_wait(&ffa_msg, FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_wait(&req));
-@@ -139,12 +186,12 @@ TEST(sp_messaging, sp_msg_wait_deny_rc_failure)
- 	struct ffa_direct_msg rc_msg = { 0 };
- 	ffa_result result = FFA_ABORTED;
- 
--	fill_ffa_msg(&rc_msg);
--	rc_msg.args[0] = ROUTING_EXT_RC_BIT;
-+	fill_ffa_msg_32(&rc_msg);
-+	rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT;
- 	expect_ffa_msg_wait(&rc_msg, FFA_OK);
- 
--	fill_ffa_msg(&ffa_msg);
--	expect_ffa_msg_send_direct_resp(
-+	fill_ffa_msg_32(&ffa_msg);
-+	expect_ffa_msg_send_direct_resp_32(
- 		rc_msg.destination_id, rc_msg.source_id,
- 		ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, result);
-@@ -157,12 +204,12 @@ TEST(sp_messaging, sp_msg_wait_deny_rc)
- {
- 	struct ffa_direct_msg rc_msg = { 0 };
- 
--	fill_ffa_msg(&rc_msg);
--	rc_msg.args[0] = ROUTING_EXT_RC_BIT;
-+	fill_ffa_msg_32(&rc_msg);
-+	rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT;
- 	expect_ffa_msg_wait(&rc_msg, FFA_OK);
- 
--	fill_ffa_msg(&ffa_msg);
--	expect_ffa_msg_send_direct_resp(
-+	fill_ffa_msg_32(&ffa_msg);
-+	expect_ffa_msg_send_direct_resp_32(
- 		rc_msg.destination_id, rc_msg.source_id,
- 		ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, FFA_OK);
-@@ -191,10 +238,10 @@ TEST(sp_messaging, sp_msg_send_direct_req_ffa_error)
- 	ffa_result result = FFA_ABORTED;
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&req);
-+	fill_sp_msg_32(&req);
- 	memset(&resp, 0x5a, sizeof(resp));
--	copy_sp_to_ffa_args(req.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_req(
-+	copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_req_32(
- 		req.source_id, req.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, result);
-@@ -203,14 +250,30 @@ TEST(sp_messaging, sp_msg_send_direct_req_ffa_error)
- 	MEMCMP_EQUAL(&empty_sp_msg, &resp, sizeof(empty_sp_msg));
- }
- 
--TEST(sp_messaging, sp_msg_send_direct_req_msg)
-+TEST(sp_messaging, sp_msg_send_direct_req_msg_32)
- {
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&req);
--	fill_ffa_msg(&ffa_msg);
--	copy_sp_to_ffa_args(req.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_req(
-+	fill_sp_msg_32(&req);
-+	fill_ffa_msg_32(&ffa_msg);
-+	copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_req_32(
-+		req.source_id, req.destination_id, expected_ffa_args[0],
-+		expected_ffa_args[1], expected_ffa_args[2],
-+		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-+
-+	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&req, &resp));
-+	ffa_and_sp_msg_equal(&ffa_msg, &resp);
-+}
-+
-+TEST(sp_messaging, sp_msg_send_direct_req_msg_64)
-+{
-+	uint64_t expected_ffa_args[5] = { 0 };
-+
-+	fill_sp_msg_64(&req);
-+	fill_ffa_msg_64(&ffa_msg);
-+	copy_sp_to_ffa_args_64(req.args.args64, expected_ffa_args);
-+	expect_ffa_msg_send_direct_req_64(
- 		req.source_id, req.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-@@ -223,10 +286,10 @@ TEST(sp_messaging, sp_msg_send_direct_req_success)
- {
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&req);
-+	fill_sp_msg_32(&req);
- 	ffa_msg.function_id = FFA_SUCCESS_32;
--	copy_sp_to_ffa_args(req.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_req(
-+	copy_sp_to_ffa_args_32(req.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_req_32(
- 		req.source_id, req.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-@@ -248,54 +311,54 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&rc_resp, FFA_OK);
- 
- 	/* Fowarding RC response to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0],
--				       rc_resp.args[1], rc_resp.args[2],
--				       rc_resp.args[3], rc_resp.args[4], &resp,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0],
-+				       rc_resp.args.args32[1], rc_resp.args.args32[2],
-+				       rc_resp.args.args32[3], rc_resp.args.args32[4], &resp,
- 				       FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp));
-@@ -312,28 +375,28 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_error)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_err);
-+	fill_ffa_msg_32(&rc_err);
- 	rc_err.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_err.source_id = rc_root_id;
- 	rc_err.destination_id = own_id;
--	rc_err.args[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT;
--	rc_err.args[1] = result;
-+	rc_err.args.args32[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT;
-+	rc_err.args.args32[1] = result;
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_err, FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_FFA(result),
-@@ -354,64 +417,64 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success_deny_request)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
- 	request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	request_to_deny.source_id = root_id;
- 	request_to_deny.destination_id = own_id;
--	request_to_deny.args[0] = 0;
-+	request_to_deny.args.args32[0] = 0;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving a request to deny */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&request_to_deny, FFA_OK);
- 
- 	/* Sending error to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		own_id, root_id, ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_OK);
- 
- 	/* Fowarding RC response to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0],
--				       rc_resp.args[1], rc_resp.args[2],
--				       rc_resp.args[3], rc_resp.args[4], &resp,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0],
-+				       rc_resp.args.args32[1], rc_resp.args.args32[2],
-+				       rc_resp.args.args32[3], rc_resp.args.args32[4], &resp,
- 				       FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp));
-@@ -431,65 +494,65 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_forwarding_success_invalid_req_src)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
- 	request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	/* This source ID should be denied in the current state. */
- 	request_to_deny.source_id = rc_root_id;
- 	request_to_deny.destination_id = own_id;
--	request_to_deny.args[0] = ROUTING_EXT_RC_BIT;
-+	request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&request_to_deny, FFA_OK);
- 
- 	/* Sending error to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		own_id, rc_root_id, ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT,
- 		SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_OK);
- 
- 	/* Fowarding RC response to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0],
--				       rc_resp.args[1], rc_resp.args[2],
--				       rc_resp.args[3], rc_resp.args[4], &resp,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0],
-+				       rc_resp.args.args32[1], rc_resp.args.args32[2],
-+				       rc_resp.args.args32[3], rc_resp.args.args32[4], &resp,
- 				       FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp));
-@@ -509,58 +572,58 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_success)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
- 	request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	/* This source ID should be denied in the current state. */
- 	request_to_deny.source_id = rc_root_id;
- 	request_to_deny.destination_id = own_id;
--	request_to_deny.args[0] = ROUTING_EXT_RC_BIT;
-+	request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&request_to_deny, FFA_OK);
- 
- 	/* Sending error to root which fails */
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		own_id, rc_root_id, (ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT),
- 		SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_DENIED);
- 
-@@ -568,9 +631,9 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_success)
- 	expect_ffa_msg_wait(&rc_resp, FFA_OK);
- 
- 	/* Fowarding RC response to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0],
--				       rc_resp.args[1], rc_resp.args[2],
--				       rc_resp.args[3], rc_resp.args[4], &resp,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0],
-+				       rc_resp.args.args32[1], rc_resp.args.args32[2],
-+				       rc_resp.args.args32[3], rc_resp.args.args32[4], &resp,
- 				       FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_req(&sp_req, &sp_resp));
-@@ -590,58 +653,58 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_fail_forwarding)
- 	sp_msg sp_req = { 0 };
- 	sp_msg sp_resp = { 0 };
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
- 	request_to_deny.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	/* This source ID should be denied in the current state. */
- 	request_to_deny.source_id = rc_root_id;
- 	request_to_deny.destination_id = own_id;
--	request_to_deny.args[0] = ROUTING_EXT_RC_BIT;
-+	request_to_deny.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&request_to_deny, FFA_OK);
- 
- 	/* Sending error to root which fails */
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		own_id, rc_root_id, ROUTING_EXT_ERR_BIT | ROUTING_EXT_RC_BIT,
- 		SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &rc_resp, FFA_DENIED);
- 
-@@ -649,7 +712,7 @@ TEST(sp_messaging, sp_msg_send_direct_req_deny_fail_wait_fail_forwarding)
- 	expect_ffa_msg_wait(&rc_resp, result);
- 
- 	/* Fowarding RC error as FFA_MSG_WAIT failed  */
--	expect_ffa_msg_send_direct_req(
-+	expect_ffa_msg_send_direct_req_32(
- 		own_id, rc_root_id, (ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT),
- 		result, 0, 0, 0, &resp, FFA_OK);
- 
-@@ -670,52 +733,52 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_return_rc_error_msg)
- 	sp_msg sp_resp = { 0 };
- 	ffa_result result = FFA_ABORTED;
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&rc_resp, result);
- 
- 	/* Fowarding RC error to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id,
- 				       ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 				       SP_RESULT_FFA(result), 0, 0, 0, &resp,
- 				       FFA_OK);
-@@ -737,54 +800,54 @@ TEST(sp_messaging, sp_msg_send_direct_req_rc_return_resp_fail)
- 	sp_msg sp_resp = { 0 };
- 	ffa_result result = FFA_ABORTED;
- 
--	fill_sp_msg(&sp_req);
-+	fill_sp_msg_32(&sp_req);
- 	sp_req.source_id = own_id;
- 	sp_req.destination_id = rc_root_id;
- 
- 	req.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	req.source_id = own_id;
- 	req.destination_id = rc_root_id;
--	copy_sp_to_ffa_args(sp_req.args, req.args);
-+	copy_sp_to_ffa_args_32(sp_req.args.args32, req.args.args32);
- 
--	fill_ffa_msg(&rc_req);
-+	fill_ffa_msg_32(&rc_req);
- 	rc_req.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	rc_req.source_id = rc_root_id;
- 	rc_req.destination_id = own_id;
--	rc_req.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_req.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&rc_resp);
-+	fill_ffa_msg_32(&rc_resp);
- 	rc_resp.function_id = FFA_MSG_SEND_DIRECT_REQ_32;
- 	rc_resp.source_id = root_id;
- 	rc_resp.destination_id = own_id;
--	rc_resp.args[0] = ROUTING_EXT_RC_BIT;
-+	rc_resp.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_sp_msg(&sp_resp);
-+	fill_sp_msg_32(&sp_resp);
- 	sp_resp.source_id = rc_root_id;
- 	sp_resp.destination_id = own_id;
- 
- 	resp.function_id = FFA_MSG_SEND_DIRECT_RESP_32;
- 	resp.source_id = rc_root_id;
- 	resp.destination_id = own_id;
--	copy_sp_to_ffa_args(sp_resp.args, resp.args);
-+	copy_sp_to_ffa_args_32(sp_resp.args.args32, resp.args.args32);
- 
- 	/* Initial request to current SP to set own_id */
- 	wait_and_receive_request(root_id, own_id);
- 
- 	/* Sending request and receiving RC request from RC root */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, 0, req.args[1],
--				       req.args[2], req.args[3], req.args[4],
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, 0, req.args.args32[1],
-+				       req.args.args32[2], req.args.args32[3], req.args.args32[4],
- 				       &rc_req, FFA_OK);
- 
- 	/* Forwarding RC request to root and receiving RC response */
--	expect_ffa_msg_send_direct_resp(own_id, root_id, rc_req.args[0],
--					rc_req.args[1], rc_req.args[2],
--					rc_req.args[3], rc_req.args[4],
-+	expect_ffa_msg_send_direct_resp_32(own_id, root_id, rc_req.args.args32[0],
-+					rc_req.args.args32[1], rc_req.args.args32[2],
-+					rc_req.args.args32[3], rc_req.args.args32[4],
- 					&rc_resp, FFA_OK);
- 
- 	/* Fowarding RC response to RC root and receiving response */
--	expect_ffa_msg_send_direct_req(own_id, rc_root_id, rc_resp.args[0],
--				       rc_resp.args[1], rc_resp.args[2],
--				       rc_resp.args[3], rc_resp.args[4], &resp,
-+	expect_ffa_msg_send_direct_req_32(own_id, rc_root_id, rc_resp.args.args32[0],
-+				       rc_resp.args.args32[1], rc_resp.args.args32[2],
-+				       rc_resp.args.args32[3], rc_resp.args.args32[4], &resp,
- 				       result);
- 
- 	LONGS_EQUAL(SP_RESULT_FFA(result),
-@@ -812,10 +875,11 @@ TEST(sp_messaging, sp_msg_send_direct_resp_ffa_error)
- 	ffa_result result = FFA_ABORTED;
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&resp);
-+	fill_sp_msg_32(&resp);
- 	memset(&req, 0x5a, sizeof(req));
--	copy_sp_to_ffa_args(resp.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_resp(
-+	req.is_64bit_message = false;
-+	copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_resp_32(
- 		resp.source_id, resp.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, result);
-@@ -825,14 +889,30 @@ TEST(sp_messaging, sp_msg_send_direct_resp_ffa_error)
- 	MEMCMP_EQUAL(&empty_sp_msg, &req, sizeof(empty_sp_msg));
- }
- 
--TEST(sp_messaging, sp_msg_send_direct_resp_msg)
-+TEST(sp_messaging, sp_msg_send_direct_resp_msg_32)
- {
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&resp);
--	fill_ffa_msg(&ffa_msg);
--	copy_sp_to_ffa_args(resp.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_resp(
-+	fill_sp_msg_32(&resp);
-+	fill_ffa_msg_32(&ffa_msg);
-+	copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_resp_32(
-+		resp.source_id, resp.destination_id, expected_ffa_args[0],
-+		expected_ffa_args[1], expected_ffa_args[2],
-+		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-+
-+	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_direct_resp(&resp, &req));
-+	ffa_and_sp_msg_equal(&ffa_msg, &req);
-+}
-+
-+TEST(sp_messaging, sp_msg_send_direct_resp_msg_64)
-+{
-+	uint64_t expected_ffa_args[5] = { 0 };
-+
-+	fill_sp_msg_64(&resp);
-+	fill_ffa_msg_64(&ffa_msg);
-+	copy_sp_to_ffa_args_64(resp.args.args64, expected_ffa_args);
-+	expect_ffa_msg_send_direct_resp_64(
- 		resp.source_id, resp.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-@@ -841,15 +921,16 @@ TEST(sp_messaging, sp_msg_send_direct_resp_msg)
- 	ffa_and_sp_msg_equal(&ffa_msg, &req);
- }
- 
-+
- TEST(sp_messaging, sp_msg_send_direct_resp_success)
- {
- 	uint32_t expected_ffa_args[5] = { 0 };
- 
--	fill_sp_msg(&req);
--	fill_sp_msg(&resp);
-+	fill_sp_msg_32(&req);
-+	fill_sp_msg_32(&resp);
- 	ffa_msg.function_id = FFA_SUCCESS_32;
--	copy_sp_to_ffa_args(resp.args, expected_ffa_args);
--	expect_ffa_msg_send_direct_resp(
-+	copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args);
-+	expect_ffa_msg_send_direct_resp_32(
- 		resp.source_id, resp.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &ffa_msg, FFA_OK);
-@@ -864,20 +945,20 @@ TEST(sp_messaging, sp_msg_send_direct_resp_deny_rc_failure)
- 	uint32_t expected_ffa_args[5] = { 0 };
- 	struct ffa_direct_msg rc_msg = { 0 };
- 
--	fill_sp_msg(&resp);
-+	fill_sp_msg_32(&resp);
- 
--	fill_ffa_msg(&rc_msg);
--	rc_msg.args[0] = ROUTING_EXT_RC_BIT;
-+	fill_ffa_msg_32(&rc_msg);
-+	rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&ffa_msg);
--	copy_sp_to_ffa_args(resp.args, expected_ffa_args);
-+	fill_ffa_msg_32(&ffa_msg);
-+	copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args);
- 
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		resp.source_id, resp.destination_id, expected_ffa_args[0],
- 		expected_ffa_args[1], expected_ffa_args[2],
- 		expected_ffa_args[3], expected_ffa_args[4], &rc_msg, FFA_OK);
- 
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		rc_msg.destination_id, rc_msg.source_id,
- 		ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, result);
-@@ -892,21 +973,21 @@ TEST(sp_messaging, sp_msg_send_direct_resp_deny_rc)
- 	uint32_t expected_ffa_args[5] = { 0 };
- 	struct ffa_direct_msg rc_msg = { 0 };
- 
--	fill_sp_msg(&resp);
-+	fill_sp_msg_32(&resp);
- 
--	fill_ffa_msg(&rc_msg);
--	rc_msg.args[0] = ROUTING_EXT_RC_BIT;
-+	fill_ffa_msg_32(&rc_msg);
-+	rc_msg.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	fill_ffa_msg(&ffa_msg);
--	copy_sp_to_ffa_args(resp.args, expected_ffa_args);
-+	fill_ffa_msg_32(&ffa_msg);
-+	copy_sp_to_ffa_args_32(resp.args.args32, expected_ffa_args);
- 
--	expect_ffa_msg_send_direct_resp(resp.source_id, resp.destination_id, 0,
-+	expect_ffa_msg_send_direct_resp_32(resp.source_id, resp.destination_id, 0,
- 					expected_ffa_args[1],
- 					expected_ffa_args[2],
- 					expected_ffa_args[3],
- 					expected_ffa_args[4], &rc_msg, FFA_OK);
- 
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		rc_msg.destination_id, rc_msg.source_id,
- 		ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_DENIED), 0, 0, 0, &ffa_msg, FFA_OK);
-@@ -933,13 +1014,14 @@ TEST(sp_messaging, sp_msg_send_rc_req_ffa_error)
- {
- 	ffa_result result = FFA_ABORTED;
- 
--	fill_sp_msg(&resp);
-+	fill_sp_msg_32(&resp);
- 	memset(&req, 0x5a, sizeof(req));
--	fill_ffa_msg(&ffa_msg);
-+	req.is_64bit_message = false;
-+	fill_ffa_msg_32(&ffa_msg);
- 
--	expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id,
--					ROUTING_EXT_RC_BIT, req.args[0],
--					req.args[1], req.args[2], req.args[3],
-+	expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id,
-+					ROUTING_EXT_RC_BIT, req.args.args32[0],
-+					req.args.args32[1], req.args.args32[2], req.args.args32[3],
- 					&ffa_msg, result);
- 
- 	LONGS_EQUAL(SP_RESULT_FFA(result), sp_msg_send_rc_req(&req, &resp));
-@@ -953,22 +1035,22 @@ TEST(sp_messaging, sp_msg_send_rc_req_deny_fail_wait_fail)
- 
- 	wait_and_receive_request(root_id, own_id);
- 
--	fill_sp_msg(&req);
-+	fill_sp_msg_32(&req);
- 	req.source_id = own_id;
- 	req.destination_id = root_id;
- 
--	fill_ffa_msg(&ffa_msg);
-+	fill_ffa_msg_32(&ffa_msg);
- 	ffa_msg.source_id = root_id;
- 	ffa_msg.destination_id = own_id;
- 	/* Should be RC message so it will be denied */
--	ffa_msg.args[0] = 0;
-+	ffa_msg.args.args32[0] = 0;
- 
--	expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id,
--					ROUTING_EXT_RC_BIT, req.args[0],
--					req.args[1], req.args[2], req.args[3],
-+	expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id,
-+					ROUTING_EXT_RC_BIT, req.args.args32[0],
-+					req.args.args32[1], req.args.args32[2], req.args.args32[3],
- 					&ffa_msg, FFA_OK);
- 
--	expect_ffa_msg_send_direct_resp(
-+	expect_ffa_msg_send_direct_resp_32(
- 		req.source_id, req.destination_id,
- 		ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT,
- 		SP_RESULT_FFA(FFA_BUSY), 0, 0, 0, &ffa_msg, result);
-@@ -987,19 +1069,19 @@ TEST(sp_messaging, sp_msg_send_rc_req_rc_error)
- 
- 	wait_and_receive_request(root_id, own_id);
- 
--	fill_sp_msg(&req);
-+	fill_sp_msg_32(&req);
- 	req.source_id = own_id;
- 	req.destination_id = root_id;
- 
--	fill_ffa_msg(&ffa_msg);
-+	fill_ffa_msg_32(&ffa_msg);
- 	ffa_msg.source_id = root_id;
- 	ffa_msg.destination_id = own_id;
--	ffa_msg.args[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT;
--	ffa_msg.args[1] = sp_err;
-+	ffa_msg.args.args32[0] = ROUTING_EXT_RC_BIT | ROUTING_EXT_ERR_BIT;
-+	ffa_msg.args.args32[1] = sp_err;
- 
--	expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id,
--					ROUTING_EXT_RC_BIT, req.args[0],
--					req.args[1], req.args[2], req.args[3],
-+	expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id,
-+					ROUTING_EXT_RC_BIT, req.args.args32[0],
-+					req.args.args32[1], req.args.args32[2], req.args.args32[3],
- 					&ffa_msg, FFA_OK);
- 
- 	LONGS_EQUAL(sp_err, sp_msg_send_rc_req(&req, &resp));
-@@ -1013,18 +1095,18 @@ TEST(sp_messaging, sp_msg_send_rc_req_success)
- 
- 	wait_and_receive_request(root_id, own_id);
- 
--	fill_sp_msg(&req);
-+	fill_sp_msg_32(&req);
- 	req.source_id = own_id;
- 	req.destination_id = root_id;
- 
--	fill_ffa_msg(&ffa_msg);
-+	fill_ffa_msg_32(&ffa_msg);
- 	ffa_msg.source_id = root_id;
- 	ffa_msg.destination_id = own_id;
--	ffa_msg.args[0] = ROUTING_EXT_RC_BIT;
-+	ffa_msg.args.args32[0] = ROUTING_EXT_RC_BIT;
- 
--	expect_ffa_msg_send_direct_resp(req.source_id, req.destination_id,
--					ROUTING_EXT_RC_BIT, req.args[0],
--					req.args[1], req.args[2], req.args[3],
-+	expect_ffa_msg_send_direct_resp_32(req.source_id, req.destination_id,
-+					ROUTING_EXT_RC_BIT, req.args.args32[0],
-+					req.args.args32[1], req.args.args32[2], req.args.args32[3],
- 					&ffa_msg, FFA_OK);
- 
- 	LONGS_EQUAL(SP_RESULT_OK, sp_msg_send_rc_req(&req, &resp));
-diff --git a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
-index 4ad98fb..ca3d318 100644
---- a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
-+++ b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
-@@ -81,16 +81,17 @@ static rpc_status_t call_invoke(void *context, rpc_call_handle handle, uint32_t
- 
- 	req.destination_id = this_context->dest_partition_id;
- 	req.source_id = own_id;
--	req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] =
-+	req.is_64bit_message = false;
-+	req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] =
- 		FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(this_context->dest_iface_id, opcode);
--	req.args[SP_CALL_ARGS_REQ_DATA_LEN] = (uint32_t)this_context->req_len;
--	req.args[SP_CALL_ARGS_ENCODING] = this_context->rpc_caller.encoding;
-+	req.args.args32[SP_CALL_ARGS_REQ_DATA_LEN] = (uint32_t)this_context->req_len;
-+	req.args.args32[SP_CALL_ARGS_ENCODING] = this_context->rpc_caller.encoding;
- 
- 	/* Initialise the caller ID.  Depending on the call path, this may
- 	 * be overridden by a higher privilege execution level, based on its
- 	 * perspective of the caller identity.
- 	 */
--	req.args[SP_CALL_ARGS_CALLER_ID] = 0;
-+	req.args.args32[SP_CALL_ARGS_CALLER_ID] = 0;
- 
- 	sp_res = sp_msg_send_direct_req(&req, &resp);
- 	if (sp_res != SP_RESULT_OK) {
-@@ -98,9 +99,9 @@ static rpc_status_t call_invoke(void *context, rpc_call_handle handle, uint32_t
- 		goto out;
- 	}
- 
--	this_context->resp_len = (size_t)resp.args[SP_CALL_ARGS_RESP_DATA_LEN];
--	status = resp.args[SP_CALL_ARGS_RESP_RPC_STATUS];
--	*opstatus = (rpc_status_t)((int32_t)resp.args[SP_CALL_ARGS_RESP_OP_STATUS]);
-+	this_context->resp_len = (size_t)resp.args.args32[SP_CALL_ARGS_RESP_DATA_LEN];
-+	status = resp.args.args32[SP_CALL_ARGS_RESP_RPC_STATUS];
-+	*opstatus = (rpc_status_t)((int32_t)resp.args.args32[SP_CALL_ARGS_RESP_OP_STATUS]);
- 
- 	if (this_context->resp_len > this_context->shared_mem_required_size) {
- 		EMSG("invalid response length");
-@@ -242,11 +243,12 @@ int ffarpc_caller_open(struct ffarpc_caller *caller, uint16_t dest_partition_id,
- 
- 	req.source_id = own_id;
- 	req.destination_id = dest_partition_id;
--	req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] =
-+	req.is_64bit_message = false;
-+	req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] =
- 		FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(FFA_CALL_MGMT_IFACE_ID, FFA_CALL_OPCODE_SHARE_BUF);
--	req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = (uint32_t)(handle & UINT32_MAX);
--	req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = (uint32_t)(handle >> 32);
--	req.args[SP_CALL_ARGS_SHARE_MEM_SIZE] = (uint32_t)(caller->shared_mem_required_size);
-+	req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = (uint32_t)(handle & UINT32_MAX);
-+	req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = (uint32_t)(handle >> 32);
-+	req.args.args32[SP_CALL_ARGS_SHARE_MEM_SIZE] = (uint32_t)(caller->shared_mem_required_size);
- 
- 	sp_res = sp_msg_send_direct_req(&req, &resp);
- 	if (sp_res != SP_RESULT_OK) {
-@@ -273,10 +275,11 @@ int ffarpc_caller_close(struct ffarpc_caller *caller)
- 
- 	req.source_id = own_id;
- 	req.destination_id = caller->dest_partition_id;
--	req.args[SP_CALL_ARGS_IFACE_ID_OPCODE] =
-+	req.is_64bit_message = false;
-+	req.args.args32[SP_CALL_ARGS_IFACE_ID_OPCODE] =
- 		FFA_CALL_ARGS_COMBINE_IFACE_ID_OPCODE(FFA_CALL_MGMT_IFACE_ID, FFA_CALL_OPCODE_UNSHARE_BUF);
--	req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = handle_lo;
--	req.args[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = handle_hi;
-+	req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_LSW] = handle_lo;
-+	req.args.args32[SP_CALL_ARGS_SHARE_MEM_HANDLE_MSW] = handle_hi;
- 
- 	sp_res = sp_msg_send_direct_req(&req, &resp);
- 	if (sp_res != SP_RESULT_OK) {
-diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-index 6a8cef0..c024196 100644
---- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-@@ -260,8 +260,8 @@ void ffa_call_ep_receive(struct ffa_call_ep *call_ep,
- 			 const struct sp_msg *req_msg,
- 			 struct sp_msg *resp_msg)
- {
--	const uint32_t *req_args = req_msg->args;
--	uint32_t *resp_args = resp_msg->args;
-+	const uint32_t *req_args = req_msg->args.args32;
-+	uint32_t *resp_args = resp_msg->args.args32;
- 
- 	uint16_t source_id = req_msg->source_id;
- 	uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
-diff --git a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-index 09f1e2c..dc49e64 100644
---- a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-+++ b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include "components/rpc/mm_communicate/common/mm_communicate_call_args.h"
-@@ -127,15 +127,15 @@ void mm_communicate_call_ep_receive(struct mm_communicate_ep *mm_communicate_cal
- 	uintptr_t buffer_address = 0;
- 	size_t buffer_size = 0;
- 
--	buffer_address = req_msg->args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS];
--	buffer_size = req_msg->args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE];
-+	buffer_address = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS];
-+	buffer_size = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE];
- 
- 	return_value = handle_mm_communicate(mm_communicate_call_ep, req_msg->source_id,
- 					     buffer_address, buffer_size);
- 
--	resp_msg->args[MM_COMMUNICATE_CALL_ARGS_RETURN_ID] = ARM_SVC_ID_SP_EVENT_COMPLETE;
--	resp_msg->args[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value;
--	resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0;
--	resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0;
--	resp_msg->args[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0;
-+	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_ID] = ARM_SVC_ID_SP_EVENT_COMPLETE;
-+	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value;
-+	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0;
-+	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0;
-+	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0;
- }
-diff --git a/deployments/smm-gateway/common/smm_gateway_sp.c b/deployments/smm-gateway/common/smm_gateway_sp.c
-index 2187fea..3697b7f 100644
---- a/deployments/smm-gateway/common/smm_gateway_sp.c
-+++ b/deployments/smm-gateway/common/smm_gateway_sp.c
-@@ -70,10 +70,10 @@ void __noreturn sp_main(struct ffa_init_info *init_info)
- 	while (1) {
- 		mm_communicate_call_ep_receive(&mm_communicate_call_ep, &req_msg, &resp_msg);
- 
--		ffa_msg_send_direct_resp(req_msg.destination_id,
--					 req_msg.source_id, resp_msg.args[0],
--					 resp_msg.args[1], resp_msg.args[2],
--					 resp_msg.args[3], resp_msg.args[4],
-+		ffa_msg_send_direct_resp_32(req_msg.destination_id,
-+					 req_msg.source_id, resp_msg.args.args32[0],
-+					 resp_msg.args.args32[1], resp_msg.args.args32[2],
-+					 resp_msg.args.args32[3], resp_msg.args.args32[4],
- 					 &req_msg);
- 	}
- 
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0022-Change-MM-communicate-RPC-protocol-of-call-endpoint.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0022-Change-MM-communicate-RPC-protocol-of-call-endpoint.patch
deleted file mode 100644
index 4090397..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0022-Change-MM-communicate-RPC-protocol-of-call-endpoint.patch
+++ /dev/null
@@ -1,497 +0,0 @@
-From 0f02f04c7f0a7130874dc4bc1a500604d580c4dc Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Wed, 20 Jul 2022 15:19:17 +0200
-Subject: [PATCH 22/24] Change MM communicate RPC protocol of call endpoint
-
-Replace buffer address and size parameter by offset in buffer parameter
-and move to 64 bit FF-A direct message call. Deny all 32 bit direct
-messages in SMM gateway.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I7a69b440ff9842960229b2bfdd1b5ae5318d9c26
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../common/mm_communicate_call_args.h         |  15 ++-
- .../endpoint/sp/mm_communicate_call_ep.c      |  58 ++++-----
- .../endpoint/sp/test/mock_mm_service.cpp      |   6 +-
- .../endpoint/sp/test/mock_mm_service.h        |   4 +-
- .../sp/test/test_mm_communicate_call_ep.cpp   | 110 +++++++++++-------
- .../endpoint/sp/test/test_mock_mm_service.cpp |   4 +-
- .../smm-gateway/common/smm_gateway_sp.c       |  17 ++-
- 7 files changed, 123 insertions(+), 91 deletions(-)
-
-diff --git a/components/rpc/mm_communicate/common/mm_communicate_call_args.h b/components/rpc/mm_communicate/common/mm_communicate_call_args.h
-index 7d7311d..280c04d 100644
---- a/components/rpc/mm_communicate/common/mm_communicate_call_args.h
-+++ b/components/rpc/mm_communicate/common/mm_communicate_call_args.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: BSD-3-Clause */
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #ifndef MM_COMMUNICATE_CALL_ARGS_H_
-@@ -12,13 +12,12 @@
-  */
- 
- /* SP message arg indexes */
--#define MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS	0
--#define MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE	1
-+#define MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_OFFSET	0
- 
--#define MM_COMMUNICATE_CALL_ARGS_RETURN_ID		0
--#define MM_COMMUNICATE_CALL_ARGS_RETURN_CODE		1
--#define MM_COMMUNICATE_CALL_ARGS_MBZ0			2
--#define MM_COMMUNICATE_CALL_ARGS_MBZ1			3
--#define MM_COMMUNICATE_CALL_ARGS_MBZ2			4
-+#define MM_COMMUNICATE_CALL_ARGS_RETURN_CODE		0
-+#define MM_COMMUNICATE_CALL_ARGS_MBZ0			1
-+#define MM_COMMUNICATE_CALL_ARGS_MBZ1			2
-+#define MM_COMMUNICATE_CALL_ARGS_MBZ2			3
-+#define MM_COMMUNICATE_CALL_ARGS_MBZ3			4
- 
- #endif /* MM_COMMUNICATE_CALL_ARGS_H_ */
-diff --git a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-index dc49e64..93aa0f4 100644
---- a/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-+++ b/components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.c
-@@ -35,7 +35,8 @@ bool mm_communicate_call_ep_init(struct mm_communicate_ep *call_ep, uint8_t *com
- 
- static int32_t invoke_mm_service(struct mm_communicate_ep *call_ep, uint16_t source_id,
- 				 struct mm_service_interface *iface,
--				 EFI_MM_COMMUNICATE_HEADER *header)
-+				 EFI_MM_COMMUNICATE_HEADER *header,
-+				 size_t buffer_size)
- {
- 	rpc_status_t rpc_status = TS_RPC_ERROR_INTERNAL;
- 	struct mm_service_call_req call_req = { 0 };
-@@ -49,11 +50,11 @@ static int32_t invoke_mm_service(struct mm_communicate_ep *call_ep, uint16_t sou
- 	 */
- 	call_req.req_buf.data = header->Data;
- 	call_req.req_buf.data_len = header->MessageLength;
--	call_req.req_buf.size = call_ep->comm_buffer_size - EFI_MM_COMMUNICATE_HEADER_SIZE;
-+	call_req.req_buf.size = buffer_size;
- 
- 	call_req.resp_buf.data = header->Data;
- 	call_req.resp_buf.data_len = 0;
--	call_req.resp_buf.size = call_ep->comm_buffer_size - EFI_MM_COMMUNICATE_HEADER_SIZE;
-+	call_req.resp_buf.size = buffer_size;
- 
- 	result = iface->receive(iface, &call_req);
- 
-@@ -63,32 +64,38 @@ static int32_t invoke_mm_service(struct mm_communicate_ep *call_ep, uint16_t sou
- }
- 
- static int32_t handle_mm_communicate(struct mm_communicate_ep *call_ep, uint16_t source_id,
--				     uintptr_t buffer_addr, size_t buffer_size)
-+				     size_t buffer_offset)
- {
--	uintptr_t buffer_arg = 0;
--	size_t request_size = 0;
-+	size_t header_end_offset = 0;
-+	size_t request_end_offset = 0;
-+	size_t buffer_size = 0;
- 	EFI_MM_COMMUNICATE_HEADER *header = NULL;
- 	unsigned int i = 0;
- 
--	/* Validating call args according to ARM MM spec 3.2.4 */
--	if (buffer_addr == 0)
-+	if (ADD_OVERFLOW(buffer_offset, EFI_MM_COMMUNICATE_HEADER_SIZE, &header_end_offset))
-+		return MM_RETURN_CODE_INVALID_PARAMETER;
-+
-+	if (call_ep->comm_buffer_size < header_end_offset)
- 		return MM_RETURN_CODE_INVALID_PARAMETER;
- 
- 	/* Validating comm buffer contents */
--	header = (EFI_MM_COMMUNICATE_HEADER *)call_ep->comm_buffer;
--	if (ADD_OVERFLOW(header->MessageLength, EFI_MM_COMMUNICATE_HEADER_SIZE, &request_size))
-+	header = (EFI_MM_COMMUNICATE_HEADER *)(call_ep->comm_buffer + buffer_offset);
-+	if (ADD_OVERFLOW(header_end_offset, header->MessageLength, &request_end_offset))
- 		return MM_RETURN_CODE_INVALID_PARAMETER;
- 
--	if (call_ep->comm_buffer_size < request_size)
-+	if (call_ep->comm_buffer_size < request_end_offset)
- 		return MM_RETURN_CODE_INVALID_PARAMETER;
- 
-+	buffer_size = call_ep->comm_buffer_size - header_end_offset;
-+
- 	/* Finding iface_id by GUID */
- 	for (i = 0; i < ARRAY_SIZE(call_ep->service_table); i++) {
- 		const struct mm_service_entry *entry = &call_ep->service_table[i];
- 
- 		if (entry->iface != NULL &&
- 		    memcmp(&header->HeaderGuid, &entry->guid, sizeof(entry->guid)) == 0)
--			return invoke_mm_service(call_ep, source_id, entry->iface, header);
-+			return invoke_mm_service(call_ep, source_id, entry->iface, header,
-+						 buffer_size);
- 	}
- 
- 	return MM_RETURN_CODE_NOT_SUPPORTED;
-@@ -123,19 +130,16 @@ void mm_communicate_call_ep_receive(struct mm_communicate_ep *mm_communicate_cal
- 				    const struct ffa_direct_msg *req_msg,
- 				    struct ffa_direct_msg *resp_msg)
- {
--	int32_t return_value = 0;
--	uintptr_t buffer_address = 0;
--	size_t buffer_size = 0;
--
--	buffer_address = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS];
--	buffer_size = req_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE];
--
--	return_value = handle_mm_communicate(mm_communicate_call_ep, req_msg->source_id,
--					     buffer_address, buffer_size);
--
--	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_ID] = ARM_SVC_ID_SP_EVENT_COMPLETE;
--	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value;
--	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0;
--	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0;
--	resp_msg->args.args32[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0;
-+	int32_t return_value = MM_RETURN_CODE_NOT_SUPPORTED;
-+	size_t buffer_offset = req_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_OFFSET];
-+
-+	return_value = handle_mm_communicate(mm_communicate_call_ep,
-+						req_msg->source_id,
-+						buffer_offset);
-+
-+	resp_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE] = return_value;
-+	resp_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_MBZ0] = 0;
-+	resp_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_MBZ1] = 0;
-+	resp_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_MBZ2] = 0;
-+	resp_msg->args.args64[MM_COMMUNICATE_CALL_ARGS_MBZ3] = 0;
- }
-diff --git a/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.cpp b/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.cpp
-index a58c33a..0ae2a80 100644
---- a/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.cpp
-+++ b/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.cpp
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include <CppUTestExt/MockSupport.h>
-@@ -16,7 +16,7 @@ void mock_mm_service_init(void)
- 
- void expect_mock_mm_service_receive(struct mm_service_interface *iface,
- 				    const struct mm_service_call_req *req,
--				    int32_t result)
-+				    int64_t result)
- {
- 	mock().expectOneCall("mm_service_receive").onObject(iface).
- 		withOutputParameterReturning("resp_buf_data_len", &req->resp_buf.data_len,
-@@ -31,5 +31,5 @@ int32_t mock_mm_service_receive(struct mm_service_interface *iface,
- 	return mock().actualCall("mm_service_receive").onObject(iface).
- 		withOutputParameter("resp_buf_data_len", &req->resp_buf.data_len).
- 		withParameterOfType("mm_service_call_req", "req", req).
--		returnIntValue();
-+		returnLongIntValue();
- }
-diff --git a/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.h b/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.h
-index 768022d..56c8a26 100644
---- a/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.h
-+++ b/components/rpc/mm_communicate/endpoint/sp/test/mock_mm_service.h
-@@ -1,6 +1,6 @@
- /* SPDX-License-Identifier: BSD-3-Clause */
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #ifndef MOCK_MM_SERVICE_H_
-@@ -16,7 +16,7 @@ void mock_mm_service_init(void);
- 
- void expect_mock_mm_service_receive(struct mm_service_interface *iface,
- 				    const struct mm_service_call_req *req,
--				    int32_t result);
-+				    int64_t result);
- 
- int32_t mock_mm_service_receive(struct mm_service_interface *iface,
- 				struct mm_service_call_req *req);
-diff --git a/components/rpc/mm_communicate/endpoint/sp/test/test_mm_communicate_call_ep.cpp b/components/rpc/mm_communicate/endpoint/sp/test/test_mm_communicate_call_ep.cpp
-index 55a61fb..5aaa3a6 100644
---- a/components/rpc/mm_communicate/endpoint/sp/test/test_mm_communicate_call_ep.cpp
-+++ b/components/rpc/mm_communicate/endpoint/sp/test/test_mm_communicate_call_ep.cpp
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include <CppUTest/TestHarness.h>
-@@ -32,14 +32,14 @@ TEST_GROUP(mm_communicate_call_ep)
- 		mock().clear();
- 	}
- 
--	void check_sp_msg(const struct ffa_direct_msg *msg, uint32_t arg0,
--			  uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4)
-+	void check_sp_msg(const struct ffa_direct_msg *msg, uint64_t arg0,
-+			  uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4)
- 	{
--		UNSIGNED_LONGLONGS_EQUAL(arg0, msg->args[0]);
--		UNSIGNED_LONGLONGS_EQUAL(arg1, msg->args[1]);
--		UNSIGNED_LONGLONGS_EQUAL(arg2, msg->args[2]);
--		UNSIGNED_LONGLONGS_EQUAL(arg3, msg->args[3]);
--		UNSIGNED_LONGLONGS_EQUAL(arg4,  msg->args[4]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg0, msg->args.args64[0]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg1, msg->args.args64[1]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg2, msg->args.args64[2]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg3, msg->args.args64[3]);
-+		UNSIGNED_LONGLONGS_EQUAL(arg4,  msg->args.args64[4]);
- 	}
- 
- 	struct mm_communicate_ep call_ep;
-@@ -114,59 +114,54 @@ TEST(mm_communicate_call_ep, attach_do_not_fit)
- 	}
- }
- 
--TEST(mm_communicate_call_ep, mm_communicate_no_buffer_arg)
-+TEST(mm_communicate_call_ep, mm_communicate_offset_int_overflow)
- {
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
-+	req_msg.args.args64[0] = 0xffffffffffffffff;
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_INVALID_PARAMETER,
--		     0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_INVALID_PARAMETER, 0, 0, 0, 0);
- }
- 
--TEST(mm_communicate_call_ep, mm_communicate_length_overflow)
-+TEST(mm_communicate_call_ep, mm_communicate_offset_overflow)
- {
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
-+	req_msg.args.args64[0] = sizeof(comm_buffer) - EFI_MM_COMMUNICATE_HEADER_SIZE + 1;
-+
-+	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_INVALID_PARAMETER, 0, 0, 0, 0);
-+}
- 
-+TEST(mm_communicate_call_ep, mm_communicate_length_overflow)
-+{
-+	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
- 	header->MessageLength = UINT64_MAX - EFI_MM_COMMUNICATE_HEADER_SIZE + 1;
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_INVALID_PARAMETER,
--		     0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_INVALID_PARAMETER, 0, 0, 0, 0);
- }
- 
- TEST(mm_communicate_call_ep, mm_communicate_too_large)
- {
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
--
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
--
- 	header->MessageLength = sizeof(comm_buffer) - EFI_MM_COMMUNICATE_HEADER_SIZE + 1;
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_INVALID_PARAMETER,
--		     0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_INVALID_PARAMETER, 0, 0, 0, 0);
- }
- 
- TEST(mm_communicate_call_ep, mm_communicate_no_handler)
- {
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
--
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
--
- 	header->MessageLength = 0;
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_NOT_SUPPORTED,
--		     0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_NOT_SUPPORTED, 0, 0, 0, 0);
- }
- 
- TEST(mm_communicate_call_ep, mm_communicate_single_handler_not_matching)
-@@ -175,16 +170,11 @@ TEST(mm_communicate_call_ep, mm_communicate_single_handler_not_matching)
- 
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
- 	mm_communicate_call_ep_attach_service(&call_ep, &guid0, &iface);
--
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
--
- 	header->MessageLength = 0;
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_NOT_SUPPORTED,
--		     0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_NOT_SUPPORTED, 0, 0, 0, 0);
- }
- 
- TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching)
-@@ -211,19 +201,55 @@ TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching)
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
- 	mm_communicate_call_ep_attach_service(&call_ep, &guid0, &iface);
- 
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
-+	memcpy(&header->HeaderGuid, &guid0, sizeof(guid0));
-+	header->MessageLength = req_len;
-+
-+	expect_mock_mm_service_receive(&iface, &req, MM_RETURN_CODE_SUCCESS);
-+
-+	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
-+
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_SUCCESS, 0, 0, 0, 0);
-+}
-+
-+TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching_with_offset)
-+{
-+	const size_t offset = 0x10;
-+	EFI_MM_COMMUNICATE_HEADER *header = (EFI_MM_COMMUNICATE_HEADER *)(comm_buffer + offset);
-+
-+	const size_t req_len = 16;
-+	struct mm_service_interface iface = {
-+		.context = (void *)0x1234,
-+		.receive = mock_mm_service_receive
-+	};
-+	struct mm_service_call_req req = {
-+		.guid = &guid0,
-+		.req_buf = {
-+			.size = sizeof(comm_buffer) - EFI_MM_COMMUNICATE_HEADER_SIZE - offset,
-+			.data_len = req_len,
-+			.data = header->Data
-+		},
-+		.resp_buf = {
-+			.size = sizeof(comm_buffer) - EFI_MM_COMMUNICATE_HEADER_SIZE - offset,
-+			.data_len = 0,
-+			.data = header->Data
-+		},
-+	};
-+
-+	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
-+	mm_communicate_call_ep_attach_service(&call_ep, &guid0, &iface);
- 
- 	memcpy(&header->HeaderGuid, &guid0, sizeof(guid0));
- 	header->MessageLength = req_len;
-+	req_msg.args.args64[0] = offset;
- 
- 	expect_mock_mm_service_receive(&iface, &req, MM_RETURN_CODE_SUCCESS);
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_SUCCESS, 0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_SUCCESS, 0, 0, 0, 0);
- }
- 
-+
- TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching_error)
- {
- 	const size_t req_len = 16;
-@@ -248,9 +274,6 @@ TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching_error)
- 	CHECK_TRUE(mm_communicate_call_ep_init(&call_ep, comm_buffer, sizeof(comm_buffer)));
- 	mm_communicate_call_ep_attach_service(&call_ep, &guid0, &iface);
- 
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
--
- 	memcpy(&header->HeaderGuid, &guid0, sizeof(guid0));
- 	header->MessageLength = req_len;
- 
-@@ -258,7 +281,7 @@ TEST(mm_communicate_call_ep, mm_communicate_single_handler_matching_error)
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_NO_MEMORY, 0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_NO_MEMORY, 0, 0, 0, 0);
- }
- 
- TEST(mm_communicate_call_ep, mm_communicate_two_handlers)
-@@ -290,9 +313,6 @@ TEST(mm_communicate_call_ep, mm_communicate_two_handlers)
- 	mm_communicate_call_ep_attach_service(&call_ep, &guid0, &iface0);
- 	mm_communicate_call_ep_attach_service(&call_ep, &guid1, &iface1);
- 
--	req_msg.args[0] = (uintptr_t)comm_buffer;
--	req_msg.args[1] = sizeof(comm_buffer);
--
- 	memcpy(&header->HeaderGuid, &guid1, sizeof(guid0));
- 	header->MessageLength = req_len;
- 
-@@ -300,5 +320,5 @@ TEST(mm_communicate_call_ep, mm_communicate_two_handlers)
- 
- 	mm_communicate_call_ep_receive(&call_ep, &req_msg, &resp_msg);
- 
--	check_sp_msg(&resp_msg, ARM_SVC_ID_SP_EVENT_COMPLETE, MM_RETURN_CODE_SUCCESS, 0, 0, 0);
-+	check_sp_msg(&resp_msg, MM_RETURN_CODE_SUCCESS, 0, 0, 0, 0);
- }
-diff --git a/components/rpc/mm_communicate/endpoint/sp/test/test_mock_mm_service.cpp b/components/rpc/mm_communicate/endpoint/sp/test/test_mock_mm_service.cpp
-index 360a8fa..600386e 100644
---- a/components/rpc/mm_communicate/endpoint/sp/test/test_mock_mm_service.cpp
-+++ b/components/rpc/mm_communicate/endpoint/sp/test/test_mock_mm_service.cpp
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: BSD-3-Clause
- /*
-- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
-+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
-  */
- 
- #include <CppUTest/TestHarness.h>
-@@ -44,7 +44,7 @@ TEST(mock_mm_service, receive)
- 			.data = (void *)0x2345
- 		}
- 	};
--	int32_t result = -123456;
-+	int64_t result = -123456;
- 
- 	expect_mock_mm_service_receive(&iface, &req, result);
- 	LONGS_EQUAL(result, mock_mm_service_receive(&iface, &req));
-diff --git a/deployments/smm-gateway/common/smm_gateway_sp.c b/deployments/smm-gateway/common/smm_gateway_sp.c
-index 3697b7f..3062877 100644
---- a/deployments/smm-gateway/common/smm_gateway_sp.c
-+++ b/deployments/smm-gateway/common/smm_gateway_sp.c
-@@ -11,6 +11,7 @@
- #include "components/rpc/mm_communicate/endpoint/sp/mm_communicate_call_ep.h"
- #include "components/service/smm_variable/frontend/mm_communicate/smm_variable_mm_service.h"
- #include "platform/interface/memory_region.h"
-+#include "protocols/common/mm/mm_smc.h"
- #include <ffa_api.h>
- #include <sp_api.h>
- #include <sp_messaging.h>
-@@ -68,12 +69,20 @@ void __noreturn sp_main(struct ffa_init_info *init_info)
- 	ffa_msg_wait(&req_msg);
- 
- 	while (1) {
-+		if (FFA_IS_32_BIT_FUNC(req_msg.function_id)) {
-+			EMSG("MM communicate over 32 bit FF-A messages is not supported");
-+			ffa_msg_send_direct_resp_32(req_msg.destination_id, req_msg.source_id,
-+						    MM_RETURN_CODE_NOT_SUPPORTED, 0, 0, 0, 0,
-+						    &req_msg);
-+			continue;
-+		}
-+
- 		mm_communicate_call_ep_receive(&mm_communicate_call_ep, &req_msg, &resp_msg);
- 
--		ffa_msg_send_direct_resp_32(req_msg.destination_id,
--					 req_msg.source_id, resp_msg.args.args32[0],
--					 resp_msg.args.args32[1], resp_msg.args.args32[2],
--					 resp_msg.args.args32[3], resp_msg.args.args32[4],
-+		ffa_msg_send_direct_resp_64(req_msg.destination_id,
-+					 req_msg.source_id, resp_msg.args.args64[0],
-+					 resp_msg.args.args64[1], resp_msg.args.args64[2],
-+					 resp_msg.args.args64[3], resp_msg.args.args64[4],
- 					 &req_msg);
- 	}
- 
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0023-Change-MM-communicate-RPC-protocol-of-MM-caller.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0023-Change-MM-communicate-RPC-protocol-of-MM-caller.patch
deleted file mode 100644
index 4244225..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0023-Change-MM-communicate-RPC-protocol-of-MM-caller.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 96d226e4e0ea9c633dbc5d05ae2a7a2f4ba0f39e Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Fri, 22 Jul 2022 17:22:05 +0200
-Subject: [PATCH 23/24] Change MM communicate RPC protocol of MM caller
-
-Replace buffer address and size parameter by offset in buffer parameter
-and move to 64 bit FF-A direct message call. This change requires an
-updated version of the debugfs driver which supports 64 bit direct
-messages.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I003c1de7f9c3f45bbc52e4a51d622ec960fa7052
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../caller/linux/mm_communicate_caller.c      | 35 +++++++------------
- .../LinuxFFAUserShim/LinuxFFAUserShim.cmake   |  2 +-
- 2 files changed, 14 insertions(+), 23 deletions(-)
-
-diff --git a/components/rpc/mm_communicate/caller/linux/mm_communicate_caller.c b/components/rpc/mm_communicate/caller/linux/mm_communicate_caller.c
-index 0c505b4..0287acf 100644
---- a/components/rpc/mm_communicate/caller/linux/mm_communicate_caller.c
-+++ b/components/rpc/mm_communicate/caller/linux/mm_communicate_caller.c
-@@ -19,7 +19,7 @@
- #include <string.h>
- #include <errno.h>
- 
--#define KERNEL_MOD_REQ_VER_MAJOR 2
-+#define KERNEL_MOD_REQ_VER_MAJOR 5
- #define KERNEL_MOD_REQ_VER_MINOR 0
- #define KERNEL_MOD_REQ_VER_PATCH 0
- 
-@@ -294,37 +294,28 @@ static rpc_status_t call_invoke(
- 
- 		direct_msg.dst_id = s->dest_partition_id;
- 
--		direct_msg.args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_ADDRESS] = (uintptr_t)s->comm_buffer;
--		direct_msg.args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_SIZE] = s->comm_buffer_size;
-+		direct_msg.args[MM_COMMUNICATE_CALL_ARGS_COMM_BUFFER_OFFSET] = 0;
- 
- 		int kernel_op_status = ioctl(s->ffa_fd, FFA_IOC_MSG_SEND, &direct_msg);
- 
- 		if (kernel_op_status == 0) {
--
- 			/* Kernel send operation completed normally */
--			uint32_t mm_return_id = direct_msg.args[MM_COMMUNICATE_CALL_ARGS_RETURN_ID];
- 			int32_t mm_return_code = direct_msg.args[MM_COMMUNICATE_CALL_ARGS_RETURN_CODE];
- 
--			if (mm_return_id == ARM_SVC_ID_SP_EVENT_COMPLETE) {
--
--				if (mm_return_code == MM_RETURN_CODE_SUCCESS) {
--
--					mm_communicate_serializer_header_decode(s->serializer,
--						s->comm_buffer, (efi_status_t*)opstatus, resp_buf, resp_len);
--
--					if (*resp_len > s->req_len) {
-+			if (mm_return_code == MM_RETURN_CODE_SUCCESS) {
-+				mm_communicate_serializer_header_decode(
-+					s->serializer, s->comm_buffer, (efi_status_t *)opstatus,
-+					resp_buf, resp_len);
- 
--						s->scrub_len =
--							mm_communicate_serializer_header_size(s->serializer) +
--							*resp_len;
--					}
-+				if (*resp_len > s->req_len)
-+					s->scrub_len =
-+						mm_communicate_serializer_header_size(
-+							s->serializer) + *resp_len;
- 
--					rpc_status = TS_RPC_CALL_ACCEPTED;
--				}
--				else {
-+				rpc_status = TS_RPC_CALL_ACCEPTED;
-+			} else {
- 
--					rpc_status = mm_return_code_to_rpc_status(mm_return_code);
--				}
-+				rpc_status = mm_return_code_to_rpc_status(mm_return_code);
- 			}
- 		}
- 	}
-diff --git a/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
-index 7ba64af..9c2252c 100644
---- a/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
-+++ b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
-@@ -11,7 +11,7 @@
- 
- 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 "v4.0.0"
-+set(LINUX_FFA_USER_SHIM_REFSPEC "v5.0.0"
- 	CACHE STRING "Linux FF-A user space shim git refspec")
- 
- set(LINUX_FFA_USER_SHIM_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_user_shim-src"
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/files/0024-Deny-64-bit-FF-A-messages-in-FF-A-RPC-endpoint.patch b/meta-arm/meta-arm/recipes-security/trusted-services/files/0024-Deny-64-bit-FF-A-messages-in-FF-A-RPC-endpoint.patch
deleted file mode 100644
index 01cf523..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/files/0024-Deny-64-bit-FF-A-messages-in-FF-A-RPC-endpoint.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From f173e99554512c982665c1d5d4b0543421177b09 Mon Sep 17 00:00:00 2001
-From: Imre Kis <imre.kis@arm.com>
-Date: Tue, 26 Jul 2022 17:06:46 +0200
-Subject: [PATCH 24/24] Deny 64 bit FF-A messages in FF-A RPC endpoint
-
-FF-A RPC protocol only allows 32 bit FF-A direct messages thus deny all
-64 bit messages in the RPC endpoint.
-
-Signed-off-by: Imre Kis <imre.kis@arm.com>
-Change-Id: I37c95425f80b6e2821b3f6b8649ceba8aa007bce
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- .../rpc/ffarpc/endpoint/ffarpc_call_ep.c      | 31 ++++++++++++-------
- 1 file changed, 20 insertions(+), 11 deletions(-)
-
-diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-index c024196..3035c16 100644
---- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
-@@ -12,6 +12,7 @@
- #include <protocols/rpc/common/packed-c/status.h>
- #include <trace.h>
- #include <stddef.h>
-+#include <string.h>
- 
- /* TODO: remove this when own ID will be available in libsp */
- extern uint16_t own_id;
-@@ -260,17 +261,25 @@ void ffa_call_ep_receive(struct ffa_call_ep *call_ep,
- 			 const struct sp_msg *req_msg,
- 			 struct sp_msg *resp_msg)
- {
--	const uint32_t *req_args = req_msg->args.args32;
--	uint32_t *resp_args = resp_msg->args.args32;
--
--	uint16_t source_id = req_msg->source_id;
--	uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
--
--	if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
--		/* It's an RPC layer management request */
--		handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
-+	resp_msg->is_64bit_message = req_msg->is_64bit_message;
-+	memset(&resp_msg->args, 0x00, sizeof(resp_msg->args));
-+
-+	if (!req_msg->is_64bit_message) {
-+		const uint32_t *req_args = req_msg->args.args32;
-+		uint32_t *resp_args = resp_msg->args.args32;
-+		uint16_t source_id = req_msg->source_id;
-+		uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
-+
-+		if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
-+			/* It's an RPC layer management request */
-+			handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
-+		} else {
-+			/* Assume anything else is a service request */
-+			handle_service_msg(call_ep, source_id, req_args, resp_args);
-+		}
- 	} else {
--		/* Assume anything else is a service request */
--		handle_service_msg(call_ep, source_id, req_args, resp_args);
-+		EMSG("64 bit FF-A messages are not supported by the TS RPC layer");
-+		resp_msg->args.args64[SP_CALL_ARGS_RESP_RPC_STATUS] =
-+			TS_RPC_ERROR_INVALID_PARAMETER;
- 	}
- }
--- 
-2.17.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/libts/0001-QEMU-MM-communication-buffer-address.patch b/meta-arm/meta-arm/recipes-security/trusted-services/libts/0001-QEMU-MM-communication-buffer-address.patch
deleted file mode 100644
index 2c21e6f..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/libts/0001-QEMU-MM-communication-buffer-address.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 1fe74d7d5008aed61feb34a8d5d8b5f9144a58b2 Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 16:33:13 +0100
-Subject: [PATCH] Update MM communication buffer address for qemuarm64 machine
-
-Upstream-Status: Inappropriate [qemuarm64 specific change]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- components/rpc/mm_communicate/caller/linux/carveout.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/components/rpc/mm_communicate/caller/linux/carveout.c b/components/rpc/mm_communicate/caller/linux/carveout.c
-index e3cdf16f..62845d30 100644
---- a/components/rpc/mm_communicate/caller/linux/carveout.c
-+++ b/components/rpc/mm_communicate/caller/linux/carveout.c
-@@ -12,8 +12,8 @@
- #include "carveout.h"
- 
- /* Need to be aligned with carve-out used by StMM or smm-gateway. */
--static const off_t carveout_pa = 0x0000000881000000;
--static const size_t carveout_len = 0x8000;
-+static const off_t carveout_pa = 0x42000000;
-+static const size_t carveout_len = 0x1000;
- 
- int carveout_claim(uint8_t **buf, size_t *buf_size)
- {
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/libts_%.bbappend b/meta-arm/meta-arm/recipes-security/trusted-services/libts_%.bbappend
index f987e40..9156e02 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/libts_%.bbappend
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/libts_%.bbappend
@@ -1,3 +1,4 @@
 # Update MM communication buffer address for qemuarm64 machine
-SRC_URI:append:qemuarm64-secureboot = "file://0001-QEMU-MM-communication-buffer-address.patch \
+EXTRA_OECMAKE:append:qemuarm64-secureboot = "-DMM_COMM_BUFFER_ADDRESS=0x42000000 \
+                                             -DMM_COMM_BUFFER_SIZE=0x1000 \
 "
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb b/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb
index dfcf8ce..598b281 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb
@@ -13,10 +13,6 @@
 DEPENDS           += "arm-ffa-tee arm-ffa-user"
 RRECOMMENDS:${PN} += "arm-ffa-tee"
 
-# arm-ffa-user.h is installed by arm-ffa-user recipe
-EXTRA_OECMAKE += "-DLINUX_FFA_USER_SHIM_INCLUDE_DIR:PATH=/usr/include \
-                 "
-
 # Unix group name for dev/tee* ownership.
 TEE_GROUP_NAME ?= "teeclnt"
 
@@ -28,12 +24,11 @@
     fi
 
     # Move the dynamic libraries into the standard place.
-    # Update a cmake files to use correct paths.
+    # Update a cmake file to use correct paths.
     install -d ${D}${libdir}
     mv ${D}${TS_INSTALL}/lib/libts* ${D}${libdir}
 
-    sed -i -e "s#/${TS_ENV}##g" ${D}${TS_INSTALL}/lib/cmake/libtsTargets-noconfig.cmake
-    sed -i -e 's#INTERFACE_INCLUDE_DIRECTORIES.*$#INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/${TS_ENV}/include"#' ${D}${TS_INSTALL}/lib/cmake/libtsTargets.cmake
+    sed -i -e "s#/${TS_ENV}##g" ${D}${TS_INSTALL}/lib/cmake/libts/libtsTargets-noconfig.cmake
 }
 
 inherit ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', '', 'useradd', d)}
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services-src.inc b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
index 0251fef..c8aa821 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
@@ -3,24 +3,10 @@
 LICENSE = "Apache-2.0 & BSD-3-Clause & BSD-2-Clause & Zlib"
 
 SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=integration;name=trusted-services;destsuffix=git/trusted-services \
-           file://0004-correctly-find-headers-dir.patch \
-           file://0005-setting-sysroot-for-libgcc-lookup.patch \
-           file://0006-applying-lowercase-project-convention.patch \
-           file://0009-PSA-CRYPTO-API-INCLUDE.patch \
-           file://0010-change-libts-to-export-CMake-package.patch \
-           file://0011-Adapt-deployments-to-libts-changes.patch \
-           file://0017-Move-libsp-mocks-into-separate-component.patch \
-           file://0018-Add-mock-for-libsp-sp_discovery.patch \
-           file://0019-Add-mock-for-libsp-sp_memory_management.patch \
-           file://0020-Add-mock-for-libsp-sp_messaging.patch \
-           file://0021-Add-64-bit-direct-message-handling-to-libsp.patch \
-           file://0022-Change-MM-communicate-RPC-protocol-of-call-endpoint.patch \
-           file://0023-Change-MM-communicate-RPC-protocol-of-MM-caller.patch \
-           file://0024-Deny-64-bit-FF-A-messages-in-FF-A-RPC-endpoint.patch \
 "
 
-#latest on 05.07.22.
-SRCREV_trusted-services = "1b0c520279445fc4d85fc582eda5e5ff5f380c39"
+#latest on 12.10.22.
+SRCREV_trusted-services = "3d4956770f89eb9ae0a73257901ae6277c078da6"
 LIC_FILES_CHKSUM = "file://${S}/license.rst;md5=ea160bac7f690a069c608516b17997f4"
 
 S = "${WORKDIR}/git/trusted-services"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc
index a8f49a5..59f461d 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc
@@ -47,8 +47,6 @@
                  "
 
 # Paths to pre-built dependencies required by some TS SPs/tools
-EXTRA_OECMAKE += "-Dlibts_DIR=${STAGING_DIR_HOST}${TS_INSTALL}/lib/cmake/ \
-                  -DNEWLIB_INSTALL_DIR=${STAGING_DIR_HOST}${TS_INSTALL}/newlib_install \
+EXTRA_OECMAKE += "-Dlibts_ROOT=${STAGING_DIR_HOST}${TS_INSTALL}/lib/cmake/libts/ \
+                  -DNEWLIB_INSTALL_DIR=${STAGING_DIR_HOST}${TS_INSTALL}/newlib \
                  "
-# Newlib does not compile with clang
-TOOLCHAIN = "gcc"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-demo_git.bb b/meta-arm/meta-arm/recipes-security/trusted-services/ts-demo_git.bb
index b0abb6f..a9f7b65 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-demo_git.bb
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-demo_git.bb
@@ -11,6 +11,10 @@
 
 OECMAKE_SOURCEPATH="${S}/deployments/ts-demo/${TS_ENV}"
 
+# Mbedtls 3.1.0 does not compile with clang.
+# This can be removed after TS updated required mbedtls version
+TOOLCHAIN = "gcc"
+
 FILES:${PN} = "${bindir}/ts-demo"
 
 do_install:append () {
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0003-Add-newlib-deployment.patch b/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0003-Add-newlib-deployment.patch
deleted file mode 100644
index e43e7d2..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0003-Add-newlib-deployment.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 03337e3a509eace9f55a46993cfaadee0e796f46 Mon Sep 17 00:00:00 2001
-From: Gyorgy Szing <Gyorgy.Szing@arm.com>
-Date: Fri, 14 Jan 2022 20:35:53 +0000
-Subject: [PATCH 1/1] Add newlib deployment
-
-This deployment allow building newlib directly and not part of SP
-builds. The resulting binary can be used as a pre-build binary for
-building SPs later.
-The intent is to help integration systems, where recursive build is
-problematic, and there is no direct support for building newlib.
-
-Change-Id: I770cdfd3c39eb7bf9764de74dfb191c321c49561
-Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
-
-Upstream-Status: Pending [In review]
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
-
----
- deployments/newlib/opteesp/CMakeLists.txt | 38 +++++++++++++++++++++++
- tools/b-test/test_data.yaml               |  4 +++
- 2 files changed, 42 insertions(+)
- create mode 100644 deployments/newlib/opteesp/CMakeLists.txt
-
-diff --git a/deployments/newlib/opteesp/CMakeLists.txt b/deployments/newlib/opteesp/CMakeLists.txt
-new file mode 100644
-index 00000000..593e0a96
---- /dev/null
-+++ b/deployments/newlib/opteesp/CMakeLists.txt
-@@ -0,0 +1,38 @@
-+#-------------------------------------------------------------------------------
-+# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
-+#
-+# SPDX-License-Identifier: BSD-3-Clause
-+#
-+#-------------------------------------------------------------------------------
-+cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
-+include(../../deployment.cmake REQUIRED)
-+
-+#-------------------------------------------------------------------------------
-+#  The CMakeLists.txt for building the newlib deployment for opteesp
-+#
-+#  Can be used to build the newlib library, which can be used to build SPs.
-+#-------------------------------------------------------------------------------
-+include(${TS_ROOT}/environments/opteesp/env.cmake)
-+
-+project(newlib C)
-+
-+# This is a dummy library not intended to be compiled ever. It is needed
-+# to avoid opteesp specific newlib targeting files.
-+add_library(dummy EXCLUDE_FROM_ALL)
-+set(TGT dummy)
-+# Build newlib as an external component.
-+include(${TS_ROOT}/external/newlib/newlib.cmake)
-+
-+######################################## install
-+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-+	set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
-+endif()
-+
-+install(DIRECTORY ${NEWLIB_INSTALL_DIR} DESTINATION  ${TS_ENV})
-+
-+#get_property(_tmp_lib TARGET stdlib::c PROPERTY IMPORTED_LOCATION)
-+#get_filename_component(_tmp_path ${_tmp_lib} DIRECTORY)
-+#install(DIRECTORY ${_tmp_path} DESTINATION ${TS_ENV})
-+
-+#get_property(_tmp_path TARGET stdlib::c PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
-+#install(DIRECTORY ${_tmp_path} DESTINATION ${TS_ENV})
-diff --git a/tools/b-test/test_data.yaml b/tools/b-test/test_data.yaml
-index 7caafa8b..6bfacc66 100644
---- a/tools/b-test/test_data.yaml
-+++ b/tools/b-test/test_data.yaml
-@@ -69,6 +69,10 @@ data:
-       os_id : "GNU/Linux"
-       params:
-             - "-GUnix Makefiles"
-+    - name: "newlib-optee-arm"
-+      src: "$TS_ROOT/deployments/newlib/opteesp"
-+      params:
-+          - "-GUnix Makefiles"
-     - name: "platform-inspect-arm-linux"
-       src: "$TS_ROOT/deployments/platform-inspect/arm-linux"
-       os_id : "GNU/Linux"
--- 
-2.37.0
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0021-newlib-configure.patch b/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0021-newlib-configure.patch
deleted file mode 100644
index a9d291b..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib/0021-newlib-configure.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From df66efc0db9899c41632091db11bfe2c05eec1fa Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:55:21 +0100
-Subject: [PATCH] Allow to define additional partameters for newlib configure.
-
-Do not skip newlib and libgloss when crosscompiling
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- ...-aarch64-linux-gcc-to-compile-bare-metal-lib.patch | 11 ++++++++++-
- external/newlib/newlib.cmake                          |  6 ++++++
- 2 files changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch b/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch
-index f87ed5a..7533ed0 100644
---- a/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch
-+++ b/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch
-@@ -16,9 +16,18 @@ Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com>
-  2 files changed, 2 insertions(+), 2 deletions(-)
- 
- diff --git a/configure b/configure
--index 5db52701..1eb71a80 100755
-+index 5db527014..dce91609e 100755
- --- a/configure
- +++ b/configure
-+@@ -2886,7 +2886,7 @@ esac
-+
-+ # Some are only suitable for cross toolchains.
-+ # Remove these if host=target.
-+-cross_only="target-libgloss target-newlib target-opcodes"
-++cross_only="target-opcodes"
-+
-+ case $is_cross_compiler in
-+   no) skipdirs="${skipdirs} ${cross_only}" ;;
- @@ -3659,7 +3659,7 @@ case "${target}" in
-    *-*-freebsd*)
-      noconfigdirs="$noconfigdirs target-newlib target-libgloss"
-diff --git a/external/newlib/newlib.cmake b/external/newlib/newlib.cmake
-index 13eb78c..5ee99a5 100644
---- a/external/newlib/newlib.cmake
-+++ b/external/newlib/newlib.cmake
-@@ -168,6 +168,10 @@ if (NOT NEWLIB_LIBC_PATH)
- 	string(REPLACE ";" " -isystem " CFLAGS_FOR_TARGET "${_gcc_include_dirs}")
- 	set(CFLAGS_FOR_TARGET "-isystem ${CFLAGS_FOR_TARGET} -fpic")
- 
-+	# Split a newlib extra build parameter into a list of parameters
-+	set(NEWLIB_EXTRAS ${NEWLIB_EXTRA})
-+	separate_arguments(NEWLIB_EXTRAS)
-+
- 	# Newlib configure step
- 	# CC env var must be unset otherwise configure will assume the cross compiler is the host
- 	# compiler.
-@@ -175,6 +179,7 @@ if (NOT NEWLIB_LIBC_PATH)
- 	execute_process(COMMAND
- 		${CMAKE_COMMAND} -E env --unset=CC PATH=${COMPILER_PATH}:$ENV{PATH} ./configure
- 			--target=${COMPILER_PREFIX}
-+			--host=${COMPILER_PREFIX}
- 			--prefix=${NEWLIB_INSTALL_DIR}
- 			--enable-newlib-nano-formatted-io
- 			--enable-newlib-nano-malloc
-@@ -182,6 +187,7 @@ if (NOT NEWLIB_LIBC_PATH)
- 			--enable-newlib-reent-small
- 			--enable-newlib-global-atexit
- 			--disable-multilib
-+			${NEWLIB_EXTRAS}
- 			CFLAGS_FOR_TARGET=${CFLAGS_FOR_TARGET}
- 			LDFLAGS_FOR_TARGET=-fpie
- 		WORKING_DIRECTORY
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb b/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
index 94038b5..408c7d3 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
@@ -5,16 +5,17 @@
 require trusted-services.inc
 
 SRC_URI += "git://sourceware.org/git/newlib-cygwin.git;name=newlib;protocol=https;branch=master;destsuffix=git/newlib \
-            file://0003-Add-newlib-deployment.patch \
-            file://0021-newlib-configure.patch \
 "
 
 # tag "newlib-0.4.1"
 SRCREV_newlib = "415fdd4279b85eeec9d54775ce13c5c412451e08"
 LIC_FILES_CHKSUM += "file://../newlib/COPYING.NEWLIB;md5=b8dda70da54e0efb49b1074f349d7749"
 
+# Newlib does not compile with clang
+TOOLCHAIN = "gcc"
+
 EXTRA_OECMAKE += '-DNEWLIB_SOURCE_DIR=${WORKDIR}/git/newlib \
-                  -DNEWLIB_EXTRA="CFLAGS=--sysroot=${STAGING_DIR_HOST}" \
+                  -DNEWLIB_CFLAGS="--sysroot=${STAGING_DIR_HOST}" \
                  '
 
 OECMAKE_SOURCEPATH = "${S}/deployments/newlib/${TS_ENV}/"
@@ -27,5 +28,5 @@
 }
 do_patch[postfuncs] += "apply_ts_patch"
 
-FILES:${PN}-dev = "${TS_INSTALL}/newlib_install"
-FILES:${PN}-staticdev = "${TS_INSTALL}/newlib_install/*/lib/*.a"
+FILES:${PN}-dev = "${TS_INSTALL}/newlib"
+FILES:${PN}-staticdev = "${TS_INSTALL}/newlib/*/lib/*.a"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc b/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
index 1e1be6a..dfd4716 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
@@ -8,7 +8,7 @@
 RDEPENDS:${PN} += "libts"
 
 SRC_URI += "git://github.com/ARM-software/psa-arch-tests.git;name=psatest;protocol=https;branch=main;destsuffix=git/psatest \
-            file://0012-psa-arch-test-toolchain.patch \
+            file://0001-Pass-Yocto-build-settings-to-psa-arch-tests-native.patch;patchdir=../psatest \
            "
 
 SRCREV_psatest = "451aa087a40d02c7d04778235014c5619d126471"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test/0012-PSA-TARGET-QCBOR.patch b/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test/0012-PSA-TARGET-QCBOR.patch
deleted file mode 100644
index 3b28e80..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test/0012-PSA-TARGET-QCBOR.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 3229ca31e59933608f82001c1cdcca9d0a0aa0e0 Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:19:08 +0100
-Subject: [PATCH] Subject: [PATCH] Pass PSA_TARGET_QCBOR to psa-arch-tests
-
-psa-arch-tests require they own version of qcbor library.
-Pass PSA_TARGET_QCBOR which defines where pre-fetched qcbor sources are.
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- external/psa_arch_tests/pas-arch-test-init-cache.cmake.in | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/external/psa_arch_tests/pas-arch-test-init-cache.cmake.in b/external/psa_arch_tests/pas-arch-test-init-cache.cmake.in
-index 5c63596..64196c2 100644
---- a/external/psa_arch_tests/pas-arch-test-init-cache.cmake.in
-+++ b/external/psa_arch_tests/pas-arch-test-init-cache.cmake.in
-@@ -10,6 +10,7 @@ set(CMAKE_TOOLCHAIN_FILE "@TS_EXTERNAL_LIB_TOOLCHAIN_FILE@" CACHE STRING "")
- 
- set(TOOLCHAIN INHERIT CACHE STRING "")
- set(PSA_INCLUDE_PATHS "@PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS@"  CACHE STRING "")
-+set(PSA_TARGET_QCBOR "@PSA_TARGET_QCBOR@"  CACHE STRING "")
- set(SUITE "@TS_ARCH_TEST_SUITE@"  CACHE STRING "")
- set(ARCH_TEST_EXTERNAL_DEFS "@PSA_ARCH_TEST_EXTERNAL_DEFS@"  CACHE STRING "")
- set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "")
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test_git.bb b/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test_git.bb
index 73c5f61..e5c662e 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test_git.bb
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-psa-iat-api-test_git.bb
@@ -11,9 +11,12 @@
 # psa-arch-tests for INITIAL_ATTESTATION suite can't be built with pre-built qcbor
 # Fetch qcbor sources as a temp work-around and pass PSA_TARGET_QCBOR to psa-arch-tests
 SRC_URI += "git://github.com/laurencelundblade/QCBOR.git;name=psaqcbor;protocol=https;branch=master;destsuffix=git/psaqcbor \
-            file://0012-PSA-TARGET-QCBOR.patch \
            "
 SRCREV_psaqcbor = "42272e466a8472948bf8fca076d113b81b99f0e0"
 
 EXTRA_OECMAKE += "-DPSA_TARGET_QCBOR=${WORKDIR}/git/psaqcbor \
                  "
+
+# Mbedtls 3.1.0 does not compile with clang.
+# This can be removed after TS updated required mbedtls version
+TOOLCHAIN = "gcc"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-common.inc b/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-common.inc
index e46cd6b..75ddab3 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-common.inc
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-common.inc
@@ -27,3 +27,6 @@
 # Ignore that SP stripped.elf does not have GNU_HASH
 # Older versions of optee support SYSV hash only.
 INSANE_SKIP:${PN}-dev += "ldflags"
+
+# Trusted Services SPs do not compile with clang
+TOOLCHAIN = "gcc"
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test/0013-env-test-no-std-libs.patch b/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test/0013-env-test-no-std-libs.patch
deleted file mode 100644
index f6269db..0000000
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test/0013-env-test-no-std-libs.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 7a0dcc40ea736dc20b25813dfc08e576c2615217 Mon Sep 17 00:00:00 2001
-From: Anton Antonov <Anton.Antonov@arm.com>
-Date: Wed, 31 Aug 2022 17:32:47 +0100
-Subject: [PATCH] Do not use standard libraries in env-test opteesp deployment
-
-In opteesp deployments newlib used used. The standard libraries should not be included.
-
-Upstream-Status: Pending
-Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
----
- deployments/env-test/opteesp/CMakeLists.txt | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/deployments/env-test/opteesp/CMakeLists.txt b/deployments/env-test/opteesp/CMakeLists.txt
-index cff00ff..60abc0d 100644
---- a/deployments/env-test/opteesp/CMakeLists.txt
-+++ b/deployments/env-test/opteesp/CMakeLists.txt
-@@ -56,9 +56,9 @@ include(../env-test.cmake REQUIRED)
- #-------------------------------------------------------------------------------
- add_platform(TARGET env-test)
- 
--if(CMAKE_CROSSCOMPILING)
--	target_link_libraries(env-test PRIVATE stdc++ gcc m)
--endif()
-+#if(CMAKE_CROSSCOMPILING)
-+#	target_link_libraries(env-test PRIVATE stdc++ gcc m)
-+#endif()
- 
- #################################################################
- 
--- 
-2.25.1
-
diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test_git.bb b/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test_git.bb
index 9cd73cb..040fd4d 100644
--- a/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test_git.bb
+++ b/meta-arm/meta-arm/recipes-security/trusted-services/ts-sp-env-test_git.bb
@@ -8,7 +8,3 @@
 SP_UUID = "${ENV_TEST_UUID}"
 
 OECMAKE_SOURCEPATH="${S}/deployments/env-test/${TS_ENV}"
-
-SRC_URI += "\
-            file://0013-env-test-no-std-libs.patch \
-"
diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.04.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.25.bb
similarity index 96%
rename from meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.04.bb
rename to meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.25.bb
index 90f49f7..45a1578 100644
--- a/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.04.bb
+++ b/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.09.25.bb
@@ -10,7 +10,7 @@
            file://0002-Drop-detached_mounts_propagation-and-remove-sys-moun.patch \
            "
 
-SRCREV_xfstests = "890c50823b6430bf0929d9a57e76b9b4d6bbc25f"
+SRCREV_xfstests = "e5555e75ba199d153f4dfb81496a891263ec9bdd"
 SRCREV_unionmount = "e3825b16b46f4c4574a1a69909944c059835f914"
 
 S = "${WORKDIR}/git"
diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.11.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.12.0.bb
similarity index 75%
rename from meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.11.1.bb
rename to meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.12.0.bb
index c76a48f..b7e4954 100644
--- a/meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.11.1.bb
+++ b/meta-openembedded/meta-gnome/recipes-gnome/gspell/gspell_1.12.0.bb
@@ -7,4 +7,4 @@
 
 inherit gnomebase gettext gobject-introspection vala
 
-SRC_URI[archive.sha256sum] = "ef6aa4e3f711775158a7e241a5f809cf2426bc0e02c23a7d2b5c71fc3de00292"
+SRC_URI[archive.sha256sum] = "40d2850f1bb6e8775246fa1e39438b36caafbdbada1d28a19fa1ca07e1ff82ad"
diff --git a/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.44.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb
similarity index 91%
rename from meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.44.0.bb
rename to meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb
index b670855..2760d73 100644
--- a/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.44.0.bb
+++ b/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb
@@ -23,7 +23,7 @@
 
 inherit gnomebase gsettings gettext upstream-version-is-even features_check
 
-SRC_URI[archive.sha256sum] = "19c3c5d79d2171f45baa0f632cc8995f8607bf1231a16014439bac9ba165a7c0"
+SRC_URI[archive.sha256sum] = "4ba777e938547bfccbf9acca0967574c46643022e054c93a033419cb3cc7c1ec"
 SRC_URI += "file://0001-drop-zenity-detection.patch"
 
 PACKAGECONFIG[xinerama] = "--enable-xinerama,--disable-xinerama,libxinerama"
diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera.bb
index 0b9f3f7..53cd94c 100644
--- a/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera.bb
+++ b/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera.bb
@@ -12,13 +12,13 @@
         git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \
 "
 
-SRCREV = "acf8d028edda0a59b10e15962c2606137a4940af"
+SRCREV = "ed591e705c451d0ce14988ae96829a31a2ae2f9a"
 
 PV = "202105+git${SRCPV}"
 
 S = "${WORKDIR}/git"
 
-DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls boost chrpath-native libevent"
+DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls chrpath-native libevent libyaml"
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'qt', 'qtbase qtbase-native', '', d)}"
 
 PACKAGES =+ "${PN}-gst"
diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/x265/x265_3.2.1.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/x265/x265_3.2.1.bb
index c36619b..d786afe 100644
--- a/meta-openembedded/meta-multimedia/recipes-multimedia/x265/x265_3.2.1.bb
+++ b/meta-openembedded/meta-multimedia/recipes-multimedia/x265/x265_3.2.1.bb
@@ -18,7 +18,8 @@
 inherit lib_package pkgconfig cmake
 
 EXTRA_OECMAKE:append:x86 = " -DENABLE_ASSEMBLY=OFF"
+EXTRA_OECMAKE:append:aarch64 = " -DENABLE_PIC=ON"
 
 AS[unexport] = "1"
 
-COMPATIBLE_HOST = '(x86_64|i.86).*-linux'
+COMPATIBLE_HOST = '(x86_64|i.86|aarch64).*-linux'
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman/0001-meson-add-pythoninstalldir-option.patch b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman/0001-meson-add-pythoninstalldir-option.patch
index a528219..cc448b4 100644
--- a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman/0001-meson-add-pythoninstalldir-option.patch
+++ b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman/0001-meson-add-pythoninstalldir-option.patch
@@ -16,14 +16,14 @@
  2 files changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/meson.build b/meson.build
-index bc990cd..a37aacd 100644
+index e12d0ce6..e84457a5 100644
 --- a/meson.build
 +++ b/meson.build
 @@ -26,7 +26,12 @@ pkgdatadir = join_paths([prefix, get_option('datadir'), package_name])
  bindir = join_paths([prefix, get_option('bindir')])
  libexecdir = join_paths([prefix, get_option('libexecdir')])
- schemadir = join_paths([datadir, 'glib-2.0', 'schemas'])
--pythondir = join_paths([prefix, python.sysconfig_path('purelib')])
+ schemadir = join_paths(['share', 'glib-2.0', 'schemas'])
+-pythondir = pyinstall.get_install_dir()
 +pythoninstalldir = get_option('pythoninstalldir')
 +if pythoninstalldir != ''
 +    pythondir = join_paths([prefix, pythoninstalldir])
@@ -34,16 +34,17 @@
  if get_option('policykit')
      have_polkit = 'True'
 diff --git a/meson_options.txt b/meson_options.txt
-index b3e939f..96acbbc 100644
+index 177d9ab8..3e397d8e 100644
 --- a/meson_options.txt
 +++ b/meson_options.txt
-@@ -5,5 +5,6 @@ option('pulseaudio', type: 'boolean', value: true, description: 'Enable PulseAud
- option('appindicator', type: 'boolean', value: true, description: 'Enable Libappindicator support')
+@@ -2,6 +2,7 @@ option('runtime_deps_check', type: 'boolean', value: true, description: 'Disable
+ option('dhcp-config-path', type: 'string', value: '/etc/dhcp3/dhcpd.conf', description: 'Set dhcp3 server configuration path')
+ option('policykit', type: 'boolean', value: true, description: 'Enable policykit support')
+ option('pulseaudio', type: 'boolean', value: true, description: 'Enable PulseAudio support')
++option('pythoninstalldir', type: 'string', description: 'Path to python site-packages dir relative to ${prefix}')
  option('systemdsystemunitdir', type: 'string', description: 'Path to systemd system unit dir relative to ${prefix}')
  option('systemduserunitdir', type: 'string', description: 'Path to systemd user unit dir relative to ${prefix}')
-+option('pythoninstalldir', type: 'string', description: 'Path to python site-packages dir relative to ${prefix}')
  option('sendto-plugins', type: 'array', choices: ['Caja', 'Nemo', 'Nautilus'], value: ['Caja', 'Nemo', 'Nautilus'], description: 'Install sendto plugins for various filemanagers')
- option('thunar-sendto', type: 'boolean', value: true, description: 'Install Thunar sendto plugin')
 -- 
-2.33.0
+2.34.1
 
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.2.4.bb b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.2.bb
similarity index 86%
rename from meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.2.4.bb
rename to meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.2.bb
index 1197520..eed00fc 100644
--- a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.2.4.bb
+++ b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.2.bb
@@ -7,14 +7,15 @@
 inherit meson gettext systemd gsettings pkgconfig python3native gtk-icon-cache
 
 SRC_URI = " \
-    https://github.com/blueman-project/blueman/releases/download/${PV}/blueman-${PV}.tar.xz \
+    git://github.com/blueman-project/blueman.git;protocol=https;branch=2-3-stable \
     file://0001-Search-for-cython3.patch \
     file://0002-fix-fail-to-enable-bluetooth.patch \
     file://0001-meson-add-pythoninstalldir-option.patch \
 "
-SRC_URI[sha256sum] = "55d639feeda0b43b18a659e65985213a54b47dcb1348f3b4effb5238db242602"
+S = "${WORKDIR}/git"
+SRCREV = "4275c35ffe372c3b194080726fbe1c99f974360f"
 
-EXTRA_OEMESON = "-Druntime_deps_check=false -Dappindicator=false -Dpythoninstalldir=${@noprefix('PYTHON_SITEPACKAGES_DIR', d)}"
+EXTRA_OEMESON = "-Druntime_deps_check=false -Dpythoninstalldir=${@noprefix('PYTHON_SITEPACKAGES_DIR', d)}"
 
 SYSTEMD_SERVICE:${PN} = "${BPN}-mechanism.service"
 SYSTEMD_AUTO_ENABLE:${PN} = "disable"
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3.bb b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3p1.bb
similarity index 90%
rename from meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3.bb
rename to meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3p1.bb
index 92c6487..2fd86bc 100644
--- a/meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3.bb
+++ b/meta-openembedded/meta-networking/recipes-connectivity/dhcp/dhcp-relay_4.4.3p1.bb
@@ -10,7 +10,7 @@
 
 DEPENDS = "openssl libcap zlib"
 
-SRC_URI = "https://downloads.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
+SRC_URI = "https://downloads.isc.org/isc/dhcp/4.4.3-P1/dhcp-4.4.3-P1.tar.gz \
            file://default-relay \
            file://init-relay \
            file://dhcrelay.service \
@@ -19,12 +19,12 @@
            file://0003-bind-Makefile.in-regenerate-configure.patch \
            "
 
-SRC_URI[sha256sum] = "0e3ec6b4c2a05ec0148874bcd999a66d05518378d77421f607fb0bc9d0135818"
+SRC_URI[sha256sum] = "0ac416bb55997ca8632174fd10737fd61cdb8dba2752160a335775bc21dc73c7"
 
 UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/"
 
-S = "${WORKDIR}/dhcp-${PV}"
+S = "${WORKDIR}/dhcp-4.4.3-P1"
 
 inherit autotools-brokensep systemd pkgconfig
 
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.0.bb b/meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.1.bb
similarity index 84%
rename from meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.0.bb
rename to meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.1.bb
index d4a9c7b..742414d 100644
--- a/meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.0.bb
+++ b/meta-openembedded/meta-networking/recipes-connectivity/mbedtls/mbedtls_2.28.1.bb
@@ -23,7 +23,7 @@
 SECTION = "libs"
 
 S = "${WORKDIR}/git"
-SRCREV = "8b3f26a5ac38d4fdccbc5c5366229f3e01dafcc0"
+SRCREV = "dd79db10014d85b26d11fe57218431f2e5ede6f2"
 SRC_URI = "git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=mbedtls-2.28"
 
 inherit cmake
@@ -42,3 +42,10 @@
 FILES:${PN}-programs = "${bindir}/"
 
 BBCLASSEXTEND = "native nativesdk"
+
+CVE_PRODUCT = "mbed_tls"
+
+# Fix merged upstream https://github.com/Mbed-TLS/mbedtls/pull/5310
+CVE_CHECK_IGNORE += "CVE-2021-43666"
+# Fix merged upstream https://github.com/Mbed-TLS/mbedtls/commit/9a4a9c66a48edfe9ece03c7e4a53310adf73a86c
+CVE_CHECK_IGNORE += "CVE-2021-45451"
diff --git a/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.0.bb b/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.1.bb
similarity index 93%
rename from meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.0.bb
rename to meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.1.bb
index 3aa4f40..790fa68 100644
--- a/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.0.bb
+++ b/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.1.bb
@@ -13,7 +13,7 @@
 RPROVIDES:${PN} = "cyassl"
 
 SRC_URI = "git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master"
-SRCREV = "44f81f8bc082319cebf0e37df8470aa5748c1355"
+SRCREV = "f1e2165c591f074feb47872a8ff712713ec411e1"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch
new file mode 100644
index 0000000..52b39c1
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch
@@ -0,0 +1,43 @@
+From 066770ac1c69ee5b484bb82581b22ad0423b004d Mon Sep 17 00:00:00 2001
+From: Donald Sharp <sharpd@nvidia.com>
+Date: Thu, 21 Jul 2022 08:11:58 -0400
+Subject: [PATCH] bgpd: Make sure hdr length is at a minimum of what is
+ expected
+
+Ensure that if the capability length specified is enough data.
+
+Signed-off-by: Donald Sharp <sharpd@nvidia.com>
+(cherry picked from commit ff6db1027f8f36df657ff2e5ea167773752537ed)
+
+CVE: CVE-2022-37032
+
+Upstream-Status: Backport
+[https://github.com/FRRouting/frr/commit/066770ac1c69ee5b484bb82581b22ad0423b004d]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ bgpd/bgp_packet.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
+index 7613ccc7d..a5f065a15 100644
+--- a/bgpd/bgp_packet.c
++++ b/bgpd/bgp_packet.c
+@@ -2621,6 +2621,14 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
+ 				"%s CAPABILITY has action: %d, code: %u, length %u",
+ 				peer->host, action, hdr->code, hdr->length);
+ 
++		if (hdr->length < sizeof(struct capability_mp_data)) {
++			zlog_info(
++				"%pBP Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d",
++				peer, sizeof(struct capability_mp_data),
++				hdr->length);
++			return BGP_Stop;
++		}
++
+ 		/* Capability length check. */
+ 		if ((pnt + hdr->length + 3) > end) {
+ 			zlog_info("%s Capability length error", peer->host);
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb b/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb
index c69720e..1abea63 100644
--- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb
+++ b/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb
@@ -13,6 +13,7 @@
            file://0001-configure-Check-for-readline-function-instead-of-mai.patch \
            file://0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch \
            file://0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch \
+           file://0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch \
            file://frr.pam \
 	      "
 
diff --git a/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541/0001-fix-build-do-not-install-git-files.patch b/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541/0001-fix-build-do-not-install-git-files.patch
new file mode 100644
index 0000000..44ee7b9
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541/0001-fix-build-do-not-install-git-files.patch
@@ -0,0 +1,22 @@
+From a490e82dca5a669b0af27a13d74759d8f77e2333 Mon Sep 17 00:00:00 2001
+From: Vyacheslav Yurkov <v.yurkov@precitec.de>
+Date: Mon, 3 Oct 2022 18:25:15 +0200
+Subject: [PATCH] fix(build): do not install git files
+
+Signed-off-by: Vyacheslav Yurkov <v.yurkov@precitec.de>
+---
+ CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1934374e..bc5c8bad 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1703,6 +1703,7 @@ install(DIRECTORY ${UA_install_tools_dirs}
+     FILES_MATCHING
+     PATTERN "*"
+     PATTERN "*.pyc" EXCLUDE
++    PATTERN ".git*" EXCLUDE
+     )
+ 
+ install(FILES ${UA_install_tools_files} DESTINATION ${open62541_install_tools_dir})
diff --git a/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541_1.3.3.bb b/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541_1.3.3.bb
new file mode 100644
index 0000000..5af856a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-protocols/opcua/open62541_1.3.3.bb
@@ -0,0 +1,47 @@
+DESCRIPTION = "open62541 is an implementation of OPC UA (OPC Unified Architecture)"
+HOMEPAGE = "https://github.com/open62541/open62541.git"
+LICENSE = "MPL-2.0 & BSD-3-Clause & MIT"
+LIC_FILES_CHKSUM = "\
+    file://LICENSE;md5=815ca599c9df247a0c7f619bab123dad \
+    file://deps/mdnsd/LICENSE;md5=3bb4047dc4095cd7336de3e2a9be94f0 \
+    file://deps/mqtt-c/LICENSE;md5=9226377baf0b79174c89a1ab55592456 \
+"
+
+SRCREV_FORMAT = "opcua_mdnsd_ua-nodeset_mqtt-c"
+SRCREV_opcua = "ff73268829359639531ff02905c889f73a77b408"
+SRCREV_mdnsd = "3151afe5899dba5125dffa9f4cf3ae1fe2edc0f0"
+SRCREV_ua-nodeset = "f71b3f411d5cb16097c3ae0c744f67ad45535ffb"
+SRCREV_mqtt-c = "f69ce1e7fd54f3b1834c9c9137ce0ec5d703cb4d"
+
+SRC_URI = " \
+    git://github.com/open62541/open62541.git;name=opcua;branch=1.3;protocol=https \
+    git://github.com/Pro/mdnsd.git;name=mdnsd;protocol=https;branch=master;destsuffix=git/deps/mdnsd \
+    git://github.com/OPCFoundation/UA-Nodeset;name=ua-nodeset;protocol=https;branch=v1.04;destsuffix=git/deps/ua-nodeset \
+    git://github.com/LiamBindle/MQTT-C.git;name=mqtt-c;protocol=https;branch=master;destsuffix=git/deps/mqtt-c \
+    file://0001-fix-build-do-not-install-git-files.patch \
+"
+
+S = "${WORKDIR}/git"
+
+inherit cmake python3native
+
+EXTRA_OECMAKE += "\
+    -DBUILD_SHARED_LIBS=ON \
+    -DUA_NAMESPACE_ZERO=FULL \
+    -DUA_LOGLEVEL=600 \
+"
+
+PACKAGECONFIG ?= "encryption pubsub pubsub-eth"
+PACKAGECONFIG[amalgamation] = "-DUA_ENABLE_AMALGAMATION=ON, -DUA_ENABLE_AMALGAMATION=OFF"
+PACKAGECONFIG[encryption] = "-DUA_ENABLE_ENCRYPTION=ON, -DUA_ENABLE_ENCRYPTION=OFF, mbedtls"
+PACKAGECONFIG[pubsub] = "-DUA_ENABLE_PUBSUB=ON, -DUA_ENABLE_PUBSUB=OFF"
+PACKAGECONFIG[pubsub-eth] = "-DUA_ENABLE_PUBSUB_ETH_UADP=ON, -DUA_ENABLE_PUBSUB_ETH_UADP=OFF"
+
+do_configure:prepend:toolchain-clang:riscv64() {
+    sed -i -e 's/set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)/set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)/' ${S}/CMakeLists.txt
+}
+
+do_configure:prepend:toolchain-clang:riscv32() {
+    sed -i -e 's/set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)/set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)/' ${S}/CMakeLists.txt
+}
+
diff --git a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb
index 083d2cb..d0e2c4b 100644
--- a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb
+++ b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb
@@ -45,7 +45,7 @@
 
 # Note: Despite being built via './configure; make; make install',
 #       chrony does not use GNU Autotools.
-inherit update-rc.d systemd
+inherit update-rc.d systemd pkgconfig
 
 # Add chronyd user if privdrop packageconfig is selected
 inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
@@ -70,7 +70,7 @@
 PACKAGECONFIG ??= "editline \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
 "
-PACKAGECONFIG[readline] = "--without-editline,--without-readline,readline"
+PACKAGECONFIG[readline] = "--without-editline,--disable-readline,readline"
 PACKAGECONFIG[editline] = ",--without-editline,libedit"
 PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss"
 PACKAGECONFIG[privdrop] = "--with-libcap,--disable-privdrop --without-libcap,libcap"
diff --git a/meta-openembedded/meta-networking/recipes-support/mctp/mctp_git.bb b/meta-openembedded/meta-networking/recipes-support/mctp/mctp_git.bb
index 516f3e2..9e97a6a 100644
--- a/meta-openembedded/meta-networking/recipes-support/mctp/mctp_git.bb
+++ b/meta-openembedded/meta-networking/recipes-support/mctp/mctp_git.bb
@@ -22,13 +22,16 @@
 # mctpd will only be built if pkg-config detects libsystemd; in which case
 # we'll want to declare the dep and install the service.
 PACKAGECONFIG[systemd] = ",,systemd,libsystemd"
-SYSTEMD_SERVICE:${PN} = "mctpd.service"
+SYSTEMD_SERVICE:${PN} = "mctpd.service mctp.target mctp-local.target"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
 
 do_install:append () {
     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_system_unitdir}
         install -m 0644 ${S}/conf/mctpd.service \
                 ${D}${systemd_system_unitdir}/mctpd.service
+        install -m 0644 ${S}/conf/*.target \
+                ${D}${systemd_system_unitdir}/
         install -d ${D}${datadir}/dbus-1/system.d
         install -m 0644 ${S}/conf/mctpd-dbus.conf \
                 ${D}${datadir}/dbus-1/system.d/mctpd.conf
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Add-resolv_compat.h-for-musl-builds.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Add-resolv_compat.h-for-musl-builds.patch
index c09bc12..4a97c26 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Add-resolv_compat.h-for-musl-builds.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Add-resolv_compat.h-for-musl-builds.patch
@@ -1,4 +1,4 @@
-From f93b680ec1a816ffe90d5f1bce609f8bf68a456e Mon Sep 17 00:00:00 2001
+From c1ee0b0a0a05379d0e6475dfceaaf41876192640 Mon Sep 17 00:00:00 2001
 From: Trevor Gamblin <trevor.gamblin@windriver.com>
 Date: Wed, 14 Apr 2021 10:24:52 -0400
 Subject: [PATCH] Add resolv_compat.h for musl builds
@@ -10,7 +10,6 @@
 Upstream-Status: Pending
 
 Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
-
 ---
  open-vm-tools/lib/nicInfo/nicInfoPosix.c  |  4 +++
  open-vm-tools/lib/nicInfo/resolv_compat.h | 30 +++++++++++++++++++++++
@@ -18,7 +17,7 @@
  create mode 100644 open-vm-tools/lib/nicInfo/resolv_compat.h
 
 diff --git a/open-vm-tools/lib/nicInfo/nicInfoPosix.c b/open-vm-tools/lib/nicInfo/nicInfoPosix.c
-index c56b73cf..8ae3b2f7 100644
+index c56b73cfe..8ae3b2f74 100644
 --- a/open-vm-tools/lib/nicInfo/nicInfoPosix.c
 +++ b/open-vm-tools/lib/nicInfo/nicInfoPosix.c
 @@ -70,6 +70,10 @@
@@ -34,7 +33,7 @@
   *
 diff --git a/open-vm-tools/lib/nicInfo/resolv_compat.h b/open-vm-tools/lib/nicInfo/resolv_compat.h
 new file mode 100644
-index 00000000..d768464b
+index 000000000..d768464b9
 --- /dev/null
 +++ b/open-vm-tools/lib/nicInfo/resolv_compat.h
 @@ -0,0 +1,30 @@
@@ -68,3 +67,6 @@
 +}
 +#endif
 +
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch
deleted file mode 100644
index 61a681f..0000000
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From caf80e220b055dbce259078be96e899dc78ec1d2 Mon Sep 17 00:00:00 2001
-From: Bartosz Brachaczek <b.brachaczek@gmail.com>
-Date: Tue, 12 Nov 2019 14:31:08 +0100
-Subject: [PATCH] Make HgfsConvertFromNtTimeNsec aware of 64-bit time_t on i386
-
-I verified that this function behaves as expected on x86_64, i386 with
-32-bit time_t, and i386 with 64-bit time_t for the following values of
-ntTtime:
-
-UNIX_EPOCH-1, UNIX_EPOCH, UNIX_EPOCH+1, UNIX_S32_MAX-1, UNIX_S32_MAX,
-UNIX_S32_MAX+1, UNIX_S32_MAX*2+1
-
-I did not verify whether the use of Div643264 is optimal, performance
-wise.
-
-Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/387]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- open-vm-tools/lib/hgfs/hgfsUtil.c | 34 +++++++++++++++++--------------
- 1 file changed, 19 insertions(+), 15 deletions(-)
-
-diff --git a/open-vm-tools/lib/hgfs/hgfsUtil.c b/open-vm-tools/lib/hgfs/hgfsUtil.c
-index cc580ab8..49b10040 100644
---- a/open-vm-tools/lib/hgfs/hgfsUtil.c
-+++ b/open-vm-tools/lib/hgfs/hgfsUtil.c
-@@ -110,23 +110,21 @@ HgfsConvertFromNtTimeNsec(struct timespec *unixTime, // OUT: Time in UNIX format
- 			  uint64 ntTime) // IN: Time in Windows NT format
- {
- #ifdef __i386__
--   uint32 sec;
--   uint32 nsec;
-+   uint64 sec64;
-+   uint32 sec32, nsec;
-+#endif
- 
-    ASSERT(unixTime);
--   /* We assume that time_t is 32bit */
--   ASSERT_ON_COMPILE(sizeof (unixTime->tv_sec) == 4);
- 
--   /* Cap NT time values that are outside of Unix time's range */
-+   if (sizeof (unixTime->tv_sec) == 4) {
-+      /* Cap NT time values that are outside of Unix time's range */
- 
--   if (ntTime >= UNIX_S32_MAX) {
--      unixTime->tv_sec = 0x7FFFFFFF;
--      unixTime->tv_nsec = 0;
--      return 1;
-+      if (ntTime >= UNIX_S32_MAX) {
-+         unixTime->tv_sec = 0x7FFFFFFF;
-+         unixTime->tv_nsec = 0;
-+         return 1;
-+      }
-    }
--#else
--   ASSERT(unixTime);
--#endif
- 
-    if (ntTime < UNIX_EPOCH) {
-       unixTime->tv_sec = 0;
-@@ -135,9 +133,15 @@ HgfsConvertFromNtTimeNsec(struct timespec *unixTime, // OUT: Time in UNIX format
-    }
- 
- #ifdef __i386__
--   Div643232(ntTime - UNIX_EPOCH, 10000000, &sec, &nsec);
--   unixTime->tv_sec = sec;
--   unixTime->tv_nsec = nsec * 100;
-+   if (sizeof (unixTime->tv_sec) == 4) {
-+      Div643232(ntTime - UNIX_EPOCH, 10000000, &sec32, &nsec);
-+      unixTime->tv_sec = sec32;
-+      unixTime->tv_nsec = nsec * 100;
-+   } else {
-+      Div643264(ntTime - UNIX_EPOCH, 10000000, &sec64, &nsec);
-+      unixTime->tv_sec = sec64;
-+      unixTime->tv_nsec = nsec * 100;
-+   }
- #else
-    unixTime->tv_sec = (ntTime - UNIX_EPOCH) / 10000000;
-    unixTime->tv_nsec = ((ntTime - UNIX_EPOCH) % 10000000) * 100;
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
index a711f5e..3aa21e3 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-configure.ac-don-t-use-dnet-config.patch
@@ -1,4 +1,4 @@
-From fc9bf1ce9f1a21150b10736a1c968d4ca6d4eaa3 Mon Sep 17 00:00:00 2001
+From c953564b9f029b31381a2c630b47133ffe6a33e7 Mon Sep 17 00:00:00 2001
 From: Martin Kelly <mkelly@xevo.com>
 Date: Fri, 7 Apr 2017 15:20:30 -0700
 Subject: [PATCH] configure.ac: don't use dnet-config
@@ -14,9 +14,11 @@
  open-vm-tools/configure.ac | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
+diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
+index 3c058135a..124781f99 100644
 --- a/open-vm-tools/configure.ac
 +++ b/open-vm-tools/configure.ac
-@@ -937,7 +937,7 @@ if test "$with_dnet" = "yes"; then
+@@ -1227,7 +1227,7 @@ if test "$with_dnet" = "yes"; then
        AC_VMW_CHECK_LIB([dnet],
                         [DNET],
                         [],
@@ -25,7 +27,7 @@
                         [],
                         [dnet.h],
                         [intf_open],
-@@ -947,7 +947,7 @@ if test "$with_dnet" = "yes"; then
+@@ -1237,7 +1237,7 @@ if test "$with_dnet" = "yes"; then
  
     if test $have_dnet = "no"; then
  		AC_MSG_ERROR(
@@ -34,3 +36,6 @@
     fi
  fi
  
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Use-configure-test-for-struct-timespec.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-Use-configure-test-for-struct-timespec.patch
similarity index 88%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Use-configure-test-for-struct-timespec.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-Use-configure-test-for-struct-timespec.patch
index 6d2e498..aa5ffde 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Use-configure-test-for-struct-timespec.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-Use-configure-test-for-struct-timespec.patch
@@ -1,4 +1,4 @@
-From bf9292ff9bd25467a014d6c2070805d163daa4c9 Mon Sep 17 00:00:00 2001
+From 6384b37cdef4ea868c3cee27bb627e4cfbab7b50 Mon Sep 17 00:00:00 2001
 From: Natanael Copa <ncopa@alpinelinux.org>
 Date: Wed, 18 Nov 2015 09:03:00 +0000
 Subject: [PATCH] Use configure test for struct timespec
@@ -13,10 +13,10 @@
  2 files changed, 2 insertions(+), 7 deletions(-)
 
 diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
-index 713ea683..48ff1ef3 100644
+index 124781f99..05f37f275 100644
 --- a/open-vm-tools/configure.ac
 +++ b/open-vm-tools/configure.ac
-@@ -1208,6 +1208,7 @@ AC_TYPE_OFF_T
+@@ -1441,6 +1441,7 @@ AC_TYPE_OFF_T
  AC_TYPE_PID_T
  AC_TYPE_SIZE_T
  AC_CHECK_MEMBERS([struct stat.st_rdev])
@@ -25,7 +25,7 @@
  AC_STRUCT_TM
  AC_C_VOLATILE
 diff --git a/open-vm-tools/lib/include/hgfsUtil.h b/open-vm-tools/lib/include/hgfsUtil.h
-index 609f4c00..a3a022d4 100644
+index 609f4c000..a3a022d42 100644
 --- a/open-vm-tools/lib/include/hgfsUtil.h
 +++ b/open-vm-tools/lib/include/hgfsUtil.h
 @@ -53,13 +53,7 @@
@@ -43,3 +43,6 @@
  struct timespec {
     time_t tv_sec;
     long   tv_nsec;
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
similarity index 91%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
index e107ecf..24279e3 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
@@ -1,4 +1,4 @@
-From 5a795b234c617150915a607776c76377948870a6 Mon Sep 17 00:00:00 2001
+From 6be6cda5aea42b951212ec5f8a72778b1ef9c2da Mon Sep 17 00:00:00 2001
 From: Natanael Copa <ncopa@alpinelinux.org>
 Date: Wed, 18 Nov 2015 09:10:14 +0000
 Subject: [PATCH] Fix definition of ALLPERMS and ACCESSPERMS
@@ -15,7 +15,7 @@
  2 files changed, 6 insertions(+), 5 deletions(-)
 
 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
-index f2b7ce67..0e6351a9 100644
+index 63c4e65f0..87d419a7b 100644
 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
 +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
 @@ -105,11 +105,13 @@ typedef struct DirectoryEntry {
@@ -36,10 +36,10 @@
  #endif
  
 diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
-index 89133652..7e9c3a91 100644
+index 219065f74..b5b7e6203 100644
 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
 +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
-@@ -52,7 +52,7 @@
+@@ -53,7 +53,7 @@
  
  #define DND_ROOTDIR_PERMS     (S_IRWXU | S_IRWXG | S_IRWXO)
  #define DND_STAGINGDIR_PERMS  (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
@@ -48,7 +48,7 @@
  #define ACCESSPERMS           (S_IRWXU | S_IRWXG | S_IRWXO)
  #endif
  #ifdef __ANDROID__
-@@ -61,7 +61,6 @@
+@@ -62,7 +62,6 @@
   */
  #define NO_SETMNTENT
  #define NO_ENDMNTENT
@@ -56,3 +56,6 @@
  #endif
  
  
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-to-test-for-feature-instead-of-platfor.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Use-configure-to-test-for-feature-instead-of-platfor.patch
similarity index 94%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-to-test-for-feature-instead-of-platfor.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Use-configure-to-test-for-feature-instead-of-platfor.patch
index 34d4ce4..613bba2 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-to-test-for-feature-instead-of-platfor.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0004-Use-configure-to-test-for-feature-instead-of-platfor.patch
@@ -1,4 +1,4 @@
-From b653a81da70c44af002dcbc7489ad9f4588ed11d Mon Sep 17 00:00:00 2001
+From 9d22fba096cd77101fc45420c918ec748d2cc31b Mon Sep 17 00:00:00 2001
 From: Natanael Copa <ncopa@alpinelinux.org>
 Date: Wed, 18 Nov 2015 10:05:07 +0000
 Subject: [PATCH] Use configure to test for feature instead of platform
@@ -29,10 +29,10 @@
  3 files changed, 23 insertions(+), 17 deletions(-)
 
 diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
-index 27f3717f..6baab9e3 100644
+index 05f37f275..9a0c63cf6 100644
 --- a/open-vm-tools/configure.ac
 +++ b/open-vm-tools/configure.ac
-@@ -923,6 +923,7 @@ AC_CHECK_FUNCS(
+@@ -1169,6 +1169,7 @@ AC_CHECK_FUNCS(
  
  AC_CHECK_FUNCS([ecvt])
  AC_CHECK_FUNCS([fcvt])
@@ -40,7 +40,7 @@
  
  AC_CHECK_FUNC([mkdtemp], [have_mkdtemp=yes])
  
-@@ -1132,10 +1133,13 @@ fi
+@@ -1378,10 +1379,13 @@ fi
  ###
  
  AC_CHECK_HEADERS([crypt.h])
@@ -55,7 +55,7 @@
  AC_CHECK_HEADERS([sys/io.h])
  AC_CHECK_HEADERS([sys/param.h]) # Required to make the sys/user.h check work correctly on FreeBSD
 diff --git a/open-vm-tools/lib/misc/idLinux.c b/open-vm-tools/lib/misc/idLinux.c
-index 1bb86f48..41c670cf 100644
+index 1bb86f483..41c670cfc 100644
 --- a/open-vm-tools/lib/misc/idLinux.c
 +++ b/open-vm-tools/lib/misc/idLinux.c
 @@ -27,12 +27,9 @@
@@ -118,7 +118,7 @@
  }
  #endif
 diff --git a/open-vm-tools/lib/nicInfo/nicInfoPosix.c b/open-vm-tools/lib/nicInfo/nicInfoPosix.c
-index cc5fa281..8710c542 100644
+index de57a4a90..c56b73cfe 100644
 --- a/open-vm-tools/lib/nicInfo/nicInfoPosix.c
 +++ b/open-vm-tools/lib/nicInfo/nicInfoPosix.c
 @@ -35,9 +35,13 @@
@@ -137,5 +137,5 @@
  #endif
  #ifndef NO_DNET
 -- 
-2.27.0
+2.25.1
 
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Use-configure-test-for-sys-stat.h-include.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-sys-stat.h-include.patch
similarity index 86%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Use-configure-test-for-sys-stat.h-include.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-sys-stat.h-include.patch
index 9a227f9..b52f242 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Use-configure-test-for-sys-stat.h-include.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-sys-stat.h-include.patch
@@ -1,4 +1,4 @@
-From 11adcf43a1e7aa39ee4d82fa567f37e5b0c6ca81 Mon Sep 17 00:00:00 2001
+From 2bc09bc7d933bc3d91c687e1cc2befdaa38d2c86 Mon Sep 17 00:00:00 2001
 From: Natanael Copa <ncopa@alpinelinux.org>
 Date: Wed, 18 Nov 2015 10:41:01 +0000
 Subject: [PATCH] Use configure test for sys/stat.h include
@@ -11,7 +11,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c
-index e5273786..cabc4137 100644
+index 34f3125d2..cebf4dd8d 100644
 --- a/open-vm-tools/services/plugins/vix/vixTools.c
 +++ b/open-vm-tools/services/plugins/vix/vixTools.c
 @@ -66,7 +66,7 @@
@@ -23,3 +23,6 @@
  #include <sys/stat.h>
  #endif
  
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-Fix-subdir-objects-configure-error.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-subdir-objects-configure-error.patch
similarity index 86%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-Fix-subdir-objects-configure-error.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-subdir-objects-configure-error.patch
index fd7ebce..cb30966 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-Fix-subdir-objects-configure-error.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-subdir-objects-configure-error.patch
@@ -1,4 +1,4 @@
-From 294a3f14b74f2020a5cf3ccc2b6adabbcfce4151 Mon Sep 17 00:00:00 2001
+From dbe0943011c24d48de3df5a95f4e4606be0ef250 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 13 Jun 2018 23:48:04 -0700
 Subject: [PATCH] Fix subdir objects configure error
@@ -6,13 +6,12 @@
 Fix build on musl while here
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
 ---
  open-vm-tools/configure.ac | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
-index 005814ef..edf1f21a 100644
+index 9a0c63cf6..5845490f6 100644
 --- a/open-vm-tools/configure.ac
 +++ b/open-vm-tools/configure.ac
 @@ -326,7 +326,6 @@ AC_ARG_ENABLE(
@@ -32,3 +31,6 @@
  
  ###
  ### Constants
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-include-poll.h-instead-of-sys-poll.h.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-include-poll.h-instead-of-sys-poll.h.patch
similarity index 84%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-include-poll.h-instead-of-sys-poll.h.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-include-poll.h-instead-of-sys-poll.h.patch
index 814b9e3..ff5fee6 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-include-poll.h-instead-of-sys-poll.h.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0007-include-poll.h-instead-of-sys-poll.h.patch
@@ -1,4 +1,4 @@
-From e4f0b99d90e26b15106f634caad1c3dea9e09cb8 Mon Sep 17 00:00:00 2001
+From 8c7f5895ed1f98bfc4101f8cfb93af3d13fd6bce Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 13 Jun 2018 23:02:50 -0700
 Subject: [PATCH] include poll.h instead of sys/poll.h
@@ -11,10 +11,10 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c
-index 65b07109..b41aa29d 100644
+index 2bf97b549..b285c59c6 100644
 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c
 +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c
-@@ -69,8 +69,8 @@
+@@ -70,8 +70,8 @@
  #else
  #include <stddef.h>
  #include <ctype.h>
@@ -24,3 +24,6 @@
  #include <sys/socket.h>
  #include <sys/un.h>
  #include <netdb.h>
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-Rename-poll.h-to-vm_poll.h.patch
similarity index 92%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-Rename-poll.h-to-vm_poll.h.patch
index 214dac4..b3906e8 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0008-Rename-poll.h-to-vm_poll.h.patch
@@ -1,4 +1,4 @@
-From 7a5db1cf47e70e72d78a42468912c276e57f865e Mon Sep 17 00:00:00 2001
+From 0c695d910b3e136e116cdbe0bfc6231dfac255a1 Mon Sep 17 00:00:00 2001
 From: Randy MacLeod <Randy.MacLeod@windriver.com>
 Date: Wed, 24 Mar 2021 16:21:35 -0400
 Subject: [PATCH] Rename poll.h to vm_poll.h
@@ -27,7 +27,7 @@
  rename open-vm-tools/lib/include/{poll.h => vm_poll.h} (99%)
 
 diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c
-index 9914ffc5..89679f7a 100644
+index b285c59c6..5c528820d 100644
 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c
 +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c
 @@ -87,7 +87,7 @@
@@ -40,7 +40,7 @@
  #include "err.h"
  #include "hostinfo.h"
 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c
-index 3a18a7e1..acdda54d 100644
+index 98f5b3f06..b436f0c7e 100644
 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
 +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
 @@ -51,7 +51,7 @@
@@ -53,7 +53,7 @@
  #include "vm_basic_asm.h"
  #include "unicodeOperations.h"
 diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h
-index 746dd78b..82c22f46 100644
+index dad848093..b61a2561f 100644
 --- a/open-vm-tools/lib/include/asyncsocket.h
 +++ b/open-vm-tools/lib/include/asyncsocket.h
 @@ -171,7 +171,7 @@ typedef struct AsyncSocket AsyncSocket;
@@ -66,7 +66,7 @@
  typedef struct AsyncSocketPollParams {
     int flags;               /* Default 0, only POLL_FLAG_NO_BULL is valid */
 diff --git a/open-vm-tools/lib/include/pollImpl.h b/open-vm-tools/lib/include/pollImpl.h
-index 46442e55..8bc66997 100644
+index 46442e556..8bc669970 100644
 --- a/open-vm-tools/lib/include/pollImpl.h
 +++ b/open-vm-tools/lib/include/pollImpl.h
 @@ -44,7 +44,7 @@
@@ -82,7 +82,7 @@
 similarity index 99%
 rename from open-vm-tools/lib/include/poll.h
 rename to open-vm-tools/lib/include/vm_poll.h
-index c90f5dcd..73a56204 100644
+index ade356b9f..8759fb960 100644
 --- a/open-vm-tools/lib/include/poll.h
 +++ b/open-vm-tools/lib/include/vm_poll.h
 @@ -60,7 +60,7 @@ extern "C" {
@@ -95,7 +95,7 @@
  #endif
  #ifdef __ANDROID__
 diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c
-index 8b1fe759..f22fcd40 100644
+index 8b1fe759d..f22fcd402 100644
 --- a/open-vm-tools/lib/rpcIn/rpcin.c
 +++ b/open-vm-tools/lib/rpcIn/rpcin.c
 @@ -57,7 +57,7 @@
@@ -108,5 +108,5 @@
  #  include "vmci_defs.h"
  #include "dataMap.h"
 -- 
-2.27.0
+2.25.1
 
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-use-posix-strerror_r-unless-on-gnu-libc-system.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch
similarity index 90%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-use-posix-strerror_r-unless-on-gnu-libc-system.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch
index 784b4fc..9ae1a8e 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-use-posix-strerror_r-unless-on-gnu-libc-system.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch
@@ -1,4 +1,4 @@
-From e86a259e1ce19c70ecfdece69ab53a07c63a34e1 Mon Sep 17 00:00:00 2001
+From 921621a098f242953117747f5852d7e3136ae6c4 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 13 Jun 2018 23:16:53 -0700
 Subject: [PATCH] use posix strerror_r unless on gnu libc system
@@ -9,7 +9,7 @@
  1 file changed, 6 insertions(+), 3 deletions(-)
 
 diff --git a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c
-index c81b4c13..7a403640 100644
+index c81b4c13f..7a4036402 100644
 --- a/open-vm-tools/lib/err/errPosix.c
 +++ b/open-vm-tools/lib/err/errPosix.c
 @@ -31,6 +31,7 @@
@@ -37,3 +37,6 @@
     ASSERT(p != NULL);
     return p;
  }
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-uintmax_t-for-handling-rlim_t.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-Use-uintmax_t-for-handling-rlim_t.patch
similarity index 83%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-uintmax_t-for-handling-rlim_t.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-Use-uintmax_t-for-handling-rlim_t.patch
index 144b583..36d0c64 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -1,7 +1,7 @@
-From 4b69d8fd78bf6edbc8b4ace58e621d46071fd8dc Mon Sep 17 00:00:00 2001
+From b44d1d4e4ba77f1d9cf7de73a3bd210d02b5ff36 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 24 Mar 2021 17:26:53 -0400
-Subject: [PATCH 2/2] Use uintmax_t for handling rlim_t
+Subject: [PATCH] Use uintmax_t for handling rlim_t
 
 rlimit types are not representable with long or long long
 formats, therefore use uintmax_t to typecast rlim_t types
@@ -17,10 +17,10 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
-index ba2e5624..889f730a 100644
+index 87d419a7b..f5cc80b76 100644
 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
 +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
-@@ -5292,8 +5292,8 @@ HgfsWriteCheckIORange(off_t offset,         // IN:
+@@ -5301,8 +5301,8 @@ HgfsWriteCheckIORange(off_t offset,         // IN:
        goto exit;
     }
  
@@ -32,5 +32,5 @@
     /*
      * Check the offset is within the file size range.
 -- 
-2.30.2
+2.25.1
 
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-Use-off64_t-instead-of-__off64_t.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-off64_t-instead-of-__off64_t.patch
similarity index 87%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-Use-off64_t-instead-of-__off64_t.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-off64_t-instead-of-__off64_t.patch
index 5e37d76..98eeceb 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-Use-off64_t-instead-of-__off64_t.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0011-Use-off64_t-instead-of-__off64_t.patch
@@ -1,4 +1,4 @@
-From 80b1c4236549b0194d1f0d6e9be887e3a5850843 Mon Sep 17 00:00:00 2001
+From 39a59ab7efe98c880c783b2ccf43e5a137d2b222 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 27 Aug 2018 23:22:21 -0700
 Subject: [PATCH] Use off64_t instead of __off64_t
@@ -8,16 +8,15 @@
 
 Upstream-Status: Pending
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
 ---
  open-vm-tools/lib/file/fileIOPosix.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c
-index 82c0aa18..e9154541 100644
+index 492a4bf4a..a80a884cd 100644
 --- a/open-vm-tools/lib/file/fileIOPosix.c
 +++ b/open-vm-tools/lib/file/fileIOPosix.c
-@@ -206,10 +206,10 @@ static AlignedPool alignedPool;
+@@ -211,10 +211,10 @@ static AlignedPool alignedPool;
         * the symbols (and anyone building XOPEN<700 gets nothing).
         */
        extern ssize_t preadv64(int fd, const struct iovec *iov, int iovcnt,
@@ -30,3 +29,6 @@
     #else
        #error "Large file support is unavailable."
     #endif
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
similarity index 93%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
index 97a4136..c7e62da 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
@@ -1,4 +1,4 @@
-From c6836386549fb8f017761ce17a237fa42901434c Mon Sep 17 00:00:00 2001
+From 859c21b9a21c53d936301b05044d0c649d6cf32b Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 24 Mar 2021 17:36:26 -0400
 Subject: [PATCH] hgfsServerLinux: Consider 64bit time_t possibility
@@ -10,13 +10,12 @@
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
 Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
-
 ---
  open-vm-tools/lib/hgfsServer/hgfsServerLinux.c | 14 --------------
  1 file changed, 14 deletions(-)
 
 diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
-index f5cc80b7..5a79d645 100644
+index f5cc80b76..5a79d6451 100644
 --- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
 +++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
 @@ -2566,20 +2566,6 @@ HgfsStatToFileAttr(struct stat *stats,       // IN: stat information
@@ -40,3 +39,6 @@
  
     attr->userId = stats->st_uid;
     attr->groupId = stats->st_gid;
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch
deleted file mode 100644
index 3e4753b..0000000
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-misc-Do-not-print-NULL-string-into-logs.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From cfc6839362bd96bf2f42954160f16a60bf1de377 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 22 Dec 2018 19:59:02 -0800
-Subject: [PATCH] misc: Do not print NULL string into logs
-
-string format %s is getting a NULL pointer for 'expand'
-parameter always since the check for chunks[i] == NULL will ensure that
-its always null when the Log() API is called
-
-Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/312]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- open-vm-tools/lib/misc/util_misc.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/open-vm-tools/lib/misc/util_misc.c
-+++ b/open-vm-tools/lib/misc/util_misc.c
-@@ -719,7 +719,7 @@ Util_ExpandString(const char *fileName)
-       ASSERT(!freeChunk[i]);
-       chunks[i] = expand;
-       if (chunks[i] == NULL) {
--	 Log("%s: Cannot allocate memory to expand $ in \"%s\".\n",
-+	 Log("%s: Cannot allocate memory to expand in \"%s\".\n",
-              __FUNCTION__, fileName);
- 	 goto out;
-       }
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-open-vm-tools-Correct-include-path-for-poll.h.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-open-vm-tools-Correct-include-path-for-poll.h.patch
similarity index 94%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-open-vm-tools-Correct-include-path-for-poll.h.patch
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-open-vm-tools-Correct-include-path-for-poll.h.patch
index d9823bd..8368746 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-open-vm-tools-Correct-include-path-for-poll.h.patch
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0013-open-vm-tools-Correct-include-path-for-poll.h.patch
@@ -1,4 +1,4 @@
-From 2cefed441753b012c385e2d3ea5374b4d67e5696 Mon Sep 17 00:00:00 2001
+From 7f7e00ce582d72013cb54278548d3320e032b0dc Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 7 Feb 2022 13:32:32 -0800
 Subject: [PATCH] open-vm-tools: Correct include path for poll.h
@@ -32,5 +32,5 @@
  #endif
  
 -- 
-2.35.1
+2.25.1
 
diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_11.3.5.bb b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb
similarity index 80%
rename from meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_11.3.5.bb
rename to meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb
index 1c3545f..19e4ee1 100644
--- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_11.3.5.bb
+++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb
@@ -30,20 +30,18 @@
            file://vmtoolsd.service \
            file://vmtoolsd.init \
            file://0001-configure.ac-don-t-use-dnet-config.patch;patchdir=.. \
-           file://0003-Use-configure-test-for-struct-timespec.patch;patchdir=.. \
-           file://0004-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch;patchdir=.. \
-           file://0005-Use-configure-to-test-for-feature-instead-of-platfor.patch;patchdir=.. \
-           file://0006-Use-configure-test-for-sys-stat.h-include.patch;patchdir=.. \
-           file://0007-Fix-subdir-objects-configure-error.patch;patchdir=.. \
-           file://0008-include-poll.h-instead-of-sys-poll.h.patch;patchdir=.. \
-           file://0009-Rename-poll.h-to-vm_poll.h.patch;patchdir=.. \
-           file://0010-use-posix-strerror_r-unless-on-gnu-libc-system.patch;patchdir=.. \
-           file://0011-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \
-           file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \
-           file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \
-           file://0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch;patchdir=.. \
-           file://0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch;patchdir=.. \
-           file://0001-open-vm-tools-Correct-include-path-for-poll.h.patch;patchdir=.. \
+           file://0002-Use-configure-test-for-struct-timespec.patch;patchdir=.. \
+           file://0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch;patchdir=.. \
+           file://0004-Use-configure-to-test-for-feature-instead-of-platfor.patch;patchdir=.. \
+           file://0005-Use-configure-test-for-sys-stat.h-include.patch;patchdir=.. \
+           file://0006-Fix-subdir-objects-configure-error.patch;patchdir=.. \
+           file://0007-include-poll.h-instead-of-sys-poll.h.patch;patchdir=.. \
+           file://0008-Rename-poll.h-to-vm_poll.h.patch;patchdir=.. \
+           file://0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch;patchdir=.. \
+           file://0010-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \
+           file://0011-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \
+           file://0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch;patchdir=.. \
+           file://0013-open-vm-tools-Correct-include-path-for-poll.h.patch;patchdir=.. \
            "
 
 UPSTREAM_CHECK_GITTAGREGEX = "stable-(?P<pver>\d+(\.\d+)+)"
@@ -51,7 +49,7 @@
 SRC_URI:append:libc-musl = " file://0001-Add-resolv_compat.h-for-musl-builds.patch;patchdir=.. \
 "
 
-SRCREV = "87abba1ce2356fc860eb9d0777d8e9de47427358"
+SRCREV = "6f5e4b13647b40a45c196dad76b1cb39cc6690b9"
 
 S = "${WORKDIR}/git/open-vm-tools"
 
@@ -66,7 +64,7 @@
 
 EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \
          --disable-tests --without-gtkmm --without-xerces --without-pam \
-         --disable-vgauth --disable-deploypkg \
+         --disable-vgauth --disable-deploypkg --disable-containerinfo \
          --without-root-privileges --without-kernel-modules --with-tirpc \
          --with-udev-rules-dir=${nonarch_base_libdir}/udev/rules.d"
 
diff --git a/meta-openembedded/meta-networking/recipes-support/spice/spice_git.bb b/meta-openembedded/meta-networking/recipes-support/spice/spice_git.bb
index 1887a55..b3e6874 100644
--- a/meta-openembedded/meta-networking/recipes-support/spice/spice_git.bb
+++ b/meta-openembedded/meta-networking/recipes-support/spice/spice_git.bb
@@ -58,7 +58,7 @@
 PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,,"
 PACKAGECONFIG[xinerama] = "--enable-xinerama,--disable-xinerama,libxinerama,"
 
-COMPATIBLE_HOST = '(x86_64|i.86).*-linux'
+COMPATIBLE_HOST = '(x86_64|i.86|aarch64).*-linux'
 
 BBCLASSEXTEND = "native nativesdk"
 
diff --git a/meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.7.bb b/meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.8.bb
similarity index 97%
rename from meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.7.bb
rename to meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.8.bb
index 71ffb7b..266d43a 100644
--- a/meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.7.bb
+++ b/meta-openembedded/meta-networking/recipes-support/strongswan/strongswan_5.9.8.bb
@@ -11,7 +11,7 @@
 SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \
            "
 
-SRC_URI[sha256sum] = "9e64a2ba62efeac81abff1d962522404ebc6ed6c0d352a23ab7c0b2c639e3fcf"
+SRC_URI[sha256sum] = "d3303a43c0bd7b75a12b64855e8edcb53696f06190364f26d1533bde1f2e453c"
 
 UPSTREAM_CHECK_REGEX = "strongswan-(?P<pver>\d+(\.\d+)+)\.tar"
 
@@ -39,7 +39,6 @@
 PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap,openldap,${PN}-plugin-ldap"
 PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,${PN}-plugin-mysql"
 PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl,${PN}-plugin-openssl"
-PACKAGECONFIG[scep] = "--enable-scepclient,--disable-scepclient,"
 PACKAGECONFIG[soup] = "--enable-soup,--disable-soup,libsoup-2.4,${PN}-plugin-soup"
 PACKAGECONFIG[sqlite3] = "--enable-sqlite,--disable-sqlite,sqlite3,${PN}-plugin-sqlite"
 PACKAGECONFIG[stroke] = "--enable-stroke,--disable-stroke,,${PN}-plugin-stroke"
@@ -148,6 +147,7 @@
     ${PN}-plugin-dnskey \
     ${PN}-plugin-drbg \
     ${PN}-plugin-fips-prf \
+    ${PN}-plugin-gcm \
     ${PN}-plugin-hmac \
     ${PN}-plugin-kdf \
     ${PN}-plugin-kernel-netlink \
diff --git a/meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.65.bb b/meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.66.bb
similarity index 92%
rename from meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.65.bb
rename to meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.66.bb
index ab7ff43..17c8c53 100644
--- a/meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.65.bb
+++ b/meta-openembedded/meta-networking/recipes-support/stunnel/stunnel_5.66.bb
@@ -11,7 +11,7 @@
            file://fix-openssl-no-des.patch \
 "
 
-SRC_URI[sha256sum] = "60c500063bd1feff2877f5726e38278c086f96c178f03f09d264a2012d6bf7fc"
+SRC_URI[sha256sum] = "558178704d1aa5f6883aac6cc5d6bbf2a5714c8a0d2e91da0392468cee9f579c"
 
 inherit autotools bash-completion pkgconfig
 
diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bb b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb
similarity index 96%
rename from meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bb
rename to meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb
index 467e10b..234d347 100644
--- a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bb
+++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb
@@ -21,8 +21,7 @@
     file://lirc_options.conf \
     file://lirc.tmpfiles \
 "
-SRC_URI[md5sum] = "86c3f8e4efaba10571addb8313d1e040"
-SRC_URI[sha256sum] = "8b753c60df2a7f5dcda2db72c38e448ca300c3b4f6000c1501fcb0bd5df414f2"
+SRC_URI[sha256sum] = "3d44ec8274881cf262f160805641f0827ffcc20ade0d85e7e6f3b90e0d3d222a"
 
 SYSTEMD_PACKAGES = "lirc lirc-exec"
 SYSTEMD_SERVICE:${PN} = "lircd.service lircmd.service lircd-setup.service lircd-uinput.service"
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.11.bb b/meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.12.bb
similarity index 95%
rename from meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.11.bb
rename to meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.12.bb
index 2142a8e..8c5ce36 100644
--- a/meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.11.bb
+++ b/meta-openembedded/meta-oe/recipes-benchmark/iperf3/iperf3_3.12.bb
@@ -18,7 +18,7 @@
            file://0001-configure.ac-check-for-CPP-prog.patch \
            "
 
-SRCREV = "76bd67f6e90e239a7686202d2b1b595159826d24"
+SRCREV = "e61aaf8c95df956cefbc54fab7b3d78914664180"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.10.bb b/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb
similarity index 94%
rename from meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.10.bb
rename to meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb
index 374922e..218672e 100644
--- a/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.10.bb
+++ b/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb
@@ -13,7 +13,7 @@
 
 SRC_URI = "git://github.com/eclipse/paho.mqtt.c;protocol=http;branch=master;protocol=https"
 
-SRCREV = "eff2da4875725509fc97641b118d6badf3e3a08f"
+SRCREV = "0995176412616ae8f1cba51c8d609fe4b69687ea"
 
 DEPENDS = "openssl"
 
diff --git a/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb b/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb
index 8ad7d9d..8bbee5c 100644
--- a/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb
+++ b/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb
@@ -5,8 +5,8 @@
 SECTION = "base"
 
 S = "${WORKDIR}/git"
-PV = "2022.09.23"
-SRCREV = "5e2f8c66476bcf60eb8c2921807e34efb30294ee"
+PV = "2022.09.30"
+SRCREV = "a51354a85f41d203e755124ad51ae3425933df45"
 SRC_URI = "git://github.com/KhronosGroup/OpenCL-Headers.git;branch=main;protocol=https"
 
 do_configure[noexec] = "1"
diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb
index e38726d..17a0634 100644
--- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb
+++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb
@@ -2,7 +2,9 @@
 inherit native
 
 PROVIDES += "mysql5-native"
-DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native"
+DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \
+gnutls-native fmt-native \
+"
 
 RDEPENDS:${PN} = ""
 PACKAGES = ""
diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc
index 7bd4ac0..2ef0d1a 100644
--- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc
+++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc
@@ -19,6 +19,8 @@
            file://ssize_t.patch \
            file://mm_malloc.patch \
            file://sys_futex.patch \
+           file://cross-compiling.patch \
+           file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \
           "
 SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch"
 
@@ -61,6 +63,8 @@
                        "
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} lz4 openssl"
+EXTRA_OEMAKE = "'GEN_LEX_HASH=${STAGING_BINDIR_NATIVE}/gen_lex_hash'"
+
 PACKAGECONFIG:class-native = ""
 PACKAGECONFIG[pam] = ",-DWITHOUT_AUTH_PAM=TRUE,libpam"
 PACKAGECONFIG[valgrind] = "-DWITH_VALGRIND=TRUE,-DWITH_VALGRIND=FALSE,valgrind"
@@ -94,9 +98,9 @@
                  -DINSTALL_SYSCONFDIR:PATH=${sysconfdir} \
                  -DMYSQL_DATADIR:PATH=/var/mysql \
                  -DCAT_EXECUTABLE=`which cat` \
+                 -DSTACK_DIRECTION=1 \
                  -DCMAKE_AR:FILEPATH=${AR}"
 
-EXTRA_OECMAKE:prepend:class-target = "-DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper "
 
 # With Ninja it fails with:
 # make: *** No rule to make target `install'.  Stop.
@@ -120,18 +124,12 @@
     sed -i "/set( CMAKE_SYSTEM_PROCESSOR/d" ${WORKDIR}/toolchain.cmake
 }
 
-do_configure:prepend:class-target () {
-	# Write out a qemu wrapper that will be used by cmake
-	# so that it can run target helper binaries through that.
-	qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
-	cat > ${WORKDIR}/qemuwrapper << EOF
-#!/bin/sh
-$qemu_binary "\$@"
-EOF
-	chmod +x ${WORKDIR}/qemuwrapper
-}
 
 do_compile:prepend:class-target () {
+    # These need to be in-tree or make will think they need to be built,
+    # and since we're cross-compiling that is disabled
+    cp ${STAGING_BINDIR_NATIVE}/comp_err ${S}/extra
+    cp ${STAGING_BINDIR_NATIVE}/comp_sql ${S}/scripts
     if [ "${@bb.utils.contains('PACKAGECONFIG', 'krb5', 'yes', 'no', d)}" = "no" ]; then
         if ! [ -e ${B}/include/openssl/kssl.h ] ; then
             mkdir -p ${B}/include/openssl
diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch
new file mode 100644
index 0000000..456a2ba
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch
@@ -0,0 +1,69 @@
+From f92f657973997df30afdb0032c88ad3a14ead46b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+Date: Fri, 23 Sep 2022 15:48:21 +0800
+Subject: [PATCH] sql/CMakeLists.txt: fix gen_lex_hash not found
+
+Fix the below do_compile issue in cross-compiling env.
+| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_hash', needed by 'sql/lex_hash.h'.  Stop.
+| make[2]: *** No rule to make target '/build/tmp/work/aarch64-poky-linux/mariadb/10.3.13-r0/mariadb-10.3.13/sql/gen_lex_token', needed by 'sql/lex_token.h'.  Stop.
+
+Upstream-Status: Inappropriate [oe build specific]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ sql/CMakeLists.txt | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
+index 241b482..27a3991 100644
+--- a/sql/CMakeLists.txt
++++ b/sql/CMakeLists.txt
+@@ -60,11 +60,18 @@ ${CMAKE_BINARY_DIR}/sql
+ ${CMAKE_SOURCE_DIR}/tpool
+ )
+ 
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
+-  COMMAND gen_lex_token > lex_token.h
+-  DEPENDS gen_lex_token
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
++    DEPENDS gen_lex_token
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
++    COMMAND gen_lex_token > lex_token.h
+ )
++ENDIF()
+ 
+ FIND_PACKAGE(BISON 2.4)
+ 
+@@ -372,11 +379,18 @@ IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
+   ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
+ ENDIF()
+ 
+-ADD_CUSTOM_COMMAND(
+-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
+-  COMMAND gen_lex_hash > lex_hash.h
+-  DEPENDS gen_lex_hash
++IF(NOT CMAKE_CROSSCOMPILING)
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
++    DEPENDS gen_lex_hash
++)
++ELSE()
++  ADD_CUSTOM_COMMAND(
++    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
++    COMMAND gen_lex_hash > lex_hash.h
+ )
++ENDIF()
+ 
+ MYSQL_ADD_EXECUTABLE(mariadb-tzinfo-to-sql tztime.cc)
+ SET_TARGET_PROPERTIES(mariadb-tzinfo-to-sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL")
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch
new file mode 100644
index 0000000..d0d6e3c
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/cross-compiling.patch
@@ -0,0 +1,34 @@
+From 80be37351d995654f86b838f6b5ed47e8a90261b Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+Date: Fri, 23 Sep 2022 12:05:17 +0800
+Subject: [PATCH] CMakeLists.txt: not include import_executables.cmake
+
+building failed since native does not generate import_executables.cmake
+In fact, our building system will export the needed commands.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f9e2b1b..34924ba 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -394,11 +394,6 @@ CHECK_LIBFMT()
+ ADD_SUBDIRECTORY(tpool)
+ CHECK_SYSTEMD()
+ 
+-IF(CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
+-  SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
+-  INCLUDE(${IMPORT_EXECUTABLES})
+-ENDIF()
+-
+ #
+ # Setup maintainer mode options. Platform checks are
+ # not run with the warning options as to not perturb fragile checks
+-- 
+2.25.1
+
diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb
index 20bb5fc..87faabf 100644
--- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb
+++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb
@@ -1,8 +1,6 @@
 require mariadb.inc
 
-inherit qemu
-
-DEPENDS += "qemu-native bison-native boost libpcre2 curl ncurses \
+DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \
             zlib libaio libedit libevent libxml2 gnutls fmt lzo zstd"
 
 PROVIDES += "mysql5 libmysqlclient"
diff --git a/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20220925.0.bb b/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221002.0.bb
similarity index 95%
rename from meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20220925.0.bb
rename to meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221002.0.bb
index f5bacfd..de9e6db 100644
--- a/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20220925.0.bb
+++ b/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221002.0.bb
@@ -14,7 +14,7 @@
 
 inherit autotools-brokensep pkgconfig manpages
 
-SRCREV = "299fe525048358ecdfecb9ca91505333c0fb14f4"
+SRCREV = "132379f59e223696f2382a84c2e12b6e7860a7ac"
 SRC_URI = "git://github.com/universal-ctags/ctags;branch=master;protocol=https"
 
 S = "${WORKDIR}/git"
diff --git a/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb b/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb
index f170b9f..9f96188 100644
--- a/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb
+++ b/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb
@@ -4,7 +4,7 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
 SRC_URI = "git://github.com/ubinux/dnf-plugin-tui.git;branch=master;protocol=https"
-SRCREV = "bac88927b253cdcfe0d06ac7dc5afb876cd2d996"
+SRCREV = "b0d80b7129f1d84cc563a4098d869e7420bcf4bc"
 PV = "1.3"
 
 SRC_URI:append:class-target = " file://oe-remote.repo.sample"
@@ -42,6 +42,6 @@
     dnf \
     libnewt-python \
 "
-
+DEPENDS:append:class-nativesdk = " file-replacement-nativesdk"
 BBCLASSEXTEND = "nativesdk"
 SKIP_RECIPE[dnf-plugin-tui] ?= "${@bb.utils.contains('PACKAGE_CLASSES', 'package_rpm', '', 'does not build correctly without package_rpm in PACKAGE_CLASSES', d)}"
diff --git a/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc b/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc
index ebdd944..fc85e57 100644
--- a/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc
+++ b/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc
@@ -1,3 +1,3 @@
-PV = "2.0.8"
-SRCREV = "06c5c7ed0bd987a918cf88caafb094f22cdd1721"
+PV = "22.9.29"
+SRCREV = "c92e78a9f841a6110ec27180d68d1f7f2afda21d"
 SRC_URI = "git://github.com/google/flatbuffers.git;branch=master;protocol=https"
diff --git a/meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.10.bb b/meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.11.bb
similarity index 98%
rename from meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.10.bb
rename to meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.11.bb
index 9fc39e8..fefabf7 100644
--- a/meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.10.bb
+++ b/meta-openembedded/meta-oe/recipes-devtools/php/php_8.1.11.bb
@@ -33,7 +33,7 @@
           "
 
 S = "${WORKDIR}/php-${PV}"
-SRC_URI[sha256sum] = "2de8e0402285f7c56887defe651922308aded58ba60befcf3b77720209e31f10"
+SRC_URI[sha256sum] = "af6250b18b4403b6eeff9b4a02786ac86a12a208141f6f65478f79256f47f246"
 
 CVE_CHECK_IGNORE += "\
     CVE-2007-2728 \
diff --git a/meta-openembedded/meta-oe/recipes-devtools/systemd/nativesdk-systemd-systemctl.bb b/meta-openembedded/meta-oe/recipes-devtools/systemd/nativesdk-systemd-systemctl.bb
new file mode 100644
index 0000000..f7160f5
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/systemd/nativesdk-systemd-systemctl.bb
@@ -0,0 +1,15 @@
+SUMMARY = "Wrapper for enabling systemd services"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+inherit nativesdk
+
+SRC_URI = "file://systemctl"
+
+S = "${WORKDIR}"
+
+do_install() {
+	install -d ${D}${bindir}
+	install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
+}
diff --git a/meta-openembedded/meta-oe/recipes-devtools/systemd/systemd-systemctl/systemctl b/meta-openembedded/meta-oe/recipes-devtools/systemd/systemd-systemctl/systemctl
new file mode 100755
index 0000000..07d24fd
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-devtools/systemd/systemd-systemctl/systemctl
@@ -0,0 +1,340 @@
+#!/usr/bin/env python3
+"""systemctl: subset of systemctl used for image construction
+
+Mask/preset systemd units
+"""
+
+import argparse
+import fnmatch
+import os
+import re
+import sys
+
+from collections import namedtuple
+from pathlib import Path
+
+version = 1.0
+
+ROOT = Path("/")
+SYSCONFDIR = Path("etc")
+BASE_LIBDIR = Path("lib")
+LIBDIR = Path("usr", "lib")
+
+locations = list()
+
+
+class SystemdFile():
+    """Class representing a single systemd configuration file"""
+    def __init__(self, root, path):
+        self.sections = dict()
+        self._parse(root, path)
+        dirname = os.path.basename(path.name) + ".d"
+        for location in locations:
+            for path2 in sorted((root / location / "system" / dirname).glob("*.conf")):
+                self._parse(root, path2)
+
+    def _parse(self, root, path):
+        """Parse a systemd syntax configuration file
+
+        Args:
+            path: A pathlib.Path object pointing to the file
+
+        """
+        skip_re = re.compile(r"^\s*([#;]|$)")
+        section_re = re.compile(r"^\s*\[(?P<section>.*)\]")
+        kv_re = re.compile(r"^\s*(?P<key>[^\s]+)\s*=\s*(?P<value>.*)")
+        section = None
+
+        if path.is_symlink():
+            try:
+                path.resolve()
+            except FileNotFoundError:
+                # broken symlink, try relative to root
+                path = root / Path(os.readlink(str(path))).relative_to(ROOT)
+
+        with path.open() as f:
+            for line in f:
+                if skip_re.match(line):
+                    continue
+
+                line = line.strip()
+                m = section_re.match(line)
+                if m:
+                    if m.group('section') not in self.sections:
+                        section = dict()
+                        self.sections[m.group('section')] = section
+                    else:
+                        section = self.sections[m.group('section')]
+                    continue
+
+                while line.endswith("\\"):
+                    line += f.readline().rstrip("\n")
+
+                m = kv_re.match(line)
+                k = m.group('key')
+                v = m.group('value')
+                if k not in section:
+                    section[k] = list()
+                section[k].extend(v.split())
+
+    def get(self, section, prop):
+        """Get a property from section
+
+        Args:
+            section: Section to retrieve property from
+            prop: Property to retrieve
+
+        Returns:
+            List representing all properties of type prop in section.
+
+        Raises:
+            KeyError: if ``section`` or ``prop`` not found
+        """
+        return self.sections[section][prop]
+
+
+class Presets():
+    """Class representing all systemd presets"""
+    def __init__(self, scope, root):
+        self.directives = list()
+        self._collect_presets(scope, root)
+
+    def _parse_presets(self, presets):
+        """Parse presets out of a set of preset files"""
+        skip_re = re.compile(r"^\s*([#;]|$)")
+        directive_re = re.compile(r"^\s*(?P<action>enable|disable)\s+(?P<unit_name>(.+))")
+
+        Directive = namedtuple("Directive", "action unit_name")
+        for preset in presets:
+            with preset.open() as f:
+                for line in f:
+                    m = directive_re.match(line)
+                    if m:
+                        directive = Directive(action=m.group('action'),
+                                              unit_name=m.group('unit_name'))
+                        self.directives.append(directive)
+                    elif skip_re.match(line):
+                        pass
+                    else:
+                        sys.exit("Unparsed preset line in {}".format(preset))
+
+    def _collect_presets(self, scope, root):
+        """Collect list of preset files"""
+        presets = dict()
+        for location in locations:
+            paths = (root / location / scope).glob("*.preset")
+            for path in paths:
+                # earlier names override later ones
+                if path.name not in presets:
+                    presets[path.name] = path
+
+        self._parse_presets([v for k, v in sorted(presets.items())])
+
+    def state(self, unit_name):
+        """Return state of preset for unit_name
+
+        Args:
+            presets: set of presets
+            unit_name: name of the unit
+
+        Returns:
+            None: no matching preset
+            `enable`: unit_name is enabled
+            `disable`: unit_name is disabled
+        """
+        for directive in self.directives:
+            if fnmatch.fnmatch(unit_name, directive.unit_name):
+                return directive.action
+
+        return None
+
+
+def add_link(path, target):
+    try:
+        path.parent.mkdir(parents=True)
+    except FileExistsError:
+        pass
+    if not path.is_symlink():
+        print("ln -s {} {}".format(target, path))
+        path.symlink_to(target)
+
+
+class SystemdUnitNotFoundError(Exception):
+    def __init__(self, path, unit):
+        self.path = path
+        self.unit = unit
+
+
+class SystemdUnit():
+    def __init__(self, root, unit):
+        self.root = root
+        self.unit = unit
+        self.config = None
+
+    def _path_for_unit(self, unit):
+        for location in locations:
+            path = self.root / location / "system" / unit
+            if path.exists() or path.is_symlink():
+                return path
+
+        raise SystemdUnitNotFoundError(self.root, unit)
+
+    def _process_deps(self, config, service, location, prop, dirstem):
+        systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+
+        target = ROOT / location.relative_to(self.root)
+        try:
+            for dependent in config.get('Install', prop):
+                wants = systemdir / "{}.{}".format(dependent, dirstem) / service
+                add_link(wants, target)
+
+        except KeyError:
+            pass
+
+    def enable(self, caller_unit=None):
+        # if we're enabling an instance, first extract the actual instance
+        # then figure out what the template unit is
+        template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit)
+        if template:
+            instance = template.group('instance')
+            unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
+        else:
+            instance = None
+            unit = self.unit
+
+        path = self._path_for_unit(unit)
+
+        if path.is_symlink():
+            # ignore aliases
+            return
+
+        config = SystemdFile(self.root, path)
+        if instance == "":
+            try:
+                default_instance = config.get('Install', 'DefaultInstance')[0]
+            except KeyError:
+                # no default instance, so nothing to enable
+                return
+
+            service = self.unit.replace("@.",
+                                        "@{}.".format(default_instance))
+        else:
+            service = self.unit
+
+        self._process_deps(config, service, path, 'WantedBy', 'wants')
+        self._process_deps(config, service, path, 'RequiredBy', 'requires')
+
+        try:
+            for also in config.get('Install', 'Also'):
+                try:
+                    if caller_unit != also:
+                        SystemdUnit(self.root, also).enable(unit)
+                except SystemdUnitNotFoundError as e:
+                    sys.exit("Error: Systemctl also enable issue with  %s (%s)" % (service, e.unit))
+
+        except KeyError:
+            pass
+
+        systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+        target = ROOT / path.relative_to(self.root)
+        try:
+            for dest in config.get('Install', 'Alias'):
+                alias = systemdir / dest
+                add_link(alias, target)
+
+        except KeyError:
+            pass
+
+    def mask(self):
+        systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+        add_link(systemdir / self.unit, "/dev/null")
+
+
+def collect_services(root):
+    """Collect list of service files"""
+    services = set()
+    for location in locations:
+        paths = (root / location / "system").glob("*")
+        for path in paths:
+            if path.is_dir():
+                continue
+            services.add(path.name)
+
+    return services
+
+
+def preset_all(root):
+    presets = Presets('system-preset', root)
+    services = collect_services(root)
+
+    for service in services:
+        state = presets.state(service)
+
+        if state == "enable" or state is None:
+            try:
+                SystemdUnit(root, service).enable()
+            except SystemdUnitNotFoundError:
+                sys.exit("Error: Systemctl preset_all issue in %s" % service)
+
+    # If we populate the systemd links we also create /etc/machine-id, which
+    # allows systemd to boot with the filesystem read-only before generating
+    # a real value and then committing it back.
+    #
+    # For the stateless configuration, where /etc is generated at runtime
+    # (for example on a tmpfs), this script shouldn't run at all and we
+    # allow systemd to completely populate /etc.
+    (root / SYSCONFDIR / "machine-id").touch()
+
+
+def main():
+    if sys.version_info < (3, 4, 0):
+        sys.exit("Python 3.4 or greater is required")
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('command', nargs='?', choices=['enable', 'mask',
+                                                     'preset-all'])
+    parser.add_argument('service', nargs=argparse.REMAINDER)
+    parser.add_argument('--root')
+    parser.add_argument('--preset-mode',
+                        choices=['full', 'enable-only', 'disable-only'],
+                        default='full')
+
+    args = parser.parse_args()
+
+    root = Path(args.root) if args.root else ROOT
+
+    locations.append(SYSCONFDIR / "systemd")
+    # Handle the usrmerge case by ignoring /lib when it's a symlink
+    if not (root / BASE_LIBDIR).is_symlink():
+        locations.append(BASE_LIBDIR / "systemd")
+    locations.append(LIBDIR / "systemd")
+
+    command = args.command
+    if not command:
+        parser.print_help()
+        return 0
+
+    if command == "mask":
+        for service in args.service:
+            try:
+                SystemdUnit(root, service).mask()
+            except SystemdUnitNotFoundError as e:
+                sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit))
+    elif command == "enable":
+        for service in args.service:
+            try:
+                SystemdUnit(root, service).enable()
+            except SystemdUnitNotFoundError as e:
+                sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit))
+    elif command == "preset-all":
+        if len(args.service) != 0:
+            sys.exit("Too many arguments.")
+        if args.preset_mode != "enable-only":
+            sys.exit("Only enable-only is supported as preset-mode.")
+        preset_all(root)
+    else:
+        raise RuntimeError()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.5.bb b/meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.7.bb
similarity index 86%
rename from meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.5.bb
rename to meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.7.bb
index 0546814..28d2bb1 100644
--- a/meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.5.bb
+++ b/meta-openembedded/meta-oe/recipes-gnome/gtk+/gtkmm3_3.24.7.bb
@@ -16,7 +16,7 @@
 
 ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
 
-SRC_URI[archive.sha256sum] = "856333de86689f6a81c123f2db15d85db9addc438bc3574c36f15736aeae22e6"
+SRC_URI[archive.sha256sum] = "1d7a35af9c5ceccacb244ee3c2deb9b245720d8510ac5c7e6f4b6f9947e6789c"
 
 EXTRA_OEMESON = "-Dbuild-demos=false"
 
diff --git a/meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.2.bb b/meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.3.bb
similarity index 95%
rename from meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.2.bb
rename to meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.3.bb
index 671b8ca..3a306ad 100644
--- a/meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.2.bb
+++ b/meta-openembedded/meta-oe/recipes-graphics/dnfdragora/dnfdragora_2.1.3.bb
@@ -9,7 +9,7 @@
            file://0001-To-fix-error-when-do_package.patch \
            "
 
-SRCREV = "5cbbc07c9d015af284a424a172a379b385f05b6f"
+SRCREV = "5b0f4c38efb92c9dac1d39fade5b9a3c30f20ec4"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.2.1.bb b/meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb
similarity index 81%
rename from meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.2.1.bb
rename to meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb
index 6ef9f74..627ce23 100644
--- a/meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.2.1.bb
+++ b/meta-openembedded/meta-oe/recipes-graphics/freeglut/freeglut_3.4.0.bb
@@ -4,8 +4,7 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=89c0b58a3e01ce3d8254c9f59e78adfb"
 
 SRC_URI = "https://sourceforge.net/projects/${BPN}/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz"
-SRC_URI[md5sum] = "cd5c670c1086358598a6d4a9d166949d"
-SRC_URI[sha256sum] = "d4000e02102acaf259998c870e25214739d1f16f67f99cb35e4f46841399da68"
+SRC_URI[sha256sum] = "3c0bcb915d9b180a97edaebd011b7a1de54583a838644dcd42bb0ea0c6f3eaec"
 
 inherit cmake features_check
 
diff --git a/meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.8.5.bb b/meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.9.bb
similarity index 82%
rename from meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.8.5.bb
rename to meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.9.bb
index e88c2c0..517d467 100644
--- a/meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.8.5.bb
+++ b/meta-openembedded/meta-oe/recipes-graphics/suckless/st_0.9.bb
@@ -1,13 +1,13 @@
 SECTION = "shadow"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=04c3ca13a702147c62db90f556c5b3ca"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=703e9835709f45ee7b81082277f1daec"
 SRC_URI = "http://dl.suckless.org/${BPN}/${BP}.tar.gz"
 
 inherit pkgconfig features_check
 
 REQUIRED_DISTRO_FEATURES = "x11"
 
-SRC_URI[sha256sum] = "ea6832203ed02ff74182bcb8adaa9ec454c8f989e79232cb859665e2f544ab37"
+SRC_URI[sha256sum] = "f36359799734eae785becb374063f0be833cf22f88b4f169cd251b99324e08e7"
 
 DEPENDS += "libx11 libxft fontconfig ncurses-native"
 
diff --git a/meta-openembedded/meta-oe/recipes-multimedia/jack/jack/0001-Remove-usage-of-U-mode-bit-for-opening-files-in-pyth.patch b/meta-openembedded/meta-oe/recipes-multimedia/jack/jack/0001-Remove-usage-of-U-mode-bit-for-opening-files-in-pyth.patch
new file mode 100644
index 0000000..d3b2031
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-multimedia/jack/jack/0001-Remove-usage-of-U-mode-bit-for-opening-files-in-pyth.patch
@@ -0,0 +1,52 @@
+From 415d50fc56b82963e5570c7738c61b22f4a83748 Mon Sep 17 00:00:00 2001
+From: Daan De Meyer <daan.j.demeyer@gmail.com>
+Date: Mon, 11 Jul 2022 00:56:28 +0200
+Subject: [PATCH] Remove usage of 'U' mode bit for opening files in python
+
+The 'U' mode bit is removed in python 3.11. It has been
+deprecated for a long time. The 'U' mode bit has no effect
+so this change doesn't change any behavior.
+
+See https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
+
+Upstream-Status: Submitted [https://github.com/jackaudio/jack2/pull/884]
+---
+ waflib/ConfigSet.py | 2 +-
+ waflib/Context.py   | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/waflib/ConfigSet.py b/waflib/ConfigSet.py
+index b300bb56..84736c9c 100644
+--- a/waflib/ConfigSet.py
++++ b/waflib/ConfigSet.py
+@@ -312,7 +312,7 @@ class ConfigSet(object):
+ 		:type filename: string
+ 		"""
+ 		tbl = self.table
+-		code = Utils.readf(filename, m='rU')
++		code = Utils.readf(filename, m='r')
+ 		for m in re_imp.finditer(code):
+ 			g = m.group
+ 			tbl[g(2)] = eval(g(3))
+diff --git a/waflib/Context.py b/waflib/Context.py
+index 9fee3fa1..761b521f 100644
+--- a/waflib/Context.py
++++ b/waflib/Context.py
+@@ -266,7 +266,7 @@ class Context(ctx):
+ 				cache[node] = True
+ 				self.pre_recurse(node)
+ 				try:
+-					function_code = node.read('rU', encoding)
++					function_code = node.read('r', encoding)
+ 					exec(compile(function_code, node.abspath(), 'exec'), self.exec_dict)
+ 				finally:
+ 					self.post_recurse(node)
+@@ -662,7 +662,7 @@ def load_module(path, encoding=None):
+ 
+ 	module = imp.new_module(WSCRIPT_FILE)
+ 	try:
+-		code = Utils.readf(path, m='rU', encoding=encoding)
++		code = Utils.readf(path, m='r', encoding=encoding)
+ 	except EnvironmentError:
+ 		raise Errors.WafError('Could not read the file %r' % path)
+ 
diff --git a/meta-openembedded/meta-oe/recipes-multimedia/jack/jack_1.19.21.bb b/meta-openembedded/meta-oe/recipes-multimedia/jack/jack_1.19.21.bb
index c949623..808b825 100644
--- a/meta-openembedded/meta-oe/recipes-multimedia/jack/jack_1.19.21.bb
+++ b/meta-openembedded/meta-oe/recipes-multimedia/jack/jack_1.19.21.bb
@@ -14,7 +14,9 @@
 
 DEPENDS = "libsamplerate0 libsndfile1 readline"
 
-SRC_URI = "git://github.com/jackaudio/jack2.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/jackaudio/jack2.git;branch=master;protocol=https \
+    file://0001-Remove-usage-of-U-mode-bit-for-opening-files-in-pyth.patch \
+"
 SRCREV = "6b3c96d8aeef8aeb4b20f3aa647e6d01b4000ff8"
 
 S = "${WORKDIR}/git"
diff --git a/meta-openembedded/meta-oe/recipes-support/dool/dool_1.0.0.bb b/meta-openembedded/meta-oe/recipes-support/dool/dool_1.1.0.bb
similarity index 94%
rename from meta-openembedded/meta-oe/recipes-support/dool/dool_1.0.0.bb
rename to meta-openembedded/meta-oe/recipes-support/dool/dool_1.1.0.bb
index d34397c..dcb66c7 100644
--- a/meta-openembedded/meta-oe/recipes-support/dool/dool_1.0.0.bb
+++ b/meta-openembedded/meta-oe/recipes-support/dool/dool_1.1.0.bb
@@ -13,7 +13,7 @@
 	   file://0001-Fix-build-error-as-following.patch \
           "
 
-SRCREV = "34a3244b46aa70a31f871a7ca8ffa8d3a7b950d2"
+SRCREV = "41ec7b392b358dae29f0b587711d5c8f7f462805"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.362.bb b/meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.363.bb
similarity index 91%
rename from meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.362.bb
rename to meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.363.bb
index e408c4d..ddfce3f 100644
--- a/meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.362.bb
+++ b/meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.363.bb
@@ -5,7 +5,7 @@
 LICENSE = "GPL-2.0-or-later | XFree86-1.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=1556547711e8246992b999edd9445a57"
 
-SRCREV = "8a3647e5da0a157cbf1bff1845b0cdaf1ce1bdb0"
+SRCREV = "75df73ae53e2bb878b5dc62036679efb69210222"
 SRC_URI = "git://github.com/vcrhonek/${BPN}.git;branch=master;protocol=https"
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/links/links_2.27.bb b/meta-openembedded/meta-oe/recipes-support/links/links_2.28.bb
similarity index 78%
rename from meta-openembedded/meta-oe/recipes-support/links/links_2.27.bb
rename to meta-openembedded/meta-oe/recipes-support/links/links_2.28.bb
index 4803353..a36393f 100644
--- a/meta-openembedded/meta-oe/recipes-support/links/links_2.27.bb
+++ b/meta-openembedded/meta-oe/recipes-support/links/links_2.28.bb
@@ -8,4 +8,4 @@
                 --without-libtiff --without-svgalib --with-fb \
                 --without-directfb --without-pmshell --without-atheos \
                 --without-x"
-SRC_URI[sha256sum] = "d8ddcbfcede7cdde80abeb0a236358f57fa6beb2bcf92e109624e9b896f9ebb4"
+SRC_URI[sha256sum] = "2fd5499b13dee59457c132c167b8495c40deda75389489c6cccb683193f454b4"
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv_4.6.0.bb b/meta-openembedded/meta-oe/recipes-support/opencv/opencv_4.6.0.bb
index f6c1005..da1e659 100644
--- a/meta-openembedded/meta-oe/recipes-support/opencv/opencv_4.6.0.bb
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv_4.6.0.bb
@@ -39,12 +39,12 @@
 
 SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
 SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=master;protocol=https \
-           git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib;branch=master;protocol=https \
-           git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=ipp;name=ipp;protocol=https \
-           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc;protocol=https \
-           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg;protocol=https \
-           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=face;name=face;protocol=https \
-           git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=wechat_qrcode;name=wechat-qrcode;protocol=https \
+           git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=master;protocol=https \
+           git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=git/ipp;name=ipp;protocol=https \
+           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=git/boostdesc;name=boostdesc;protocol=https \
+           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=git/vgg;name=vgg;protocol=https \
+           git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=git/face;name=face;protocol=https \
+           git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=git/wechat_qrcode;name=wechat-qrcode;protocol=https \
            file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
            file://0003-To-fix-errors-as-following.patch \
            file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
@@ -52,7 +52,7 @@
            file://download.patch \
            file://0001-Make-ts-module-external.patch \
            "
-SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=../contrib"
+SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=contrib"
 
 S = "${WORKDIR}/git"
 
@@ -61,7 +61,7 @@
 OPENCV_DLDIR = "${WORKDIR}/downloads"
 
 do_unpack_extra() {
-    tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
+    tar xzf ${S}/ipp/ippicv/${IPP_FILENAME} -C ${S}
 
     md5() {
         # Return the MD5 of $1
@@ -76,22 +76,22 @@
             test -e $DEST || ln -s $F $DEST
         done
     }
-    cache xfeatures2d/boostdesc ${WORKDIR}/boostdesc/*.i
-    cache xfeatures2d/vgg ${WORKDIR}/vgg/*.i
-    cache data ${WORKDIR}/face/*.dat
-    cache wechat_qrcode ${WORKDIR}/wechat_qrcode/*.caffemodel
-    cache wechat_qrcode ${WORKDIR}/wechat_qrcode/*.prototxt
+    cache xfeatures2d/boostdesc ${S}/boostdesc/*.i
+    cache xfeatures2d/vgg ${S}/vgg/*.i
+    cache data ${S}/face/*.dat
+    cache wechat_qrcode ${S}/wechat_qrcode/*.caffemodel
+    cache wechat_qrcode ${S}/wechat_qrcode/*.prototxt
 }
 addtask unpack_extra after do_unpack before do_patch
 
 CMAKE_VERBOSE = "VERBOSE=1"
 
-EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
+EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${S}/contrib/modules \
     -DWITH_1394=OFF \
     -DENABLE_PRECOMPILED_HEADERS=OFF \
     -DCMAKE_SKIP_RPATH=ON \
     -DOPENCV_ICV_HASH=${IPP_MD5} \
-    -DIPPROOT=${WORKDIR}/ippicv_lnx \
+    -DIPPROOT=${S}/ippicv_lnx \
     -DOPENCV_GENERATE_PKGCONFIG=ON \
     -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \
     -DOPENCV_ALLOW_DOWNLOADS=OFF \
diff --git a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch b/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch
deleted file mode 100644
index b42bd97..0000000
--- a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 9e4ccd1e78ceac8de1ab66ee62ee216f1fbd4956 Mon Sep 17 00:00:00 2001
-From: Yi Zhao <yi.zhao@windriver.com>
-Date: Thu, 2 Dec 2021 11:38:15 +0800
-Subject: [PATCH] ldif-filter: fix parallel build failure
-
-Add slapd-common.o as dependency for ldif-filter to fix the parallel
-build failure:
-  ld: cannot find slapd-common.o: No such file or directory
-
-Upstream-Status: Pending
-
-Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
----
- tests/progs/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/progs/Makefile.in b/tests/progs/Makefile.in
-index 13f1e8be2..e4f4ccf98 100644
---- a/tests/progs/Makefile.in
-+++ b/tests/progs/Makefile.in
-@@ -56,7 +56,7 @@ slapd-modify: slapd-modify.o $(OBJS) $(XLIBS)
- slapd-bind: slapd-bind.o $(OBJS) $(XLIBS)
- 	$(LTLINK) -o $@ slapd-bind.o $(OBJS) $(LIBS)
- 
--ldif-filter: ldif-filter.o $(XLIBS)
-+ldif-filter: ldif-filter.o $(OBJS) $(XLIBS)
- 	$(LTLINK) -o $@ ldif-filter.o $(OBJS) $(LIBS)
- 
- slapd-mtread: slapd-mtread.o $(OBJS) $(XLIBS)
--- 
-2.25.1
-
diff --git a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch b/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch
deleted file mode 100644
index 552726b..0000000
--- a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 690f69791eb6cd0d7e94b4d73219ee864de27f62 Mon Sep 17 00:00:00 2001
-From: Yi Zhao <yi.zhao@windriver.com>
-Date: Mon, 10 Jan 2022 10:13:51 +0800
-Subject: [PATCH] libraries/Makefile.in: ignore the mkdir errors
-
-Ignore the mkdir errors to fix the parallel build failure:
-
-../../build/shtool mkdir -p TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib
-mkdir: cannot create directory 'TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib': File exists
-
-Upstream-Status: Pending
-
-Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
----
- libraries/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libraries/Makefile.in b/libraries/Makefile.in
-index d9cb2ff..c6b251f 100644
---- a/libraries/Makefile.in
-+++ b/libraries/Makefile.in
-@@ -24,7 +24,7 @@ PKGCONFIG_DIR=$(DESTDIR)$(libdir)/pkgconfig
- PKGCONFIG_SRCDIRS=liblber libldap
- 
- install-local:
--	@$(MKDIR) $(PKGCONFIG_DIR)
-+	@-$(MKDIR) $(PKGCONFIG_DIR)
- 	@for i in $(PKGCONFIG_SRCDIRS); do \
- 	    $(INSTALL_DATA) $$i/*.pc $(PKGCONFIG_DIR); \
- 	done
--- 
-2.17.1
-
diff --git a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch b/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
deleted file mode 100644
index bcd1525..0000000
--- a/meta-openembedded/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 7 Feb 2022 16:26:57 -0800
-Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining
- calloc
-
-This helps compiling with musl, where sched.h is included by
-ldap_pvt_thread.h which provides prototype for calloc() and conflicts
-
-/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc'
-| void *calloc(size_t, size_t);
-|       ^1
-|  warning and 1 error generated.
-| ./rewrite-int.h:44:21: note: expanded from macro 'calloc'
-| #define calloc(x,y)     ber_memcalloc(x,y)
-|                         ^
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- libraries/librewrite/rewrite-int.h | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h
-index 4481dd3..5ec226d 100644
---- a/libraries/librewrite/rewrite-int.h
-+++ b/libraries/librewrite/rewrite-int.h
-@@ -40,6 +40,11 @@
- 
- #include <rewrite.h>
- 
-+#ifndef NO_THREADS
-+#define USE_REWRITE_LDAP_PVT_THREADS
-+#include <ldap_pvt_thread.h>
-+#endif
-+
- #define malloc(x)	ber_memalloc(x)
- #define calloc(x,y)	ber_memcalloc(x,y)
- #define realloc(x,y)	ber_memrealloc(x,y)
-@@ -47,11 +52,6 @@
- #undef strdup
- #define	strdup(x)	ber_strdup(x)
- 
--#ifndef NO_THREADS
--#define USE_REWRITE_LDAP_PVT_THREADS
--#include <ldap_pvt_thread.h>
--#endif
--
- /*
-  * For details, see RATIONALE.
-  */
--- 
-2.35.1
-
diff --git a/meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.12.bb b/meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.13.bb
similarity index 96%
rename from meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.12.bb
rename to meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.13.bb
index a8ea84d..b117677 100644
--- a/meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.12.bb
+++ b/meta-openembedded/meta-oe/recipes-support/openldap/openldap_2.5.13.bb
@@ -18,14 +18,11 @@
     file://initscript \
     file://slapd.service \
     file://remove-user-host-pwd-from-version.patch \
-    file://0001-ldif-filter-fix-parallel-build-failure.patch \
     file://0001-build-top.mk-unset-STRIP_OPTS.patch \
-    file://0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch \
-    file://0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch \
     file://0001-configure-Pass-pthread_t-to-pthread_detach.patch \
 "
 
-SRC_URI[sha256sum] = "d5086cbfc49597fa7d0670a429a9054552d441b16ee8b2435412797ab0e37b96"
+SRC_URI[sha256sum] = "ee3c430c4ef7b87c57b622108c7339376d6c27fbbf2767770be3de1df63d008c"
 
 DEPENDS = "util-linux groff-native"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.09.0.bb b/meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.10.0.bb
similarity index 95%
rename from meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.09.0.bb
rename to meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.10.0.bb
index 2cae897..0a15088 100644
--- a/meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.09.0.bb
+++ b/meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.10.0.bb
@@ -7,7 +7,7 @@
            file://0001-Do-not-overwrite-all-our-build-flags.patch \
            file://basename-include.patch \
            "
-SRC_URI[sha256sum] = "d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb30d5852a41e2e"
+SRC_URI[sha256sum] = "04e40fad924a6de62e63017a6fd4c04696c1f526dedc2ba5ef275cedf646292a"
 
 DEPENDS = "fontconfig zlib cairo lcms glib-2.0"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/re2/re2_2020.11.01.bb b/meta-openembedded/meta-oe/recipes-support/re2/re2_2020.11.01.bb
index 698fe7e..5ec1c6b 100644
--- a/meta-openembedded/meta-oe/recipes-support/re2/re2_2020.11.01.bb
+++ b/meta-openembedded/meta-oe/recipes-support/re2/re2_2020.11.01.bb
@@ -5,7 +5,7 @@
 
 SRCREV = "166dbbeb3b0ab7e733b278e8f42a84f6882b8a25"
 
-SRC_URI = "git://github.com/google/re2.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/google/re2.git;branch=main;protocol=https"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/spitools/spitools_git.bb b/meta-openembedded/meta-oe/recipes-support/spitools/spitools_git.bb
index 9dfb23c..c190d7e 100644
--- a/meta-openembedded/meta-oe/recipes-support/spitools/spitools_git.bb
+++ b/meta-openembedded/meta-oe/recipes-support/spitools/spitools_git.bb
@@ -4,7 +4,6 @@
 LICENSE="GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=8c16666ae6c159876a0ba63099614381"
 
-BPV = "1.0.0"
 PV = "1.0.2"
 SRCREV = "1748e092425a4a0ff693aa347062a57fc1ffdd00"
 
diff --git a/meta-openembedded/meta-oe/recipes-support/tio/tio_2.0.bb b/meta-openembedded/meta-oe/recipes-support/tio/tio_2.0.bb
index 3cc5100..54e448b 100644
--- a/meta-openembedded/meta-oe/recipes-support/tio/tio_2.0.bb
+++ b/meta-openembedded/meta-oe/recipes-support/tio/tio_2.0.bb
@@ -3,7 +3,7 @@
     straightforward command-line and configuration file interface to easily \
     connect to serial TTY devices for basic I/O operations."
 
-LICENSE = "GPL-2.0-only"
+LICENSE = "GPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=0e1a95b7892d3015ecd6d0016f601f2c"
 
 SRC_URI = "git://github.com/tio/tio;protocol=https;nobranch=1"
diff --git a/meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.34.bb b/meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.35.bb
similarity index 94%
rename from meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.34.bb
rename to meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.35.bb
index 69afe6e..5df586d 100644
--- a/meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.34.bb
+++ b/meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.35.bb
@@ -9,7 +9,7 @@
 
 SRC_URI = "http://search.cpan.org/CPAN/authors/id/N/NL/NLNETLABS/Net-DNS-${PV}.tar.gz"
 
-SRC_URI[sha256sum] = "de756e3fb6addbd32beafc869c4dd1c6a0b3783c5ef56dbefc6809443a4b1d15"
+SRC_URI[sha256sum] = "f1a1478e4acbdb6b96de63070b35050dec9b9fce6c95bb2215bfc64a2d98e167"
 
 UPSTREAM_CHECK_REGEX = "Net\-DNS\-(?P<pver>(\d+\.\d+))(?!_\d+).tar"
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.2.bb b/meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.3.0.bb
similarity index 62%
rename from meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.2.bb
rename to meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.3.0.bb
index 45deb09..4daaf52 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.2.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python-jsonref/python3-jsonref_0.3.0.bb
@@ -3,9 +3,14 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=a34264f25338d41744dca1abfe4eb18f"
 
-SRC_URI[md5sum] = "42b518b9ccd6852d1d709749bc96cb70"
-SRC_URI[sha256sum] = "f3c45b121cf6257eafabdc3a8008763aed1cd7da06dbabc59a9e4d2a5e4e6697"
+SRC_URI[sha256sum] = "68b330c6815dc0d490dbb3d65ccda265ddde9f7856fd2f3322f971d456ea7549"
 
 inherit pypi setuptools3
 
 BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS:${PN} += " \
+	${PYTHON_PN}-core \
+	${PYTHON_PN}-json \
+	${PYTHON_PN}-netclient \
+"
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.10.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.11.bb
similarity index 89%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.10.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.11.bb
index c1d746b..b9dc580 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.10.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.11.bb
@@ -4,7 +4,7 @@
 LICENSE = "LGPL-2.1-only"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=a70cf540abf41acb644ac3b621b2fad1"
 
-SRC_URI[sha256sum] = "81f870105d892e73bf535da77a8261aa5bde838fa4ed12bb2f435291a098c581"
+SRC_URI[sha256sum] = "2df4f9980c4511474687895cbfdb8558293c1a826d9118bb09233d7c2bff1c83"
 
 inherit pypi setuptools3
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-cchardet_2.1.7.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-cchardet_2.1.7.bb
index d6d9696..3d9194c 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-cchardet_2.1.7.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-cchardet_2.1.7.bb
@@ -8,3 +8,5 @@
 inherit pypi setuptools3
 
 BBCLASSEXTEND = "native nativesdk"
+
+DEPENDS += "python3-cython-native"
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.4.4.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.5.0.bb
similarity index 82%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.4.4.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.5.0.bb
index 5bff969..dfa374d 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.4.4.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.5.0.bb
@@ -3,7 +3,7 @@
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2ee41112a44fe7014dce33e26468ba93"
 
-SRC_URI[sha256sum] = "e16c45b726acb780e1e6f88b286d3c10b3914ab03438f32117c4aa52d7f30d58"
+SRC_URI[sha256sum] = "f642e90754ee3e06b0e7e51bce3379590e76b7f76b708e1a71ff043f87025c84"
 
 inherit pypi setuptools3
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent/0001-_setuputils.py-Do-not-add-sys_inc_dir.patch b/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent/0001-_setuputils.py-Do-not-add-sys_inc_dir.patch
new file mode 100644
index 0000000..ac8b031
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent/0001-_setuputils.py-Do-not-add-sys_inc_dir.patch
@@ -0,0 +1,40 @@
+From f3267ad7994a4b66e6bcf72cb0e418105f77bd52 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 11 Oct 2022 17:37:01 -0700
+Subject: [PATCH] _setuputils.py: Do not add sys_inc_dir
+
+sys_inc_dir computes to ignore sysroot and ends with paths into host
+system include area, which is then flagged by OE gcc since it finds
+the host include path poisoning. Since we are adding the syroot anyway
+we really do not need setuptools to deduce it for us.
+
+Upstream-Status: Inappropriate [ Cross-compile specific ]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ _setuputils.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/_setuputils.py b/_setuputils.py
+index d98f716..31134a4 100644
+--- a/_setuputils.py
++++ b/_setuputils.py
+@@ -161,7 +161,6 @@ def get_include_dirs(*extra_paths):
+     # Neither sysconfig dir is not enough if we're in a virtualenv; the greenlet.h
+     # header goes into a site/ subdir. See https://github.com/pypa/pip/issues/4610
+     dist_inc_dir = os.path.abspath(dist_sysconfig.get_python_inc()) # 1
+-    sys_inc_dir = os.path.abspath(sysconfig.get_path("include")) # 2
+     venv_include_dir = os.path.join(
+         sys.prefix, 'include', 'site',
+         'python' + sysconfig.get_python_version()
+@@ -175,7 +174,7 @@ def get_include_dirs(*extra_paths):
+ 
+     return [
+         p
+-        for p in (dist_inc_dir, sys_inc_dir, dep_inc_dir) + extra_paths
++        for p in (dist_inc_dir, dep_inc_dir) + extra_paths
+         if os.path.exists(p)
+     ]
+ 
+-- 
+2.38.0
+
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_21.12.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_21.12.0.bb
deleted file mode 100644
index 5cbb326..0000000
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_21.12.0.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-SUMMARY = "A coroutine-based Python networking library"
-DESCRIPTION = "gevent is a coroutine-based Python networking library that uses greenlet to provide \
-a high-level synchronous API on top of the libevent event loop."
-HOMEPAGE = "http://www.gevent.org"
-LICENSE = "MIT & Python-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=4de99aac27b470c29c6c309e0c279b65"
-DEPENDS += "${PYTHON_PN}-greenlet libev libuv c-ares"
-
-RDEPENDS:${PN} = "${PYTHON_PN}-greenlet \
-		  ${PYTHON_PN}-mime \
-		  ${PYTHON_PN}-pprint \
-		 "
-
-SRC_URI[sha256sum] = "f48b64578c367b91fa793bf8eaaaf4995cb93c8bc45860e473bf868070ad094e"
-
-inherit pypi setuptools3
-
-# Don't embed libraries, link to the system provided libs instead
-export GEVENTSETUP_EMBED_CARES = "0"
-export GEVENTSETUP_EMBED_LIBEV = "0"
-export GEVENTSETUP_EMBED_LIBUV = "0"
-
-# Delete the embedded copies of libraries so we can't accidentally link to them
-do_configure:append() {
-	rm -rf ${S}/deps
-}
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_22.8.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_22.8.0.bb
new file mode 100644
index 0000000..96a0cb7
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-gevent_22.8.0.bb
@@ -0,0 +1,35 @@
+SUMMARY = "A coroutine-based Python networking library"
+DESCRIPTION = "gevent is a coroutine-based Python networking library that uses greenlet to provide \
+a high-level synchronous API on top of the libevent event loop."
+HOMEPAGE = "http://www.gevent.org"
+LICENSE = "MIT & Python-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4de99aac27b470c29c6c309e0c279b65"
+DEPENDS += "${PYTHON_PN}-greenlet libev libuv c-ares python3-cython-native"
+
+RDEPENDS:${PN} = "${PYTHON_PN}-greenlet \
+		  ${PYTHON_PN}-mime \
+		  ${PYTHON_PN}-pprint \
+		 "
+
+SRC_URI += "file://0001-_setuputils.py-Do-not-add-sys_inc_dir.patch"
+
+SRC_URI[sha256sum] = "868d500fe2b7f9750eadc07ada8ab32360c0e71976be2bf5919482f14a6477c7"
+
+inherit pypi setuptools3
+
+# Don't embed libraries, link to the system provided libs instead
+export GEVENTSETUP_EMBED_CARES = "0"
+export GEVENTSETUP_EMBED_LIBEV = "0"
+export GEVENTSETUP_EMBED_LIBUV = "0"
+
+do_configure:append() {
+	# Delete the embedded copies of libraries so we can't accidentally link to them
+	rm -rf ${S}/deps
+
+	# Delete the generated cython files, as they are all out of date with python 3.11
+	rm -rf ${S}/src/gevent/*.c
+}
+
+do_compile:append() {
+        sed -i -e 's#${WORKDIR}##g' ${S}/src/gevent/*.c ${S}/src/gevent/libev/*.c ${S}/src/gevent/resolver/*.c
+}
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.post0.bb
similarity index 78%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.post0.bb
index 5175212..342227c 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_1.1.3.post0.bb
@@ -4,6 +4,6 @@
 LIC_FILES_CHKSUM = "file://LICENSE;md5=e95668d68e4329085c7ab3535e6a7aee \
                     file://LICENSE.PSF;md5=c106931d9429eda0492617f037b8f69a"
 
-SRC_URI[sha256sum] = "bcb6c6dd1d6be6d38d6db283747d07fda089ff8c559a835236560a4410340455"
+SRC_URI[sha256sum] = "f5e09dc5c6e1796969fd4b775ea1417d70e49a5df29aaa8e5d10675d9e11872c"
 
 inherit pypi setuptools3
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.1.bb
similarity index 81%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.0.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.1.bb
index 6bc7b60..9e187bb 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.0.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.1.bb
@@ -5,7 +5,7 @@
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=24cb9a367a9e641b459a01c4d15256ba"
 
-SRC_URI[sha256sum] = "a332d127ec387b2d3dca967fd065a90f1c1a4ba2343570b03fe2cebb6ed064ea"
+SRC_URI[sha256sum] = "465ec35f919d538906d3023b61ccec766d8e7575fe55fcbd7669ece55afb97ca"
 
 inherit pypi setuptools3
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.6.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.7.bb
similarity index 88%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.6.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.7.bb
index 3eebfcf..2212c27 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.6.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.7.bb
@@ -3,7 +3,7 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=44614b6df7cf3c19be69d0a945e29904"
 
-SRC_URI[sha256sum] = "bd2b7730300860cbd2dafe8e5af89ff5c9a65c3975b352799d87a6238b4301a6"
+SRC_URI[sha256sum] = "815383fd52ece0a7024b5fd8408cc13a389ea350cd912178b82eed8b96f82cd3"
 
 inherit pypi setuptools3
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.6.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.7.bb
similarity index 91%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.6.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.7.bb
index 96b3d02..24ce61c 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.6.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.7.bb
@@ -7,7 +7,7 @@
 
 inherit pypi setuptools3
 
-SRC_URI[sha256sum] = "6b1040a5661cd5f6e610cbca9cfaa2a17d60e2bb545309bc1b278bb05be44bdd"
+SRC_URI[sha256sum] = "71d9dba03ed3432c878a801e2ea51e034b0ea01cf3a4344fb60166cb5f6c8757"
 
 # http://errors.yoctoproject.org/Errors/Details/184715/
 # Can't find required file: ../src/google/protobuf/descriptor.proto
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch
new file mode 100644
index 0000000..af4869f
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez/py-3.11.patch
@@ -0,0 +1,454 @@
+From f83d38687fec2239c517037453ed4a2191279796 Mon Sep 17 00:00:00 2001
+From: Victor Stinner <vstinner@python.org>
+Date: Fri, 28 Jan 2022 00:14:04 +0100
+Subject: [PATCH] Port to Python 3.11 (#410)
+
+* Replace "arg == Py_None" with Py_IsNone(arg)
+* Replace arg->ob_type with Py_TYPE(arg)
+* Replace "Py_TYPE(obj) = type" with Py_SET_TYPE(obj, type).
+* Copy pythoncapi_compat.h from:
+  https://github.com/pythoncapi/pythoncapi_compat
+* pythoncapi_compat.h provides Py_SET_TYPE() and Py_IsNone() to old
+  Python versions.
+
+Upstream-Status: Backport [https://github.com/pybluez/pybluez/commit/5096047f90a1f6a74ceb250aef6243e144170f92]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ bluez/btmodule.c          |  14 +-
+ bluez/pythoncapi_compat.h | 364 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 372 insertions(+), 6 deletions(-)
+ create mode 100644 bluez/pythoncapi_compat.h
+
+diff --git a/bluez/btmodule.c b/bluez/btmodule.c
+index 912a489..b61f74a 100644
+--- a/bluez/btmodule.c
++++ b/bluez/btmodule.c
+@@ -21,6 +21,8 @@ Local naming conventions:
+ #include "btmodule.h"
+ #include "structmember.h"
+ 
++#include "pythoncapi_compat.h"
++
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -678,7 +680,7 @@ sock_settimeout(PySocketSockObject *s, PyObject *arg)
+ {
+ 	double timeout;
+ 
+-	if (arg == Py_None)
++	if (Py_IsNone(arg))
+ 		timeout = -1.0;
+ 	else {
+ 		timeout = PyFloat_AsDouble(arg);
+@@ -1752,7 +1754,7 @@ bt_btohl(PyObject *self, PyObject *args)
+ 	else
+ 		return PyErr_Format(PyExc_TypeError,
+ 				    "expected int/long, %s found",
+-				    arg->ob_type->tp_name);
++				    Py_TYPE(arg)->tp_name);
+ 	if (x == (unsigned long) -1 && PyErr_Occurred())
+ 		return NULL;
+ 	return PyInt_FromLong(btohl(x));
+@@ -1816,7 +1818,7 @@ bt_htobl(PyObject *self, PyObject *args)
+ 	else
+ 		return PyErr_Format(PyExc_TypeError,
+ 				    "expected int/long, %s found",
+-				    arg->ob_type->tp_name);
++				    Py_TYPE(arg)->tp_name);
+ 	return PyInt_FromLong(htobl(x));
+ }
+ 
+@@ -1889,7 +1891,7 @@ bt_setdefaulttimeout(PyObject *self, PyObject *arg)
+ {
+ 	double timeout;
+ 
+-	if (arg == Py_None)
++	if (Py_IsNone(arg))
+ 		timeout = -1.0;
+ 	else {
+ 		timeout = PyFloat_AsDouble(arg);
+@@ -2980,8 +2982,8 @@ PyMODINIT_FUNC
+ init_bluetooth(void)
+ #endif
+ {
+-    Py_TYPE(&sock_type) = &PyType_Type;
+-    Py_TYPE(&sdp_session_type) = &PyType_Type;
++    Py_SET_TYPE(&sock_type, &PyType_Type);
++    Py_SET_TYPE(&sdp_session_type, &PyType_Type);
+ #if PY_MAJOR_VERSION >= 3
+     PyObject *m = PyModule_Create(&moduledef);
+ #else
+diff --git a/bluez/pythoncapi_compat.h b/bluez/pythoncapi_compat.h
+new file mode 100644
+index 0000000..e660b61
+--- /dev/null
++++ b/bluez/pythoncapi_compat.h
+@@ -0,0 +1,364 @@
++// Header file providing new functions of the Python C API to old Python
++// versions.
++//
++// File distributed under the MIT license.
++// Copyright Contributors to the pythoncapi_compat project.
++//
++// Homepage:
++// https://github.com/pythoncapi/pythoncapi_compat
++//
++// Latest version:
++// https://raw.githubusercontent.com/pythoncapi/pythoncapi_compat/master/pythoncapi_compat.h
++//
++// SPDX-License-Identifier: MIT
++
++#ifndef PYTHONCAPI_COMPAT
++#define PYTHONCAPI_COMPAT
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#include <Python.h>
++#include "frameobject.h"          // PyFrameObject, PyFrame_GetBack()
++
++
++// Compatibility with Visual Studio 2013 and older which don't support
++// the inline keyword in C (only in C++): use __inline instead.
++#if (defined(_MSC_VER) && _MSC_VER < 1900 \
++     && !defined(__cplusplus) && !defined(inline))
++#  define inline __inline
++#  define PYTHONCAPI_COMPAT_MSC_INLINE
++   // These two macros are undefined at the end of this file
++#endif
++
++
++// Cast argument to PyObject* type.
++#ifndef _PyObject_CAST
++#  define _PyObject_CAST(op) ((PyObject*)(op))
++#endif
++#ifndef _PyObject_CAST_CONST
++#  define _PyObject_CAST_CONST(op) ((const PyObject*)(op))
++#endif
++
++
++// bpo-42262 added Py_NewRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_NewRef)
++static inline PyObject* _Py_NewRef(PyObject *obj)
++{
++    Py_INCREF(obj);
++    return obj;
++}
++#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj))
++#endif
++
++
++// bpo-42262 added Py_XNewRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_XNewRef)
++static inline PyObject* _Py_XNewRef(PyObject *obj)
++{
++    Py_XINCREF(obj);
++    return obj;
++}
++#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj))
++#endif
++
++
++// See https://bugs.python.org/issue42522
++#if !defined(_Py_StealRef)
++static inline PyObject* __Py_StealRef(PyObject *obj)
++{
++    Py_DECREF(obj);
++    return obj;
++}
++#define _Py_StealRef(obj) __Py_StealRef(_PyObject_CAST(obj))
++#endif
++
++
++// See https://bugs.python.org/issue42522
++#if !defined(_Py_XStealRef)
++static inline PyObject* __Py_XStealRef(PyObject *obj)
++{
++    Py_XDECREF(obj);
++    return obj;
++}
++#define _Py_XStealRef(obj) __Py_XStealRef(_PyObject_CAST(obj))
++#endif
++
++
++// bpo-39573 added Py_SET_REFCNT() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_REFCNT)
++static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt)
++{
++    ob->ob_refcnt = refcnt;
++}
++#define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt)
++#endif
++
++
++// Py_SETREF() and Py_XSETREF() were added to Python 3.5.2.
++// It is excluded from the limited C API.
++#if (PY_VERSION_HEX < 0x03050200 && !defined(Py_SETREF)) && !defined(Py_LIMITED_API)
++#define Py_SETREF(op, op2)                      \
++    do {                                        \
++        PyObject *_py_tmp = _PyObject_CAST(op); \
++        (op) = (op2);                           \
++        Py_DECREF(_py_tmp);                     \
++    } while (0)
++
++#define Py_XSETREF(op, op2)                     \
++    do {                                        \
++        PyObject *_py_tmp = _PyObject_CAST(op); \
++        (op) = (op2);                           \
++        Py_XDECREF(_py_tmp);                    \
++    } while (0)
++#endif
++
++
++// bpo-43753 added Py_Is(), Py_IsNone(), Py_IsTrue() and Py_IsFalse()
++// to Python 3.10.0b1.
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_Is)
++#  define Py_Is(x, y) ((x) == (y))
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsNone)
++#  define Py_IsNone(x) Py_Is(x, Py_None)
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsTrue)
++#  define Py_IsTrue(x) Py_Is(x, Py_True)
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsFalse)
++#  define Py_IsFalse(x) Py_Is(x, Py_False)
++#endif
++
++
++// bpo-39573 added Py_SET_TYPE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
++static inline void
++_Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
++{
++    ob->ob_type = type;
++}
++#define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type)
++#endif
++
++
++// bpo-39573 added Py_SET_SIZE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
++static inline void
++_Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
++{
++    ob->ob_size = size;
++}
++#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
++#endif
++
++
++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1
++static inline PyCodeObject*
++PyFrame_GetCode(PyFrameObject *frame)
++{
++    assert(frame != NULL);
++    assert(frame->f_code != NULL);
++    return (PyCodeObject*)Py_NewRef(frame->f_code);
++}
++#endif
++
++static inline PyCodeObject*
++_PyFrame_GetCodeBorrow(PyFrameObject *frame)
++{
++    return (PyCodeObject *)_Py_StealRef(PyFrame_GetCode(frame));
++}
++
++
++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
++static inline PyFrameObject*
++PyFrame_GetBack(PyFrameObject *frame)
++{
++    assert(frame != NULL);
++    return (PyFrameObject*)Py_XNewRef(frame->f_back);
++}
++#endif
++
++#if !defined(PYPY_VERSION)
++static inline PyFrameObject*
++_PyFrame_GetBackBorrow(PyFrameObject *frame)
++{
++    return (PyFrameObject *)_Py_XStealRef(PyFrame_GetBack(frame));
++}
++#endif
++
++
++// bpo-39947 added PyThreadState_GetInterpreter() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline PyInterpreterState *
++PyThreadState_GetInterpreter(PyThreadState *tstate)
++{
++    assert(tstate != NULL);
++    return tstate->interp;
++}
++#endif
++
++
++// bpo-40429 added PyThreadState_GetFrame() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
++static inline PyFrameObject*
++PyThreadState_GetFrame(PyThreadState *tstate)
++{
++    assert(tstate != NULL);
++    return (PyFrameObject *)Py_XNewRef(tstate->frame);
++}
++#endif
++
++#if !defined(PYPY_VERSION)
++static inline PyFrameObject*
++_PyThreadState_GetFrameBorrow(PyThreadState *tstate)
++{
++    return (PyFrameObject *)_Py_XStealRef(PyThreadState_GetFrame(tstate));
++}
++#endif
++
++
++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline PyInterpreterState *
++PyInterpreterState_Get(void)
++{
++    PyThreadState *tstate;
++    PyInterpreterState *interp;
++
++    tstate = PyThreadState_GET();
++    if (tstate == NULL) {
++        Py_FatalError("GIL released (tstate is NULL)");
++    }
++    interp = tstate->interp;
++    if (interp == NULL) {
++        Py_FatalError("no current interpreter");
++    }
++    return interp;
++}
++#endif
++
++
++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a6
++#if 0x030700A1 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION)
++static inline uint64_t
++PyThreadState_GetID(PyThreadState *tstate)
++{
++    assert(tstate != NULL);
++    return tstate->id;
++}
++#endif
++
++
++// bpo-37194 added PyObject_CallNoArgs() to Python 3.9.0a1
++#if PY_VERSION_HEX < 0x030900A1
++static inline PyObject*
++PyObject_CallNoArgs(PyObject *func)
++{
++    return PyObject_CallFunctionObjArgs(func, NULL);
++}
++#endif
++
++
++// bpo-39245 made PyObject_CallOneArg() public (previously called
++// _PyObject_CallOneArg) in Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4
++static inline PyObject*
++PyObject_CallOneArg(PyObject *func, PyObject *arg)
++{
++    return PyObject_CallFunctionObjArgs(func, arg, NULL);
++}
++#endif
++
++
++// bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3
++static inline int
++PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value)
++{
++    Py_XINCREF(value);
++    int res = PyModule_AddObject(module, name, value);
++    if (res < 0) {
++        Py_XDECREF(value);
++    }
++    return res;
++}
++#endif
++
++
++// bpo-40024 added PyModule_AddType() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline int
++PyModule_AddType(PyObject *module, PyTypeObject *type)
++{
++    const char *name, *dot;
++
++    if (PyType_Ready(type) < 0) {
++        return -1;
++    }
++
++    // inline _PyType_Name()
++    name = type->tp_name;
++    assert(name != NULL);
++    dot = strrchr(name, '.');
++    if (dot != NULL) {
++        name = dot + 1;
++    }
++
++    return PyModule_AddObjectRef(module, name, (PyObject *)type);
++}
++#endif
++
++
++// bpo-40241 added PyObject_GC_IsTracked() to Python 3.9.0a6.
++// bpo-4688 added _PyObject_GC_IS_TRACKED() to Python 2.7.0a2.
++#if PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION)
++static inline int
++PyObject_GC_IsTracked(PyObject* obj)
++{
++    return (PyObject_IS_GC(obj) && _PyObject_GC_IS_TRACKED(obj));
++}
++#endif
++
++// bpo-40241 added PyObject_GC_IsFinalized() to Python 3.9.0a6.
++// bpo-18112 added _PyGCHead_FINALIZED() to Python 3.4.0 final.
++#if PY_VERSION_HEX < 0x030900A6 && PY_VERSION_HEX >= 0x030400F0 && !defined(PYPY_VERSION)
++static inline int
++PyObject_GC_IsFinalized(PyObject *obj)
++{
++    return (PyObject_IS_GC(obj) && _PyGCHead_FINALIZED((PyGC_Head *)(obj)-1));
++}
++#endif
++
++
++// bpo-39573 added Py_IS_TYPE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_IS_TYPE)
++static inline int
++_Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
++    return ob->ob_type == type;
++}
++#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
++#endif
++
++
++// Py_UNUSED() was added to Python 3.4.0b2.
++#if PY_VERSION_HEX < 0x030400B2 && !defined(Py_UNUSED)
++#  if defined(__GNUC__) || defined(__clang__)
++#    define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
++#  else
++#    define Py_UNUSED(name) _unused_ ## name
++#  endif
++#endif
++
++
++#ifdef PYTHONCAPI_COMPAT_MSC_INLINE
++#  undef inline
++#  undef PYTHONCAPI_COMPAT_MSC_INLINE
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++#endif  // PYTHONCAPI_COMPAT
+-- 
+2.30.2
+
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez_0.23.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez_0.23.bb
index 6a1df27..2196428 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez_0.23.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-pybluez_0.23.bb
@@ -7,7 +7,8 @@
 LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=8a71d0475d08eee76d8b6d0c6dbec543"
 
-SRC_URI += "file://0001-Use-Py_ssize_t-when-parsing-buffer-length-fix-426-42.patch"
+SRC_URI += "file://0001-Use-Py_ssize_t-when-parsing-buffer-length-fix-426-42.patch \
+            file://py-3.11.patch "
 SRC_URI[md5sum] = "afbe8429bb82d2c46a3d0f5f4f898f9d"
 SRC_URI[sha256sum] = "c8f04d2e78951eaa9de486b4d49381704e8943d0a6e6e58f55fcd7b8582e90de"
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.1.1.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.1.1.bb
deleted file mode 100644
index 27f65dc..0000000
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.1.1.bb
+++ /dev/null
@@ -1,17 +0,0 @@
-SUMMARY = "RDFLib is a pure Python package for working with RDF"
-LICENSE = "BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=b6cde159c801514e0e45a40cf0a9d3d9"
-
-SRC_URI[sha256sum] = "8dbfa0af2990b98471dacbc936d6494c997ede92fd8ed693fb84ee700ef6f754"
-
-inherit pypi setuptools3
-
-RDEPENDS:${PN} += " \
-    ${PYTHON_PN}-isodate \
-    ${PYTHON_PN}-pyparsing \
-    ${PYTHON_PN}-logging \
-    ${PYTHON_PN}-numbers \
-    ${PYTHON_PN}-xml \
-"
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.2.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.2.0.bb
new file mode 100644
index 0000000..282d407
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-rdflib_6.2.0.bb
@@ -0,0 +1,19 @@
+SUMMARY = "RDFLib is a pure Python package for working with RDF"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=bcae79bd3c84b857f42a98a7ccf6ad47"
+
+SRC_URI[sha256sum] = "62dc3c86d1712db0f55785baf8047f63731fa59b2682be03219cb89262065942"
+
+inherit pypi setuptools3
+
+RDEPENDS:${PN} += " \
+    ${PYTHON_PN}-isodate \
+    ${PYTHON_PN}-pyparsing \
+    ${PYTHON_PN}-logging \
+    ${PYTHON_PN}-numbers \
+    ${PYTHON_PN}-xml \
+    ${PYTHON_PN}-compression \
+    ${PYTHON_PN}-core \
+"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.9.1.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.10.0.bb
similarity index 77%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.9.1.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.10.0.bb
index 366f41c..77b99a7 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.9.1.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-requests-toolbelt_0.10.0.bb
@@ -3,13 +3,12 @@
 AUTHOR = "Ian Cordasco, Cory Benfield"
 
 LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=71760e0f1dda8cff91b0bc9246caf571"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6f14302a4b4099009ab38b4dde5f1075"
 
 SRC_URI = "file://run-ptest \
           "
 
-SRC_URI[md5sum] = "b1509735c4b4cf95df2619facbc3672e"
-SRC_URI[sha256sum] = "968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"
+SRC_URI[sha256sum] = "f695d6207931200b46c8ef6addbc8a921fb5d77cc4cd209c2e7d39293fcd2b30"
 
 inherit pypi setuptools3 ptest
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.5.12.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.5.12.bb
deleted file mode 100644
index 36e48f9..0000000
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.5.12.bb
+++ /dev/null
@@ -1,14 +0,0 @@
-SUMMARY = "The new Python SDK for Sentry.io"
-DESCRIPTION = "This is the next line of the Python SDK \
-for Sentry, intended to replace the raven package on PyPI."
-HOMEPAGE = "https://github.com/getsentry/sentry-python"
-LICENSE = "BSD-2-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=0c79f8d3c91fc847350efd28bfe0a341"
-
-RDEPENDS:${PN} += "python3-urllib3"
-
-SRC_URI[sha256sum] = "259535ba66933eacf85ab46524188c84dcb4c39f40348455ce15e2c0aca68863"
-
-PYPI_PACKAGE = "sentry-sdk"
-
-inherit pypi setuptools3
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.9.10.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.9.10.bb
new file mode 100644
index 0000000..c09a01b
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.9.10.bb
@@ -0,0 +1,22 @@
+SUMMARY = "The new Python SDK for Sentry.io"
+DESCRIPTION = "This is the next line of the Python SDK \
+for Sentry, intended to replace the raven package on PyPI."
+HOMEPAGE = "https://github.com/getsentry/sentry-python"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=0c79f8d3c91fc847350efd28bfe0a341"
+
+RDEPENDS:${PN} += "\
+	${PYTHON_PN}-urllib3 \
+	${PYTHON_PN}-core \
+	${PYTHON_PN}-json \
+	${PYTHON_PN}-logging \
+	${PYTHON_PN}-threading \
+	${PYTHON_PN}-compression \
+	${PYTHON_PN}-datetime \
+"
+
+SRC_URI[sha256sum] = "4fbace9a763285b608c06f01a807b51acb35f6059da6a01236654e08b0ee81ff"
+
+PYPI_PACKAGE = "sentry-sdk"
+
+inherit pypi setuptools3
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.8.10.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.8.10.bb
deleted file mode 100644
index 222e6e7..0000000
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.8.10.bb
+++ /dev/null
@@ -1,8 +0,0 @@
-SUMMARY = "Pretty-print tabular data"
-HOMEPAGE = "https://github.com/astanin/python-tabulate"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=6ad1430c0c4824ec6a5dbb9754b011d7"
-
-SRC_URI[sha256sum] = "6c57f3f3dd7ac2782770155f3adb2db0b1a269637e42f27599925e64b114f519"
-
-inherit pypi setuptools3
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.9.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.9.0.bb
new file mode 100644
index 0000000..a25a1c6
--- /dev/null
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-tabulate_0.9.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Pretty-print tabular data"
+HOMEPAGE = "https://github.com/astanin/python-tabulate"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6ad1430c0c4824ec6a5dbb9754b011d7"
+
+SRC_URI[sha256sum] = "0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"
+
+inherit pypi python_setuptools_build_meta
+
+DEPENDS += " \
+	${PYTHON_PN}-setuptools-scm-native \
+	${PYTHON_PN}-toml-native \
+"
+
+RDEPENDS:${PN} += " \
+	${PYTHON_PN}-html \
+	${PYTHON_PN}-core \
+	${PYTHON_PN}-io \
+	${PYTHON_PN}-math \
+	${PYTHON_PN}-profile \
+"
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.1.bb
similarity index 83%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.0.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.1.bb
index 435eb1d..587d34f 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.0.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.1.bb
@@ -4,7 +4,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=1dc2732bdc5e50382737979791cbb3b7"
 
-SRC_URI[sha256sum] = "ef0ad5c62958fe18202bacfa1f216a57d97a8abdecc68f87946c02b38aaab34e"
+SRC_URI[sha256sum] = "74732fbd4b2e2baff9d0ac61f268b3e7b25b09ca6572d619390a9d782c2289f2"
 
 inherit pypi setuptools3
 
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.1.bb
similarity index 84%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.0.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.1.bb
index d7988b8..ff7e969 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.0.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-xmlschema_2.1.1.bb
@@ -3,7 +3,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=0ab20f8e337bea2e6874f372edfd12c0"
 
-SRC_URI[sha256sum] = "e7f70c305e0def2a2293ab7110827086c477ab3c6f8757d2acb3ccbfa6b425a4"
+SRC_URI[sha256sum] = "5ca34ff15dd3276cfb2e3e7b4c8dde4b7d4d27080f333a93b6c3f817e90abddf"
 
 PYPI_PACKAGE = "xmlschema"
 inherit pypi setuptools3
diff --git a/meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.12.0.bb b/meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.13.0.bb
similarity index 74%
rename from meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.12.0.bb
rename to meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.13.0.bb
index 1d871b2..aadf8b7 100644
--- a/meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.12.0.bb
+++ b/meta-openembedded/meta-python/recipes-devtools/python/python3-xmltodict_0.13.0.bb
@@ -4,8 +4,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=01441d50dc74476db58a41ac10cb9fa2"
 
-SRC_URI[md5sum] = "ddb2bd078cef4f7e3021a578034ad941"
-SRC_URI[sha256sum] = "50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21"
+SRC_URI[sha256sum] = "341595a488e3e01a85a9d8911d8912fd922ede5fecc4dce437eb4b6c8d037e56"
 
 PYPI_PACKAGE = "xmltodict"
 
@@ -15,6 +14,12 @@
 	file://run-ptest \
 "
 
+RDEPENDS:${PN} += " \
+	${PYTHON_PN}-core \
+	${PYTHON_PN}-xml \
+	${PYTHON_PN}-io \
+"
+
 RDEPENDS:${PN}-ptest += " \
 	${PYTHON_PN}-pytest \
 "
diff --git a/meta-raspberrypi/.github/actions/docker-build/action.yml b/meta-raspberrypi/.github/actions/docker-build/action.yml
index 35fac92..b91668e 100644
--- a/meta-raspberrypi/.github/actions/docker-build/action.yml
+++ b/meta-raspberrypi/.github/actions/docker-build/action.yml
@@ -17,7 +17,7 @@
   steps:
     - name: Build the ${{ inputs.docker_image }} docker image
       shell: bash
-      # We run this unconditinally even if the change doesn't touch the
+      # We run this unconditionally even if the change doesn't touch the
       # relevant docker files because there is a chance that another PR (or
       # something else) rebuilt the local image. For example if the first
       # version of the PR included change for the relevant docker image but a
diff --git a/meta-raspberrypi/.github/workflows/yocto-builds.yml b/meta-raspberrypi/.github/workflows/yocto-builds.yml
index 3f21242..d237f0a 100644
--- a/meta-raspberrypi/.github/workflows/yocto-builds.yml
+++ b/meta-raspberrypi/.github/workflows/yocto-builds.yml
@@ -50,7 +50,7 @@
             .github/workflows/docker-images/yocto-builder/**
             .github/workflows/docker-images/*.sh
             .github/workflows/yocto-builds.yml
-            classes/**'
+            classes/**
             conf/**
             dynamic-layers/**
             files/**
diff --git a/meta-raspberrypi/.github/workflows/yocto-layer.yml b/meta-raspberrypi/.github/workflows/yocto-layer.yml
index 6d92366..63cb9e9 100644
--- a/meta-raspberrypi/.github/workflows/yocto-layer.yml
+++ b/meta-raspberrypi/.github/workflows/yocto-layer.yml
@@ -27,7 +27,7 @@
             .github/workflows/docker-images/yocto-builder/**
             .github/workflows/docker-images/*.sh
             .github/workflows/yocto-builds.yml
-            classes/**'
+            classes/**
             conf/**
             dynamic-layers/**
             files/**
diff --git a/meta-raspberrypi/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bbappend b/meta-raspberrypi/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.%.bbappend
similarity index 100%
rename from meta-raspberrypi/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.1.bbappend
rename to meta-raspberrypi/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.%.bbappend
diff --git a/meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera/libcamera.bbappend b/meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera/libcamera.bbappend
index 2721cfe..efa1f80 100644
--- a/meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera/libcamera.bbappend
+++ b/meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera/libcamera.bbappend
@@ -1,2 +1,2 @@
-PACKAGECONFIG[raspberrypi] = "-Dpipelines=raspberrypi"
+PACKAGECONFIG[raspberrypi] = "-Dpipelines=raspberrypi -Dipas=raspberrypi -Dcpp_args=-Wno-unaligned-access"
 PACKAGECONFIG:append:rpi = " raspberrypi"
diff --git a/meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb b/meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb
index 6fb3a1b..3ff8251 100644
--- a/meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb
+++ b/meta-raspberrypi/recipes-bsp/bootfiles/rpi-cmdline.bb
@@ -13,10 +13,6 @@
 
 CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}"
 
-CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}"
-
-CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_HD_CAMERA", "1", "cma=64M", "", d)}"
-
 CMDLINE_PITFT ?= "${@bb.utils.contains("MACHINE_FEATURES", "pitft", "fbcon=map:10 fbcon=font:VGA8x8", "", d)}"
 
 # Add the kernel debugger over console kernel command line option if enabled
diff --git a/meta-raspberrypi/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb b/meta-raspberrypi/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb
new file mode 100644
index 0000000..073105d
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/libcamera-apps/rpi-libcamera-apps_git.bb
@@ -0,0 +1,44 @@
+SUMMARY = "A suite of libcamera-based apps for the Raspberry Pi"
+DESCRIPTION = "This is a small suite of libcamera-based apps that aim to \
+copy the functionality of the existing \"raspicam\" apps."
+HOMEPAGE = "https://github.com/raspberrypi/libcamera-apps"
+SECTION = "console/utils"
+
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://license.txt;md5=a0013d1b383d72ba4bdc5b750e7d1d77"
+
+SRC_URI = "\
+    git://github.com/raspberrypi/libcamera-apps.git;protocol=https;branch=main \
+"
+SRCREV = "22a52590c33a813743b4e6337478c208201c77b1"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = "^rpi$"
+
+DEPENDS = "libcamera libexif jpeg tiff libpng boost"
+
+inherit cmake pkgconfig
+
+EXTRA_OECMAKE = "\
+    -DCMAKE_BUILD_TYPE=Release \
+    -DBoost_INCLUDE_DIR=${STAGING_INCDIR} \
+    -DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR} \
+"
+
+EXTRA_OECMAKE:append:raspberrypi3 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon"
+EXTRA_OECMAKE:append:raspberrypi4 = " -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon"
+
+PACKAGECONFIG[x11] = "-DENABLE_X11=1,-DENABLE_X11=0"
+PACKAGECONFIG[qt] = "-DENABLE_QT=1,-DENABLE_QT=0"
+PACKAGECONFIG[opencv] = "-DENABLE_OPENCV=1,-DENABLE_OPENCV=0"
+PACKAGECONFIG[tensorflow-lite] = "-DENABLE_TFLITE=1,-DENABLE_TFLITE=0"
+
+# Build does not version solibs so we need to change the suffix
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+
+do_install:append() {
+    # Requires python3-core which not all systems may have
+    rm ${D}/${bindir}/camera-bug-report
+}
diff --git a/meta-security/meta-tpm/recipes-kernel/linux/linux-yocto_5.%.bbappend b/meta-security/meta-tpm/recipes-kernel/linux/linux-yocto_5.%.bbappend
index 2cf1453..e8027ff 100644
--- a/meta-security/meta-tpm/recipes-kernel/linux/linux-yocto_5.%.bbappend
+++ b/meta-security/meta-tpm/recipes-kernel/linux/linux-yocto_5.%.bbappend
@@ -1 +1 @@
-require ${@bb.utils.contains_any('DISTRO_FEATURES', 'tpm', 'linux-yocto_tpm.inc', '', d)}
+require ${@bb.utils.contains_any('DISTRO_FEATURES', 'tpm tpm2', 'linux-yocto_tpm.inc', '', d)}
diff --git a/meta-security/recipes-mac/AppArmor/apparmor_3.0.6.bb b/meta-security/recipes-mac/AppArmor/apparmor_3.0.7.bb
similarity index 98%
rename from meta-security/recipes-mac/AppArmor/apparmor_3.0.6.bb
rename to meta-security/recipes-mac/AppArmor/apparmor_3.0.7.bb
index 45f19d1..e7d677e 100644
--- a/meta-security/recipes-mac/AppArmor/apparmor_3.0.6.bb
+++ b/meta-security/recipes-mac/AppArmor/apparmor_3.0.7.bb
@@ -5,7 +5,7 @@
  which is required to convert AppArmor text profiles into machine-readable \
  policies that are loaded into the kernel for use with the AppArmor Linux \
  Security Module."
-HOMEAPAGE = "http://apparmor.net/"
+HOMEPAGE = "http://apparmor.net/"
 SECTION = "admin"
 
 LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & LGPL-2.1-or-later"
@@ -22,7 +22,7 @@
     file://0001-rc.apparmor.debian-add-missing-functions.patch \
     "
 
-SRCREV = "822db765c6fa7f9de7233c4011254a82d4dafe76"
+SRCREV = "0ead606d9e608801f45e13a34358036135470729"
 S = "${WORKDIR}/git"
 
 PARALLEL_MAKE = ""
diff --git a/meta-security/recipes-security/cryptmount/cryptmount_5.3.3.bb b/meta-security/recipes-security/cryptmount/cryptmount_6.0.bb
similarity index 81%
rename from meta-security/recipes-security/cryptmount/cryptmount_5.3.3.bb
rename to meta-security/recipes-security/cryptmount/cryptmount_6.0.bb
index 6741a5f..d712a61 100644
--- a/meta-security/recipes-security/cryptmount/cryptmount_5.3.3.bb
+++ b/meta-security/recipes-security/cryptmount/cryptmount_6.0.bb
@@ -1,13 +1,12 @@
 SUMMARY = "Linux encrypted filesystem management tool"
 HOMEPAGE = "http://cryptmount.sourceforge.net/"
-LIC_FILES_CHKSUM = "file://README;beginline=3;endline=4;md5=673a990de93a2c5531a0f13f1c40725a"
+LIC_FILES_CHKSUM = "file://README;beginline=3;endline=4;md5=dae0772f0ff46fd927e7fdb08af51b71"
 LICENSE = "GPL-2.0-only"
 
-SRC_URI = "https://sourceforge.net/projects/cryptmount/files/${BPN}/${BPN}-5.3/${BPN}-${PV}.tar.gz \
-           file://remove_linux_fs.patch \
+SRC_URI = "https://sourceforge.net/projects/cryptmount/files/${BPN}/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
            "
 
-SRC_URI[sha256sum] = "682953ff5ba497d48d6b13e22ca726c98659abd781bb8596bb299640dd255d9b"
+SRC_URI[sha256sum] = "86528a9175e1eb53f60613e3c3ea6ae6d69dbfe5ac2b53b2f58ba0f768371e7e"
 
 inherit autotools-brokensep gettext pkgconfig systemd
 
diff --git a/meta-security/recipes-security/cryptmount/files/remove_linux_fs.patch b/meta-security/recipes-security/cryptmount/files/remove_linux_fs.patch
deleted file mode 100644
index 304b853..0000000
--- a/meta-security/recipes-security/cryptmount/files/remove_linux_fs.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-# From glibc 2.36, <linux/mount.h> (included from <linux/fs.h>) and 
-# <sys/mount.h> (included from glibc) are no longer compatible:
-# https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
-
-Upstream-Status: Pending
-Signed-off-by: Armin Kuster <akuster808@gmail.com>
-
-Index: cryptmount-5.3.3/cryptmount.c
-===================================================================
---- cryptmount-5.3.3.orig/cryptmount.c
-+++ cryptmount-5.3.3/cryptmount.c
-@@ -41,7 +41,6 @@
- #ifdef HAVE_SYSLOG
- #  include <syslog.h>
- #endif
--#include <linux/fs.h>       /* Beware ordering conflict with sys/mount.h */
- 
- 
- #include "armour.h"
diff --git a/meta-security/recipes-security/libgssglue/files/libgssglue-fix-CVE-2011-2709.patch b/meta-security/recipes-security/libgssglue/files/libgssglue-fix-CVE-2011-2709.patch
deleted file mode 100644
index 6aa1a65..0000000
--- a/meta-security/recipes-security/libgssglue/files/libgssglue-fix-CVE-2011-2709.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Use secure_getenv instead of getenv for setuid programs
-
-(bnc#694598 CVE-2011-2709 bnc#831805)
-
-import from:
-https://build.opensuse.org/package/view_file/openSUSE:Factory/libgssglue/secure-getenv.patch
-
-Upstream-Status: Pending
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
-
-diff --git a/src/g_initialize.c b/src/g_initialize.c
-index 200f173..935a9fa 100644
---- a/src/g_initialize.c
-+++ b/src/g_initialize.c
-@@ -26,6 +26,7 @@
-  * This function will initialize the gssapi mechglue library
-  */
- 
-+#define _GNU_SOURCE
- #include "mglueP.h"
- #include <stdlib.h>
- 
-@@ -197,8 +198,7 @@ static void solaris_initialize ()
-     void *dl;
-     gss_mechanism (*sym)(void), mech;
- 
--    if ((getuid() != geteuid()) ||
--        ((filename = getenv("GSSAPI_MECH_CONF")) == NULL))
-+    if ((filename = secure_getenv("GSSAPI_MECH_CONF")) == NULL)
- 	filename = MECH_CONF;
- 
-     if ((conffile = fopen(filename, "r")) == NULL) {
-@@ -274,8 +274,7 @@ static void linux_initialize ()
-     void *dl;
-     gss_mechanism (*sym)(void), mech;
- 
--    if ((getuid() != geteuid()) ||
--        ((filename = getenv("GSSAPI_MECH_CONF")) == NULL))
-+    if ((filename = secure_getenv("GSSAPI_MECH_CONF")) == NULL)
- 	filename = MECH_CONF;
- 
-     if ((conffile = fopen(filename, "r")) == NULL) {
diff --git a/meta-security/recipes-security/libgssglue/files/libgssglue-g-initialize.patch b/meta-security/recipes-security/libgssglue/files/libgssglue-g-initialize.patch
deleted file mode 100644
index 4a9ba33..0000000
--- a/meta-security/recipes-security/libgssglue/files/libgssglue-g-initialize.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Fix the warning for getuid, geteuid
-g_initialize.c: In function 'linux_initialize':
-g_initialize.c:275:5: warning: implicit declaration of function 'getuid' [-Wimplicit-function-declaration]
-g_initialize.c:275:5: warning: implicit declaration of function 'geteuid' [-Wimplicit-function-declaration]
-
-Upstream-Status: Pending
-Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
-
-diff --git a/src/g_initialize.c b/src1/g_initialize.c
-index 82fcce1..200f173 100644
---- a/src/g_initialize.c
-+++ b/src/g_initialize.c
-@@ -29,6 +29,8 @@
- #include "mglueP.h"
- #include <stdlib.h>
- 
-+#include <unistd.h>   /*getuid, geteuid */
-+#include <sys/types.h>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
diff --git a/meta-security/recipes-security/libgssglue/files/libgssglue-gss-inq-cred.patch b/meta-security/recipes-security/libgssglue/files/libgssglue-gss-inq-cred.patch
deleted file mode 100644
index 6dce3e7..0000000
--- a/meta-security/recipes-security/libgssglue/files/libgssglue-gss-inq-cred.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-1) add free if malloc failed for (*mechanisms)->elements
-2) g_inq_cred.c: In function 'gss_inquire_cred':
-g_inq_cred.c:161:8: warning: passing argument 3 of 'generic_gss_copy_oid' from incompatible pointer type [enabled by default]
-
-Upstream-Status: Pending
-Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
-
---- a/src/g_inq_cred.c
-+++ b/src/g_inq_cred.c
-@@ -152,13 +152,15 @@ gss_OID_set *		mechanisms;
- 			     union_cred->count);
- 	if ((*mechanisms)->elements == NULL) {
- 	    *minor_status = ENOMEM;
-+	    free(*mechanisms);
-+	    *mechanisms = GSS_C_NO_OID_SET;
- 	    return (GSS_S_FAILURE);
- 	}
- 
- 	for (i=0; i < union_cred->count; i++) {
--	    status = generic_gss_copy_oid(minor_status,
-+	    status = generic_gss_add_oid_set_member(minor_status,
- 	    				  &union_cred->mechs_array[i],
--					  &((*mechanisms)->elements[i]));
-+					  mechanisms);
- 	    if (status != GSS_S_COMPLETE)
- 	        break;
- 	}
diff --git a/meta-security/recipes-security/libgssglue/files/libgssglue-mglueP.patch b/meta-security/recipes-security/libgssglue/files/libgssglue-mglueP.patch
deleted file mode 100644
index 6c9ebf0..0000000
--- a/meta-security/recipes-security/libgssglue/files/libgssglue-mglueP.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-fix the warning:
-warning: implicit declaration of function 'generic_gss_copy_oid_set' [-Wimplicit-function-declaration]
-
-Upstream-Status: Pending
-Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
-
---- a/src/mglueP.h
-+++ b/src/mglueP.h
-@@ -447,6 +447,12 @@ OM_uint32 generic_gss_copy_oid
- 	    gss_OID *		/* new_oid */
- 	    );
- 
-+OM_uint32 generic_gss_copy_oid_set
-+	   (OM_uint32 *minor_status,	/* minor_status */
-+	    const gss_OID_set_desc * const oidset,	/* oid */
-+	    gss_OID_set *new_oidset			/* new_oid */
-+	   );
-+
- OM_uint32 generic_gss_create_empty_oid_set
- 	   (OM_uint32 *,	/* minor_status */
- 	    gss_OID_set *	/* oid_set */
diff --git a/meta-security/recipes-security/libgssglue/libgssglue_0.4.bb b/meta-security/recipes-security/libgssglue/libgssglue_0.7.bb
similarity index 77%
rename from meta-security/recipes-security/libgssglue/libgssglue_0.4.bb
rename to meta-security/recipes-security/libgssglue/libgssglue_0.7.bb
index 3085ee6..26bd2f3 100644
--- a/meta-security/recipes-security/libgssglue/libgssglue_0.4.bb
+++ b/meta-security/recipes-security/libgssglue/libgssglue_0.7.bb
@@ -15,27 +15,24 @@
 #Copyright 1995 by the Massachusetts Institute of Technology.  HPND without Disclaimer
 #Copyright 1993 by OpenVision Technologies, Inc.               HPND
 LIC_FILES_CHKSUM = "file://COPYING;md5=56871e72a5c475289c0d5e4ba3f2ee3a \
-                    file://src/g_accept_sec_context.c;beginline=3;endline=23;md5=8a7f4017cb7f4be49f8981cb8c472690 \
+                    file://src/g_accept_sec_context.c;beginline=3;endline=23;md5=da8ca7a37bd26e576c23874d453751d2\
                     file://src/g_ccache_name.c;beginline=1;endline=32;md5=208d4de05d5c8273963a8332f084faa7 \
-                    file://src/oid_ops.c;beginline=1;endline=26;md5=1f194d148b396972da26759a8ec399f0 \
-                    file://src/oid_ops.c;beginline=378;endline=398;md5=e02c165cb8383e950214baca2fbd664b \
+                    file://src/oid_ops.c;beginline=1;endline=26;md5=1f194d148b396972da26759a8ec399f0\
+                    file://src/oid_ops.c;beginline=378;endline=398;md5=d77a5c03e91908fac453c08bbeaddce1\
 "
 
-SRC_URI = "${DEBIAN_MIRROR}/main/libg/${BPN}/${BPN}_${PV}.orig.tar.bz2 \
+SRC_URI = "${DEBIAN_MIRROR}/main/libg/${BPN}/${BPN}_${PV}.orig.tar.gz \
            file://libgssglue-canon-name.patch  \
-           file://libgssglue-gss-inq-cred.patch  \
-           file://libgssglue-mglueP.patch \
-           file://libgssglue-g-initialize.patch \
-           file://libgssglue-fix-CVE-2011-2709.patch \
 "
 
-SRC_URI[md5sum] = "5ce81940965fa68c7635c42dcafcddfe"
-SRC_URI[sha256sum] = "bb47b2de78409f461811d0db8595c66e6631a9879c3621a35e4434b104ee52f5"
+SRC_URI[sha256sum] = "bcd618ae0bc69f12815d77295658a760e7edc20706b9a731a81da8993f5c970a"
 
-# gssglue can use krb5, spkm3... as gssapi library, configurable
-RRECOMMENDS:${PN} += "krb5"
+inherit autotools-brokensep
 
-inherit autotools
+do_configure:prepend() {
+    cd ${S}
+    ./bootstrap
+}
 
 do_install:append() {
     # install some docs
@@ -49,3 +46,6 @@
     # change the libgssapi_krb5.so path and name(it is .so.2)
     sed -i -e "s:/usr/lib/libgssapi_krb5.so:libgssapi_krb5.so.2:" ${D}${sysconfdir}/gssapi_mech.conf
 }
+
+# gssglue can use krb5, spkm3... as gssapi library, configurable
+RRECOMMENDS:${PN} += "krb5"
diff --git a/poky/documentation/dev-manual/common-tasks.rst b/poky/documentation/dev-manual/common-tasks.rst
index 559709d..a4741c5 100644
--- a/poky/documentation/dev-manual/common-tasks.rst
+++ b/poky/documentation/dev-manual/common-tasks.rst
@@ -1731,7 +1731,7 @@
 
       If you need to install one or more custom CMake toolchain files
       that are supplied by the application you are building, install the
-      files to ``${D}${datadir}/cmake/Modules`` during ``do_install``.
+      files to ``${D}${datadir}/cmake/Modules`` during :ref:`ref-tasks-install`.
 
 -  *Other:* If your source files do not have a ``configure.ac`` or
    ``CMakeLists.txt`` file, then your software is built using some
@@ -1826,8 +1826,8 @@
 Compilation
 -----------
 
-During a build, the ``do_compile`` task happens after source is fetched,
-unpacked, and configured. If the recipe passes through ``do_compile``
+During a build, the :ref:`ref-tasks-compile` task happens after source is fetched,
+unpacked, and configured. If the recipe passes through :ref:`ref-tasks-compile`
 successfully, nothing needs to be done.
 
 However, if the compile step fails, you need to diagnose the failure.
@@ -1888,7 +1888,7 @@
 Installing
 ----------
 
-During ``do_install``, the task copies the built files along with their
+During :ref:`ref-tasks-install`, the task copies the built files along with their
 hierarchy to locations that would mirror their locations on the target
 device. The installation process copies files from the
 ``${``\ :term:`S`\ ``}``,
@@ -1906,14 +1906,14 @@
 -  *Autotools and CMake:* If the software your recipe is building uses
    Autotools or CMake, the OpenEmbedded build system understands how to
    install the software. Consequently, you do not have to have a
-   ``do_install`` task as part of your recipe. You just need to make
+   :ref:`ref-tasks-install` task as part of your recipe. You just need to make
    sure the install portion of the build completes with no issues.
    However, if you wish to install additional files not already being
    installed by ``make install``, you should do this using a
    ``do_install:append`` function using the install command as described
    in the "Manual" bulleted item later in this list.
 
--  *Other (using* ``make install``\ *)*: You need to define a ``do_install``
+-  *Other (using* ``make install``\ *)*: You need to define a :ref:`ref-tasks-install`
    function in your recipe. The function should call
    ``oe_runmake install`` and will likely need to pass in the
    destination directory as well. How you pass that path is dependent on
@@ -1923,7 +1923,7 @@
    For an example recipe using ``make install``, see the
    ":ref:`dev-manual/common-tasks:makefile-based package`" section.
 
--  *Manual:* You need to define a ``do_install`` function in your
+-  *Manual:* You need to define a :ref:`ref-tasks-install` function in your
    recipe. The function must first use ``install -d`` to create the
    directories under
    ``${``\ :term:`D`\ ``}``. Once the
@@ -1946,10 +1946,10 @@
       might need to replace hard-coded paths in an initscript with
       values of variables provided by the build system, such as
       replacing ``/usr/bin/`` with ``${bindir}``. If you do perform such
-      modifications during ``do_install``, be sure to modify the
+      modifications during :ref:`ref-tasks-install`, be sure to modify the
       destination file after copying rather than before copying.
       Modifying after copying ensures that the build system can
-      re-execute ``do_install`` if needed.
+      re-execute :ref:`ref-tasks-install` if needed.
 
    -  ``oe_runmake install``, which can be run directly or can be run
       indirectly by the
@@ -1958,7 +1958,7 @@
       runs ``make install`` in parallel. Sometimes, a Makefile can have
       missing dependencies between targets that can result in race
       conditions. If you experience intermittent failures during
-      ``do_install``, you might be able to work around them by disabling
+      :ref:`ref-tasks-install`, you might be able to work around them by disabling
       parallel Makefile installs by adding the following to the recipe::
 
          PARALLEL_MAKEINST = ""
@@ -1980,7 +1980,7 @@
 If you are adding services and the service initialization script or the
 service file itself is not installed, you must provide for that
 installation in your recipe using a ``do_install:append`` function. If
-your recipe already has a ``do_install`` function, update the function
+your recipe already has a :ref:`ref-tasks-install` function, update the function
 near its end rather than adding an additional ``do_install:append``
 function.
 
@@ -2028,10 +2028,10 @@
 by the OpenEmbedded build system and some specific steps you need to
 take. The following list describes the process:
 
--  *Splitting Files*: The ``do_package`` task splits the files produced
+-  *Splitting Files*: The :ref:`ref-tasks-package` task splits the files produced
    by the recipe into logical components. Even software that produces a
    single binary might still have debug symbols, documentation, and
-   other logical components that should be split out. The ``do_package``
+   other logical components that should be split out. The :ref:`ref-tasks-package`
    task ensures that files are split up and packaged correctly.
 
 -  *Running QA Checks*: The
@@ -2337,7 +2337,7 @@
 Building an application from a single file that is stored locally (e.g.
 under ``files``) requires a recipe that has the file listed in the
 :term:`SRC_URI` variable. Additionally, you need to manually write the
-``do_compile`` and ``do_install`` tasks. The :term:`S` variable defines the
+:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The :term:`S` variable defines the
 directory containing the source code, which is set to
 :term:`WORKDIR` in this case --- the
 directory BitBake uses for the build.
@@ -2401,14 +2401,14 @@
 
 Applications that use GNU ``make`` also require a recipe that has the
 source archive listed in :term:`SRC_URI`. You do not need to add a
-``do_compile`` step since by default BitBake starts the ``make`` command
+:ref:`ref-tasks-compile` step since by default BitBake starts the ``make`` command
 to compile the application. If you need additional ``make`` options, you
 should store them in the
 :term:`EXTRA_OEMAKE` or
 :term:`PACKAGECONFIG_CONFARGS`
 variables. BitBake passes these options into the GNU ``make``
-invocation. Note that a ``do_install`` task is still required.
-Otherwise, BitBake runs an empty ``do_install`` task by default.
+invocation. Note that a :ref:`ref-tasks-install` task is still required.
+Otherwise, BitBake runs an empty :ref:`ref-tasks-install` task by default.
 
 Some applications might require extra parameters to be passed to the
 compiler. For example, the application might need an additional header
@@ -2551,7 +2551,7 @@
    ``${``\ :term:`S`\ ``}``.
 
    If ``${S}`` might contain a Makefile, or if you inherit some class
-   that replaces ``do_configure`` and ``do_compile`` with custom
+   that replaces :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` with custom
    versions, then you can use the
    ``[``\ :ref:`noexec <bitbake-user-manual/bitbake-user-manual-metadata:variable flags>`\ ``]``
    flag to turn the tasks into no-ops, as follows::
@@ -2567,7 +2567,7 @@
    :ref:`ref-tasks-patch` tasks to the
    :ref:`ref-tasks-install` task.
 
--  Make sure your ``do_install`` task installs the binaries
+-  Make sure your :ref:`ref-tasks-install` task installs the binaries
    appropriately.
 
 -  Ensure that you set up :term:`FILES`
@@ -2881,7 +2881,7 @@
 If you are creating a new kernel recipe, normal recipe-writing rules
 apply for setting up a :term:`SRC_URI`. Thus, you need to specify any
 necessary patches and set :term:`S` to point at the source code. You need to
-create a ``do_configure`` task that configures the unpacked kernel with
+create a :ref:`ref-tasks-configure` task that configures the unpacked kernel with
 a ``defconfig`` file. You can do this by using a ``make defconfig``
 command or, more commonly, by copying in a suitable ``defconfig`` file
 and then running ``make oldconfig``. By making use of ``inherit kernel``
@@ -3446,7 +3446,7 @@
    you added to the patch.
 
 6. *Test Your Changes:* Once you have modified the source code, the
-   easiest way to test your changes is by calling the ``do_compile``
+   easiest way to test your changes is by calling the :ref:`ref-tasks-compile`
    task as shown in the following example::
 
       $ bitbake -c compile -f package
@@ -3458,7 +3458,7 @@
    .. note::
 
       All the modifications you make to the temporary source code disappear
-      once you run the ``do_clean`` or ``do_cleanall`` tasks using BitBake
+      once you run the :ref:`ref-tasks-clean` or :ref:`ref-tasks-cleanall` tasks using BitBake
       (i.e. ``bitbake -c clean package`` and ``bitbake -c cleanall package``).
       Modifications will also disappear if you use the ``rm_work`` feature as
       described in the
@@ -3853,8 +3853,8 @@
    do_image[mcdepends] = "mc:x86:arm:core-image-minimal:do_rootfs"
 
 In this example, the `from_multiconfig` is "x86". The `to_multiconfig` is "arm". The
-task on which the ``do_image`` task in the recipe depends is the
-``do_rootfs`` task from the ``core-image-minimal`` recipe associated
+task on which the :ref:`ref-tasks-image` task in the recipe depends is the
+:ref:`ref-tasks-rootfs` task from the ``core-image-minimal`` recipe associated
 with the "arm" multiconfig.
 
 Once you set up this dependency, you can build the "x86" multiconfig
@@ -3864,7 +3864,7 @@
 
 This command executes all the tasks needed to create the
 ``core-image-sato`` image for the "x86" multiconfig. Because of the
-dependency, BitBake also executes through the ``do_rootfs`` task for the
+dependency, BitBake also executes through the :ref:`ref-tasks-rootfs` task for the
 "arm" multiconfig build.
 
 Having a recipe depend on the root filesystem of another build might not
@@ -3882,99 +3882,59 @@
 each build in the respective temporary build directories (i.e.
 :term:`TMPDIR`).
 
-Building an Initial RAM Filesystem (initramfs) Image
+Building an Initial RAM Filesystem (Initramfs) Image
 ----------------------------------------------------
 
-An initial RAM filesystem (initramfs) image provides a temporary root
-filesystem used for early system initialization (e.g. loading of modules
-needed to locate and mount the "real" root filesystem).
+An initial RAM filesystem (:term:`Initramfs`) image provides a temporary root
+filesystem used for early system initialization, typically providing tools and
+loading modules needed to locate and mount the final root filesystem.
 
-.. note::
+Follow these steps to create an :term:`Initramfs` image:
 
-   The initramfs image is the successor of initial RAM disk (initrd). It
-   is a "copy in and out" (cpio) archive of the initial filesystem that
-   gets loaded into memory during the Linux startup process. Because
-   Linux uses the contents of the archive during initialization, the
-   initramfs image needs to contain all of the device drivers and tools
-   needed to mount the final root filesystem.
-
-Follow these steps to create an initramfs image:
-
-1. *Create the initramfs Image Recipe:* You can reference the
+1. *Create the Initramfs Image Recipe:* You can reference the
    ``core-image-minimal-initramfs.bb`` recipe found in the
    ``meta/recipes-core`` directory of the :term:`Source Directory`
-   as an example
-   from which to work.
+   as an example from which to work.
 
-2. *Decide if You Need to Bundle the initramfs Image Into the Kernel
-   Image:* If you want the initramfs image that is built to be bundled
-   in with the kernel image, set the
-   :term:`INITRAMFS_IMAGE_BUNDLE`
-   variable to "1" in your ``local.conf`` configuration file and set the
-   :term:`INITRAMFS_IMAGE`
-   variable in the recipe that builds the kernel image.
+2. *Decide if You Need to Bundle the Initramfs Image Into the Kernel
+   Image:* If you want the :term:`Initramfs` image that is built to be bundled
+   in with the kernel image, set the :term:`INITRAMFS_IMAGE_BUNDLE`
+   variable to ``"1"`` in your ``local.conf`` configuration file and set the
+   :term:`INITRAMFS_IMAGE` variable in the recipe that builds the kernel image.
 
-   .. note::
-
-      It is recommended that you bundle the initramfs image with the
-      kernel image to avoid circular dependencies between the kernel
-      recipe and the initramfs recipe should the initramfs image include
-      kernel modules.
-
-   Setting the :term:`INITRAMFS_IMAGE_BUNDLE` flag causes the initramfs
+   Setting the :term:`INITRAMFS_IMAGE_BUNDLE` flag causes the :term:`Initramfs`
    image to be unpacked into the ``${B}/usr/`` directory. The unpacked
-   initramfs image is then passed to the kernel's ``Makefile`` using the
-   :term:`CONFIG_INITRAMFS_SOURCE`
-   variable, allowing the initramfs image to be built into the kernel
-   normally.
+   :term:`Initramfs` image is then passed to the kernel's ``Makefile`` using the
+   :term:`CONFIG_INITRAMFS_SOURCE` variable, allowing the :term:`Initramfs`
+   image to be built into the kernel normally.
 
-   .. note::
+3. *Optionally Add Items to the Initramfs Image Through the Initramfs
+   Image Recipe:* If you add items to the :term:`Initramfs` image by way of its
+   recipe, you should use :term:`PACKAGE_INSTALL` rather than
+   :term:`IMAGE_INSTALL`. :term:`PACKAGE_INSTALL` gives more direct control of
+   what is added to the image as compared to the defaults you might not
+   necessarily want that are set by the :ref:`image <ref-classes-image>`
+   or :ref:`core-image <ref-classes-core-image>` classes.
 
-      Bundling the initramfs with the kernel conflates the code in the initramfs
-      with the GPLv2 licensed Linux kernel binary. Thus only GPLv2 compatible
-      software may be part of a bundled initramfs.
-
-   .. note::
-
-      If you choose to not bundle the initramfs image with the kernel
-      image, you are essentially using an
-      `Initial RAM Disk (initrd) <https://en.wikipedia.org/wiki/Initrd>`__.
-      Creating an initrd is handled primarily through the :term:`INITRD_IMAGE`,
-      ``INITRD_LIVE``, and ``INITRD_IMAGE_LIVE`` variables. For more
-      information, see the :ref:`ref-classes-image-live` file.
-
-3. *Optionally Add Items to the initramfs Image Through the initramfs
-   Image Recipe:* If you add items to the initramfs image by way of its
-   recipe, you should use
-   :term:`PACKAGE_INSTALL`
-   rather than
-   :term:`IMAGE_INSTALL`.
-   :term:`PACKAGE_INSTALL` gives more direct control of what is added to the
-   image as compared to the defaults you might not necessarily want that
-   are set by the :ref:`image <ref-classes-image>`
-   or :ref:`core-image <ref-classes-core-image>`
-   classes.
-
-4. *Build the Kernel Image and the initramfs Image:* Build your kernel
-   image using BitBake. Because the initramfs image recipe is a
-   dependency of the kernel image, the initramfs image is built as well
+4. *Build the Kernel Image and the Initramfs Image:* Build your kernel
+   image using BitBake. Because the :term:`Initramfs` image recipe is a
+   dependency of the kernel image, the :term:`Initramfs` image is built as well
    and bundled with the kernel image if you used the
-   :term:`INITRAMFS_IMAGE_BUNDLE`
-   variable described earlier.
+   :term:`INITRAMFS_IMAGE_BUNDLE` variable described earlier.
 
 Bundling an Initramfs Image From a Separate Multiconfig
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-There may be a case where we want to build an initramfs image which does not
+There may be a case where we want to build an :term:`Initramfs` image which does not
 inherit the same distro policy as our main image, for example, we may want
-our main image to use ``TCLIBC="glibc"``, but to use ``TCLIBC="musl"`` in our initramfs
+our main image to use ``TCLIBC="glibc"``, but to use ``TCLIBC="musl"`` in our :term:`Initramfs`
 image to keep a smaller footprint. However, by performing the steps mentioned
-above the initramfs image will inherit ``TCLIBC="glibc"`` without allowing us
+above the :term:`Initramfs` image will inherit ``TCLIBC="glibc"`` without allowing us
 to override it.
 
 To achieve this, you need to perform some additional steps:
 
-1. *Create a multiconfig for your initramfs image:* You can perform the steps
+1. *Create a multiconfig for your Initramfs image:* You can perform the steps
    on ":ref:`dev-manual/common-tasks:building images for multiple targets using multiple configurations`" to create a separate multiconfig.
    For the sake of simplicity let's assume such multiconfig is called: ``initramfscfg.conf`` and
    contains the variables::
@@ -3982,7 +3942,7 @@
       TMPDIR="${TOPDIR}/tmp-initramfscfg"
       TCLIBC="musl"
 
-2. *Set additional initramfs variables on your main configuration:*
+2. *Set additional Initramfs variables on your main configuration:*
    Additionally, on your main configuration (``local.conf``) you need to set the
    variables::
 
@@ -3995,9 +3955,9 @@
    buildsystem know where the :term:`INITRAMFS_IMAGE` will be located.
 
    Building a system with such configuration will build the kernel using the
-   main configuration but the ``do_bundle_initramfs`` task will grab the
+   main configuration but the :ref:`ref-tasks-bundle_initramfs` task will grab the
    selected :term:`INITRAMFS_IMAGE` from :term:`INITRAMFS_DEPLOY_DIR_IMAGE`
-   instead, resulting in a musl based initramfs image bundled in the kernel
+   instead, resulting in a musl based :term:`Initramfs` image bundled in the kernel
    but a glibc based main image.
 
    The same is applicable to avoid inheriting :term:`DISTRO_FEATURES` on :term:`INITRAMFS_IMAGE`
@@ -4171,7 +4131,7 @@
 Finally, you should consider exactly the type of root filesystem you
 need to meet your needs while also reducing its size. For example,
 consider ``cramfs``, ``squashfs``, ``ubifs``, ``ext2``, or an
-``initramfs`` using ``initramfs``. Be aware that ``ext3`` requires a 1
+:term:`Initramfs` using ``initramfs``. Be aware that ``ext3`` requires a 1
 Mbyte journal. If you are okay with running read-only, you do not need
 this journal.
 
@@ -4740,7 +4700,7 @@
 The :term:`PACKAGES` and
 :term:`FILES:* <FILES>` variables in the
 ``meta/conf/bitbake.conf`` configuration file define how files installed
-by the ``do_install`` task are packaged. By default, the :term:`PACKAGES`
+by the :ref:`ref-tasks-install` task are packaged. By default, the :term:`PACKAGES`
 variable includes ``${PN}-staticdev``, which represents all static
 library files.
 
@@ -6902,7 +6862,7 @@
 ``do_split_packages``.
 
 -  A directory within the files installed by your recipe through
-   ``do_install`` in which to search.
+   :ref:`ref-tasks-install` in which to search.
 
 -  A regular expression used to match module files in that directory. In
    the example, note the parentheses () that mark the part of the
@@ -8481,7 +8441,7 @@
    information.
 
 -  ``sstate-task-sizes.txt:`` A text file containing name-value pairs
-   with information about task group sizes (e.g. ``do_populate_sysroot``
+   with information about task group sizes (e.g. :ref:`ref-tasks-populate_sysroot`
    tasks have a total size). The ``sstate-task-sizes.txt`` file exists
    only when an extensible SDK is created.
 
@@ -8802,7 +8762,7 @@
    -  Installs normal linux utilities not BusyBox ones (e.g. ``bash``,
       ``coreutils``, ``tar``, ``gzip``, and ``kmod``).
 
-   -  Uses a custom Initial RAM Disk (initramfs) image with a custom
+   -  Uses a custom :term:`Initramfs` image with a custom
       installer. A normal image that you can install usually creates a
       single root filesystem partition. This image uses another installer that
       creates a specific partition layout. Not all Board Support
@@ -9081,7 +9041,7 @@
 
 -  *hasPackage(pkg):* Returns "True" if ``pkg`` is in the installed
    package list of the image, which is based on the manifest file that
-   is generated during the ``do_rootfs`` task.
+   is generated during the :ref:`ref-tasks-rootfs` task.
 
 -  *hasFeature(feature):* Returns "True" if the feature is in
    :term:`IMAGE_FEATURES` or
@@ -9633,11 +9593,11 @@
 ----------------------
 
 Any given recipe consists of a set of tasks. The standard BitBake
-behavior in most cases is: ``do_fetch``, ``do_unpack``, ``do_patch``,
-``do_configure``, ``do_compile``, ``do_install``, ``do_package``,
-``do_package_write_*``, and ``do_build``. The default task is
-``do_build`` and any tasks on which it depends build first. Some tasks,
-such as ``do_devshell``, are not part of the default build chain. If you
+behavior in most cases is: :ref:`ref-tasks-fetch`, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch`,
+:ref:`ref-tasks-configure`, :ref:`ref-tasks-compile`, :ref:`ref-tasks-install`, :ref:`ref-tasks-package`,
+:ref:`do_package_write_* <ref-tasks-package_write_deb>`, and :ref:`ref-tasks-build`. The default task is
+:ref:`ref-tasks-build` and any tasks on which it depends build first. Some tasks,
+such as :ref:`ref-tasks-devshell`, are not part of the default build chain. If you
 wish to run a task that is not part of the default build chain, you can
 use the ``-c`` option in BitBake. Here is an example::
 
@@ -9677,7 +9637,7 @@
 
 This sequence first builds and then recompiles ``matchbox-desktop``. The
 last command reruns all tasks (basically the packaging tasks) after the
-compile. BitBake recognizes that the ``do_compile`` task was rerun and
+compile. BitBake recognizes that the :ref:`ref-tasks-compile` task was rerun and
 therefore understands that the other tasks also need to be run again.
 
 Another, shorter way to rerun a task and all
@@ -9724,7 +9684,7 @@
 
 
 You can view a list of tasks in a given package by running the
-``do_listtasks`` task as follows::
+:ref:`ref-tasks-listtasks` task as follows::
 
    $ bitbake matchbox-desktop -c listtasks
 
diff --git a/poky/documentation/dev-manual/qemu.rst b/poky/documentation/dev-manual/qemu.rst
index 88a63c1..9f4bc26 100644
--- a/poky/documentation/dev-manual/qemu.rst
+++ b/poky/documentation/dev-manual/qemu.rst
@@ -123,9 +123,9 @@
 
          $ runqemu qemux86-64 core-image-minimal ext4
 
-   -  This example specifies to boot an initial RAM disk image and to
-      enable audio in QEMU. For this case, ``runqemu`` set the internal
-      variable ``FSTYPE`` to "cpio.gz". Also, for audio to be enabled,
+   -  This example specifies to boot an :term:`Initramfs` image and to
+      enable audio in QEMU. For this case, ``runqemu`` sets the internal
+      variable ``FSTYPE`` to ``cpio.gz``. Also, for audio to be enabled,
       an appropriate driver must be installed (see the previous
       description for the ``audio`` option for more information).
       ::
@@ -394,7 +394,7 @@
    options are basically identical. If you do not provide a MACHINE
    option, ``runqemu`` tries to determine it based on other options.
 
--  ``ramfs``: Indicates you are booting an initial RAM disk (initramfs)
+-  ``ramfs``: Indicates you are booting an :term:`Initramfs`
    image, which means the ``FSTYPE`` is ``cpio.gz``.
 
 -  ``iso``: Indicates you are booting an ISO image, which means the
diff --git a/poky/documentation/kernel-dev/common.rst b/poky/documentation/kernel-dev/common.rst
index fb8d7cd..0a1819c 100644
--- a/poky/documentation/kernel-dev/common.rst
+++ b/poky/documentation/kernel-dev/common.rst
@@ -1316,7 +1316,7 @@
 See the ":ref:`kernel-dev/common:using \`\`menuconfig\`\``" section for
 information on how to create a configuration file.
 
-Following is sample output from the ``do_kernel_configcheck`` task:
+Following is sample output from the :ref:`ref-tasks-kernel_configcheck` task:
 
 .. code-block:: none
 
@@ -1396,7 +1396,7 @@
 audit, noting any issues, making changes to correct the issues, and then
 repeating.
 
-As part of the kernel build process, the ``do_kernel_configcheck`` task
+As part of the kernel build process, the :ref:`ref-tasks-kernel_configcheck` task
 runs. This task validates the kernel configuration by checking the final
 ``.config`` file against the input files. During the check, the task
 produces warning messages for the following issues:
@@ -1430,13 +1430,13 @@
    successfully. Use this configuration file as your baseline.
 
 2. *Run Configure and Check Tasks:* Separately run the
-   ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks::
+   :ref:`ref-tasks-kernel_configme` and :ref:`ref-tasks-kernel_configcheck` tasks::
 
       $ bitbake linux-yocto -c kernel_configme -f
       $ bitbake linux-yocto -c kernel_configcheck -f
 
 3. *Process the Results:* Take the resulting list of files from the
-   ``do_kernel_configcheck`` task warnings and do the following:
+   :ref:`ref-tasks-kernel_configcheck` task warnings and do the following:
 
    -  Drop values that are redefined in the fragment but do not change
       the final ``.config`` file.
@@ -1450,7 +1450,7 @@
 
 4. *Re-Run Configure and Check Tasks:* After you have worked through the
    output of the kernel configuration audit, you can re-run the
-   ``do_kernel_configme`` and ``do_kernel_configcheck`` tasks to see the
+   :ref:`ref-tasks-kernel_configme` and :ref:`ref-tasks-kernel_configcheck` tasks to see the
    results of your changes. If you have more issues, you can deal with
    them as described in the previous step.
 
diff --git a/poky/documentation/migration-guides/migration-1.3.rst b/poky/documentation/migration-guides/migration-1.3.rst
index 6a1755d..3ba189b 100644
--- a/poky/documentation/migration-guides/migration-1.3.rst
+++ b/poky/documentation/migration-guides/migration-1.3.rst
@@ -62,7 +62,7 @@
 extending these functions using ``_append`` or ``_prepend`` complicated
 given that Python treats whitespace as syntactically significant. If you
 are defining or extending any Python functions (e.g.
-``populate_packages``, ``do_unpack``, ``do_patch`` and so forth) in
+``populate_packages``, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch` and so forth) in
 custom recipes or classes, you need to ensure you are using consistent
 four-space indentation.
 
diff --git a/poky/documentation/migration-guides/migration-1.7.rst b/poky/documentation/migration-guides/migration-1.7.rst
index 8213ab5..7b179f2 100644
--- a/poky/documentation/migration-guides/migration-1.7.rst
+++ b/poky/documentation/migration-guides/migration-1.7.rst
@@ -165,7 +165,7 @@
    more parallel execution. This change is unlikely to be an issue
    except for highly customized recipes that disable packaging tasks
    themselves by marking them as ``noexec``. For those packages, you
-   will need to disable the ``do_package_qa`` task as well.
+   will need to disable the :ref:`ref-tasks-package_qa` task as well.
 
 -  Files being overwritten during the
    :ref:`ref-tasks-populate_sysroot` task now
diff --git a/poky/documentation/migration-guides/migration-1.8.rst b/poky/documentation/migration-guides/migration-1.8.rst
index 51a1387..f058029 100644
--- a/poky/documentation/migration-guides/migration-1.8.rst
+++ b/poky/documentation/migration-guides/migration-1.8.rst
@@ -84,7 +84,7 @@
 
 Recipes that rely on the kernel source code and do not inherit the
 module classes might need to add explicit dependencies on the
-``do_shared_workdir`` kernel task, for example::
+:ref:`ref-tasks-shared_workdir` kernel task, for example::
 
    do_configure[depends] += "virtual/kernel:do_shared_workdir"
 
@@ -128,7 +128,7 @@
 re-executed.
 
 One of the improvements is to attempt to run "make clean" during the
-``do_configure`` task if a ``Makefile`` exists. Some software packages
+:ref:`ref-tasks-configure` task if a ``Makefile`` exists. Some software packages
 do not provide a working clean target within their make files. If you
 have such recipes, you need to set
 :term:`CLEANBROKEN` to "1" within the recipe, for example::
diff --git a/poky/documentation/migration-guides/migration-2.1.rst b/poky/documentation/migration-guides/migration-2.1.rst
index b2d8a0b..c19ba55 100644
--- a/poky/documentation/migration-guides/migration-2.1.rst
+++ b/poky/documentation/migration-guides/migration-2.1.rst
@@ -108,12 +108,12 @@
 bypasses the standard :ref:`ref-tasks-configure` task
 from the :ref:`autotools <ref-classes-autotools>` class and the software the recipe is building
 uses a very old version of ``autoconf``, the recipe might be incapable
-of determining the correct size of ``off_t`` during ``do_configure``.
+of determining the correct size of ``off_t`` during :ref:`ref-tasks-configure`.
 
 The best course of action is to patch the software as necessary to allow
 the default implementation from the :ref:`autotools <ref-classes-autotools>` class to work such
 that ``autoreconf`` succeeds and produces a working configure script,
-and to remove the overridden ``do_configure`` task such that the default
+and to remove the overridden :ref:`ref-tasks-configure` task such that the default
 implementation does get used.
 
 .. _migration-2.1-image-generation-split-out-from-filesystem-generation:
@@ -128,12 +128,12 @@
 operation and in the code.
 
 For most cases, this change does not present any problems. However, if
-you have made customizations that directly modify the ``do_rootfs`` task
-or that mention ``do_rootfs``, you might need to update those changes.
-In particular, if you had added any tasks after ``do_rootfs``, you
+you have made customizations that directly modify the :ref:`ref-tasks-rootfs` task
+or that mention :ref:`ref-tasks-rootfs`, you might need to update those changes.
+In particular, if you had added any tasks after :ref:`ref-tasks-rootfs`, you
 should make edits so that those tasks are after the
 :ref:`ref-tasks-image-complete` task rather than
-after ``do_rootfs`` so that your added tasks run at the correct
+after :ref:`ref-tasks-rootfs` so that your added tasks run at the correct
 time.
 
 A minor part of this restructuring is that the post-processing
diff --git a/poky/documentation/migration-guides/migration-2.4.rst b/poky/documentation/migration-guides/migration-2.4.rst
index 964ed92..8904495 100644
--- a/poky/documentation/migration-guides/migration-2.4.rst
+++ b/poky/documentation/migration-guides/migration-2.4.rst
@@ -54,7 +54,7 @@
       when "pam" is in :term:`DISTRO_FEATURES`.
 
    -  The ``switch_root`` program is now packaged in a separate
-      "util-linux-switch-root" package for small initramfs images that
+      "util-linux-switch-root" package for small :term:`Initramfs` images that
       do not need the whole ``util-linux`` package or the busybox
       binary, which are both much larger than ``switch_root``. The main
       ``util-linux`` package has a recommended runtime dependency (i.e.
diff --git a/poky/documentation/migration-guides/migration-2.5.rst b/poky/documentation/migration-guides/migration-2.5.rst
index abd2680..04f4cd7 100644
--- a/poky/documentation/migration-guides/migration-2.5.rst
+++ b/poky/documentation/migration-guides/migration-2.5.rst
@@ -261,7 +261,7 @@
    ``pkg_postinst_ontarget()`` or call
    ``postinst_intercept delay_to_first_boot`` from ``pkg_postinst()``.
    Any failure of a ``pkg_postinst()`` script (including ``exit 1``)
-   will trigger a warning during ``do_rootfs``.
+   will trigger a warning during :ref:`ref-tasks-rootfs`.
 
    For more information, see the
    ":ref:`dev-manual/common-tasks:post-installation scripts`"
diff --git a/poky/documentation/migration-guides/migration-2.6.rst b/poky/documentation/migration-guides/migration-2.6.rst
index 11e659d..32bb48b 100644
--- a/poky/documentation/migration-guides/migration-2.6.rst
+++ b/poky/documentation/migration-guides/migration-2.6.rst
@@ -135,7 +135,7 @@
 sysroot negatively affects the ability to reproduce builds. This type of
 fetching is now explicitly disabled. Consequently, any missing
 dependencies in Python recipes that use these classes now result in an
-error during the ``do_configure`` task.
+error during the :ref:`ref-tasks-configure` task.
 
 .. _migration-2.6-linux-yocto-configuration-audit-issues-now-correctly-reported:
 
diff --git a/poky/documentation/migration-guides/migration-3.1.rst b/poky/documentation/migration-guides/migration-3.1.rst
index cc788ef..a6106ee 100644
--- a/poky/documentation/migration-guides/migration-3.1.rst
+++ b/poky/documentation/migration-guides/migration-3.1.rst
@@ -234,7 +234,7 @@
 Additional warnings
 -------------------
 
-Warnings will now be shown at ``do_package_qa`` time in the following
+Warnings will now be shown at :ref:`ref-tasks-package_qa` time in the following
 circumstances:
 
 -  A recipe installs ``.desktop`` files containing ``MimeType`` keys but
diff --git a/poky/documentation/migration-guides/migration-3.2.rst b/poky/documentation/migration-guides/migration-3.2.rst
index 92b7f91..a714bd6 100644
--- a/poky/documentation/migration-guides/migration-3.2.rst
+++ b/poky/documentation/migration-guides/migration-3.2.rst
@@ -60,7 +60,7 @@
 
 There is a possible complication where some existing recipe may break, for
 example, a recipe was found to be writing to ``${B}/install`` for
-``make install`` in ``do_install`` and since ``${B}`` is listed as not to be tracked,
+``make install`` in :ref:`ref-tasks-install` and since ``${B}`` is listed as not to be tracked,
 there were errors trying to ``chown root`` for files in this location. Another
 example was the ``tcl`` recipe where the source directory :term:`S` is set to a
 subdirectory of the source tree but files were written out to the directory
@@ -191,7 +191,7 @@
 
 Globbing (``*`` and ``?`` wildcards) in ``file://`` URLs within :term:`SRC_URI`
 did not properly support file checksums, thus changes to the source files
-would not always change the do_fetch task checksum, and consequently would
+would not always change the :ref:`ref-tasks-fetch` task checksum, and consequently would
 not ensure that the changed files would be incorporated in subsequent builds.
 
 Unfortunately it is not practical to make globbing work generically here, so
@@ -207,9 +207,9 @@
 deploy class now cleans ``DEPLOYDIR`` before ``do_deploy``
 ----------------------------------------------------------
 
-``do_deploy`` as implemented in the :ref:`deploy <ref-classes-deploy>` class now cleans up ${:term:`DEPLOYDIR`} before running, just as ``do_install`` cleans up ${:term:`D`} before running. This reduces the risk of :term:`DEPLOYDIR` being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds.
+:ref:`ref-tasks-deploy` as implemented in the :ref:`deploy <ref-classes-deploy>` class now cleans up ${:term:`DEPLOYDIR`} before running, just as :ref:`ref-tasks-install` cleans up ${:term:`D`} before running. This reduces the risk of :term:`DEPLOYDIR` being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds.
 
-Most recipes and classes that inherit the :ref:`deploy <ref-classes-deploy>` class or interact with ``do_deploy`` are unlikely to be affected by this unless they add ``prefuncs`` to ``do_deploy`` *which also* put files into ``${DEPLOYDIR}`` --- these should be refactored to use ``do_deploy_prepend`` instead.
+Most recipes and classes that inherit the :ref:`deploy <ref-classes-deploy>` class or interact with :ref:`ref-tasks-deploy` are unlikely to be affected by this unless they add ``prefuncs`` to :ref:`ref-tasks-deploy` *which also* put files into ``${DEPLOYDIR}`` --- these should be refactored to use ``do_deploy_prepend`` instead.
 
 
 .. _migration-3.2-nativesdk-sdk-provides-dummy:
@@ -265,10 +265,10 @@
 
 .. _migration-3.2-initramfs-suffix:
 
-initramfs images now use a blank suffix
+Initramfs images now use a blank suffix
 ---------------------------------------
 
-The reference initramfs images (``core-image-minimal-initramfs``,
+The reference :term:`Initramfs` images (``core-image-minimal-initramfs``,
 ``core-image-tiny-initramfs`` and ``core-image-testmaster-initramfs``) now
 set an empty string for :term:`IMAGE_NAME_SUFFIX`, which otherwise defaults
 to ``".rootfs"``. These images aren't root filesystems and thus the rootfs
diff --git a/poky/documentation/migration-guides/migration-3.4.rst b/poky/documentation/migration-guides/migration-3.4.rst
index bc2c75d..4ceea7b 100644
--- a/poky/documentation/migration-guides/migration-3.4.rst
+++ b/poky/documentation/migration-guides/migration-3.4.rst
@@ -22,7 +22,7 @@
 
    SRC_URI_append = " file://somefile"
    SRC_URI_append_qemux86 = " file://somefile2"
-   SRC_URI_remove_qemux86-64 = " file://somefile3"
+   SRC_URI_remove_qemux86-64 = "file://somefile3"
    SRC_URI_prepend_qemuarm = "file://somefile4 "
    FILES_${PN}-ptest = "${bindir}/xyz"
    IMAGE_CMD_tar = "tar"
@@ -34,7 +34,7 @@
 
    SRC_URI:append = " file://somefile"
    SRC_URI:append:qemux86 = " file://somefile2"
-   SRC_URI:remove:qemux86-64 = " file://somefile3"
+   SRC_URI:remove:qemux86-64 = "file://somefile3"
    SRC_URI:prepend:qemuarm = "file://somefile4 "
    FILES:${PN}-ptest = "${bindir}/xyz"
    IMAGE_CMD:tar = "tar"
@@ -206,7 +206,7 @@
 Image / SDK generation changes
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- Recursive dependencies on the ``do_build`` task are now disabled when
+- Recursive dependencies on the :ref:`ref-tasks-build` task are now disabled when
   building SDKs. These are generally not needed; in the unlikely event
   that you do encounter problems then it will probably be as a result of
   missing explicit dependencies that need to be added.
diff --git a/poky/documentation/migration-guides/migration-4.0.rst b/poky/documentation/migration-guides/migration-4.0.rst
index 79e53f8..02d3c3e 100644
--- a/poky/documentation/migration-guides/migration-4.0.rst
+++ b/poky/documentation/migration-guides/migration-4.0.rst
@@ -93,8 +93,8 @@
 
      do_mytask[network] = "1"
 
-  This is allowed by default from ``do_fetch`` but not from any of our other standard
-  tasks. Recipes shouldn't be accessing the network outside of ``do_fetch`` as it
+  This is allowed by default from :ref:`ref-tasks-fetch` but not from any of our other standard
+  tasks. Recipes shouldn't be accessing the network outside of :ref:`ref-tasks-fetch` as it
   usually undermines fetcher source mirroring, image and licence manifests, software
   auditing and supply chain security.
 
@@ -145,7 +145,7 @@
   :ref:`python_setuptools_build_meta <ref-classes-python_setuptools_build_meta>`
   and :ref:`python_poetry_core <ref-classes-python_poetry_core>`.  
 
-- The :ref:`setuptools3 <ref-classes-setuptools3>` class ``do_install()`` task now
+- The :ref:`setuptools3 <ref-classes-setuptools3>` class :ref:`ref-tasks-install` task now
   installs the ``wheel`` binary archive. In current versions of ``setuptools`` the
   legacy ``setup.py install`` method is deprecated. If the ``setup.py`` cannot be used
   with wheels, for example it creates files outside of the Python module or standard
diff --git a/poky/documentation/migration-guides/release-4.0.rst b/poky/documentation/migration-guides/release-4.0.rst
index fe1efae..9f67daa 100644
--- a/poky/documentation/migration-guides/release-4.0.rst
+++ b/poky/documentation/migration-guides/release-4.0.rst
@@ -8,3 +8,4 @@
    release-notes-4.0.1
    release-notes-4.0.2
    release-notes-4.0.3
+   release-notes-4.0.4
diff --git a/poky/documentation/migration-guides/release-notes-3.4.rst b/poky/documentation/migration-guides/release-notes-3.4.rst
index 323e4df..de1d209 100644
--- a/poky/documentation/migration-guides/release-notes-3.4.rst
+++ b/poky/documentation/migration-guides/release-notes-3.4.rst
@@ -36,7 +36,7 @@
 
 -  Kernel-related enhancements:
 
-   -  Support zstd-compressed modules and initramfs images
+   -  Support zstd-compressed modules and :term:`Initramfs` images
    -  Allow opt-out of split kernel modules
    -  linux-yocto-dev: base AUTOREV on specified version
    -  kernel-yocto: provide debug / summary information for metadata
@@ -67,7 +67,7 @@
 
 -  SDK-related enhancements:
 
-   -  Enable do_populate_sdk with multilibs
+   -  Enable :ref:`ref-tasks-populate_sdk` with multilibs
    -  New ``SDKPATHINSTALL`` variable decouples default install path from built in path to avoid rebuilding nativesdk components on e.g. :term:`DISTRO_VERSION` changes
    -  eSDK: Error if trying to generate an eSDK from a multiconfig
    -  eSDK: introduce :term:`TOOLCHAIN_HOST_TASK_ESDK` to be used in place of :term:`TOOLCHAIN_HOST_TASK` to add components to the host part of the eSDK
@@ -211,7 +211,7 @@
 Other license-related notes:
 
 -  When creating recipes for Python software, recipetool will now treat "BSD" as "BSD-3-Clause" for the purposes of setting LICENSE, as that is the most common understanding.
--  Please be aware that an initramfs bundled with the kernel using :term:`INITRAMFS_IMAGE_BUNDLE` should only contain GPLv2-compatible software; this is now mentioned in the documentation.
+-  Please be aware that an :term:`Initramfs` bundled with the kernel using :term:`INITRAMFS_IMAGE_BUNDLE` should only contain GPLv2-compatible software; this is now mentioned in the documentation.
 
 Security Fixes in 3.4
 ~~~~~~~~~~~~~~~~~~~~~
diff --git a/poky/documentation/migration-guides/release-notes-4.0.4.rst b/poky/documentation/migration-guides/release-notes-4.0.4.rst
new file mode 100644
index 0000000..2623a1d
--- /dev/null
+++ b/poky/documentation/migration-guides/release-notes-4.0.4.rst
@@ -0,0 +1,299 @@
+Release notes for Yocto-4.0.4 (Kirkstone)
+-----------------------------------------
+
+Security Fixes in Yocto-4.0.4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+-  binutils : fix :cve:`2022-38533`
+-  curl: fix :cve:`2022-35252`
+-  sqlite: fix :cve:`2022-35737`
+-  grub2: fix :cve:`2021-3695`, :cve:`2021-3696`, :cve:`2021-3697`, :cve:`2022-28733`, :cve:`2022-28734` and :cve:`2022-28735`
+-  u-boot: fix :cve:`2022-30552` and :cve:`2022-33967`
+-  libxml2: Ignore :cve:`2016-3709`
+-  libtiff: fix :cve:`2022-34526`
+-  zlib: fix :cve:`2022-37434`
+-  gnutls: fix :cve:`2022-2509`
+-  u-boot: fix :cve:`2022-33103`
+-  qemu: fix :cve:`2021-3507`, :cve:`2021-3929`, :cve:`2021-4158`, :cve:`2022-0216` and :cve:`2022-0358`
+
+
+Fixes in Yocto-4.0.4
+~~~~~~~~~~~~~~~~~~~~
+
+-  apr: Cache configure tests which use AC_TRY_RUN
+-  apr: Use correct strerror_r implementation based on libc type
+-  apt: fix nativesdk-apt build failure during the second time build
+-  archiver.bbclass: remove unsed do_deploy_archives[dirs]
+-  archiver.bbclass: some recipes that uses the kernelsrc bbclass uses the shared source
+-  autoconf: Fix strict prototype errors in generated tests
+-  autoconf: Update K & R stype functions
+-  bind: upgrade to 9.18.5
+-  bitbake.conf: set BB_DEFAULT_UMASK using ??=
+-  bitbake: ConfHandler/BBHandler: Improve comment error messages and add tests
+-  bitbake: ConfHandler: Remove lingering close
+-  bitbake: bb/utils: movefile: use the logger for printing
+-  bitbake: bb/utils: remove: check the path again the expand python glob
+-  bitbake: bitbake-user-manual: Correct description of the ??= operator
+-  bitbake: bitbake-user-manual: npm fetcher: improve description of SRC_URI format
+-  bitbake: bitbake: bitbake-user-manual: hashserv can be accessed on a dedicated domain
+-  bitbake: bitbake: runqueue: add cpu/io pressure regulation
+-  bitbake: bitbake: runqueue: add memory pressure regulation
+-  bitbake: cooker: Drop sre_constants usage
+-  bitbake: doc: bitbake-user-manual: add explicit target for crates fetcher
+-  bitbake: doc: bitbake-user-manual: document npm and npmsw fetchers
+-  bitbake: event.py: ignore exceptions from stdout and sterr operations in atexit
+-  bitbake: fetch2: Ensure directory exists before creating symlink
+-  bitbake: fetch2: gitsm: fix incorrect handling of git submodule relative urls
+-  bitbake: runqueue: Change pressure file warning to a note
+-  bitbake: runqueue: Fix unihash cache mismatch issues
+-  bitbake: toaster: fix kirkstone version
+-  bitbake: utils: Pass lock argument in fileslocked
+-  bluez5: upgrade to 5.65
+-  boost: fix install of fiber shared libraries
+-  cairo: Adapt the license information based on what is being built
+-  classes: cve-check: Get shared database lock
+-  cmake: remove CMAKE_ASM_FLAGS variable in toolchain file
+-  connman: Backports for security fixes
+-  core-image.bbclass: Exclude openssh complementary packages
+-  cracklib: Drop using register keyword
+-  cracklib: upgrade to 2.9.8
+-  create-spdx: Fix supplier field
+-  create-spdx: handle links to inaccessible locations
+-  create-spdx: ignore packing control files from ipk and deb
+-  cve-check: Don't use f-strings
+-  cve-check: close cursors as soon as possible
+-  devtool/upgrade: catch bb.fetch2.decodeurl errors
+-  devtool/upgrade: correctly clean up when recipe filename isn't yet known
+-  devtool: error out when workspace is using old override syntax
+-  ell: upgrade to 0.50
+-  epiphany: upgrade to 42.4
+-  externalsrc: Don't wipe out src dir when EXPORT_FUNCTIONS is used.
+-  gcc-multilib-config: Fix i686 toolchain relocation issues
+-  gcr: Define _GNU_SOURCE
+-  gdk-pixbuf: upgrade to 2.42.9
+-  glib-networking: upgrade to 2.72.2
+-  go: upgrade to v1.17.13
+-  insane.bbclass: Skip patches not in oe-core by full path
+-  iso-codes: upgrade to 4.11.0
+-  kernel-fitimage.bbclass: add padding algorithm property in config nodes
+-  kernel-fitimage.bbclass: only package unique DTBs
+-  kernel: Always set CC and LD for the kernel build
+-  kernel: Use consistent make flags for menuconfig
+-  lib:npm_registry: initial checkin
+-  libatomic-ops: upgrade to 7.6.14
+-  libcap: upgrade to 2.65
+-  libjpeg-turbo: upgrade to 2.1.4
+-  libpam: use /run instead of /var/run in systemd tmpfiles
+-  libtasn1: upgrade to 4.19.0
+-  liburcu: upgrade to 0.13.2
+-  libwebp: upgrade to 1.2.4
+-  libwpe: upgrade to 1.12.3
+-  libxml2: Port gentest.py to Python-3
+-  lighttpd: upgrade to 1.4.66
+-  linux-yocto/5.10: update genericx86* machines to v5.10.135
+-  linux-yocto/5.10: update to v5.10.137
+-  linux-yocto/5.15: update genericx86* machines to v5.15.59
+-  linux-yocto/5.15: update to v5.15.62
+-  linux-yocto: Fix COMPATIBLE_MACHINE regex match
+-  linux-yocto: prepend the the value with a space when append to KERNEL_EXTRA_ARGS
+-  lttng-modules: fix 5.19+ build
+-  lttng-modules: fix build against mips and v5.19 kernel
+-  lttng-modules: fix build for kernel 5.10.137
+-  lttng-modules: replace mips compaction fix with upstream change
+-  lz4: upgrade to 1.9.4
+-  maintainers: update opkg maintainer
+-  meta: introduce UBOOT_MKIMAGE_KERNEL_TYPE
+-  migration guides: add missing release notes
+-  mobile-broadband-provider-info: upgrade to 20220725
+-  nativesdk: Clear TUNE_FEATURES
+-  npm: replace 'npm pack' call by 'tar czf'
+-  npm: return content of 'package.json' in 'npm_pack'
+-  npm: take 'version' directly from 'package.json'
+-  npm: use npm_registry to cache package
+-  oeqa/gotoolchain: put writable files in the Go module cache
+-  oeqa/gotoolchain: set CGO_ENABLED=1
+-  oeqa/parselogs: add qemuarmv5 arm-charlcd masking
+-  oeqa/qemurunner: add run_serial() comment
+-  oeqa/selftest: rename git.py to intercept.py
+-  oeqa: qemurunner: Report UNIX Epoch timestamp on login
+-  package_rpm: Do not replace square brackets in %files
+-  packagegroup-self-hosted: update for strace
+-  parselogs: Ignore xf86OpenConsole error
+-  perf: Fix reproducibility issues with 5.19 onwards
+-  pinentry: enable _XOPEN_SOURCE on musl for wchar usage in curses
+-  poky.conf: add ubuntu-22.04 to tested distros
+-  poky.conf: bump version for 4.0.4
+-  pseudo: Update to include recent upstream minor fixes
+-  python3-pip: Fix RDEPENDS after the update
+-  ref-manual: add numa to machine features
+-  relocate_sdk.py: ensure interpreter size error causes relocation to fail
+-  rootfs-postcommands.bbclass: avoid moving ssh host keys if etc is writable
+-  rootfs.py: dont try to list installed packages for baremetal images
+-  rootfspostcommands.py: Cleanup subid backup files generated by shadow-utils
+-  ruby: drop capstone support
+-  runqemu: Add missing space on default display option
+-  runqemu: display host uptime when starting
+-  sanity: add a comment to ensure CONNECTIVITY_CHECK_URIS is correct
+-  scripts/oe-setup-builddir: make it known where configurations come from
+-  scripts/runqemu.README: fix typos and trailing whitespaces
+-  selftest/wic: Tweak test case to not depend on kernel size
+-  shadow: Avoid nss warning/error with musl
+-  shadow: Enable subid support
+-  system-requirements.rst: Add Ubuntu 22.04 to list of supported distros
+-  systemd: Add 'no-dns-fallback' PACKAGECONFIG option
+-  systemd: Fix unwritable /var/lock when no sysvinit handling
+-  sysvinit-inittab/start_getty: Fix respawn too fast
+-  tcp-wrappers: Fix implicit-function-declaration warnings
+-  tzdata: upgrade to 2022b
+-  util-linux: Remove --enable-raw from EXTRA_OECONF
+-  vala: upgrade to 0.56.3
+-  vim: Upgrade to 9.0.0453
+-  watchdog: Include needed system header for function decls
+-  webkitgtk: upgrade to 2.36.5
+-  weston: upgrade to 10.0.2
+-  wic/bootimg-efi: use cross objcopy when building unified kernel image
+-  wic: add target tools to PATH when executing native commands
+-  wic: depend on cross-binutils
+-  wireless-regdb: upgrade to 2022.08.12
+-  wpebackend-fdo: upgrade to 1.12.1
+-  xinetd: Pass missing -D_GNU_SOURCE
+-  xz: update to 5.2.6
+
+
+Known Issues in Yocto-4.0.4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- N/A
+
+
+Contributors to Yocto-4.0.4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+-  Alejandro Hernandez Samaniego
+-  Alex Stewart
+-  Alexander Kanavin
+-  Alexandre Belloni
+-  Andrei Gherzan
+-  Anuj Mittal
+-  Aryaman Gupta
+-  Awais Belal
+-  Beniamin Sandu
+-  Bertrand Marquis
+-  Bruce Ashfield
+-  Changqing Li
+-  Chee Yang Lee
+-  Daiane Angolini
+-  Enrico Scholz
+-  Ernst Sjöstrand
+-  Gennaro Iorio
+-  Hitendra Prajapati
+-  Jacob Kroon
+-  Jon Mason
+-  Jose Quaresma
+-  Joshua Watt
+-  Kai Kang
+-  Khem Raj
+-  Kristian Amlie
+-  LUIS ENRIQUEZ
+-  Mark Hatle
+-  Martin Beeger
+-  Martin Jansa
+-  Mateusz Marciniec
+-  Michael Opdenacker
+-  Mihai Lindner
+-  Mikko Rapeli
+-  Ming Liu
+-  Niko Mauno
+-  Ola x Nilsson
+-  Otavio Salvador
+-  Paul Eggleton
+-  Pavel Zhukov
+-  Peter Bergin
+-  Peter Kjellerstedt
+-  Peter Marko
+-  Rajesh Dangi
+-  Randy MacLeod
+-  Rasmus Villemoes
+-  Richard Purdie
+-  Robert Joslyn
+-  Roland Hieber
+-  Ross Burton
+-  Sakib Sajal
+-  Shubham Kulkarni
+-  Steve Sakoman
+-  Ulrich Ölmann
+-  Yang Xu
+-  Yongxin Liu
+-  ghassaneben
+-  pgowda
+-  wangmy
+
+Repositories / Downloads for Yocto-4.0.4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+poky
+
+-  Repository Location: https://git.yoctoproject.org/git/poky
+-  Branch: :yocto_git:`kirkstone </poky/log/?h=kirkstone>`
+-  Tag:  :yocto_git:`yocto-4.0.4 </poky/log/?h=yocto-4.0.4>`
+-  Git Revision: :yocto_git:`d64bef1c7d713b92a51228e5ade945835e5a94a4 </poky/commit/?id=d64bef1c7d713b92a51228e5ade945835e5a94a4>`
+-  Release Artefact: poky-d64bef1c7d713b92a51228e5ade945835e5a94a4
+-  sha: b5e92506b31f88445755bad2f45978b747ad1a5bea66ca897370542df5f1e7db
+-  Download Locations:
+   http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.4/poky-d64bef1c7d713b92a51228e5ade945835e5a94a4.tar.bz2
+   http://mirrors.kernel.org/yocto/yocto/yocto-4.0.4/poky-d64bef1c7d713b92a51228e5ade945835e5a94a4.tar.bz2
+
+openembedded-core
+
+-  Repository Location: https://git.openembedded.org/openembedded-core
+-  Branch: :oe_git:`kirkstone </openembedded-core/log/?h=kirkstone>`
+-  Tag:  :oe_git:`yocto-4.0.4 </openembedded-core/log/?h=yocto-4.0.4>`
+-  Git Revision: :oe_git:`f7766da462905ec67bf549d46b8017be36cd5b2a </openembedded-core/commit/?id=f7766da462905ec67bf549d46b8017be36cd5b2a>`
+-  Release Artefact: oecore-f7766da462905ec67bf549d46b8017be36cd5b2a
+-  sha: ce0ac011474db5e5f0bb1be3fb97f890a02e46252a719dbcac5813268e48ff16
+-  Download Locations:
+   http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.4/oecore-f7766da462905ec67bf549d46b8017be36cd5b2a.tar.bz2
+   http://mirrors.kernel.org/yocto/yocto/yocto-4.0.4/oecore-f7766da462905ec67bf549d46b8017be36cd5b2a.tar.bz2
+
+meta-mingw
+
+-  Repository Location: https://git.yoctoproject.org/git/meta-mingw
+-  Branch: :yocto_git:`kirkstone </meta-mingw/log/?h=kirkstone>`
+-  Tag:  :yocto_git:`yocto-4.0.4 </meta-mingw/log/?h=yocto-4.0.4>`
+-  Git Revision: :yocto_git:`a90614a6498c3345704e9611f2842eb933dc51c1 </meta-mingw/commit/?id=a90614a6498c3345704e9611f2842eb933dc51c1>`
+-  Release Artefact: meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1
+-  sha: 49f9900bfbbc1c68136f8115b314e95d0b7f6be75edf36a75d9bcd1cca7c6302
+-  Download Locations:
+   http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.4/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
+   http://mirrors.kernel.org/yocto/yocto/yocto-4.0.4/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
+
+meta-gplv2
+
+-  Repository Location: https://git.yoctoproject.org/git/meta-gplv2
+-  Branch: :yocto_git:`kirkstone </meta-gplv2/log/?h=kirkstone>`
+-  Tag:  :yocto_git:`yocto-4.0.4 </meta-gplv2/log/?h=yocto-4.0.4>`
+-  Git Revision: :yocto_git:`d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a </meta-gplv2/commit/?id=d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a>`
+-  Release Artefact: meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a
+-  sha: c386f59f8a672747dc3d0be1d4234b6039273d0e57933eb87caa20f56b9cca6d
+-  Download Locations:
+   http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.4/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
+   http://mirrors.kernel.org/yocto/yocto/yocto-4.0.4/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
+
+bitbake
+
+-  Repository Location: https://git.openembedded.org/bitbake
+-  Branch: :oe_git:`2.0 </bitbake/log/?h=2.0>`
+-  Tag:  :oe_git:`yocto-4.0.4 </bitbake/log/?h=yocto-4.0.4>`
+-  Git Revision: :oe_git:`ac576d6fad6bba0cfea931883f25264ea83747ca </bitbake/commit/?id=ac576d6fad6bba0cfea931883f25264ea83747ca>`
+-  Release Artefact: bitbake-ac576d6fad6bba0cfea931883f25264ea83747ca
+-  sha: 526c2768874eeda61ade8c9ddb3113c90d36ef44a026d6690f02de6f3dd0ea12
+-  Download Locations:
+   http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.4/bitbake-ac576d6fad6bba0cfea931883f25264ea83747ca.tar.bz2
+   http://mirrors.kernel.org/yocto/yocto/yocto-4.0.4/bitbake-ac576d6fad6bba0cfea931883f25264ea83747ca.tar.bz2
+
+yocto-docs
+
+-  Repository Location: https://git.yoctoproject.org/git/yocto-docs
+-  Branch: :yocto_git:`kirkstone </yocto-docs/log/?h=kirkstone>`
+-  Tag: :yocto_git:`yocto-4.0.4 </yocto-docs/log/?h=yocto-4.0.4>`
+-  Git Revision: :yocto_git:`f632dad24c39778f948014029e74db3c871d9d21 </yocto-docs/commit/?id=f632dad24c39778f948014029e74db3c871d9d21>`
diff --git a/poky/documentation/migration-guides/release-notes-4.0.rst b/poky/documentation/migration-guides/release-notes-4.0.rst
index b675cae..a61ccc6 100644
--- a/poky/documentation/migration-guides/release-notes-4.0.rst
+++ b/poky/documentation/migration-guides/release-notes-4.0.rst
@@ -30,7 +30,7 @@
 
 - New :ref:`overlayfs <ref-classes-overlayfs>` and
   :ref:`overlayfs-etc <ref-classes-overlayfs-etc>` classes and
-  ``overlayroot`` support in the initramfs framework to make it easier to
+  ``overlayroot`` support in the :term:`Initramfs` framework to make it easier to
   overlay read-only filesystems (for example) with
   `OverlayFS <https://en.wikipedia.org/wiki/OverlayFS>`__.
 
@@ -168,7 +168,7 @@
 
 -  Kernel-related enhancements:
 
-   - Allow initramfs to be built from a separate multiconfig
+   - Allow :term:`Initramfs` to be built from a separate multiconfig
    - Make kernel-base recommend kernel-image, not depend (allowing images containing kernel modules without kernel image)
    - linux-yocto: split vtpm for more granular inclusion
    - linux-yocto: cfg/debug: add configs for kcsan
@@ -182,7 +182,7 @@
 
 - FIT image related enhancements:
 
-   - New ``FIT_SUPPORTED_INITRAMFS_FSTYPES`` variable to allow extending initramfs image types to look for
+   - New ``FIT_SUPPORTED_INITRAMFS_FSTYPES`` variable to allow extending :term:`Initramfs` image types to look for
    - New ``FIT_CONF_PREFIX`` variable to allow overriding FIT configuration prefix
    - Use 'bbnote' for better logging
 
@@ -276,7 +276,7 @@
 - volatile-binds: SELinux and overlayfs extensions in mount-copybind
 - gtk-icon-cache: Allow using gtk4
 - kmod: Add an exclude directive to depmod
-- os-release: add os-release-initrd package for use in systemd-based initramfs images
+- os-release: add os-release-initrd package for use in systemd-based :term:`Initramfs` images
 - gstreamer1.0-plugins-base: add support for graphene
 - gpg-sign: Add parameters to gpg signature function
 - package_manager: sign DEB package feeds
diff --git a/poky/documentation/overview-manual/concepts.rst b/poky/documentation/overview-manual/concepts.rst
index 8e0303f..39b8713 100644
--- a/poky/documentation/overview-manual/concepts.rst
+++ b/poky/documentation/overview-manual/concepts.rst
@@ -703,16 +703,12 @@
 
 .. note::
 
-   For every local file (e.g.
-   file://
-   ) that is part of a recipe's
-   SRC_URI
-   statement, the OpenEmbedded build system takes a checksum of the file
-   for the recipe and inserts the checksum into the signature for the
-   do_fetch
-   task. If any local file has been modified, the
-   do_fetch
-   task and all tasks that depend on it are re-executed.
+   For every local file (e.g. ``file://``) that is part of a recipe's
+   :term:`SRC_URI` statement, the OpenEmbedded build system takes a
+   checksum of the file for the recipe and inserts the checksum into
+   the signature for the :ref:`ref-tasks-fetch` task. If any local
+   file has been modified, the :ref:`ref-tasks-fetch` task and all
+   tasks that depend on it are re-executed.
 
 By default, everything is accomplished in the Build Directory, which has
 a defined structure. For additional general information on the Build
@@ -892,7 +888,7 @@
 looking at shared library dependencies between packages, and looking at
 package relationships.
 
-The ``do_packagedata`` task creates package metadata based on the
+The :ref:`ref-tasks-packagedata` task creates package metadata based on the
 analysis such that the build system can generate the final packages. The
 :ref:`ref-tasks-populate_sysroot`
 task stages (copies) a subset of the files installed by the
@@ -905,7 +901,7 @@
    individual packages.
 
 -  :term:`PKGDESTWORK`: A
-   temporary work area (i.e. ``pkgdata``) used by the ``do_package``
+   temporary work area (i.e. ``pkgdata``) used by the :ref:`ref-tasks-package`
    task to save package metadata.
 
 -  :term:`PKGDEST`: The parent
@@ -1012,7 +1008,7 @@
 the package installation phase since the root filesystem on the target
 is read-only.
 
-The final stages of the ``do_rootfs`` task handle post processing. Post
+The final stages of the :ref:`ref-tasks-rootfs` task handle post processing. Post
 processing includes creation of a manifest file and optimizations.
 
 The manifest file (``.manifest``) resides in the same directory as the
@@ -1036,7 +1032,7 @@
 variable. This variable specifies a list of functions to call before the
 build system creates the final image output files.
 
-The build system dynamically creates ``do_image_*`` tasks as needed,
+The build system dynamically creates :ref:`do_image_* <ref-tasks-image>` tasks as needed,
 based on the image types specified in the
 :term:`IMAGE_FSTYPES` variable.
 The process turns everything into an image file or a set of image files
@@ -1085,7 +1081,7 @@
    For more information on the cross-development toolchain generation,
    see the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
    section. For information on advantages gained when building a
-   cross-development toolchain using the do_populate_sdk task, see the
+   cross-development toolchain using the :ref:`ref-tasks-populate_sdk` task, see the
    ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" section in
    the Yocto Project Application Development and the Extensible Software
    Development Kit (eSDK) manual.
@@ -1100,13 +1096,13 @@
 see the ":ref:`overview-manual/concepts:application development sdk`"
 section.
 
-The ``do_populate_sdk`` task helps create the standard SDK and handles
+The :ref:`ref-tasks-populate_sdk` task helps create the standard SDK and handles
 two parts: a target part and a host part. The target part is the part
 built for the target hardware and includes libraries and headers. The
 host part is the part of the SDK that runs on the
 :term:`SDKMACHINE`.
 
-The ``do_populate_sdk_ext`` task helps create the extensible SDK and
+The :ref:`ref-tasks-populate_sdk_ext` task helps create the extensible SDK and
 handles host and target parts differently than its counter part does for
 the standard SDK. For the extensible SDK, the task encapsulates the
 build system, which includes everything needed (host and target) for the
@@ -1198,7 +1194,7 @@
 
 In the build system, the common tasks that have setscene variants are
 :ref:`ref-tasks-package`,
-``do_package_write_*``,
+:ref:`do_package_write_* <ref-tasks-package_write_deb>`,
 :ref:`ref-tasks-deploy`,
 :ref:`ref-tasks-packagedata`, and
 :ref:`ref-tasks-populate_sysroot`.
@@ -1208,15 +1204,15 @@
 The build system has knowledge of the relationship between these tasks
 and other preceding tasks. For example, if BitBake runs
 ``do_populate_sysroot_setscene`` for something, it does not make sense
-to run any of the ``do_fetch``, ``do_unpack``, ``do_patch``,
-``do_configure``, ``do_compile``, and ``do_install`` tasks. However, if
-``do_package`` needs to be run, BitBake needs to run those other tasks.
+to run any of the :ref:`ref-tasks-fetch`, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch`,
+:ref:`ref-tasks-configure`, :ref:`ref-tasks-compile`, and :ref:`ref-tasks-install` tasks. However, if
+:ref:`ref-tasks-package` needs to be run, BitBake needs to run those other tasks.
 
 It becomes more complicated if everything can come from an sstate cache
 because some objects are simply not required at all. For example, you do
 not need a compiler or native tools, such as quilt, if there isn't anything
-to compile or patch. If the ``do_package_write_*`` packages are available
-from sstate, BitBake does not need the ``do_package`` task data.
+to compile or patch. If the :ref:`do_package_write_* <ref-tasks-package_write_deb>` packages are available
+from sstate, BitBake does not need the :ref:`ref-tasks-package` task data.
 
 To handle all these complexities, BitBake runs in two phases. The first
 is the "setscene" stage. During this stage, BitBake first checks the
@@ -1801,14 +1797,14 @@
 
 The following list explains the previous example:
 
--  Adding "do_deploy" to ``SSTATETASKS`` adds some required
+-  Adding ``do_deploy`` to ``SSTATETASKS`` adds some required
    sstate-related processing, which is implemented in the
    :ref:`sstate <ref-classes-sstate>` class, to
    before and after the
    :ref:`ref-tasks-deploy` task.
 
 -  The ``do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"`` declares that
-   ``do_deploy`` places its output in ``${DEPLOYDIR}`` when run normally
+   :ref:`ref-tasks-deploy` places its output in ``${DEPLOYDIR}`` when run normally
    (i.e. when not using the sstate cache). This output becomes the input
    to the shared state cache.
 
@@ -1818,15 +1814,15 @@
 
    .. note::
 
-      If ``do_deploy`` is not already in the shared state cache or if its input
+      If :ref:`ref-tasks-deploy` is not already in the shared state cache or if its input
       checksum (signature) has changed from when the output was cached, the task
       runs to populate the shared state cache, after which the contents of the
       shared state cache is copied to ${:term:`DEPLOY_DIR_IMAGE`}. If
-      ``do_deploy`` is in the shared state cache and its signature indicates
+      :ref:`ref-tasks-deploy` is in the shared state cache and its signature indicates
       that the cached output is still valid (i.e. if no relevant task inputs
       have changed), then the contents of the shared state cache copies
       directly to ${:term:`DEPLOY_DIR_IMAGE`} by the ``do_deploy_setscene`` task
-      instead, skipping the ``do_deploy`` task.
+      instead, skipping the :ref:`ref-tasks-deploy` task.
 
 -  The following task definition is glue logic needed to make the
    previous settings effective::
@@ -1836,16 +1832,16 @@
       }
       addtask do_deploy_setscene
 
-  ``sstate_setscene()`` takes the flags above as input and accelerates the ``do_deploy`` task
+  ``sstate_setscene()`` takes the flags above as input and accelerates the :ref:`ref-tasks-deploy` task
   through the shared state cache if possible. If the task was
   accelerated, ``sstate_setscene()`` returns True. Otherwise, it
-  returns False, and the normal ``do_deploy`` task runs. For more
+  returns False, and the normal :ref:`ref-tasks-deploy` task runs. For more
   information, see the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-execution:setscene`"
   section in the BitBake User Manual.
 
 -  The ``do_deploy[dirs] = "${DEPLOYDIR} ${B}"`` line creates
-   ``${DEPLOYDIR}`` and ``${B}`` before the ``do_deploy`` task runs, and
-   also sets the current working directory of ``do_deploy`` to ``${B}``.
+   ``${DEPLOYDIR}`` and ``${B}`` before the :ref:`ref-tasks-deploy` task runs, and
+   also sets the current working directory of :ref:`ref-tasks-deploy` to ``${B}``.
    For more information, see the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags`"
    section in the BitBake
    User Manual.
@@ -1854,7 +1850,7 @@
 
       In cases where ``sstate-inputdirs`` and ``sstate-outputdirs`` would be
       the same, you can use ``sstate-plaindirs``. For example, to preserve the
-      ${:term:`PKGD`} and ${:term:`PKGDEST`} output from the ``do_package``
+      ${:term:`PKGD`} and ${:term:`PKGDEST`} output from the :ref:`ref-tasks-package`
       task, use the following::
 
               do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}"
@@ -2101,12 +2097,12 @@
    :term:`PRIVATE_LIBS` inside
    the package's recipe.
 
--  ``pcdeps``: During the ``do_package`` task of each recipe, all
+-  ``pcdeps``: During the :ref:`ref-tasks-package` task of each recipe, all
    pkg-config modules (``*.pc`` files) installed by the recipe are
    located. For each module, the package that contains the module is
    registered as providing the module. The resulting module-to-package
    mapping is saved globally in :term:`PKGDATA_DIR` by the
-   ``do_packagedata`` task.
+   :ref:`ref-tasks-packagedata` task.
 
    Simultaneously, all pkg-config modules installed by the recipe are
    inspected to see what other pkg-config modules they depend on. A
@@ -2147,7 +2143,7 @@
    :term:`ALLOW_EMPTY` variable
    for more information.
 
-The ``do_package`` task depends on the ``do_packagedata`` task of each
+The :ref:`ref-tasks-package` task depends on the :ref:`ref-tasks-packagedata` task of each
 recipe in :term:`DEPENDS` through use
 of a ``[``\ :ref:`deptask <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags>`\ ``]``
 declaration, which guarantees that the required
@@ -2162,8 +2158,8 @@
 :ref:`ref-tasks-install`,
 :ref:`do_package_write* <ref-tasks-package_write_deb>`,
 :ref:`ref-tasks-rootfs`, and
-:ref:`do_image* <ref-tasks-image>`). For example,
-the ``do_install`` task benefits from being able to set the UID and GID
+:ref:`do_image_* <ref-tasks-image>`). For example,
+the :ref:`ref-tasks-install` task benefits from being able to set the UID and GID
 of installed files to arbitrary values.
 
 One approach to allowing tasks to perform root-only operations would be
diff --git a/poky/documentation/ref-manual/classes.rst b/poky/documentation/ref-manual/classes.rst
index 11e0d47..5e49613 100644
--- a/poky/documentation/ref-manual/classes.rst
+++ b/poky/documentation/ref-manual/classes.rst
@@ -47,7 +47,7 @@
    even if the recipes do not produce architecture-specific output.
 
    Configuring such recipes for all architectures causes the
-   ``do_package_write_*`` tasks to
+   :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to
    have different signatures for the machines with different tunings.
    Additionally, unnecessary rebuilds occur every time an image for a
    different :term:`MACHINE` is built even when the recipe never changes.
@@ -444,7 +444,7 @@
 ``devshell.bbclass``
 ====================
 
-The ``devshell`` class adds the ``do_devshell`` task. Distribution
+The ``devshell`` class adds the :ref:`ref-tasks-devshell` task. Distribution
 policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
 section in the Yocto Project Development Tasks Manual for more
 information about using ``devshell``.
@@ -1081,12 +1081,12 @@
    might result in host contamination of the build output.
 
 -  ``installed-vs-shipped:`` Reports when files have been installed
-   within ``do_install`` but have not been included in any package by
+   within :ref:`ref-tasks-install` but have not been included in any package by
    way of the :term:`FILES` variable. Files that do not
    appear in any package cannot be present in an image later on in the
    build process. Ideally, all installed files should be packaged or not
    installed at all. These files can be deleted at the end of
-   ``do_install`` if the files are not needed in any package.
+   :ref:`ref-tasks-install` if the files are not needed in any package.
 
 -  ``invalid-chars:`` Checks that the recipe metadata variables
    :term:`DESCRIPTION`,
@@ -1256,9 +1256,9 @@
 packages such as ``kernel-vmlinux``.
 
 The ``kernel`` class contains logic that allows you to embed an initial
-RAM filesystem (initramfs) image when you build the kernel image. For
-information on how to build an initramfs, see the
-":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section in
+RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
+information on how to build an :term:`Initramfs`, see the
+":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section in
 the Yocto Project Development Tasks Manual.
 
 Various other classes are used by the ``kernel`` and ``module`` classes
@@ -1339,7 +1339,7 @@
 ``kernel-fitimage`` and the boot script is optional.
 The boot script is specified in the ITS file as a text file containing
 U-boot commands. When using a boot script the user should configure the
-U-boot ``do_install`` task to copy the script to sysroot.
+U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
 So the script can be included in the FIT image by the ``kernel-fitimage``
 class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
 load the boot script from the FIT image and executes it.
@@ -2401,7 +2401,7 @@
 
    .. note::
 
-      The ``setuptools3`` class ``do_compile()`` task now calls
+      The ``setuptools3`` class :ref:`ref-tasks-compile` task now calls
       ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
       (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
 
@@ -2412,7 +2412,7 @@
 
    .. note::
 
-     The ``setuptools3`` class ``do_install()`` task now installs the ``wheel``
+     The ``setuptools3`` class :ref:`ref-tasks-install` task now installs the ``wheel``
      binary archive. In current versions of ``setuptools`` the legacy ``setup.py
      install`` method is deprecated. If the ``setup.py`` cannot be used with
      wheels, for example it creates files outside of the Python module or
@@ -2527,7 +2527,7 @@
    want to share with other recipes that have dependencies on the
    originating recipe. Normally these dependencies are installed through
    the :ref:`ref-tasks-install` task into
-   ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task
+   ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
    copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
    subset of files is controlled by the
    :term:`SYSROOT_DIRS`,
diff --git a/poky/documentation/ref-manual/faq.rst b/poky/documentation/ref-manual/faq.rst
index 6104952..af49d57 100644
--- a/poky/documentation/ref-manual/faq.rst
+++ b/poky/documentation/ref-manual/faq.rst
@@ -54,13 +54,10 @@
 
 **Q:** Are there any products built using the OpenEmbedded build system?
 
-**A:** The software running on the `Vernier
-LabQuest <https://vernier.com/labquest/>`__ is built using the
-OpenEmbedded build system. See the `Vernier
-LabQuest <https://www.vernier.com/products/interfaces/labq/>`__ website
-for more information. There are a number of pre-production devices using
-the OpenEmbedded build system and the Yocto Project team announces them
-as soon as they are released.
+**A:** See :yocto_wiki:`Products that use the Yocto Project
+</Project_Users#Products_that_use_the_Yocto_Project>` in the Yocto Project
+Wiki. Don't hesitate to contribute to this page if you know other such
+products.
 
 **Q:** What does the OpenEmbedded build system produce as output?
 
@@ -437,7 +434,7 @@
 **Q:** The files provided by my ``*-native`` recipe do not appear to be
 available to other recipes. Files are missing from the native sysroot,
 my recipe is installing to the wrong place, or I am getting permissions
-errors during the do_install task in my recipe! What is wrong?
+errors during the :ref:`ref-tasks-install` task in my recipe! What is wrong?
 
 **A:** This situation results when a build system does not recognize the
 environment variables supplied to it by :term:`BitBake`. The
diff --git a/poky/documentation/ref-manual/images.rst b/poky/documentation/ref-manual/images.rst
index 31fb567..4b771d0 100644
--- a/poky/documentation/ref-manual/images.rst
+++ b/poky/documentation/ref-manual/images.rst
@@ -78,11 +78,11 @@
    libraries you can use in a host development environment.
 
 -  ``core-image-minimal-initramfs``: A ``core-image-minimal`` image that
-   has the Minimal RAM-based Initial Root Filesystem (initramfs) as part
+   has the Minimal RAM-based Initial Root Filesystem (:term:`Initramfs`) as part
    of the kernel, which allows the system to find the first "init"
    program more efficiently. See the
    :term:`PACKAGE_INSTALL` variable for
-   additional information helpful when working with initramfs images.
+   additional information helpful when working with :term:`Initramfs` images.
 
 -  ``core-image-minimal-mtdutils``: A ``core-image-minimal`` image that
    has support for the Minimal MTD Utilities, which let the user
@@ -121,7 +121,7 @@
    section in the Yocto Project Development Tasks Manual.
 
 -  ``core-image-testmaster-initramfs``: A RAM-based Initial Root
-   Filesystem (initramfs) image tailored for use with the
+   Filesystem (:term:`Initramfs`) image tailored for use with the
    ``core-image-testmaster`` image.
 
 -  ``core-image-weston``: A very basic Wayland image with a terminal.
diff --git a/poky/documentation/ref-manual/qa-checks.rst b/poky/documentation/ref-manual/qa-checks.rst
index fbab1dc..9455bec 100644
--- a/poky/documentation/ref-manual/qa-checks.rst
+++ b/poky/documentation/ref-manual/qa-checks.rst
@@ -162,7 +162,7 @@
    normally expected to be empty (such as ``/tmp``). These files may
    be more appropriately installed to a different location, or
    perhaps alternatively not installed at all, usually by updating the
-   ``do_install`` task/function.
+   :ref:`ref-tasks-install` task/function.
 
 .. _qa-check-arch:
 
@@ -536,7 +536,7 @@
       in (e.g. ``FILES:${``\ :term:`PN`\ ``}`` for the main
       package).
 
-   -  Delete the files at the end of the ``do_install`` task if the
+   -  Delete the files at the end of the :ref:`ref-tasks-install` task if the
       files are not needed in any package.
 
     
@@ -582,7 +582,7 @@
    ``${datadir}/mime/packages``) and yet does not inherit the mime
    class which will ensure that these get properly installed. Either
    add ``inherit mime`` to the recipe or remove the files at the
-   ``do_install`` step if they are not needed.
+   :ref:`ref-tasks-install` step if they are not needed.
 
 
 .. _qa-check-mime-xdg:
@@ -592,7 +592,7 @@
     The specified package contains a .desktop file with a 'MimeType' key
     present, but does not inherit the mime-xdg class that is required in
     order for that to be activated. Either add ``inherit mime`` to the
-    recipe or remove the files at the ``do_install`` step if they are not
+    recipe or remove the files at the :ref:`ref-tasks-install` step if they are not
     needed.
 
 
@@ -667,8 +667,8 @@
 
     If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this check will ensure that no package
     installs files to root (``/bin``, ``/sbin``, ``/lib``, ``/lib64``) directories. If you are seeing this
-    message, it indicates that the ``do_install`` step (or perhaps the build process that
-    ``do_install`` is calling into, e.g. ``make install`` is using hardcoded paths instead
+    message, it indicates that the :ref:`ref-tasks-install` step (or perhaps the build process that
+    :ref:`ref-tasks-install` is calling into, e.g. ``make install`` is using hardcoded paths instead
     of the variables set up for this (``bindir``, ``sbindir``, etc.), and should be
     changed so that it does.
 
@@ -677,7 +677,7 @@
 
 - ``Fuzz detected: <patch output> [patch-fuzz]``
 
-    This check looks for evidence of "fuzz" when applying patches within the ``do_patch``
+    This check looks for evidence of "fuzz" when applying patches within the :ref:`ref-tasks-patch`
     task. Patch fuzz is a situation when the ``patch`` tool ignores some of the context
     lines in order to apply the patch. Consider this example:
 
diff --git a/poky/documentation/ref-manual/structure.rst b/poky/documentation/ref-manual/structure.rst
index 429f81e..533745b 100644
--- a/poky/documentation/ref-manual/structure.rst
+++ b/poky/documentation/ref-manual/structure.rst
@@ -630,7 +630,7 @@
    split into individual packages.
 
 -  ``${WORKDIR}/packages-split``: Contains the output of the
-   ``do_package`` task after the output has been split into individual
+   :ref:`ref-tasks-package` task after the output has been split into individual
    packages. There are subdirectories for each individual package created by
    the recipe.
 
diff --git a/poky/documentation/ref-manual/system-requirements.rst b/poky/documentation/ref-manual/system-requirements.rst
index 62da1bf..acc97c9 100644
--- a/poky/documentation/ref-manual/system-requirements.rst
+++ b/poky/documentation/ref-manual/system-requirements.rst
@@ -41,6 +41,8 @@
 
 -  Ubuntu 20.04 (LTS)
 
+-  Ubuntu 22.04 (LTS)
+
 -  Fedora 34
 
 -  Fedora 35
diff --git a/poky/documentation/ref-manual/tasks.rst b/poky/documentation/ref-manual/tasks.rst
index cb08a75..d4408d1 100644
--- a/poky/documentation/ref-manual/tasks.rst
+++ b/poky/documentation/ref-manual/tasks.rst
@@ -36,7 +36,7 @@
 
 The default behavior of this task is to run the ``oe_runmake`` function
 if a makefile (``Makefile``, ``makefile``, or ``GNUmakefile``) is found.
-If no such file is found, the ``do_compile`` task does nothing.
+If no such file is found, the :ref:`ref-tasks-compile` task does nothing.
 
 .. _ref-tasks-compile_ptest_base:
 
@@ -58,7 +58,7 @@
 makefile (``Makefile``, ``makefile``, or ``GNUmakefile``) is found and
 :term:`CLEANBROKEN` is not set to "1". If no such
 file is found or the :term:`CLEANBROKEN` variable is set to "1", the
-``do_configure`` task does nothing.
+:ref:`ref-tasks-configure` task does nothing.
 
 .. _ref-tasks-configure_ptest_base:
 
@@ -81,7 +81,7 @@
 :ref:`deploy <ref-classes-deploy>` class and should write the output
 to ``${``\ :term:`DEPLOYDIR`\ ``}``, which is not to be
 confused with ``${DEPLOY_DIR}``. The :ref:`deploy <ref-classes-deploy>` class sets up
-``do_deploy`` as a shared state (sstate) task that can be accelerated
+:ref:`ref-tasks-deploy` as a shared state (sstate) task that can be accelerated
 through sstate use. The sstate mechanism takes care of copying the
 output from ``${DEPLOYDIR}`` to ``${DEPLOY_DIR_IMAGE}``.
 
@@ -90,14 +90,14 @@
    Do not write the output directly to ``${DEPLOY_DIR_IMAGE}``, as this causes
    the sstate mechanism to malfunction.
 
-The ``do_deploy`` task is not added as a task by default and
+The :ref:`ref-tasks-deploy` task is not added as a task by default and
 consequently needs to be added manually. If you want the task to run
 after :ref:`ref-tasks-compile`, you can add it by doing
 the following::
 
       addtask deploy after do_compile
 
-Adding ``do_deploy`` after other tasks works the same way.
+Adding :ref:`ref-tasks-deploy` after other tasks works the same way.
 
 .. note::
 
@@ -110,7 +110,7 @@
    See the ":ref:`bitbake-user-manual/bitbake-user-manual-execution:dependencies`"
    section in the BitBake User Manual for more information.
 
-If the ``do_deploy`` task re-executes, any previous output is removed
+If the :ref:`ref-tasks-deploy` task re-executes, any previous output is removed
 (i.e. "cleaned").
 
 .. _ref-tasks-fetch:
@@ -128,15 +128,15 @@
 ``do_image``
 ------------
 
-Starts the image generation process. The ``do_image`` task runs after
+Starts the image generation process. The :ref:`ref-tasks-image` task runs after
 the OpenEmbedded build system has run the
 :ref:`ref-tasks-rootfs` task during which packages are
 identified for installation into the image and the root filesystem is
 created, complete with post-processing.
 
-The ``do_image`` task performs pre-processing on the image through the
+The :ref:`ref-tasks-image` task performs pre-processing on the image through the
 :term:`IMAGE_PREPROCESS_COMMAND` and
-dynamically generates supporting ``do_image_*`` tasks as needed.
+dynamically generates supporting :ref:`do_image_* <ref-tasks-image>` tasks as needed.
 
 For more information on image creation, see the ":ref:`overview-manual/concepts:image generation`"
 section in the Yocto Project Overview and Concepts Manual.
@@ -146,13 +146,13 @@
 ``do_image_complete``
 ---------------------
 
-Completes the image generation process. The ``do_image_complete`` task
+Completes the image generation process. The :ref:`do_image_complete <ref-tasks-image-complete>` task
 runs after the OpenEmbedded build system has run the
 :ref:`ref-tasks-image` task during which image
-pre-processing occurs and through dynamically generated ``do_image_*``
+pre-processing occurs and through dynamically generated :ref:`do_image_* <ref-tasks-image>`
 tasks the image is constructed.
 
-The ``do_image_complete`` task performs post-processing on the image
+The :ref:`do_image_complete <ref-tasks-image-complete>` task performs post-processing on the image
 through the
 :term:`IMAGE_POSTPROCESS_COMMAND`.
 
@@ -168,9 +168,9 @@
 Copies files that are to be packaged into the holding area
 ``${``\ :term:`D`\ ``}``. This task runs with the current
 working directory set to ``${``\ :term:`B`\ ``}``, which is the
-compilation directory. The ``do_install`` task, as well as other tasks
+compilation directory. The :ref:`ref-tasks-install` task, as well as other tasks
 that either directly or indirectly depend on the installed files (e.g.
-:ref:`ref-tasks-package`, ``do_package_write_*``, and
+:ref:`ref-tasks-package`, :ref:`do_package_write_* <ref-tasks-package_write_deb>`, and
 :ref:`ref-tasks-rootfs`), run under
 :ref:`fakeroot <overview-manual/concepts:fakeroot and pseudo>`.
 
@@ -212,7 +212,7 @@
 :term:`PACKAGES` and :term:`FILES`
 variables.
 
-The ``do_package`` task, in conjunction with the
+The :ref:`ref-tasks-package` task, in conjunction with the
 :ref:`ref-tasks-packagedata` task, also saves some
 important package metadata. For additional information, see the
 :term:`PKGDESTWORK` variable and the
@@ -327,7 +327,7 @@
        "
 
 Conversely, if you have a file whose file type is ``.patch`` or ``.diff``
-and you want to exclude it so that the ``do_patch`` task does not apply
+and you want to exclude it so that the :ref:`ref-tasks-patch` task does not apply
 it during the patch phase, you can use the "apply=no" parameter with the
 :term:`SRC_URI` statement::
 
@@ -392,7 +392,7 @@
 these variables inside your recipe if you need to make additional (or
 fewer) directories available to other recipes at build time.
 
-The ``do_populate_sysroot`` task is a shared state (sstate) task, which
+The :ref:`ref-tasks-populate_sysroot` task is a shared state (sstate) task, which
 means that the task can be accelerated through sstate use. Realize also
 that if the task is re-executed, any previous output is removed (i.e.
 "cleaned").
@@ -447,7 +447,7 @@
 ------------
 
 Removes all output files for a target from the
-:ref:`ref-tasks-unpack` task forward (i.e. ``do_unpack``,
+:ref:`ref-tasks-unpack` task forward (i.e. :ref:`ref-tasks-unpack`,
 :ref:`ref-tasks-configure`,
 :ref:`ref-tasks-compile`,
 :ref:`ref-tasks-install`, and
@@ -473,7 +473,7 @@
 Removes all output files, shared state
 (:ref:`sstate <overview-manual/concepts:shared state cache>`) cache, and
 downloaded source files for a target (i.e. the contents of
-:term:`DL_DIR`). Essentially, the ``do_cleanall`` task is
+:term:`DL_DIR`). Essentially, the :ref:`ref-tasks-cleanall` task is
 identical to the :ref:`ref-tasks-cleansstate` task
 with the added removal of downloaded source files.
 
@@ -481,7 +481,7 @@
 
    $ bitbake -c cleanall recipe
 
-Typically, you would not normally use the ``cleanall`` task. Do so only
+Typically, you would not normally use the :ref:`ref-tasks-cleanall` task. Do so only
 if you want to start fresh with the :ref:`ref-tasks-fetch`
 task.
 
@@ -492,7 +492,7 @@
 
 Removes all output files and shared state
 (:ref:`sstate <overview-manual/concepts:shared state cache>`) cache for a
-target. Essentially, the ``do_cleansstate`` task is identical to the
+target. Essentially, the :ref:`ref-tasks-cleansstate` task is identical to the
 :ref:`ref-tasks-clean` task with the added removal of
 shared state (:ref:`sstate <overview-manual/concepts:shared state cache>`)
 cache.
@@ -501,13 +501,13 @@
 
    $ bitbake -c cleansstate recipe
 
-When you run the ``do_cleansstate`` task, the OpenEmbedded build system
+When you run the :ref:`ref-tasks-cleansstate` task, the OpenEmbedded build system
 no longer uses any sstate. Consequently, building the recipe from
 scratch is guaranteed.
 
 .. note::
 
-   The ``do_cleansstate`` task cannot remove sstate from a remote sstate
+   The :ref:`ref-tasks-cleansstate` task cannot remove sstate from a remote sstate
    mirror. If you need to build a target from scratch using remote mirrors, use
    the "-f" option as follows::
 
@@ -575,10 +575,8 @@
 ``do_bundle_initramfs``
 -----------------------
 
-Combines an initial RAM disk (initramfs) image and kernel together to
-form a single image. The
-:term:`CONFIG_INITRAMFS_SOURCE` variable
-has some more information about these types of images.
+Combines an :term:`Initramfs` image and kernel together to
+form a single image.
 
 .. _ref-tasks-rootfs:
 
@@ -657,7 +655,7 @@
 
 Converts the newly unpacked kernel source into a form with which the
 OpenEmbedded build system can work. Because the kernel source can be
-fetched in several different ways, the ``do_kernel_checkout`` task makes
+fetched in several different ways, the :ref:`ref-tasks-kernel_checkout` task makes
 sure that subsequent tasks are given a clean working tree copy of the
 kernel with the correct branches checked out.
 
@@ -668,7 +666,7 @@
 
 Validates the configuration produced by the
 :ref:`ref-tasks-kernel_menuconfig` task. The
-``do_kernel_configcheck`` task produces warnings when a requested
+:ref:`ref-tasks-kernel_configcheck` task produces warnings when a requested
 configuration does not appear in the final ``.config`` file or when you
 override a policy configuration in a hardware configuration fragment.
 You can run this task explicitly and view the output by using the
@@ -686,7 +684,7 @@
 ----------------------
 
 After the kernel is patched by the :ref:`ref-tasks-patch`
-task, the ``do_kernel_configme`` task assembles and merges all the
+task, the :ref:`ref-tasks-kernel_configme` task assembles and merges all the
 kernel config fragments into a merged configuration that can then be
 passed to the kernel configuration phase proper. This is also the time
 during which user-specified defconfigs are applied if present, and where
@@ -719,7 +717,7 @@
 
 Collects all the features required for a given kernel build, whether the
 features come from :term:`SRC_URI` or from Git
-repositories. After collection, the ``do_kernel_metadata`` task
+repositories. After collection, the :ref:`ref-tasks-kernel_metadata` task
 processes the features into a series of config fragments and patches,
 which can then be applied by subsequent tasks such as
 :ref:`ref-tasks-patch` and
@@ -791,4 +789,4 @@
 sure that the machine and metadata branches as specified by the
 :term:`SRCREV` variables actually exist on the specified
 branches. Otherwise, if :term:`AUTOREV` is not being used, the
-``do_validate_branches`` task fails during the build.
+:ref:`ref-tasks-validate_branches` task fails during the build.
diff --git a/poky/documentation/ref-manual/variables.rst b/poky/documentation/ref-manual/variables.rst
index 2971654..1685a26 100644
--- a/poky/documentation/ref-manual/variables.rst
+++ b/poky/documentation/ref-manual/variables.rst
@@ -1242,24 +1242,24 @@
          :term:`Source Directory`.
 
    :term:`CONFIG_INITRAMFS_SOURCE`
-      Identifies the initial RAM filesystem (initramfs) source files. The
+      Identifies the initial RAM filesystem (:term:`Initramfs`) source files. The
       OpenEmbedded build system receives and uses this kernel Kconfig
       variable as an environment variable. By default, the variable is set
       to null ("").
 
       The :term:`CONFIG_INITRAMFS_SOURCE` can be either a single cpio archive
       with a ``.cpio`` suffix or a space-separated list of directories and
-      files for building the initramfs image. A cpio archive should contain
-      a filesystem archive to be used as an initramfs image. Directories
-      should contain a filesystem layout to be included in the initramfs
+      files for building the :term:`Initramfs` image. A cpio archive should contain
+      a filesystem archive to be used as an :term:`Initramfs` image. Directories
+      should contain a filesystem layout to be included in the :term:`Initramfs`
       image. Files should contain entries according to the format described
       by the ``usr/gen_init_cpio`` program in the kernel tree.
 
-      If you specify multiple directories and files, the initramfs image
+      If you specify multiple directories and files, the :term:`Initramfs` image
       will be the aggregate of all of them.
 
-      For information on creating an initramfs, see the
-      ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section
+      For information on creating an :term:`Initramfs`, see the
+      ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section
       in the Yocto Project Development Tasks Manual.
 
    :term:`CONFIG_SITE`
@@ -1620,7 +1620,7 @@
       the appropriate staging sysroot, given by the
       :term:`STAGING_DIR* <STAGING_DIR>` variables, by the time the
       :ref:`ref-tasks-configure` task for ``foo`` runs.
-      This mechanism is implemented by having ``do_configure`` depend on
+      This mechanism is implemented by having :ref:`ref-tasks-configure` depend on
       the :ref:`ref-tasks-populate_sysroot` task of
       each recipe listed in :term:`DEPENDS`, through a
       ``[``\ :ref:`deptask <bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags>`\ ``]``
@@ -3182,10 +3182,10 @@
             image, do not use the :term:`IMAGE_INSTALL` variable to specify
             packages for installation. Instead, use the
             :term:`PACKAGE_INSTALL` variable, which
-            allows the initial RAM filesystem (initramfs) recipe to use a
+            allows the initial RAM filesystem (:term:`Initramfs`) recipe to use a
             fixed set of packages and not be affected by :term:`IMAGE_INSTALL`.
-            For information on creating an initramfs, see the
-            ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`"
+            For information on creating an :term:`Initramfs`, see the
+            ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`"
             section in the Yocto Project Development Tasks Manual.
 
          -  Using :term:`IMAGE_INSTALL` with the
@@ -3265,7 +3265,7 @@
       to distinguish the image file from other files created during image
       building; however if this suffix is redundant or not desired you can
       clear the value of this variable (set the value to ""). For example,
-      this is typically cleared in initramfs image recipes.
+      this is typically cleared in :term:`Initramfs` image recipes.
 
    :term:`IMAGE_OVERHEAD_FACTOR`
       Defines a multiplier that the build system applies to the initial
@@ -3632,37 +3632,79 @@
          even if the toolchain's binaries are strippable, there are other files
          needed for the build that are not strippable.
 
+   :term:`Initramfs`
+      An Initial RAM Filesystem (:term:`Initramfs`) is an optionally compressed
+      `cpio <https://en.wikipedia.org/wiki/Cpio>`__ archive which is extracted
+      by the Linux kernel into RAM in a special `tmpfs <https://en.wikipedia.org/wiki/Tmpfs>`__
+      instance, used as the initial root filesystem.
+
+      This is a replacement for the legacy init RAM disk ("initrd")
+      technique, booting on an emulated block device in RAM, but being less
+      efficient because of the overhead of going through a filesystem and
+      having to duplicate accessed file contents in the file cache in RAM,
+      as for any block device.
+
+      .. note:
+
+         As far as bootloaders are concerned, :term:`Initramfs` and "initrd"
+         images are still copied to RAM in the same way. That's why most
+	 most bootloaders refer to :term:`Initramfs` images as "initrd"
+	 or "init RAM disk".
+
+      This kind of mechanism is typically used for two reasons:
+
+      -  For booting the same kernel binary on multiple systems requiring
+         different device drivers. The Initramfs image is then customized
+	 for each type of system, to include the specific  kernel modules
+         necessary to access the final root filesystem. This technique
+	 is used on all GNU / Linux distributions for desktops and servers.
+
+      -  For booting faster. As the root filesystem is extracted into RAM,
+         accessing the first user-space applications is very fast, compared
+         to having to initialize a block device, to access multiple blocks
+         from it, and to go through a filesystem having its own overhead.
+         For example, this allows to display a splashscreen very early,
+	 and to later take care of mounting the final root filesystem and
+         loading less time-critical kernel drivers.
+
+      This cpio archive can either be loaded to RAM by the bootloader,
+      or be included in the kernel binary.
+
+      For information on creating and using an :term:`Initramfs`, see the
+      ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`"
+      section in the Yocto Project Development Tasks Manual.
+
    :term:`INITRAMFS_DEPLOY_DIR_IMAGE`
-      Indicates the deploy directory used by ``do_bundle_initramfs`` where the
+      Indicates the deploy directory used by :ref:`ref-tasks-bundle_initramfs` where the
       :term:`INITRAMFS_IMAGE` will be fetched from.
       This variable is set by default to ``${DEPLOY_DIR_IMAGE}`` in the
       :ref:`kernel <ref-classes-kernel>` class and it's only meant to be changed
-      when building an initramfs image from a separate multiconfig via :term:`INITRAMFS_MULTICONFIG`.
+      when building an :term:`Initramfs` image from a separate multiconfig via :term:`INITRAMFS_MULTICONFIG`.
 
    :term:`INITRAMFS_FSTYPES`
       Defines the format for the output image of an initial RAM filesystem
-      (initramfs), which is used during boot. Supported formats are the
+      (:term:`Initramfs`), which is used during boot. Supported formats are the
       same as those supported by the
       :term:`IMAGE_FSTYPES` variable.
 
       The default value of this variable, which is set in the
       ``meta/conf/bitbake.conf`` configuration file in the
       :term:`Source Directory`, is "cpio.gz". The Linux kernel's
-      initramfs mechanism, as opposed to the initial RAM filesystem
+      :term:`Initramfs` mechanism, as opposed to the initial RAM filesystem
       `initrd <https://en.wikipedia.org/wiki/Initrd>`__ mechanism, expects
       an optionally compressed cpio archive.
 
    :term:`INITRAMFS_IMAGE`
       Specifies the :term:`PROVIDES` name of an image
-      recipe that is used to build an initial RAM filesystem (initramfs)
+      recipe that is used to build an initial RAM filesystem (:term:`Initramfs`)
       image. In other words, the :term:`INITRAMFS_IMAGE` variable causes an
       additional recipe to be built as a dependency to whatever root
       filesystem recipe you might be using (e.g. ``core-image-sato``). The
-      initramfs image recipe you provide should set
+      :term:`Initramfs` image recipe you provide should set
       :term:`IMAGE_FSTYPES` to
       :term:`INITRAMFS_FSTYPES`.
 
-      An initramfs image provides a temporary root filesystem used for
+      An :term:`Initramfs` image provides a temporary root filesystem used for
       early system initialization (e.g. loading of modules needed to locate
       and mount the "real" root filesystem).
 
@@ -3670,8 +3712,8 @@
 
          See the ``meta/recipes-core/images/core-image-minimal-initramfs.bb``
          recipe in the :term:`Source Directory`
-         for an example initramfs recipe. To select this sample recipe as
-         the one built to provide the initramfs image, set :term:`INITRAMFS_IMAGE`
+         for an example :term:`Initramfs` recipe. To select this sample recipe as
+         the one built to provide the :term:`Initramfs` image, set :term:`INITRAMFS_IMAGE`
          to "core-image-minimal-initramfs".
 
       You can also find more information by referencing the
@@ -3681,13 +3723,13 @@
       class to see how to use the :term:`INITRAMFS_IMAGE` variable.
 
       If :term:`INITRAMFS_IMAGE` is empty, which is the default, then no
-      initramfs image is built.
+      :term:`Initramfs` image is built.
 
       For more information, you can also see the
       :term:`INITRAMFS_IMAGE_BUNDLE`
       variable, which allows the generated image to be bundled inside the
-      kernel image. Additionally, for information on creating an initramfs
-      image, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section
+      kernel image. Additionally, for information on creating an :term:`Initramfs`
+      image, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section
       in the Yocto Project Development Tasks Manual.
 
    :term:`INITRAMFS_IMAGE_BUNDLE`
@@ -3696,32 +3738,32 @@
       extra pass
       (:ref:`ref-tasks-bundle_initramfs`) during
       kernel compilation in order to build a single binary that contains
-      both the kernel image and the initial RAM filesystem (initramfs)
+      both the kernel image and the initial RAM filesystem (:term:`Initramfs`)
       image. This makes use of the
       :term:`CONFIG_INITRAMFS_SOURCE` kernel
       feature.
 
       .. note::
 
-         Bundling the initramfs with the kernel conflates the code in the
-         initramfs with the GPLv2 licensed Linux kernel binary. Thus only GPLv2
-         compatible software may be part of a bundled initramfs.
+         Bundling the :term:`Initramfs` with the kernel conflates the code in the
+         :term:`Initramfs` with the GPLv2 licensed Linux kernel binary. Thus only GPLv2
+         compatible software may be part of a bundled :term:`Initramfs`.
 
       .. note::
 
-         Using an extra compilation pass to bundle the initramfs avoids a
-         circular dependency between the kernel recipe and the initramfs
-         recipe should the initramfs include kernel modules. Should that be
-         the case, the initramfs recipe depends on the kernel for the
-         kernel modules, and the kernel depends on the initramfs recipe
-         since the initramfs is bundled inside the kernel image.
+         Using an extra compilation pass to bundle the :term:`Initramfs` avoids a
+         circular dependency between the kernel recipe and the :term:`Initramfs`
+         recipe should the :term:`Initramfs` include kernel modules. Should that be
+         the case, the :term:`Initramfs` recipe depends on the kernel for the
+         kernel modules, and the kernel depends on the :term:`Initramfs` recipe
+         since the :term:`Initramfs` is bundled inside the kernel image.
 
       The combined binary is deposited into the ``tmp/deploy`` directory,
       which is part of the :term:`Build Directory`.
 
       Setting the variable to "1" in a configuration file causes the
       OpenEmbedded build system to generate a kernel image with the
-      initramfs specified in :term:`INITRAMFS_IMAGE` bundled within::
+      :term:`Initramfs` specified in :term:`INITRAMFS_IMAGE` bundled within::
 
          INITRAMFS_IMAGE_BUNDLE = "1"
 
@@ -3739,7 +3781,7 @@
       See the
       :yocto_git:`local.conf.sample.extended </poky/tree/meta-poky/conf/templates/default/local.conf.sample.extended>`
       file for additional information. Also, for information on creating an
-      initramfs, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section
+      :term:`Initramfs`, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section
       in the Yocto Project Development Tasks Manual.
 
    :term:`INITRAMFS_LINK_NAME`
@@ -3764,7 +3806,7 @@
       This allows the kernel to bundle an :term:`INITRAMFS_IMAGE` coming from
       a separate multiconfig, this is meant to be used in addition to :term:`INITRAMFS_DEPLOY_DIR_IMAGE`.
 
-      For more information on how to bundle an initramfs image from a separate
+      For more information on how to bundle an :term:`Initramfs` image from a separate
       multiconfig see the ":ref:`dev-manual/common-tasks:Bundling an Initramfs Image From a Separate Multiconfig`"
       section in the Yocto Project Development Tasks Manual.
 
@@ -4240,7 +4282,7 @@
       :term:`KERNELDEPMODDEPEND` does not control whether or not that data
       exists, but simply whether or not it is used. If you do not need to
       use the data, set the :term:`KERNELDEPMODDEPEND` variable in your
-      ``initramfs`` recipe. Setting the variable there when the data is not
+      :term:`Initramfs` recipe. Setting the variable there when the data is not
       needed avoids a potential dependency loop.
 
    :term:`KFEATURE_DESCRIPTION`
@@ -5395,9 +5437,9 @@
       :term:`IMAGE_INSTALL` variable to specify
       packages for installation. The exception to this is when working with
       the :ref:`core-image-minimal-initramfs <ref-manual/images:images>`
-      image. When working with an initial RAM filesystem (initramfs) image,
+      image. When working with an initial RAM filesystem (:term:`Initramfs`) image,
       use the :term:`PACKAGE_INSTALL` variable. For information on creating an
-      initramfs, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section
+      :term:`Initramfs`, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section
       in the Yocto Project Development Tasks Manual.
 
    :term:`PACKAGE_INSTALL_ATTEMPTONLY`
@@ -5521,7 +5563,7 @@
       :ref:`cmake <ref-classes-cmake>` use :term:`PACKAGECONFIG_CONFARGS` to
       pass :term:`PACKAGECONFIG` options to ``configure`` and ``cmake``,
       respectively. If you are using :term:`PACKAGECONFIG` but not a class that
-      handles the ``do_configure`` task, then you need to use
+      handles the :ref:`ref-tasks-configure` task, then you need to use
       :term:`PACKAGECONFIG_CONFARGS` appropriately.
 
    :term:`PACKAGEGROUP_DISABLE_COMPLEMENTARY`
@@ -5603,7 +5645,7 @@
       .. note::
 
          If the software being built experiences dependency issues during
-         the ``do_compile`` task that result in race conditions, you can clear
+         the :ref:`ref-tasks-compile` task that result in race conditions, you can clear
          the :term:`PARALLEL_MAKE` variable within the recipe as a workaround. For
          information on addressing race conditions, see the
          ":ref:`dev-manual/common-tasks:debugging parallel make races`"
@@ -5633,7 +5675,7 @@
          way to ensure this is to use the ``oe_runmake`` function.
 
          If the software being built experiences dependency issues during
-         the ``do_install`` task that result in race conditions, you can
+         the :ref:`ref-tasks-install` task that result in race conditions, you can
          clear the :term:`PARALLEL_MAKEINST` variable within the recipe as a
          workaround. For information on addressing race conditions, see the
          ":ref:`dev-manual/common-tasks:debugging parallel make races`"
@@ -6200,7 +6242,7 @@
       The practical effect of the above :term:`RDEPENDS` assignment is that
       ``bar`` and ``baz`` will be declared as dependencies inside the
       package ``foo`` when it is written out by one of the
-      :ref:`do_package_write_\* <ref-tasks-package_write_deb>` tasks.
+      :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks.
       Exactly how this is done depends on which package format is used,
       which is determined by
       :term:`PACKAGE_CLASSES`. When the
@@ -6212,7 +6254,7 @@
       added. This dependency is from the recipe's
       :ref:`ref-tasks-build` (not to be confused with
       :ref:`ref-tasks-compile`) task to the
-      ``do_package_write_*`` task of the recipes that build ``bar`` and
+      :ref:`do_package_write_* <ref-tasks-package_write_deb>` task of the recipes that build ``bar`` and
       ``baz``.
 
       The names of the packages you list within :term:`RDEPENDS` must be the
@@ -6709,10 +6751,10 @@
       A list of shared state tasks added to the extensible SDK. By default,
       the following tasks are added:
 
-      - do_populate_lic
-      - do_package_qa
-      - do_populate_sysroot
-      - do_deploy
+      - :ref:`ref-tasks-populate_lic`
+      - :ref:`ref-tasks-package_qa`
+      - :ref:`ref-tasks-populate_sysroot`
+      - :ref:`ref-tasks-deploy`
 
       Despite the default value of "" for the
       :term:`SDK_RECRDEP_TASKS` variable, the above four tasks are always added
@@ -7382,7 +7424,7 @@
       For most recipes, this sysroot is the one in which that recipe's
       :ref:`ref-tasks-populate_sysroot` task copies
       files. Exceptions include ``-native`` recipes, where the
-      ``do_populate_sysroot`` task instead uses
+      :ref:`ref-tasks-populate_sysroot` task instead uses
       :term:`STAGING_DIR_NATIVE`. Depending on
       the type of recipe and the build target, :term:`STAGING_DIR_HOST` can
       have the following values:
diff --git a/poky/documentation/sdk-manual/extensible.rst b/poky/documentation/sdk-manual/extensible.rst
index 0df6519..09b7169 100644
--- a/poky/documentation/sdk-manual/extensible.rst
+++ b/poky/documentation/sdk-manual/extensible.rst
@@ -1112,7 +1112,7 @@
       ``${``\ :term:`D`\ ``}``.
 
    -  ``sysroot-destdir/``: Contains a subset of files installed within
-      ``do_install`` that have been put into the shared sysroot. For
+      :ref:`ref-tasks-install` that have been put into the shared sysroot. For
       more information, see the
       ":ref:`dev-manual/common-tasks:sharing files between recipes`" section.