mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-05-07 16:59:30 +00:00
arm-bsp/u-boot: corstone1000: upgrade FF-A support
update the FF-A patchset with the one sent to the u-boot mailing list cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/ Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
This commit is contained in:
committed by
Jon Mason
parent
63c7e60c1e
commit
607166e3bd
+10
-9
@@ -1,7 +1,7 @@
|
||||
From 7a1a84ea74fdd06a7f5f239f4c5f4b727d6cd232 Mon Sep 17 00:00:00 2001
|
||||
From 910760408430de32ad08b1e5ddf894cc9f2f3d0c Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Thu, 24 Jun 2021 09:25:00 +0100
|
||||
Subject: [PATCH 01/24] cmd: load: add load command for memory mapped
|
||||
Subject: [PATCH 01/26] cmd: load: add load command for memory mapped
|
||||
|
||||
cp.b is used a lot as a way to load binaries to memory and execute
|
||||
them, however we may need to integrate this with the efi subsystem to
|
||||
@@ -16,6 +16,7 @@ with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
|
||||
then subsequently booted with bootefi command.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Accepted [2022.10-rc1]
|
||||
---
|
||||
README | 1 +
|
||||
cmd/Kconfig | 6 ++++
|
||||
@@ -26,7 +27,7 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
6 files changed, 78 insertions(+)
|
||||
|
||||
diff --git a/README b/README
|
||||
index b7ab6e50708d..cd76f95e74c1 100644
|
||||
index b7ab6e5070..cd76f95e74 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -2578,6 +2578,7 @@ rarpboot- boot image via network using RARP/TFTP protocol
|
||||
@@ -38,7 +39,7 @@ index b7ab6e50708d..cd76f95e74c1 100644
|
||||
mm - memory modify (auto-incrementing)
|
||||
nm - memory modify (constant address)
|
||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
||||
index 09193b61b95f..ba2f321ae989 100644
|
||||
index 09193b61b9..ba2f321ae9 100644
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -1143,6 +1143,12 @@ config CMD_LOADB
|
||||
@@ -55,7 +56,7 @@ index 09193b61b95f..ba2f321ae989 100644
|
||||
bool "loads"
|
||||
default y
|
||||
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
|
||||
index 827fcd97dfd8..37ce659fa123 100644
|
||||
index 827fcd97df..37ce659fa1 100644
|
||||
--- a/cmd/bootefi.c
|
||||
+++ b/cmd/bootefi.c
|
||||
@@ -34,6 +34,18 @@ static struct efi_device_path *bootefi_device_path;
|
||||
@@ -78,7 +79,7 @@ index 827fcd97dfd8..37ce659fa123 100644
|
||||
* efi_clear_bootdev() - clear boot device
|
||||
*/
|
||||
diff --git a/cmd/load.c b/cmd/load.c
|
||||
index 7e4a552d90ef..1224a7f85bb3 100644
|
||||
index 7e4a552d90..1224a7f85b 100644
|
||||
--- a/cmd/load.c
|
||||
+++ b/cmd/load.c
|
||||
@@ -1063,6 +1063,44 @@ static ulong load_serial_ymodem(ulong offset, int mode)
|
||||
@@ -141,7 +142,7 @@ index 7e4a552d90ef..1224a7f85bb3 100644
|
||||
+);
|
||||
+#endif /* CONFIG_CMD_LOADM */
|
||||
diff --git a/include/efi_loader.h b/include/efi_loader.h
|
||||
index 11930fbea838..5b41985244e2 100644
|
||||
index 11930fbea8..5b41985244 100644
|
||||
--- a/include/efi_loader.h
|
||||
+++ b/include/efi_loader.h
|
||||
@@ -591,6 +591,8 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
|
||||
@@ -154,7 +155,7 @@ index 11930fbea838..5b41985244e2 100644
|
||||
void efi_add_handle(efi_handle_t obj);
|
||||
/* Create handle */
|
||||
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
|
||||
index 171661b89727..2493d7432613 100644
|
||||
index 171661b897..2493d74326 100644
|
||||
--- a/lib/efi_loader/efi_device_path.c
|
||||
+++ b/lib/efi_loader/efi_device_path.c
|
||||
@@ -1158,6 +1158,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
|
||||
@@ -181,5 +182,5 @@ index 171661b89727..2493d7432613 100644
|
||||
part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
|
||||
1);
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
|
||||
+15
-14
@@ -1,7 +1,7 @@
|
||||
From c9a9a467bb335047812004dd022dcadf9514101f Mon Sep 17 00:00:00 2001
|
||||
From 3523b1bac430f10f02a31f7d013ea369e29656be Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Tue, 15 Feb 2022 09:44:10 +0000
|
||||
Subject: [PATCH 02/24] arm: add support to corstone1000 platform
|
||||
Subject: [PATCH 02/26] arm: add support to corstone1000 platform
|
||||
|
||||
Corstone1000 is a platform from arm, which includes pre
|
||||
verified Corstone SSE710 sub-system that combines Cortex-A and
|
||||
@@ -18,6 +18,7 @@ FPGA MPS3 board implementation of this platform. [2]
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Accepted [2022.10-rc1]
|
||||
---
|
||||
arch/arm/Kconfig | 8 ++
|
||||
arch/arm/dts/Makefile | 3 +
|
||||
@@ -42,7 +43,7 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
create mode 100644 include/configs/corstone1000.h
|
||||
|
||||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
|
||||
index 9898c7d68e1b..2fc2b7d20f12 100644
|
||||
index 9898c7d68e..2fc2b7d20f 100644
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -1347,6 +1347,12 @@ config ARCH_VEXPRESS64
|
||||
@@ -68,7 +69,7 @@ index 9898c7d68e1b..2fc2b7d20f12 100644
|
||||
source "board/bosch/guardian/Kconfig"
|
||||
source "board/Marvell/octeontx/Kconfig"
|
||||
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
|
||||
index a7e0d9f6c0e8..8c8f15b6a813 100644
|
||||
index a7e0d9f6c0..8c8f15b6a8 100644
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1265,6 +1265,9 @@ dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb
|
||||
@@ -83,7 +84,7 @@ index a7e0d9f6c0e8..8c8f15b6a813 100644
|
||||
targets += $(dtb-y)
|
||||
diff --git a/arch/arm/dts/corstone1000-fvp.dts b/arch/arm/dts/corstone1000-fvp.dts
|
||||
new file mode 100644
|
||||
index 000000000000..1fcc137a493c
|
||||
index 0000000000..1fcc137a49
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/corstone1000-fvp.dts
|
||||
@@ -0,0 +1,23 @@
|
||||
@@ -112,7 +113,7 @@ index 000000000000..1fcc137a493c
|
||||
+};
|
||||
diff --git a/arch/arm/dts/corstone1000-mps3.dts b/arch/arm/dts/corstone1000-mps3.dts
|
||||
new file mode 100644
|
||||
index 000000000000..e3146747c2d9
|
||||
index 0000000000..e3146747c2
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/corstone1000-mps3.dts
|
||||
@@ -0,0 +1,32 @@
|
||||
@@ -150,7 +151,7 @@ index 000000000000..e3146747c2d9
|
||||
+};
|
||||
diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..d0194aa893f2
|
||||
index 0000000000..d0194aa893
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/corstone1000.dtsi
|
||||
@@ -0,0 +1,169 @@
|
||||
@@ -325,7 +326,7 @@ index 000000000000..d0194aa893f2
|
||||
+};
|
||||
diff --git a/board/armltd/corstone1000/Kconfig b/board/armltd/corstone1000/Kconfig
|
||||
new file mode 100644
|
||||
index 000000000000..709674d4cf7d
|
||||
index 0000000000..709674d4cf
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/corstone1000/Kconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
@@ -343,7 +344,7 @@ index 000000000000..709674d4cf7d
|
||||
+endif
|
||||
diff --git a/board/armltd/corstone1000/MAINTAINERS b/board/armltd/corstone1000/MAINTAINERS
|
||||
new file mode 100644
|
||||
index 000000000000..8c905686de76
|
||||
index 0000000000..8c905686de
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/corstone1000/MAINTAINERS
|
||||
@@ -0,0 +1,7 @@
|
||||
@@ -356,7 +357,7 @@ index 000000000000..8c905686de76
|
||||
+F: configs/corstone1000_defconfig
|
||||
diff --git a/board/armltd/corstone1000/Makefile b/board/armltd/corstone1000/Makefile
|
||||
new file mode 100644
|
||||
index 000000000000..77a82c28929b
|
||||
index 0000000000..77a82c2892
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/corstone1000/Makefile
|
||||
@@ -0,0 +1,7 @@
|
||||
@@ -369,7 +370,7 @@ index 000000000000..77a82c28929b
|
||||
+obj-y := corstone1000.o
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
new file mode 100644
|
||||
index 000000000000..2fa485ff3799
|
||||
index 0000000000..2fa485ff37
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -0,0 +1,125 @@
|
||||
@@ -500,7 +501,7 @@ index 000000000000..2fa485ff3799
|
||||
+}
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
new file mode 100644
|
||||
index 000000000000..02f931b0d469
|
||||
index 0000000000..02f931b0d4
|
||||
--- /dev/null
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -0,0 +1,80 @@
|
||||
@@ -586,7 +587,7 @@ index 000000000000..02f931b0d469
|
||||
+CONFIG_MISC=y
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
new file mode 100644
|
||||
index 000000000000..cf166f107efd
|
||||
index 0000000000..cf166f107e
|
||||
--- /dev/null
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -0,0 +1,86 @@
|
||||
@@ -677,5 +678,5 @@ index 000000000000..cf166f107efd
|
||||
+ "bootefi $kernel_addr_r $fdtcontroladdr;"
|
||||
+#endif
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
|
||||
+14
-13
@@ -1,12 +1,13 @@
|
||||
From 61c5fe3758a0febdee33429f5be16f69279045cc Mon Sep 17 00:00:00 2001
|
||||
From 178da5bee196f44c4c10e9804674fe5ac0bc1176 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Mon, 28 Jun 2021 23:20:55 +0100
|
||||
Subject: [PATCH 03/24] usb: common: move urb code to common
|
||||
Subject: [PATCH 03/26] usb: common: move urb code to common
|
||||
|
||||
Move urb code from musb only use to a more common scope, so other
|
||||
drivers in the future can use the handling of urb in usb.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Accepted [2022.10-rc1]
|
||||
---
|
||||
drivers/usb/common/Makefile | 2 +
|
||||
drivers/usb/common/usb_urb.c | 160 ++++++++++++++++++
|
||||
@@ -23,7 +24,7 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
rename drivers/usb/musb-new/usb-compat.h => include/linux/usb/usb_urb_compat.h (60%)
|
||||
|
||||
diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
|
||||
index 3bedbf213f47..dc05cb0a5077 100644
|
||||
index 3bedbf213f..dc05cb0a50 100644
|
||||
--- a/drivers/usb/common/Makefile
|
||||
+++ b/drivers/usb/common/Makefile
|
||||
@@ -4,5 +4,7 @@
|
||||
@@ -36,7 +37,7 @@ index 3bedbf213f47..dc05cb0a5077 100644
|
||||
obj-$(CONFIG_USB_XHCI_FSL) += fsl-dt-fixup.o fsl-errata.o
|
||||
diff --git a/drivers/usb/common/usb_urb.c b/drivers/usb/common/usb_urb.c
|
||||
new file mode 100644
|
||||
index 000000000000..be3b6b9f32e8
|
||||
index 0000000000..be3b6b9f32
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/common/usb_urb.c
|
||||
@@ -0,0 +1,160 @@
|
||||
@@ -201,7 +202,7 @@ index 000000000000..be3b6b9f32e8
|
||||
+ return usb_urb_submit(hcd, urb);
|
||||
+}
|
||||
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
|
||||
index f1fc93f3d403..3ccbc16da379 100644
|
||||
index f1fc93f3d4..3ccbc16da3 100644
|
||||
--- a/drivers/usb/host/r8a66597-hcd.c
|
||||
+++ b/drivers/usb/host/r8a66597-hcd.c
|
||||
@@ -14,6 +14,7 @@
|
||||
@@ -249,7 +250,7 @@ index f1fc93f3d403..3ccbc16da379 100644
|
||||
{
|
||||
struct usb_device *parent = usb_dev_get_parent(dev);
|
||||
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
|
||||
index 18d9bc805f8a..fc7af7484e4c 100644
|
||||
index 18d9bc805f..fc7af7484e 100644
|
||||
--- a/drivers/usb/musb-new/musb_core.c
|
||||
+++ b/drivers/usb/musb-new/musb_core.c
|
||||
@@ -89,9 +89,9 @@
|
||||
@@ -264,7 +265,7 @@ index 18d9bc805f8a..fc7af7484e4c 100644
|
||||
|
||||
#include "musb_core.h"
|
||||
diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c
|
||||
index acb2d40f3b5a..e5905d90d66f 100644
|
||||
index acb2d40f3b..e5905d90d6 100644
|
||||
--- a/drivers/usb/musb-new/musb_host.c
|
||||
+++ b/drivers/usb/musb-new/musb_host.c
|
||||
@@ -26,8 +26,8 @@
|
||||
@@ -278,7 +279,7 @@ index acb2d40f3b5a..e5905d90d66f 100644
|
||||
|
||||
#include "musb_core.h"
|
||||
diff --git a/drivers/usb/musb-new/musb_host.h b/drivers/usb/musb-new/musb_host.h
|
||||
index afc8fa35a738..5a604bdb0cf2 100644
|
||||
index afc8fa35a7..5a604bdb0c 100644
|
||||
--- a/drivers/usb/musb-new/musb_host.h
|
||||
+++ b/drivers/usb/musb-new/musb_host.h
|
||||
@@ -10,7 +10,7 @@
|
||||
@@ -291,7 +292,7 @@ index afc8fa35a738..5a604bdb0cf2 100644
|
||||
|
||||
static inline struct usb_hcd *musb_to_hcd(struct musb *musb)
|
||||
diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
|
||||
index 61ff68def2fa..d186facc7e02 100644
|
||||
index 61ff68def2..d186facc7e 100644
|
||||
--- a/drivers/usb/musb-new/musb_uboot.c
|
||||
+++ b/drivers/usb/musb-new/musb_uboot.c
|
||||
@@ -8,10 +8,10 @@
|
||||
@@ -347,7 +348,7 @@ index 61ff68def2fa..d186facc7e02 100644
|
||||
-}
|
||||
-#endif
|
||||
diff --git a/drivers/usb/musb-new/musb_uboot.h b/drivers/usb/musb-new/musb_uboot.h
|
||||
index 18282efccc9d..6b162f03b19e 100644
|
||||
index 18282efccc..6b162f03b1 100644
|
||||
--- a/drivers/usb/musb-new/musb_uboot.h
|
||||
+++ b/drivers/usb/musb-new/musb_uboot.h
|
||||
@@ -8,8 +8,8 @@
|
||||
@@ -364,7 +365,7 @@ diff --git a/drivers/usb/musb-new/usb-compat.h b/include/linux/usb/usb_urb_compa
|
||||
similarity index 60%
|
||||
rename from drivers/usb/musb-new/usb-compat.h
|
||||
rename to include/linux/usb/usb_urb_compat.h
|
||||
index df68c9220a7a..5ed96fa64e96 100644
|
||||
index df68c9220a..5ed96fa64e 100644
|
||||
--- a/drivers/usb/musb-new/usb-compat.h
|
||||
+++ b/include/linux/usb/usb_urb_compat.h
|
||||
@@ -1,16 +1,31 @@
|
||||
@@ -439,7 +440,7 @@ index df68c9220a7a..5ed96fa64e96 100644
|
||||
+
|
||||
#endif /* __USB_COMPAT_H__ */
|
||||
diff --git a/include/usb_defs.h b/include/usb_defs.h
|
||||
index 6dd2c997f9b3..ec00161710a5 100644
|
||||
index 6dd2c997f9..ec00161710 100644
|
||||
--- a/include/usb_defs.h
|
||||
+++ b/include/usb_defs.h
|
||||
@@ -81,6 +81,32 @@
|
||||
@@ -493,5 +494,5 @@ index 6dd2c997f9b3..ec00161710a5 100644
|
||||
/*
|
||||
* Hub Status & Hub Change bit masks
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
|
||||
+17
-16
@@ -1,12 +1,13 @@
|
||||
From 8abb9c6a342d750a3a3a66e674c3be6597fc9f66 Mon Sep 17 00:00:00 2001
|
||||
From 83ba88292211394ce6b3a21fbc0f702dae543290 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Mon, 28 Jun 2021 23:31:25 +0100
|
||||
Subject: [PATCH 04/24] usb: add isp1760 family driver
|
||||
Subject: [PATCH 04/26] usb: add isp1760 family driver
|
||||
|
||||
ISP1760/61/63 are a family of usb controllers, blah, blah, more info
|
||||
here.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Accepted [2022.10-rc1]
|
||||
---
|
||||
Makefile | 1 +
|
||||
drivers/usb/Kconfig | 2 +
|
||||
@@ -34,7 +35,7 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
create mode 100644 drivers/usb/isp1760/isp1760-uboot.h
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 98867fbe06b4..67851020f5c1 100644
|
||||
index 98867fbe06..67851020f5 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -841,6 +841,7 @@ libs-y += drivers/usb/host/
|
||||
@@ -46,7 +47,7 @@ index 98867fbe06b4..67851020f5c1 100644
|
||||
libs-y += drivers/usb/ulpi/
|
||||
ifdef CONFIG_POST
|
||||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
|
||||
index ab1d061bd0d5..bbe07be02cab 100644
|
||||
index ab1d061bd0..bbe07be02c 100644
|
||||
--- a/drivers/usb/Kconfig
|
||||
+++ b/drivers/usb/Kconfig
|
||||
@@ -78,6 +78,8 @@ source "drivers/usb/musb/Kconfig"
|
||||
@@ -59,7 +60,7 @@ index ab1d061bd0d5..bbe07be02cab 100644
|
||||
|
||||
source "drivers/usb/phy/Kconfig"
|
||||
diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
|
||||
index dc05cb0a5077..f08b064d2493 100644
|
||||
index dc05cb0a50..f08b064d24 100644
|
||||
--- a/drivers/usb/common/Makefile
|
||||
+++ b/drivers/usb/common/Makefile
|
||||
@@ -4,6 +4,7 @@
|
||||
@@ -72,7 +73,7 @@ index dc05cb0a5077..f08b064d2493 100644
|
||||
obj-$(CONFIG_USB_EHCI_FSL) += fsl-dt-fixup.o fsl-errata.o
|
||||
diff --git a/drivers/usb/isp1760/Kconfig b/drivers/usb/isp1760/Kconfig
|
||||
new file mode 100644
|
||||
index 000000000000..993d71e74cd2
|
||||
index 0000000000..993d71e74c
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/Kconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
@@ -90,7 +91,7 @@ index 000000000000..993d71e74cd2
|
||||
+ capable bus.
|
||||
diff --git a/drivers/usb/isp1760/Makefile b/drivers/usb/isp1760/Makefile
|
||||
new file mode 100644
|
||||
index 000000000000..2c809c01b118
|
||||
index 0000000000..2c809c01b1
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/Makefile
|
||||
@@ -0,0 +1,6 @@
|
||||
@@ -102,7 +103,7 @@ index 000000000000..2c809c01b118
|
||||
+obj-$(CONFIG_USB_ISP1760) += isp1760.o
|
||||
diff --git a/drivers/usb/isp1760/isp1760-core.c b/drivers/usb/isp1760/isp1760-core.c
|
||||
new file mode 100644
|
||||
index 000000000000..3080595549c5
|
||||
index 0000000000..3080595549
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-core.c
|
||||
@@ -0,0 +1,378 @@
|
||||
@@ -486,7 +487,7 @@ index 000000000000..3080595549c5
|
||||
+}
|
||||
diff --git a/drivers/usb/isp1760/isp1760-core.h b/drivers/usb/isp1760/isp1760-core.h
|
||||
new file mode 100644
|
||||
index 000000000000..0a60e30b5fe7
|
||||
index 0000000000..0a60e30b5f
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-core.h
|
||||
@@ -0,0 +1,96 @@
|
||||
@@ -588,7 +589,7 @@ index 000000000000..0a60e30b5fe7
|
||||
+#endif
|
||||
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
|
||||
new file mode 100644
|
||||
index 000000000000..b1d86dd69b94
|
||||
index 0000000000..b1d86dd69b
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-hcd.c
|
||||
@@ -0,0 +1,2574 @@
|
||||
@@ -3168,7 +3169,7 @@ index 000000000000..b1d86dd69b94
|
||||
+}
|
||||
diff --git a/drivers/usb/isp1760/isp1760-hcd.h b/drivers/usb/isp1760/isp1760-hcd.h
|
||||
new file mode 100644
|
||||
index 000000000000..00f5ca8c1f75
|
||||
index 0000000000..00f5ca8c1f
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-hcd.h
|
||||
@@ -0,0 +1,82 @@
|
||||
@@ -3256,7 +3257,7 @@ index 000000000000..00f5ca8c1f75
|
||||
+#endif /* _ISP1760_HCD_H_ */
|
||||
diff --git a/drivers/usb/isp1760/isp1760-if.c b/drivers/usb/isp1760/isp1760-if.c
|
||||
new file mode 100644
|
||||
index 000000000000..c610da6b23fb
|
||||
index 0000000000..c610da6b23
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-if.c
|
||||
@@ -0,0 +1,127 @@
|
||||
@@ -3389,7 +3390,7 @@ index 000000000000..c610da6b23fb
|
||||
+};
|
||||
diff --git a/drivers/usb/isp1760/isp1760-regs.h b/drivers/usb/isp1760/isp1760-regs.h
|
||||
new file mode 100644
|
||||
index 000000000000..94ea60c20b2a
|
||||
index 0000000000..94ea60c20b
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-regs.h
|
||||
@@ -0,0 +1,292 @@
|
||||
@@ -3687,7 +3688,7 @@ index 000000000000..94ea60c20b2a
|
||||
+#endif
|
||||
diff --git a/drivers/usb/isp1760/isp1760-uboot.c b/drivers/usb/isp1760/isp1760-uboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..7635210fe2b4
|
||||
index 0000000000..7635210fe2
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-uboot.c
|
||||
@@ -0,0 +1,76 @@
|
||||
@@ -3769,7 +3770,7 @@ index 000000000000..7635210fe2b4
|
||||
+};
|
||||
diff --git a/drivers/usb/isp1760/isp1760-uboot.h b/drivers/usb/isp1760/isp1760-uboot.h
|
||||
new file mode 100644
|
||||
index 000000000000..2486de6f9e27
|
||||
index 0000000000..2486de6f9e
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/isp1760/isp1760-uboot.h
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -3801,5 +3802,5 @@ index 000000000000..2486de6f9e27
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
|
||||
+6
-5
@@ -1,20 +1,21 @@
|
||||
From 5031fea320bb4ccc1ce7470193d8f4402ae819c9 Mon Sep 17 00:00:00 2001
|
||||
From 8717357eff3f4172c74f0b10078c31cdff9bcc41 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Thu, 3 Mar 2022 16:52:02 +0000
|
||||
Subject: [PATCH 05/24] corstone1000: enable isp1763 usb controller
|
||||
Subject: [PATCH 05/26] corstone1000: enable isp1763 usb controller
|
||||
|
||||
MPS3 board have a ISP1763 usb controller, add the
|
||||
correspondent mmio area and enable it to be used for mass
|
||||
storage access for example.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Accepted [2022.10-rc1]
|
||||
---
|
||||
configs/corstone1000_defconfig | 1 +
|
||||
include/configs/corstone1000.h | 6 ++++++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index 02f931b0d469..e573fe6fe6a2 100644
|
||||
index 02f931b0d4..e573fe6fe6 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -42,6 +42,7 @@ CONFIG_REGMAP=y
|
||||
@@ -26,7 +27,7 @@ index 02f931b0d469..e573fe6fe6a2 100644
|
||||
CONFIG_EFI_MM_COMM_TEE=y
|
||||
# CONFIG_OPTEE is not set
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index cf166f107efd..8ba0effb0ab2 100644
|
||||
index cf166f107e..8ba0effb0a 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -55,7 +55,13 @@
|
||||
@@ -44,5 +45,5 @@ index cf166f107efd..8ba0effb0ab2 100644
|
||||
"boot_bank_flag=0x08002000\0" \
|
||||
"kernel_addr_bank_0=0x083EE000\0" \
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
From 7afe2370bc24b9003be8184fbd3169ebca03165a Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 29 Jul 2022 13:06:19 +0100
|
||||
Subject: [PATCH 06/26] arm64: smccc: add support for SMCCCv1.2 x0-x17
|
||||
registers
|
||||
|
||||
add support for x0-x17 registers used by the SMC calls
|
||||
|
||||
In SMCCC v1.2 [1] arguments are passed in registers x1-x17.
|
||||
Results are returned in x0-x17.
|
||||
|
||||
This work is inspired from the following kernel commit:
|
||||
|
||||
arm64: smccc: Add support for SMCCCv1.2 extended input/output registers
|
||||
|
||||
[1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6?token=
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4:
|
||||
|
||||
* rename the commit title and improve description
|
||||
new commit title: the current
|
||||
|
||||
v3:
|
||||
|
||||
* port x0-x17 registers support from linux kernel as defined by SMCCCv1.2
|
||||
commit title:
|
||||
arm64: smccc: add Xn registers support used by SMC calls
|
||||
|
||||
arch/arm/cpu/armv8/smccc-call.S | 53 +++++++++++++++++++++++++++++++++
|
||||
arch/arm/lib/asm-offsets.c | 13 ++++++++
|
||||
include/linux/arm-smccc.h | 43 ++++++++++++++++++++++++++
|
||||
3 files changed, 109 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/cpu/armv8/smccc-call.S b/arch/arm/cpu/armv8/smccc-call.S
|
||||
index dc92b28777..ec6f299bc9 100644
|
||||
--- a/arch/arm/cpu/armv8/smccc-call.S
|
||||
+++ b/arch/arm/cpu/armv8/smccc-call.S
|
||||
@@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2015, Linaro Limited
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
@@ -45,3 +47,54 @@ ENDPROC(__arm_smccc_smc)
|
||||
ENTRY(__arm_smccc_hvc)
|
||||
SMCCC hvc
|
||||
ENDPROC(__arm_smccc_hvc)
|
||||
+
|
||||
+#ifdef CONFIG_ARM64
|
||||
+
|
||||
+ .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_smc(const struct arm_smccc_1_2_regs *args,
|
||||
+ * struct arm_smccc_1_2_regs *res);
|
||||
+ */
|
||||
+ENTRY(arm_smccc_1_2_smc)
|
||||
+ SMCCC_1_2 smc
|
||||
+ENDPROC(arm_smccc_1_2_smc)
|
||||
+
|
||||
+#endif
|
||||
diff --git a/arch/arm/lib/asm-offsets.c b/arch/arm/lib/asm-offsets.c
|
||||
index 22fd541f9a..b6bd1b32b0 100644
|
||||
--- a/arch/arm/lib/asm-offsets.c
|
||||
+++ b/arch/arm/lib/asm-offsets.c
|
||||
@@ -9,6 +9,8 @@
|
||||
* generate asm statements containing #defines,
|
||||
* compile this file to assembler, and then extract the
|
||||
* #defines from the assembly-language output.
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -117,6 +119,17 @@ 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));
|
||||
+ #ifdef CONFIG_ARM64
|
||||
+ 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));
|
||||
+ #endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
|
||||
index 7f2be23394..dae58d3476 100644
|
||||
--- a/include/linux/arm-smccc.h
|
||||
+++ b/include/linux/arm-smccc.h
|
||||
@@ -1,6 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2015, Linaro Limited
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
*/
|
||||
#ifndef __LINUX_ARM_SMCCC_H
|
||||
#define __LINUX_ARM_SMCCC_H
|
||||
@@ -66,6 +68,47 @@ struct arm_smccc_res {
|
||||
unsigned long a3;
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_ARM64
|
||||
+/**
|
||||
+ * struct arm_smccc_1_2_regs - Arguments for or Results from SMC call
|
||||
+ * @a0-a17 argument values from registers 0 to 17
|
||||
+ */
|
||||
+struct arm_smccc_1_2_regs {
|
||||
+ unsigned long a0;
|
||||
+ unsigned long a1;
|
||||
+ unsigned long a2;
|
||||
+ unsigned long a3;
|
||||
+ unsigned long a4;
|
||||
+ unsigned long a5;
|
||||
+ unsigned long a6;
|
||||
+ unsigned long a7;
|
||||
+ unsigned long a8;
|
||||
+ unsigned long a9;
|
||||
+ unsigned long a10;
|
||||
+ unsigned long a11;
|
||||
+ unsigned long a12;
|
||||
+ unsigned long a13;
|
||||
+ unsigned long a14;
|
||||
+ unsigned long a15;
|
||||
+ unsigned long a16;
|
||||
+ unsigned long a17;
|
||||
+};
|
||||
+
|
||||
+/**
|
||||
+ * arm_smccc_1_2_smc() - make SMC calls
|
||||
+ * @args: arguments passed via struct arm_smccc_1_2_regs
|
||||
+ * @res: result values via struct arm_smccc_1_2_regs
|
||||
+ *
|
||||
+ * This function is used to make SMC calls following SMC Calling Convention
|
||||
+ * v1.2 or above. The content of the supplied param are copied from the
|
||||
+ * structure to registers prior to the SMC instruction. The return values
|
||||
+ * are updated with the content from registers on return from the SMC
|
||||
+ * instruction.
|
||||
+ */
|
||||
+asmlinkage void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,
|
||||
+ struct arm_smccc_1_2_regs *res);
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* struct arm_smccc_quirk - Contains quirk information
|
||||
* @id: quirk identification
|
||||
--
|
||||
2.17.1
|
||||
|
||||
-2610
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
From 83f9da30247c2d021658bc1b595c59ecc35eadf5 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Fri, 29 Jul 2022 13:07:43 +0100
|
||||
Subject: [PATCH 07/26] arm64: smccc: clear the Xn registers after SMC calls
|
||||
|
||||
set to zero the x0-x17 registers
|
||||
|
||||
As per the SMCCC v1.2 spec, unused result and scratch registers can leak
|
||||
information after an SMC call. We can mitigate against this risk by
|
||||
returning zero in each register.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4:
|
||||
|
||||
* move the clearing code into a new macro: clear_gp_regs
|
||||
|
||||
v3:
|
||||
|
||||
* clear the Xn registers after SMC calls
|
||||
|
||||
arch/arm/cpu/armv8/smccc-call.S | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/cpu/armv8/smccc-call.S b/arch/arm/cpu/armv8/smccc-call.S
|
||||
index ec6f299bc9..32f3eb8eeb 100644
|
||||
--- a/arch/arm/cpu/armv8/smccc-call.S
|
||||
+++ b/arch/arm/cpu/armv8/smccc-call.S
|
||||
@@ -50,6 +50,12 @@ ENDPROC(__arm_smccc_hvc)
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
|
||||
+ .macro clear_gp_regs
|
||||
+ .irp n,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
|
||||
+ mov x\n, xzr
|
||||
+ .endr
|
||||
+ .endm
|
||||
+
|
||||
.macro SMCCC_1_2 instr
|
||||
/* Save `res` and free a GPR that won't be clobbered */
|
||||
stp x1, x19, [sp, #-16]!
|
||||
@@ -84,6 +90,9 @@ ENDPROC(__arm_smccc_hvc)
|
||||
stp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
|
||||
stp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
|
||||
|
||||
+ /* x0-x17 registers can leak information after an SMC or HVC call. Let's clear them */
|
||||
+ clear_gp_regs
|
||||
+
|
||||
/* Restore original x19 */
|
||||
ldp xzr, x19, [sp], #16
|
||||
ret
|
||||
--
|
||||
2.17.1
|
||||
|
||||
-383
@@ -1,383 +0,0 @@
|
||||
From ee7c0aee66db53b2372a3b4245a8754dceee804d Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Wed, 13 Oct 2021 17:51:44 +0100
|
||||
Subject: [PATCH 08/24] arm_ffa: introducing MM communication with FF-A
|
||||
|
||||
This commit allows to perform MM communication using FF-A transport.
|
||||
|
||||
The MM SP (also called partition) can be StandAlonneMM or smm-gateway.
|
||||
Both partitions run in OP-TEE.
|
||||
|
||||
When using the u-boot FF-A driver, StandAlonneMM and smm-gateway are
|
||||
supported.
|
||||
|
||||
On EFI services such as GetVariable()/SetVariable(), the data
|
||||
is copied from the communication buffer to the MM shared buffer.
|
||||
|
||||
Then, notifies the MM SP about data availability in the MM shared buffer.
|
||||
Communication with the MM SP is performed using FF-A transport.
|
||||
|
||||
On such event, MM SP can read the data and updates the MM shared buffer
|
||||
with response data.
|
||||
|
||||
The response data is copied back to the communication buffer.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
lib/efi_loader/Kconfig | 14 +-
|
||||
lib/efi_loader/efi_variable_tee.c | 265 +++++++++++++++++++++++++++++-
|
||||
2 files changed, 273 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
|
||||
index e3f2402d0e8e..37131237af3f 100644
|
||||
--- a/lib/efi_loader/Kconfig
|
||||
+++ b/lib/efi_loader/Kconfig
|
||||
@@ -60,13 +60,23 @@ config EFI_VARIABLE_FILE_STORE
|
||||
stored as file /ubootefi.var on the EFI system partition.
|
||||
|
||||
config EFI_MM_COMM_TEE
|
||||
- bool "UEFI variables storage service via OP-TEE"
|
||||
- depends on OPTEE
|
||||
+ bool "UEFI variables storage service via the trusted world"
|
||||
+ depends on OPTEE || ARM_FFA_TRANSPORT
|
||||
help
|
||||
+ the MM SP (also called partition) can be StandAlonneMM or smm-gateway.
|
||||
+ When using the u-boot OP-TEE driver, StandAlonneMM is supported.
|
||||
+ When using the u-boot FF-A driver, StandAlonneMM and smm-gateway are supported.
|
||||
+
|
||||
If OP-TEE is present and running StandAloneMM, dispatch all UEFI
|
||||
variable related operations to that. The application will verify,
|
||||
authenticate and store the variables on an RPMB.
|
||||
|
||||
+ When ARM_FFA_TRANSPORT is used, dispatch all UEFI variable related
|
||||
+ operations to the MM SP running under Optee in the trusted world.
|
||||
+ A door bell mechanism is used to notify the SP when there is data in the shared
|
||||
+ MM buffer. The data is copied by u-boot to thea shared buffer before issuing
|
||||
+ the door bell event.
|
||||
+
|
||||
config EFI_VARIABLE_NO_STORE
|
||||
bool "Don't persist non-volatile UEFI variables"
|
||||
help
|
||||
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
|
||||
index dfef18435dfa..9cb8cfb9c779 100644
|
||||
--- a/lib/efi_loader/efi_variable_tee.c
|
||||
+++ b/lib/efi_loader/efi_variable_tee.c
|
||||
@@ -15,6 +15,28 @@
|
||||
#include <malloc.h>
|
||||
#include <mm_communication.h>
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_OPTEE))
|
||||
+#define OPTEE_PAGE_SIZE BIT(12)
|
||||
+#endif
|
||||
+
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+
|
||||
+#include <arm_ffa_helper.h>
|
||||
+#include <mapmem.h>
|
||||
+
|
||||
+/* MM return codes */
|
||||
+#define MM_SUCCESS (0)
|
||||
+
|
||||
+#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64 (0xC4000061)
|
||||
+#define ARM_SVC_ID_SP_EVENT_COMPLETE ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64
|
||||
+
|
||||
+/* MM_SP_UUID_DATA defined by the platform */
|
||||
+union ffa_partition_uuid mm_sp_svc_uuid = {.bytes = {MM_SP_UUID_DATA}};
|
||||
+
|
||||
+static u16 __efi_runtime_data mm_sp_id;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
extern struct efi_var_file __efi_runtime_data *efi_var_buf;
|
||||
static efi_uintn_t max_buffer_size; /* comm + var + func + data */
|
||||
static efi_uintn_t max_payload_size; /* func + data */
|
||||
@@ -24,6 +46,7 @@ struct mm_connection {
|
||||
u32 session;
|
||||
};
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_OPTEE))
|
||||
/**
|
||||
* get_connection() - Retrieve OP-TEE session for a specific UUID.
|
||||
*
|
||||
@@ -143,16 +166,229 @@ static efi_status_t optee_mm_communicate(void *comm_buf, ulong dsize)
|
||||
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+
|
||||
+/**
|
||||
+ * ffa_notify_mm_sp() - Announce there is data in the shared buffer
|
||||
+ *
|
||||
+ * Notifies the MM partition in the trusted world that
|
||||
+ * data is available in the shared buffer.
|
||||
+ * This is a blocking call during which trusted world has exclusive access
|
||||
+ * to the MM shared buffer.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success
|
||||
+ */
|
||||
+static int __efi_runtime ffa_notify_mm_sp(void)
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ u32 sp_event_complete;
|
||||
+ int sp_event_ret;
|
||||
+
|
||||
+ func_data.data0_size = sizeof(mm_sp_id);
|
||||
+ func_data.data0 = &mm_sp_id;
|
||||
+
|
||||
+ msg.a3 = FFA_SHARED_MM_BUFFER_ADDR;
|
||||
+ msg.a4 = FFA_SHARED_MM_BUFFER_SIZE;
|
||||
+ func_data.data1_size = sizeof(msg);
|
||||
+ func_data.data1 = &msg;
|
||||
+
|
||||
+ ret = ffa_helper_msg_send_direct_req(&func_data);
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS) {
|
||||
+ log_err("EFI: Failure to notify the MM SP , FF-A error (%d)\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ sp_event_complete = msg.a3;
|
||||
+ sp_event_ret = (int)msg.a4;
|
||||
+
|
||||
+ if (sp_event_complete == ARM_SVC_ID_SP_EVENT_COMPLETE && sp_event_ret == MM_SUCCESS)
|
||||
+ return 0;
|
||||
+
|
||||
+ log_err("EFI: Failure to notify the MM SP (0x%x , %d)\n",
|
||||
+ sp_event_complete,
|
||||
+ sp_event_ret);
|
||||
+
|
||||
+ return -EACCES;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * ffa_discover_mm_sp_id() - Query the MM partition ID
|
||||
+ *
|
||||
+ * Use the FF-A driver to get the MM partition ID.
|
||||
+ * If multiple partitions are found, use the first one
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success
|
||||
+ */
|
||||
+static int __efi_runtime ffa_discover_mm_sp_id(void)
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ u32 count = 0;
|
||||
+ int ret;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(mm_sp_svc_uuid);
|
||||
+ func_data.data0 = &mm_sp_svc_uuid;
|
||||
+ func_data.data1_size = sizeof(count);
|
||||
+ func_data.data1 = &count;
|
||||
+
|
||||
+ ret = ffa_helper_get_partitions_info(&func_data);
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS) {
|
||||
+ log_err("EFI: Failure in querying partitions count (error code: %d)\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (!count) {
|
||||
+ log_info("EFI: No MM partition found\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ if (!parts_info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ log_info("EFI: Pre-allocating %d partition(s) info structures\n", count);
|
||||
+
|
||||
+ func_data.data1_size = count *
|
||||
+ sizeof(struct ffa_partition_info);
|
||||
+ func_data.data1 = parts_info;
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the
|
||||
+ * buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_helper_get_partitions_info(&func_data);
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS) {
|
||||
+ log_err("EFI: Failure in querying partition(s) info (error code: %d)\n", ret);
|
||||
+ free(parts_info);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * MM SPs found , use the first one
|
||||
+ */
|
||||
+
|
||||
+ mm_sp_id = parts_info[0].id;
|
||||
+
|
||||
+ log_info("EFI: MM partition ID 0x%x\n", mm_sp_id);
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
/**
|
||||
- * mm_communicate() - Adjust the cmonnucation buffer to StandAlonneMM and send
|
||||
+ * ffa_mm_communicate() - Exchange EFI services data with the MM partition using FF-A
|
||||
+ * @comm_buf: locally allocated communication buffer used for for rx/tx
|
||||
+ * @dsize: communication buffer size
|
||||
+ *
|
||||
+ * Issues a door bell event to notify the MM partition (SP) running in OP-TEE
|
||||
+ * that there is data to read from the shared buffer.
|
||||
+ * Communication with the MM SP is performed using FF-A transport.
|
||||
+ * On the event, MM SP can read the data from the buffer and
|
||||
+ * update the MM shared buffer with response data.
|
||||
+ * The response data is copied back to the communication buffer.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * EFI status code
|
||||
+ */
|
||||
+static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_buf_size)
|
||||
+{
|
||||
+ ulong tx_data_size;
|
||||
+ int ffa_ret;
|
||||
+ struct efi_mm_communicate_header *mm_hdr;
|
||||
+ void *virt_shared_buf;
|
||||
+
|
||||
+ if (!comm_buf)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Discover MM partition ID */
|
||||
+ if (!mm_sp_id && ffa_discover_mm_sp_id() != FFA_ERR_STAT_SUCCESS) {
|
||||
+ log_err("EFI: Failure to discover MM partition ID\n");
|
||||
+ return EFI_UNSUPPORTED;
|
||||
+ }
|
||||
+
|
||||
+ mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
+ tx_data_size = mm_hdr->message_len + sizeof(efi_guid_t) + sizeof(size_t);
|
||||
+
|
||||
+ if (comm_buf_size != tx_data_size || tx_data_size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Copy the data to the shared buffer */
|
||||
+
|
||||
+ virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0);
|
||||
+ efi_memcpy_runtime(virt_shared_buf, comm_buf, tx_data_size);
|
||||
+
|
||||
+ /* Announce there is data in the shared buffer */
|
||||
+
|
||||
+ ffa_ret = ffa_notify_mm_sp();
|
||||
+ if (ffa_ret)
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+
|
||||
+ switch (ffa_ret) {
|
||||
+ case 0:
|
||||
+ {
|
||||
+ ulong rx_data_size;
|
||||
+ /* Copy the MM SP response from the shared buffer to the communication buffer */
|
||||
+ rx_data_size = ((struct efi_mm_communicate_header *)virt_shared_buf)->message_len +
|
||||
+ sizeof(efi_guid_t) +
|
||||
+ sizeof(size_t);
|
||||
+
|
||||
+ if (rx_data_size > comm_buf_size) {
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+ return EFI_OUT_OF_RESOURCES;
|
||||
+ }
|
||||
+
|
||||
+ efi_memcpy_runtime(comm_buf, virt_shared_buf, rx_data_size);
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+
|
||||
+ return EFI_SUCCESS;
|
||||
+ }
|
||||
+ case -EINVAL:
|
||||
+ return EFI_DEVICE_ERROR;
|
||||
+ case -EPERM:
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+ case -EACCES:
|
||||
+ return EFI_ACCESS_DENIED;
|
||||
+ case -EBUSY:
|
||||
+ return EFI_OUT_OF_RESOURCES;
|
||||
+ default:
|
||||
+ return EFI_ACCESS_DENIED;
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * mm_communicate() - Adjust the communication buffer to the MM SP and send
|
||||
* it to OP-TEE
|
||||
*
|
||||
- * @comm_buf: locally allocted communcation buffer
|
||||
+ * @comm_buf: locally allocted communication buffer
|
||||
* @dsize: buffer size
|
||||
+ *
|
||||
+ * The MM SP (also called partition) can be StandAlonneMM or smm-gateway.
|
||||
+ * The comm_buf format is the same for both partitions.
|
||||
+ * When using the u-boot OP-TEE driver, StandAlonneMM is supported.
|
||||
+ * When using the u-boot FF-A driver, StandAlonneMM and smm-gateway are supported.
|
||||
+ *
|
||||
* Return: status code
|
||||
*/
|
||||
-static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
+static efi_status_t __efi_runtime mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
{
|
||||
efi_status_t ret;
|
||||
struct efi_mm_communicate_header *mm_hdr;
|
||||
@@ -162,7 +398,11 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data;
|
||||
|
||||
+ #if (IS_ENABLED(CONFIG_OPTEE))
|
||||
ret = optee_mm_communicate(comm_buf, dsize);
|
||||
+ #elif (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ ret = ffa_mm_communicate(comm_buf, dsize);
|
||||
+ #endif
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("%s failed!\n", __func__);
|
||||
return ret;
|
||||
@@ -258,6 +498,23 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size)
|
||||
goto out;
|
||||
}
|
||||
*size = var_payload->size;
|
||||
+
|
||||
+ #if (IS_ENABLED(CONFIG_OPTEE))
|
||||
+ /*
|
||||
+ * Although the max payload is configurable on StMM, we only share a
|
||||
+ * single page from OP-TEE for the non-secure buffer used to communicate
|
||||
+ * with StMM. Since OP-TEE will reject to map anything bigger than that,
|
||||
+ * make sure we are in bounds.
|
||||
+ */
|
||||
+ if (*size > OPTEE_PAGE_SIZE)
|
||||
+ *size = OPTEE_PAGE_SIZE - MM_COMMUNICATE_HEADER_SIZE -
|
||||
+ MM_VARIABLE_COMMUNICATE_SIZE;
|
||||
+ #elif (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ if (*size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ *size = FFA_SHARED_MM_BUFFER_SIZE - MM_COMMUNICATE_HEADER_SIZE -
|
||||
+ MM_VARIABLE_COMMUNICATE_SIZE;
|
||||
+ #endif
|
||||
+
|
||||
/*
|
||||
* There seems to be a bug in EDK2 miscalculating the boundaries and
|
||||
* size checks, so deduct 2 more bytes to fulfill this requirement. Fix
|
||||
@@ -697,7 +954,7 @@ void efi_variables_boot_exit_notify(void)
|
||||
ret = EFI_NOT_FOUND;
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
- log_err("Unable to notify StMM for ExitBootServices\n");
|
||||
+ log_err("Unable to notify the MM partition for ExitBootServices\n");
|
||||
free(comm_buf);
|
||||
|
||||
/*
|
||||
--
|
||||
2.37.1
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
From af17d357674393565c8be15f21c86cba972963e7 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Thu, 4 Aug 2022 16:46:47 +0100
|
||||
Subject: [PATCH 08/26] lib: uuid: introduce be_uuid_str_to_le_bin function
|
||||
|
||||
convert big endian UUID string to little endian buffer
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4:
|
||||
|
||||
* rename ffa_uuid_str_to_bin to be_uuid_str_to_le_bin and put in
|
||||
a standalone commit (the current)
|
||||
|
||||
v3:
|
||||
|
||||
* introduce ffa_uuid_str_to_bin (provided by
|
||||
arm_ffa: introduce Arm FF-A low-level driver)
|
||||
|
||||
include/uuid.h | 6 +++++
|
||||
lib/uuid.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 69 insertions(+)
|
||||
|
||||
diff --git a/include/uuid.h b/include/uuid.h
|
||||
index 4a4883d3b5..5355230b5e 100644
|
||||
--- a/include/uuid.h
|
||||
+++ b/include/uuid.h
|
||||
@@ -44,4 +44,10 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin);
|
||||
const char *uuid_guid_get_str(const unsigned char *guid_bin);
|
||||
void gen_rand_uuid(unsigned char *uuid_bin);
|
||||
void gen_rand_uuid_str(char *uuid_str, int str_format);
|
||||
+
|
||||
+/**
|
||||
+ * be_uuid_str_to_le_bin - Converts a big endian UUID string to a little endian buffer
|
||||
+ */
|
||||
+int be_uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin);
|
||||
+
|
||||
#endif
|
||||
diff --git a/lib/uuid.c b/lib/uuid.c
|
||||
index 284f8113ff..d0fa51d0bf 100644
|
||||
--- a/lib/uuid.c
|
||||
+++ b/lib/uuid.c
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright 2011 Calxeda, Inc.
|
||||
+ * Copyright 2022 ARM Limited
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -342,6 +343,68 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * be_uuid_str_to_le_bin - Converts a big endian UUID string to a little endian buffer
|
||||
+ * @uuid_str: UUID string in big endian format (36 bytes wide + '/0')
|
||||
+ * @uuid_bin: preallocated 16 bytes UUID buffer in little endian format
|
||||
+ *
|
||||
+ * UUID string is 36 characters (36 bytes):
|
||||
+ *
|
||||
+ * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
+ * be be be be be
|
||||
+ *
|
||||
+ * where x is a hexadecimal character. Fields are separated by '-'s.
|
||||
+ * When converting to a binary UUID, these endianness rules apply:
|
||||
+ * be: means the field in the string is considered a big endian hex number
|
||||
+ * and should be converted to little endian binary format
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * uuid_bin filled with little endian UUID data
|
||||
+ * On success 0 is returned. Otherwise, failure code.
|
||||
+ */
|
||||
+int be_uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin)
|
||||
+{
|
||||
+ u16 tmp16 = 0;
|
||||
+ u32 tmp32 = 0;
|
||||
+ u64 tmp64 = 0;
|
||||
+
|
||||
+ if (!uuid_str_valid(uuid_str) || !uuid_bin)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /*
|
||||
+ * reverse bytes from big to little endian
|
||||
+ */
|
||||
+ tmp32 = simple_strtoul(uuid_str, NULL, 16);
|
||||
+ memcpy(uuid_bin, &tmp32, 4);
|
||||
+
|
||||
+ /*
|
||||
+ * reverse bytes from big to little endian
|
||||
+ */
|
||||
+ tmp16 = simple_strtoul(uuid_str + 9, NULL, 16);
|
||||
+ memcpy(uuid_bin + 4, &tmp16, 2);
|
||||
+
|
||||
+ /*
|
||||
+ * reverse bytes from big to little endian
|
||||
+ */
|
||||
+ tmp16 = simple_strtoul(uuid_str + 14, NULL, 16);
|
||||
+ memcpy(uuid_bin + 6, &tmp16, 2);
|
||||
+
|
||||
+ /*
|
||||
+ * reverse bytes from big to little endian
|
||||
+ */
|
||||
+ tmp16 = simple_strtoul(uuid_str + 19, NULL, 16);
|
||||
+ memcpy(uuid_bin + 8, &tmp16, 2);
|
||||
+
|
||||
+ /*
|
||||
+ * reverse bytes from big to little endian
|
||||
+ */
|
||||
+ tmp64 = simple_strtoull(uuid_str + 24, NULL, 16);
|
||||
+ memcpy(uuid_bin + 10, (char *)&tmp64, 6);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* uuid_bin_to_str() - convert big endian binary data to string UUID or GUID.
|
||||
*
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+2245
File diff suppressed because it is too large
Load Diff
-132
@@ -1,132 +0,0 @@
|
||||
From 6f998a5e94e2562b5876b88864876c8b03b88f5a Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Tue, 16 Nov 2021 12:38:48 +0000
|
||||
Subject: [PATCH 09/24] arm_ffa: introducing test module for UCLASS_FFA
|
||||
|
||||
This is the test module for the UCLASS_FFA class.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
test/dm/Makefile | 1 +
|
||||
test/dm/ffa.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
test/dm/ffa.h | 19 ++++++++++++++++
|
||||
4 files changed, 77 insertions(+)
|
||||
create mode 100644 test/dm/ffa.c
|
||||
create mode 100644 test/dm/ffa.h
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 32fc267fcf13..8209dc9319f1 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -252,6 +252,7 @@ F: drivers/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/arm_ffa_helper.h
|
||||
F: lib/arm-ffa/
|
||||
+F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
M: Stefano Babic <sbabic@denx.de>
|
||||
diff --git a/test/dm/Makefile b/test/dm/Makefile
|
||||
index f0a7c97e3d17..09a3403d2f53 100644
|
||||
--- a/test/dm/Makefile
|
||||
+++ b/test/dm/Makefile
|
||||
@@ -79,6 +79,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
|
||||
obj-$(CONFIG_ACPI_PMC) += pmc.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_PWM) += pwm.o
|
||||
+obj-$(CONFIG_ARM_FFA_TRANSPORT) += ffa.o
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_RAM) += ram.o
|
||||
obj-y += regmap.o
|
||||
diff --git a/test/dm/ffa.c b/test/dm/ffa.c
|
||||
new file mode 100644
|
||||
index 000000000000..b937cea57b80
|
||||
--- /dev/null
|
||||
+++ b/test/dm/ffa.c
|
||||
@@ -0,0 +1,56 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Test for UCLASS_FFA class
|
||||
+ *
|
||||
+ * (C) Copyright 2021 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+#include <arm_ffa_helper.h>
|
||||
+#include "ffa.h"
|
||||
+
|
||||
+/* Basic test of 'armffa' command */
|
||||
+static int dm_test_armffa_cmd(struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_assertok(ffa_helper_init_device());
|
||||
+
|
||||
+ ut_assertok(console_record_reset_enable());
|
||||
+
|
||||
+ /* armffa getpart <UUID> */
|
||||
+ ut_assertok(run_command("armffa getpart " SE_PROXY_PARTITION_UUID, 0));
|
||||
+ ut_assert_console_end();
|
||||
+
|
||||
+ /* armffa ping <ID> */
|
||||
+ ut_assertok(run_command("armffa ping " SE_PROXY_PARTITION_ID, 0));
|
||||
+ ut_assert_console_end();
|
||||
+
|
||||
+ /* armffa devlist */
|
||||
+ ut_assertok(run_command("armffa devlist", 0));
|
||||
+ ut_assert_console_end();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
+
|
||||
+static int test_ffa_msg_send_direct_req(void)
|
||||
+{
|
||||
+ char *const argv[1] = {SE_PROXY_PARTITION_ID}; /* Corstone1000 SE Proxy ID */
|
||||
+
|
||||
+ return do_ffa_msg_send_direct_req(NULL, 0, 1, argv);
|
||||
+}
|
||||
+
|
||||
+/* Basic test of the FFA uclass */
|
||||
+static int dm_test_ffa_uclass(struct unit_test_state *uts)
|
||||
+{
|
||||
+ ut_assertok(ffa_init_device());
|
||||
+ ut_assertok(test_ffa_msg_send_direct_req());
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_uclass, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
diff --git a/test/dm/ffa.h b/test/dm/ffa.h
|
||||
new file mode 100644
|
||||
index 000000000000..a0802bd6928a
|
||||
--- /dev/null
|
||||
+++ b/test/dm/ffa.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * (C) Copyright 2021 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __TEST_DM_FFA_H
|
||||
+#define __TEST_DM_FFA_H
|
||||
+
|
||||
+#define SE_PROXY_PARTITION_ID "0x8002"
|
||||
+#define SE_PROXY_PARTITION_UUID "46bb39d1-b4d9-45b5-88ff-040027dab249"
|
||||
+
|
||||
+/**
|
||||
+ * do_ffa_msg_send_direct_req - implementation of the ping subcommand
|
||||
+ */
|
||||
+int do_ffa_msg_send_direct_req(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[]);
|
||||
+
|
||||
+#endif /*__TEST_DM_FFA_H */
|
||||
--
|
||||
2.37.1
|
||||
|
||||
+84
-74
@@ -1,26 +1,48 @@
|
||||
From 58358f79d9f8abbdc8bcfc7d08bd0c7c4c90ec84 Mon Sep 17 00:00:00 2001
|
||||
From a09ed2542f4d991fef61bd51f87d373f44ad1ff3 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Tue, 16 Nov 2021 12:36:27 +0000
|
||||
Subject: [PATCH 07/24] arm_ffa: introducing armffa command
|
||||
Date: Mon, 6 Jun 2022 12:46:38 +0100
|
||||
Subject: [PATCH 10/26] arm_ffa: introduce armffa command
|
||||
|
||||
A new armffa command is provided as an example of how to use
|
||||
the FF-A helper functions to communicate with secure world.
|
||||
Provide armffa command showcasing the use of the FF-A driver
|
||||
|
||||
The armffa command allows to query secure partitions data from
|
||||
the secure world and exchanging messages with the partitions.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
cmd/Kconfig | 10 ++
|
||||
cmd/Makefile | 2 +
|
||||
cmd/armffa.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 279 insertions(+)
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4:
|
||||
|
||||
* remove pattern data in do_ffa_msg_send_direct_req
|
||||
|
||||
v3:
|
||||
|
||||
* use the new driver interfaces (partition_info_get, sync_send_receive)
|
||||
in armffa command
|
||||
|
||||
v2:
|
||||
|
||||
* replace use of ffa_helper_init_device function by
|
||||
ffa_helper_bus_discover
|
||||
|
||||
v1:
|
||||
|
||||
* introduce armffa command
|
||||
|
||||
MAINTAINERS | 1 +
|
||||
cmd/Kconfig | 10 ++
|
||||
cmd/Makefile | 2 +
|
||||
cmd/armffa.c | 242 +++++++++++++++++++++++++++++++
|
||||
drivers/firmware/arm-ffa/Kconfig | 1 +
|
||||
5 files changed, 256 insertions(+)
|
||||
create mode 100644 cmd/armffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index d29d7e040764..32fc267fcf13 100644
|
||||
index e760b4ca3a..9f0a1b7387 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -247,6 +247,7 @@ F: include/configs/turris_*.h
|
||||
@@ -28,11 +50,11 @@ index d29d7e040764..32fc267fcf13 100644
|
||||
M: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
S: Maintained
|
||||
+F: cmd/armffa.c
|
||||
F: drivers/arm-ffa/
|
||||
F: doc/README.ffa.drv
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/arm_ffa_helper.h
|
||||
diff --git a/cmd/Kconfig b/cmd/Kconfig
|
||||
index ba2f321ae989..090e668125d5 100644
|
||||
index ba2f321ae9..090e668125 100644
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -873,6 +873,16 @@ endmenu
|
||||
@@ -53,7 +75,7 @@ index ba2f321ae989..090e668125d5 100644
|
||||
#depends on FLASH_CFI_DRIVER
|
||||
bool "armflash"
|
||||
diff --git a/cmd/Makefile b/cmd/Makefile
|
||||
index 5e43a1e022e8..e40f52f1e416 100644
|
||||
index 5e43a1e022..e40f52f1e4 100644
|
||||
--- a/cmd/Makefile
|
||||
+++ b/cmd/Makefile
|
||||
@@ -12,6 +12,8 @@ obj-y += panic.o
|
||||
@@ -67,17 +89,17 @@ index 5e43a1e022e8..e40f52f1e416 100644
|
||||
obj-$(CONFIG_CMD_AES) += aes.o
|
||||
diff --git a/cmd/armffa.c b/cmd/armffa.c
|
||||
new file mode 100644
|
||||
index 000000000000..71a6ebb656d1
|
||||
index 0000000000..9b56e8a830
|
||||
--- /dev/null
|
||||
+++ b/cmd/armffa.c
|
||||
@@ -0,0 +1,266 @@
|
||||
@@ -0,0 +1,242 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * (C) Copyright 2021 ARM Limited
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <arm_ffa_helper.h>
|
||||
+#include <arm_ffa.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <common.h>
|
||||
+#include <command.h>
|
||||
@@ -93,7 +115,7 @@ index 000000000000..71a6ebb656d1
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function queries the secure partition information which the UUID is provided
|
||||
+ * as an argument. The function uses the arm_ffa driver helper function
|
||||
+ * as an argument. The function uses the arm_ffa driver partition_info_get operation
|
||||
+ * to retrieve the data.
|
||||
+ * The input UUID string is expected to be in big endian format.
|
||||
+ *
|
||||
@@ -104,31 +126,17 @@ index 000000000000..71a6ebb656d1
|
||||
+static int do_ffa_get_singular_partition_info(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ u32 count = 0;
|
||||
+ u32 count = 0, size = 0;
|
||||
+ int ret;
|
||||
+ union ffa_partition_uuid service_uuid = {0};
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+ u32 info_idx;
|
||||
+
|
||||
+ if (argc != 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (ffa_uuid_str_to_bin(argv[0], (unsigned char *)&service_uuid)) {
|
||||
+ ffa_err("Invalid UUID");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(service_uuid);
|
||||
+ func_data.data0 = &service_uuid;
|
||||
+ func_data.data1_size = sizeof(count);
|
||||
+ func_data.data1 = &count;
|
||||
+
|
||||
+ ret = ffa_helper_get_partitions_info(&func_data);
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS) {
|
||||
+ /* Mode 1: getting the number of secure partitions */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(argv[0], &count, NULL);
|
||||
+ if (ret != 0) {
|
||||
+ ffa_err("Failure in querying partitions count (error code: %d)", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
@@ -140,23 +148,23 @@ index 000000000000..71a6ebb656d1
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ ffa_info("Pre-allocating %d partition(s) info structures", count);
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ if (!parts_info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ ffa_info("Pre-allocating %d partition(s) info structures", count);
|
||||
+
|
||||
+ func_data.data1_size = count * sizeof(struct ffa_partition_info);
|
||||
+ func_data.data1 = parts_info;
|
||||
+ size = count * sizeof(struct ffa_partition_info);
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_helper_get_partitions_info(&func_data);
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS) {
|
||||
+
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(argv[0], &size, parts_info);
|
||||
+ if (ret != 0) {
|
||||
+ ffa_err("Failure in querying partition(s) info (error code: %d)", ret);
|
||||
+ free(parts_info);
|
||||
+ return ret;
|
||||
@@ -185,7 +193,7 @@ index 000000000000..71a6ebb656d1
|
||||
+ * @argv: arguments
|
||||
+ *
|
||||
+ * This function sends data to the secure partition which the ID is provided
|
||||
+ * as an argument. The function uses the arm_ffa driver helper function
|
||||
+ * as an argument. The function uses the arm_ffa driver sync_send_receive operation
|
||||
+ * to send data.
|
||||
+ *
|
||||
+ * Return:
|
||||
@@ -195,9 +203,13 @@ index 000000000000..71a6ebb656d1
|
||||
+int do_ffa_msg_send_direct_req(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u32 pattern = 0xaabbccd0;
|
||||
+ struct ffa_send_direct_data msg = {
|
||||
+ .data0 = 0xaaaaaaaa,
|
||||
+ .data1 = 0xbbbbbbbb,
|
||||
+ .data2 = 0xcccccccc,
|
||||
+ .data3 = 0xdddddddd,
|
||||
+ .data4 = 0xeeeeeeee,
|
||||
+ };
|
||||
+ u16 part_id;
|
||||
+ int ret;
|
||||
+
|
||||
@@ -212,32 +224,15 @@ index 000000000000..71a6ebb656d1
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * telling the driver which partition to use
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(part_id);
|
||||
+ func_data.data0 = &part_id;
|
||||
+
|
||||
+ /*
|
||||
+ * filling the message data
|
||||
+ */
|
||||
+ msg.a3 = ++pattern;
|
||||
+ msg.a4 = ++pattern;
|
||||
+ msg.a5 = ++pattern;
|
||||
+ msg.a6 = ++pattern;
|
||||
+ msg.a7 = ++pattern;
|
||||
+ func_data.data1_size = sizeof(msg);
|
||||
+ func_data.data1 = &msg;
|
||||
+
|
||||
+ ret = ffa_helper_msg_send_direct_req(&func_data);
|
||||
+ if (ret == FFA_ERR_STAT_SUCCESS) {
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(part_id, &msg);
|
||||
+ if (ret == 0) {
|
||||
+ u8 cnt;
|
||||
+
|
||||
+ ffa_info("SP response:\n[LSB]");
|
||||
+ for (cnt = 0;
|
||||
+ cnt < sizeof(struct ffa_send_direct_data) / sizeof(u32);
|
||||
+ cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64);
|
||||
+ cnt++)
|
||||
+ ffa_info("0x%x", ((u32 *)&msg)[cnt]);
|
||||
+ ffa_info("0x%llx", ((u64 *)&msg)[cnt]);
|
||||
+ } else {
|
||||
+ ffa_err("Sending direct request error (%d)", ret);
|
||||
+ }
|
||||
@@ -320,10 +315,13 @@ index 000000000000..71a6ebb656d1
|
||||
+ if (!armffa_cmd || argc > armffa_cmd->maxargs)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ ret = ffa_helper_init_device();
|
||||
+ if (ret != FFA_ERR_STAT_SUCCESS)
|
||||
+ ret = ffa_bus_discover();
|
||||
+ if (ret != 0)
|
||||
+ return cmd_process_error(cmdtp, ret);
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ ret = armffa_cmd->cmd(armffa_cmd, flag, argc, argv);
|
||||
+
|
||||
+ return cmd_process_error(armffa_cmd, ret);
|
||||
@@ -337,6 +335,18 @@ index 000000000000..71a6ebb656d1
|
||||
+ " - sends a data pattern to the specified partition\n"
|
||||
+ "devlist\n"
|
||||
+ " - displays the arm_ffa device info\n");
|
||||
diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig
|
||||
index aceb61cf49..40b467b0a5 100644
|
||||
--- a/drivers/firmware/arm-ffa/Kconfig
|
||||
+++ b/drivers/firmware/arm-ffa/Kconfig
|
||||
@@ -4,6 +4,7 @@ config ARM_FFA_TRANSPORT
|
||||
bool "Enable Arm Firmware Framework for Armv8-A driver"
|
||||
depends on DM && ARM64
|
||||
select ARM_SMCCC
|
||||
+ select CMD_ARMFFA
|
||||
select LIB_UUID
|
||||
select DEVRES
|
||||
help
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+1185
File diff suppressed because it is too large
Load Diff
+455
@@ -0,0 +1,455 @@
|
||||
From dbc51066367481b5a45ce24f91571f83a022576e Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 6 Jun 2022 17:26:06 +0100
|
||||
Subject: [PATCH 12/26] arm_ffa: introduce Sandbox test cases for UCLASS_FFA
|
||||
|
||||
Add functional test cases for the FF-A core driver
|
||||
|
||||
These tests rely on the FF-A Sandbox driver which helps in
|
||||
inspecting the FF-A core driver.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4: align sandbox tests with the new FF-A driver interfaces
|
||||
and new way of error handling
|
||||
|
||||
v1: introduce sandbox tests
|
||||
|
||||
MAINTAINERS | 1 +
|
||||
test/dm/Makefile | 1 +
|
||||
test/dm/ffa.c | 394 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 396 insertions(+)
|
||||
create mode 100644 test/dm/ffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 96157db6b6..e5b71b0ade 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -252,6 +252,7 @@ F: doc/README.ffa.drv
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/sandbox_arm_ffa.h
|
||||
+F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
M: Stefano Babic <sbabic@denx.de>
|
||||
diff --git a/test/dm/Makefile b/test/dm/Makefile
|
||||
index f0a7c97e3d..f96f848046 100644
|
||||
--- a/test/dm/Makefile
|
||||
+++ b/test/dm/Makefile
|
||||
@@ -79,6 +79,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
|
||||
obj-$(CONFIG_ACPI_PMC) += pmc.o
|
||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||
obj-$(CONFIG_DM_PWM) += pwm.o
|
||||
+obj-$(CONFIG_SANDBOX_FFA) += ffa.o
|
||||
obj-$(CONFIG_QFW) += qfw.o
|
||||
obj-$(CONFIG_RAM) += ram.o
|
||||
obj-y += regmap.o
|
||||
diff --git a/test/dm/ffa.c b/test/dm/ffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..052d5fc3f4
|
||||
--- /dev/null
|
||||
+++ b/test/dm/ffa.c
|
||||
@@ -0,0 +1,394 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Functional tests for UCLASS_FFA class
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <console.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/test.h>
|
||||
+#include "../../drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h"
|
||||
+#include <sandbox_arm_ffa.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+/* Macros */
|
||||
+
|
||||
+#define LOG_MSG_SZ (100)
|
||||
+#define LOG_CMD_SZ (LOG_MSG_SZ * 2)
|
||||
+
|
||||
+/* Functional tests for the UCLASS_FFA */
|
||||
+
|
||||
+static int dm_test_ffa_log(struct unit_test_state *uts, char *msg)
|
||||
+{
|
||||
+ char cmd[LOG_CMD_SZ] = {0};
|
||||
+
|
||||
+ console_record_reset();
|
||||
+
|
||||
+ snprintf(cmd, LOG_CMD_SZ, "echo \"%s\"", msg);
|
||||
+ run_command(cmd, 0);
|
||||
+
|
||||
+ ut_assert_console_end();
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_fwk_version(struct ffa_prvdata *prvdata, struct sandbox_ffa_prvdata *sdx_prvdata,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (prvdata->fwk_version != sdx_prvdata->fwk_version) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ,
|
||||
+ "[%s]: Error: framework version: core = 0x%x , sandbox = 0x%x", __func__,
|
||||
+ prvdata->fwk_version,
|
||||
+ sdx_prvdata->fwk_version);
|
||||
+
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_endpoint_id(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (prvdata->id) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ,
|
||||
+ "[%s]: Error: endpoint id: core = 0x%x", __func__, prvdata->id);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_core_dev(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!prvdata->dev) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: core device NULL", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_sandbox_dev(struct sandbox_ffa_prvdata *sdx_prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!sdx_prvdata->dev) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: sandbox device NULL", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_rxtxbuf(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (!prvdata->pair.rxbuf && prvdata->pair.txbuf) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: rxbuf = 0x%llx txbuf = 0x%llx", __func__,
|
||||
+ prvdata->pair.rxbuf,
|
||||
+ prvdata->pair.txbuf);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_features(struct ffa_prvdata *prvdata, struct unit_test_state *uts)
|
||||
+{
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ if (prvdata->pair.rxtx_min_pages != RXTX_4K &&
|
||||
+ prvdata->pair.rxtx_min_pages != RXTX_16K &&
|
||||
+ prvdata->pair.rxtx_min_pages != RXTX_64K) {
|
||||
+ snprintf(msg,
|
||||
+ LOG_MSG_SZ,
|
||||
+ "[%s]: Error: FFA_RXTX_MAP features = 0x%lx",
|
||||
+ __func__,
|
||||
+ prvdata->pair.rxtx_min_pages);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_mapped_flag(u32 queried_func_id,
|
||||
+ u8 rxbuf_mapped,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ switch (queried_func_id) {
|
||||
+ case FFA_RXTX_MAP:
|
||||
+ {
|
||||
+ if (rxbuf_mapped)
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ break;
|
||||
+ }
|
||||
+ case FFA_RXTX_UNMAP:
|
||||
+ {
|
||||
+ if (!rxbuf_mapped)
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: %s mapping issue", __func__,
|
||||
+ (queried_func_id == FFA_RXTX_MAP ? "FFA_RXTX_MAP" : "FFA_RXTX_UNMAP"));
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+
|
||||
+ return CMD_RET_FAILURE;
|
||||
+}
|
||||
+
|
||||
+static int check_rxbuf_release_flag(u8 rxbuf_owned, struct unit_test_state *uts)
|
||||
+{
|
||||
+ if (rxbuf_owned) {
|
||||
+ char msg[LOG_MSG_SZ] = {0};
|
||||
+
|
||||
+ snprintf(msg, LOG_MSG_SZ, "[%s]: Error: RX buffer not released", __func__);
|
||||
+ dm_test_ffa_log(uts, msg);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int test_ffa_msg_send_direct_req(u16 part_id, struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u8 cnt;
|
||||
+
|
||||
+ ut_assertok(ffa_bus_ops_get()->sync_send_receive(part_id, &msg));
|
||||
+
|
||||
+ for (cnt = 0; cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64); cnt++)
|
||||
+ ut_assertok(((u64 *)&msg)[cnt] != 0xffffffffffffffff);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int test_partitions_and_comms(const char *service_uuid,
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata,
|
||||
+ struct unit_test_state *uts)
|
||||
+{
|
||||
+ u32 count = 0, size = 0;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+ u32 info_idx, exp_info_idx;
|
||||
+ int ret;
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(service_uuid, &count, NULL);
|
||||
+ /* make sure partitions are detected */
|
||||
+ ut_assertok(ret != 0);
|
||||
+ ut_assertok(count != SANDBOX_SP_COUNT_PER_VALID_SERVICE);
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ ut_assertok(!parts_info);
|
||||
+
|
||||
+ size = count * sizeof(struct ffa_partition_info);
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(service_uuid, &size, parts_info);
|
||||
+ if (ret != 0) {
|
||||
+ free(parts_info);
|
||||
+ ut_assertok(ret != 0);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * SPs found , verify the partitions information
|
||||
+ */
|
||||
+
|
||||
+ ret = CMD_RET_FAILURE;
|
||||
+
|
||||
+ for (info_idx = 0; info_idx < count ; info_idx++) {
|
||||
+ for (exp_info_idx = 0;
|
||||
+ exp_info_idx < sdx_prvdata->partitions.count;
|
||||
+ exp_info_idx++) {
|
||||
+ if (parts_info[info_idx].id ==
|
||||
+ sdx_prvdata->partitions.descs[exp_info_idx].info.id) {
|
||||
+ ret = memcmp(&parts_info[info_idx],
|
||||
+ &sdx_prvdata->partitions.descs[exp_info_idx]
|
||||
+ .info,
|
||||
+ sizeof(struct ffa_partition_info));
|
||||
+ if (ret)
|
||||
+ free(parts_info);
|
||||
+ ut_assertok(ret != 0);
|
||||
+ /* send and receive data from the current partition */
|
||||
+ test_ffa_msg_send_direct_req(parts_info[info_idx].id, uts);
|
||||
+ }
|
||||
+ ret = CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ /* Verify expected partitions found in the emulated secure world*/
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+static int dm_test_ffa_ack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_prvdata *prvdata = NULL;
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata = NULL;
|
||||
+ struct ffa_sandbox_data func_data = {0};
|
||||
+ u8 rxbuf_flag = 0;
|
||||
+ const char *svc1_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *svc2_uuid = SANDBOX_SERVICE2_UUID;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* test probing FF-A devices */
|
||||
+ ut_assertok(ffa_bus_discover());
|
||||
+
|
||||
+ /* get a pointer to the FF-A core and sandbox drivers private data */
|
||||
+ func_data.data0 = &prvdata;
|
||||
+ func_data.data0_size = sizeof(prvdata);
|
||||
+ func_data.data1 = &sdx_prvdata;
|
||||
+ func_data.data1_size = sizeof(sdx_prvdata);
|
||||
+
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_VERSION, &func_data));
|
||||
+
|
||||
+ /* make sure private data pointers are retrieved */
|
||||
+ ut_assertok(prvdata == 0);
|
||||
+ ut_assertok(sdx_prvdata == 0);
|
||||
+
|
||||
+ /* make sure dev devices created */
|
||||
+ ut_assertok(check_core_dev(prvdata, uts));
|
||||
+ ut_assertok(check_sandbox_dev(sdx_prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_VERSION */
|
||||
+ ut_assertok(check_fwk_version(prvdata, sdx_prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_ID_GET */
|
||||
+ ut_assertok(check_endpoint_id(prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_FEATURES */
|
||||
+ ut_assertok(check_features(prvdata, uts));
|
||||
+
|
||||
+ /* test core RX/TX buffers */
|
||||
+ ut_assertok(check_rxtxbuf(prvdata, uts));
|
||||
+
|
||||
+ /* test FFA_RXTX_MAP */
|
||||
+ func_data.data0 = &rxbuf_flag;
|
||||
+ func_data.data0_size = sizeof(rxbuf_flag);
|
||||
+
|
||||
+ rxbuf_flag = 0;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RXTX_MAP, &func_data));
|
||||
+ ut_assertok(check_rxbuf_mapped_flag(FFA_RXTX_MAP, rxbuf_flag, uts));
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ ret = test_partitions_and_comms(svc1_uuid, sdx_prvdata, uts);
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ /* test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RX_RELEASE, &func_data));
|
||||
+ ut_assertok(check_rxbuf_release_flag(rxbuf_flag, uts));
|
||||
+
|
||||
+ /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */
|
||||
+ ret = test_partitions_and_comms(svc2_uuid, sdx_prvdata, uts);
|
||||
+ ut_assertok(ret != CMD_RET_SUCCESS);
|
||||
+
|
||||
+ /* test FFA_RX_RELEASE */
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RX_RELEASE, &func_data));
|
||||
+ ut_assertok(check_rxbuf_release_flag(rxbuf_flag, uts));
|
||||
+
|
||||
+ /* test FFA_RXTX_UNMAP */
|
||||
+ ut_assertok(ffa_bus_ops_get()->rxtx_unmap());
|
||||
+
|
||||
+ rxbuf_flag = 1;
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_RXTX_UNMAP, &func_data));
|
||||
+ ut_assertok(check_rxbuf_mapped_flag(FFA_RXTX_UNMAP, rxbuf_flag, uts));
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_ack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
+
|
||||
+static int dm_test_ffa_nack(struct unit_test_state *uts)
|
||||
+{
|
||||
+ struct ffa_prvdata *prvdata = NULL;
|
||||
+ struct sandbox_ffa_prvdata *sdx_prvdata = NULL;
|
||||
+ struct ffa_sandbox_data func_data = {0};
|
||||
+ const char *valid_svc_uuid = SANDBOX_SERVICE1_UUID;
|
||||
+ const char *unvalid_svc_uuid = SANDBOX_SERVICE3_UUID;
|
||||
+ const char *unvalid_svc_uuid_str = SANDBOX_SERVICE4_UUID;
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ u32 count = 0;
|
||||
+ u16 part_id = 0;
|
||||
+
|
||||
+ /* test probing FF-A devices */
|
||||
+ ut_assertok(ffa_bus_discover());
|
||||
+
|
||||
+ /* get a pointer to the FF-A core and sandbox drivers private data */
|
||||
+ func_data.data0 = &prvdata;
|
||||
+ func_data.data0_size = sizeof(prvdata);
|
||||
+ func_data.data1 = &sdx_prvdata;
|
||||
+ func_data.data1_size = sizeof(sdx_prvdata);
|
||||
+
|
||||
+ ut_assertok(sandbox_ffa_query_core_state(FFA_VERSION, &func_data));
|
||||
+
|
||||
+ /* make sure private data pointers are retrieved */
|
||||
+ ut_assertok(prvdata == 0);
|
||||
+ ut_assertok(sdx_prvdata == 0);
|
||||
+
|
||||
+ /* make sure dev devices created */
|
||||
+ ut_assertok(check_core_dev(prvdata, uts));
|
||||
+ ut_assertok(check_sandbox_dev(sdx_prvdata, uts));
|
||||
+
|
||||
+ /* query partitions count using invalid arguments */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(unvalid_svc_uuid, NULL, NULL);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* query partitions count using an invalid UUID string */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(unvalid_svc_uuid_str, &count, NULL);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* query partitions count using an invalid UUID (no matching SP) */
|
||||
+ count = 0;
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(unvalid_svc_uuid, &count, NULL);
|
||||
+ ut_assertok(count != 0);
|
||||
+
|
||||
+ /* query partitions count using a valid UUID */
|
||||
+ count = 0;
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(valid_svc_uuid, &count, NULL);
|
||||
+ /* make sure partitions are detected */
|
||||
+ ut_assertok(ret != 0);
|
||||
+ ut_assertok(count != SANDBOX_SP_COUNT_PER_VALID_SERVICE);
|
||||
+
|
||||
+ /* send data to an invalid partition */
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(part_id, &msg);
|
||||
+ ut_assertok(ret != -EINVAL);
|
||||
+
|
||||
+ /* send data to a valid partition */
|
||||
+ part_id = prvdata->partitions.descs[0].info.id;
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(part_id, &msg);
|
||||
+ ut_assertok(ret != 0);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_ffa_nack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
From 5be8c1d52045cbdc1adf79299792a6a49fef66c3 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 6 Jun 2022 17:30:44 +0100
|
||||
Subject: [PATCH 13/26] arm_ffa: introduce armffa command Sandbox test
|
||||
|
||||
Add Sandbox test for the armffa command
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4: drop use of helper APIs
|
||||
|
||||
v1: introduce armffa command sandbox test
|
||||
|
||||
MAINTAINERS | 1 +
|
||||
test/cmd/Makefile | 1 +
|
||||
test/cmd/armffa.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 42 insertions(+)
|
||||
create mode 100644 test/cmd/armffa.c
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index e5b71b0ade..505fffff14 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -252,6 +252,7 @@ F: doc/README.ffa.drv
|
||||
F: drivers/firmware/arm-ffa/
|
||||
F: include/arm_ffa.h
|
||||
F: include/sandbox_arm_ffa.h
|
||||
+F: test/cmd/armffa.c
|
||||
F: test/dm/ffa.c
|
||||
|
||||
ARM FREESCALE IMX
|
||||
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
|
||||
index a59adb1e6d..d9dc0809d6 100644
|
||||
--- a/test/cmd/Makefile
|
||||
+++ b/test/cmd/Makefile
|
||||
@@ -11,3 +11,4 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
|
||||
obj-$(CONFIG_CMD_PINMUX) += pinmux.o
|
||||
obj-$(CONFIG_CMD_PWM) += pwm.o
|
||||
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
|
||||
+obj-$(CONFIG_SANDBOX_FFA) += armffa.o
|
||||
diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
|
||||
new file mode 100644
|
||||
index 0000000000..531f82066e
|
||||
--- /dev/null
|
||||
+++ b/test/cmd/armffa.c
|
||||
@@ -0,0 +1,40 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Test for armffa command
|
||||
+ *
|
||||
+ * (C) Copyright 2022 ARM Limited
|
||||
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <sandbox_arm_ffa.h>
|
||||
+#include <string.h>
|
||||
+#include <test/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+#define PING_CMD_SIZE 19
|
||||
+
|
||||
+/* Basic test of 'armffa' command */
|
||||
+static int dm_test_armffa_cmd(struct unit_test_state *uts)
|
||||
+{
|
||||
+ char ping_cmd[PING_CMD_SIZE] = {0};
|
||||
+
|
||||
+ ut_assertok(ffa_bus_discover());
|
||||
+
|
||||
+ /* armffa getpart <UUID> */
|
||||
+ ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
|
||||
+
|
||||
+ snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
|
||||
+
|
||||
+ /* armffa ping <ID> */
|
||||
+ ut_assertok(run_command(ping_cmd, 0));
|
||||
+
|
||||
+ /* armffa devlist */
|
||||
+ ut_assertok(run_command("armffa devlist", 0));
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
|
||||
--
|
||||
2.17.1
|
||||
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
From 370422921b2a3f4f7b73ce5b08820c24e82bba19 Mon Sep 17 00:00:00 2001
|
||||
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Date: Thu, 18 Nov 2021 16:42:59 +0000
|
||||
Subject: [PATCH 13/24] corstone1000: Make sure shared buffer contents are not
|
||||
cached
|
||||
|
||||
After updating the shared buffer, it is required to flush the cache
|
||||
to ensure that the secure world sees expected the shared buffer
|
||||
contents.
|
||||
|
||||
The MM communication shared buffer is configured in device region of optee
|
||||
which has cache disabled. So we need to invalidate the cache every time we
|
||||
update the buffer on uboot otherwise the secure world does not see the
|
||||
accurate values.
|
||||
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
%% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch
|
||||
|
||||
%% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
lib/efi_loader/efi_variable_tee.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
|
||||
index 9cb8cfb9c779..b6be2b54a030 100644
|
||||
--- a/lib/efi_loader/efi_variable_tee.c
|
||||
+++ b/lib/efi_loader/efi_variable_tee.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
|
||||
#include <arm_ffa_helper.h>
|
||||
+#include <cpu_func.h>
|
||||
#include <mapmem.h>
|
||||
|
||||
/* MM return codes */
|
||||
@@ -335,6 +336,11 @@ static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_
|
||||
virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0);
|
||||
efi_memcpy_runtime(virt_shared_buf, comm_buf, tx_data_size);
|
||||
|
||||
+ /* The secure world has cache disabled for device region which we use for shared buffer
|
||||
+ So, the secure world reads the data from DDR. Let's flush the cache so the DDR is
|
||||
+ updated with the latest data */
|
||||
+ invalidate_dcache_all();
|
||||
+
|
||||
/* Announce there is data in the shared buffer */
|
||||
|
||||
ffa_ret = ffa_notify_mm_sp();
|
||||
--
|
||||
2.37.1
|
||||
|
||||
+540
@@ -0,0 +1,540 @@
|
||||
From b3c7d84dcde6ee1cbc13e10664d24ffa220f5fb3 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Mon, 15 Aug 2022 15:12:49 +0100
|
||||
Subject: [PATCH 14/26] arm_ffa: introduce FF-A MM communication
|
||||
|
||||
Add MM communication support using FF-A transport
|
||||
|
||||
Access an SP's service through EFI MM communication protocol.
|
||||
|
||||
This feature allows accessing MM partitions services through
|
||||
EFI MM communication protocol. MM partitions such as StandAlonneMM
|
||||
or smm-gateway secure partitions which reside in secure world.
|
||||
|
||||
An MM shared buffer and a door bell event are used to exchange
|
||||
the data.
|
||||
|
||||
The data is used by EFI services such as GetVariable()/SetVariable()
|
||||
and copied from the communication buffer to the MM shared buffer.
|
||||
|
||||
The secure partition is notified about availability of data in the
|
||||
MM shared buffer by an FF-A message (door bell).
|
||||
|
||||
On such event, MM SP can read the data and updates the MM shared
|
||||
buffer with the response data.
|
||||
|
||||
The response data is copied back to the communication buffer and
|
||||
consumed by the EFI subsystem.
|
||||
|
||||
FF-A driver private data is copied to EFI runtime section at
|
||||
ExitBootServices(). This garantees secure world partitions data are
|
||||
available at EFI runtime level.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
|
||||
Changelog:
|
||||
===============
|
||||
|
||||
v4:
|
||||
|
||||
* use the new FF-A driver interfaces
|
||||
* discover MM partitions at runtime
|
||||
* copy FF-A driver private data to EFI runtime section at
|
||||
ExitBootServices()
|
||||
* drop use of FFA_ERR_STAT_SUCCESS error code
|
||||
* replace EFI_BUFFER_TOO_SMALL by EFI_OUT_OF_RESOURCES
|
||||
in ffa_mm_communicate(). No need for efi_memcpy_runtime() anymore
|
||||
* revert the error log in mm_communicate() in case of failure
|
||||
* remove packed attribute from efi_mm_communicate_header and
|
||||
smm_variable_communicate_header
|
||||
|
||||
v2:
|
||||
|
||||
* set default values to 0 for FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_ADDR and MM_SP_UUID_DATA and add warnings
|
||||
|
||||
v1:
|
||||
|
||||
* introduce FF-A MM communication
|
||||
|
||||
arch/arm/cpu/armv8/cache.S | 16 ++
|
||||
arch/arm/cpu/armv8/cache_v8.c | 3 +-
|
||||
include/mm_communication.h | 7 +-
|
||||
lib/efi_loader/Kconfig | 14 +-
|
||||
lib/efi_loader/efi_boottime.c | 7 +
|
||||
lib/efi_loader/efi_variable_tee.c | 261 +++++++++++++++++++++++++++++-
|
||||
6 files changed, 299 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/cpu/armv8/cache.S b/arch/arm/cpu/armv8/cache.S
|
||||
index d1cee23437..f69ef64ed6 100644
|
||||
--- a/arch/arm/cpu/armv8/cache.S
|
||||
+++ b/arch/arm/cpu/armv8/cache.S
|
||||
@@ -21,7 +21,11 @@
|
||||
* x1: 0 clean & invalidate, 1 invalidate only
|
||||
* x2~x9: clobbered
|
||||
*/
|
||||
+#ifdef CONFIG_EFI_LOADER
|
||||
+.pushsection .text.efi_runtime, "ax"
|
||||
+#else
|
||||
.pushsection .text.__asm_dcache_level, "ax"
|
||||
+#endif
|
||||
ENTRY(__asm_dcache_level)
|
||||
lsl x12, x0, #1
|
||||
msr csselr_el1, x12 /* select cache level */
|
||||
@@ -65,7 +69,11 @@ ENDPROC(__asm_dcache_level)
|
||||
*
|
||||
* flush or invalidate all data cache by SET/WAY.
|
||||
*/
|
||||
+#ifdef CONFIG_EFI_LOADER
|
||||
+.pushsection .text.efi_runtime, "ax"
|
||||
+#else
|
||||
.pushsection .text.__asm_dcache_all, "ax"
|
||||
+#endif
|
||||
ENTRY(__asm_dcache_all)
|
||||
mov x1, x0
|
||||
dsb sy
|
||||
@@ -109,7 +117,11 @@ ENTRY(__asm_flush_dcache_all)
|
||||
ENDPROC(__asm_flush_dcache_all)
|
||||
.popsection
|
||||
|
||||
+#ifdef CONFIG_EFI_LOADER
|
||||
+.pushsection .text.efi_runtime, "ax"
|
||||
+#else
|
||||
.pushsection .text.__asm_invalidate_dcache_all, "ax"
|
||||
+#endif
|
||||
ENTRY(__asm_invalidate_dcache_all)
|
||||
mov x0, #0x1
|
||||
b __asm_dcache_all
|
||||
@@ -182,7 +194,11 @@ ENTRY(__asm_invalidate_icache_all)
|
||||
ENDPROC(__asm_invalidate_icache_all)
|
||||
.popsection
|
||||
|
||||
+#ifdef CONFIG_EFI_LOADER
|
||||
+.pushsection .text.efi_runtime, "ax"
|
||||
+#else
|
||||
.pushsection .text.__asm_invalidate_l3_dcache, "ax"
|
||||
+#endif
|
||||
WEAK(__asm_invalidate_l3_dcache)
|
||||
mov x0, #0 /* return status as success */
|
||||
ret
|
||||
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
|
||||
index e4736e5643..afbc487fa1 100644
|
||||
--- a/arch/arm/cpu/armv8/cache_v8.c
|
||||
+++ b/arch/arm/cpu/armv8/cache_v8.c
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <cpu_func.h>
|
||||
+#include <efi_loader.h>
|
||||
#include <hang.h>
|
||||
#include <log.h>
|
||||
#include <asm/cache.h>
|
||||
@@ -445,7 +446,7 @@ __weak void mmu_setup(void)
|
||||
/*
|
||||
* Performs a invalidation of the entire data cache at all levels
|
||||
*/
|
||||
-void invalidate_dcache_all(void)
|
||||
+void __efi_runtime invalidate_dcache_all(void)
|
||||
{
|
||||
__asm_invalidate_dcache_all();
|
||||
__asm_invalidate_l3_dcache();
|
||||
diff --git a/include/mm_communication.h b/include/mm_communication.h
|
||||
index e65fbde60d..32dc5dbac8 100644
|
||||
--- a/include/mm_communication.h
|
||||
+++ b/include/mm_communication.h
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include <part_efi.h>
|
||||
|
||||
+/* MM service UUID string (big-endian format). This UUID is common across all MM SPs */
|
||||
+#define MM_SP_UUID "33d532ed-e699-0942-c09c-a798d9cd722d"
|
||||
+
|
||||
/*
|
||||
* Interface to the pseudo Trusted Application (TA), which provides a
|
||||
* communication channel with the Standalone MM (Management Mode)
|
||||
@@ -43,7 +46,7 @@
|
||||
* To avoid confusion in interpreting frames, the communication buffer should
|
||||
* always begin with efi_mm_communicate_header.
|
||||
*/
|
||||
-struct __packed efi_mm_communicate_header {
|
||||
+struct efi_mm_communicate_header {
|
||||
efi_guid_t header_guid;
|
||||
size_t message_len;
|
||||
u8 data[];
|
||||
@@ -145,7 +148,7 @@ struct smm_variable_communicate_header {
|
||||
* Defined in EDK2 as SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
|
||||
*
|
||||
*/
|
||||
-struct smm_variable_access {
|
||||
+struct __packed smm_variable_access {
|
||||
efi_guid_t guid;
|
||||
efi_uintn_t data_size;
|
||||
efi_uintn_t name_size;
|
||||
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
|
||||
index e3f2402d0e..2a6d70f862 100644
|
||||
--- a/lib/efi_loader/Kconfig
|
||||
+++ b/lib/efi_loader/Kconfig
|
||||
@@ -60,13 +60,23 @@ config EFI_VARIABLE_FILE_STORE
|
||||
stored as file /ubootefi.var on the EFI system partition.
|
||||
|
||||
config EFI_MM_COMM_TEE
|
||||
- bool "UEFI variables storage service via OP-TEE"
|
||||
- depends on OPTEE
|
||||
+ bool "UEFI variables storage service via the trusted world"
|
||||
+ depends on OPTEE || ARM_FFA_TRANSPORT
|
||||
help
|
||||
+ Allowing access to the MM SP services (SPs such as StandAlonneMM, smm-gateway).
|
||||
+ When using the u-boot OP-TEE driver, StandAlonneMM is supported.
|
||||
+ When using the u-boot FF-A driver any MM SP is supported.
|
||||
+
|
||||
If OP-TEE is present and running StandAloneMM, dispatch all UEFI
|
||||
variable related operations to that. The application will verify,
|
||||
authenticate and store the variables on an RPMB.
|
||||
|
||||
+ When ARM_FFA_TRANSPORT is used, dispatch all UEFI variable related
|
||||
+ operations to the MM SP running in the secure world.
|
||||
+ A door bell mechanism is used to notify the SP when there is data in the shared
|
||||
+ MM buffer. The data is copied by u-boot to the shared buffer before issuing
|
||||
+ the door bell event.
|
||||
+
|
||||
config EFI_VARIABLE_NO_STORE
|
||||
bool "Don't persist non-volatile UEFI variables"
|
||||
help
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index 8fa9a58d76..cede7826bd 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -2185,6 +2185,13 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
debug("[efi_boottime][INFO]: FF-A RX/TX buffers unmapped\n");
|
||||
#endif
|
||||
|
||||
+#if CONFIG_IS_ENABLED(ARM_FFA_EFI_RUNTIME_MODE) && !CONFIG_IS_ENABLED(SANDBOX_FFA)
|
||||
+ if (ffa_copy_runtime_data())
|
||||
+ printf("ERROR: EFI: FFA: copying runtime data\n");
|
||||
+ else
|
||||
+ printf("INFO: EFI: FFA: runtime data copied\n");
|
||||
+#endif
|
||||
+
|
||||
/* Patch out unsupported runtime function */
|
||||
efi_runtime_detach();
|
||||
|
||||
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
|
||||
index dfef18435d..7d9d577281 100644
|
||||
--- a/lib/efi_loader/efi_variable_tee.c
|
||||
+++ b/lib/efi_loader/efi_variable_tee.c
|
||||
@@ -15,6 +15,36 @@
|
||||
#include <malloc.h>
|
||||
#include <mm_communication.h>
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+
|
||||
+#include <arm_ffa.h>
|
||||
+#include <cpu_func.h>
|
||||
+#include <mapmem.h>
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_SIZE
|
||||
+#warning "FFA_SHARED_MM_BUFFER_SIZE must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_SIZE 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_OFFSET
|
||||
+#warning "FFA_SHARED_MM_BUFFER_OFFSET must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_OFFSET 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FFA_SHARED_MM_BUFFER_ADDR
|
||||
+#warning "FFA_SHARED_MM_BUFFER_ADDR must be defined in include/configs/<board>.h"
|
||||
+#define FFA_SHARED_MM_BUFFER_ADDR 0
|
||||
+#endif
|
||||
+
|
||||
+/* MM return codes */
|
||||
+#define MM_SUCCESS (0)
|
||||
+
|
||||
+const char *mm_sp_svc_uuid = MM_SP_UUID;
|
||||
+
|
||||
+static __efi_runtime_data u16 mm_sp_id;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
extern struct efi_var_file __efi_runtime_data *efi_var_buf;
|
||||
static efi_uintn_t max_buffer_size; /* comm + var + func + data */
|
||||
static efi_uintn_t max_payload_size; /* func + data */
|
||||
@@ -24,6 +54,7 @@ struct mm_connection {
|
||||
u32 session;
|
||||
};
|
||||
|
||||
+#if (IS_ENABLED(CONFIG_OPTEE))
|
||||
/**
|
||||
* get_connection() - Retrieve OP-TEE session for a specific UUID.
|
||||
*
|
||||
@@ -143,16 +174,227 @@ static efi_status_t optee_mm_communicate(void *comm_buf, ulong dsize)
|
||||
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
|
||||
/**
|
||||
- * mm_communicate() - Adjust the cmonnucation buffer to StandAlonneMM and send
|
||||
+ * ffa_notify_mm_sp() - Announce there is data in the shared buffer
|
||||
+ *
|
||||
+ * Notifies the MM partition in the trusted world that
|
||||
+ * data is available in the shared buffer.
|
||||
+ * This is a blocking call during which trusted world has exclusive access
|
||||
+ * to the MM shared buffer.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success
|
||||
+ */
|
||||
+static int __efi_runtime ffa_notify_mm_sp(void)
|
||||
+{
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ int ret;
|
||||
+ int sp_event_ret = -1;
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ msg.data0 = FFA_SHARED_MM_BUFFER_OFFSET; /* x3 */
|
||||
+
|
||||
+ ret = ffa_bus_ops_get()->sync_send_receive(mm_sp_id, &msg);
|
||||
+ if (ret != 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ sp_event_ret = msg.data0; /* x3 */
|
||||
+
|
||||
+ if (sp_event_ret == MM_SUCCESS)
|
||||
+ return 0;
|
||||
+
|
||||
+ /*
|
||||
+ * Failure to notify the MM SP
|
||||
+ */
|
||||
+
|
||||
+ return -EACCES;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * ffa_discover_mm_sp_id() - Query the MM partition ID
|
||||
+ *
|
||||
+ * Use the FF-A driver to get the MM partition ID.
|
||||
+ * If multiple partitions are found, use the first one.
|
||||
+ * This is a boot time function.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * 0 on success
|
||||
+ */
|
||||
+static int ffa_discover_mm_sp_id(void)
|
||||
+{
|
||||
+ u32 count = 0, size = 0;
|
||||
+ int ret;
|
||||
+ struct ffa_partition_info *parts_info;
|
||||
+
|
||||
+ if (!ffa_bus_ops_get())
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /*
|
||||
+ * get from the driver the count of the SPs matching the UUID
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(mm_sp_svc_uuid, &count, NULL);
|
||||
+ if (ret != 0) {
|
||||
+ log_err("EFI: Failure in querying partitions count (error code: %d)\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (!count) {
|
||||
+ log_info("EFI: No MM partition found\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * pre-allocate a buffer to be filled by the driver
|
||||
+ * with ffa_partition_info structs
|
||||
+ */
|
||||
+
|
||||
+ log_info("EFI: Pre-allocating %d partition(s) info structures\n", count);
|
||||
+
|
||||
+ parts_info = calloc(count, sizeof(struct ffa_partition_info));
|
||||
+ if (!parts_info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ size = count * sizeof(struct ffa_partition_info);
|
||||
+
|
||||
+ /*
|
||||
+ * ask the driver to fill the
|
||||
+ * buffer with the SPs info
|
||||
+ */
|
||||
+ ret = ffa_bus_ops_get()->partition_info_get(mm_sp_svc_uuid, &size, parts_info);
|
||||
+ if (ret != 0) {
|
||||
+ log_err("EFI: Failure in querying partition(s) info (error code: %d)\n", ret);
|
||||
+ free(parts_info);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * MM SPs found , use the first one
|
||||
+ */
|
||||
+
|
||||
+ mm_sp_id = parts_info[0].id;
|
||||
+
|
||||
+ log_info("EFI: MM partition ID 0x%x\n", mm_sp_id);
|
||||
+
|
||||
+ free(parts_info);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * ffa_mm_communicate() - Exchange EFI services data with the MM partition using FF-A
|
||||
+ * @comm_buf: locally allocated communication buffer used for rx/tx
|
||||
+ * @dsize: communication buffer size
|
||||
+ *
|
||||
+ * Issues a door bell event to notify the MM partition (SP) running in OP-TEE
|
||||
+ * that there is data to read from the shared buffer.
|
||||
+ * Communication with the MM SP is performed using FF-A transport.
|
||||
+ * On the event, MM SP can read the data from the buffer and
|
||||
+ * update the MM shared buffer with response data.
|
||||
+ * The response data is copied back to the communication buffer.
|
||||
+ *
|
||||
+ * Return:
|
||||
+ *
|
||||
+ * EFI status code
|
||||
+ */
|
||||
+static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_buf_size)
|
||||
+{
|
||||
+ ulong tx_data_size;
|
||||
+ int ffa_ret;
|
||||
+ struct efi_mm_communicate_header *mm_hdr;
|
||||
+ void *virt_shared_buf;
|
||||
+
|
||||
+ if (!comm_buf)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Discover MM partition ID at boot time */
|
||||
+ if (!mm_sp_id && ffa_discover_mm_sp_id() != 0) {
|
||||
+ log_err("EFI: Failure to discover MM partition ID at boot time\n");
|
||||
+ return EFI_UNSUPPORTED;
|
||||
+ }
|
||||
+
|
||||
+ mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
+ tx_data_size = mm_hdr->message_len + sizeof(efi_guid_t) + sizeof(size_t);
|
||||
+
|
||||
+ if (comm_buf_size != tx_data_size || tx_data_size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+
|
||||
+ /* Copy the data to the shared buffer */
|
||||
+
|
||||
+ virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0);
|
||||
+ efi_memcpy_runtime(virt_shared_buf, comm_buf, tx_data_size);
|
||||
+
|
||||
+ /*
|
||||
+ * The secure world might have cache disabled for
|
||||
+ * the device region used for shared buffer (which is the case for Optee).
|
||||
+ * In this case, the secure world reads the data from DRAM.
|
||||
+ * Let's flush the cache so the DRAM is updated with the latest data.
|
||||
+ */
|
||||
+ #ifdef CONFIG_ARM64
|
||||
+ invalidate_dcache_all();
|
||||
+ #endif
|
||||
+
|
||||
+ /* Announce there is data in the shared buffer */
|
||||
+
|
||||
+ ffa_ret = ffa_notify_mm_sp();
|
||||
+ if (ffa_ret)
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+
|
||||
+ switch (ffa_ret) {
|
||||
+ case 0:
|
||||
+ {
|
||||
+ ulong rx_data_size;
|
||||
+ /* Copy the MM SP response from the shared buffer to the communication buffer */
|
||||
+ rx_data_size = ((struct efi_mm_communicate_header *)virt_shared_buf)->message_len +
|
||||
+ sizeof(efi_guid_t) +
|
||||
+ sizeof(size_t);
|
||||
+
|
||||
+ if (rx_data_size > comm_buf_size) {
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+ return EFI_OUT_OF_RESOURCES;
|
||||
+ }
|
||||
+
|
||||
+ efi_memcpy_runtime(comm_buf, virt_shared_buf, rx_data_size);
|
||||
+ unmap_sysmem(virt_shared_buf);
|
||||
+
|
||||
+ return EFI_SUCCESS;
|
||||
+ }
|
||||
+ case -EINVAL:
|
||||
+ return EFI_DEVICE_ERROR;
|
||||
+ case -EPERM:
|
||||
+ return EFI_INVALID_PARAMETER;
|
||||
+ case -EACCES:
|
||||
+ return EFI_ACCESS_DENIED;
|
||||
+ case -EBUSY:
|
||||
+ return EFI_OUT_OF_RESOURCES;
|
||||
+ default:
|
||||
+ return EFI_ACCESS_DENIED;
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+/**
|
||||
+ * mm_communicate() - Adjust the communication buffer to the MM SP and send
|
||||
* it to OP-TEE
|
||||
*
|
||||
- * @comm_buf: locally allocted communcation buffer
|
||||
+ * @comm_buf: locally allocated communication buffer
|
||||
* @dsize: buffer size
|
||||
+ *
|
||||
+ * The MM SP (also called partition) can be StandAlonneMM or smm-gateway.
|
||||
+ * The comm_buf format is the same for both partitions.
|
||||
+ * When using the u-boot OP-TEE driver, StandAlonneMM is supported.
|
||||
+ * When using the u-boot FF-A driver, StandAlonneMM and smm-gateway are supported.
|
||||
+ *
|
||||
* Return: status code
|
||||
*/
|
||||
-static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
+static efi_status_t __efi_runtime mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
{
|
||||
efi_status_t ret;
|
||||
struct efi_mm_communicate_header *mm_hdr;
|
||||
@@ -162,7 +404,11 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
|
||||
mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
|
||||
var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data;
|
||||
|
||||
+ #if (IS_ENABLED(CONFIG_OPTEE))
|
||||
ret = optee_mm_communicate(comm_buf, dsize);
|
||||
+ #elif (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ ret = ffa_mm_communicate(comm_buf, dsize);
|
||||
+ #endif
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("%s failed!\n", __func__);
|
||||
return ret;
|
||||
@@ -258,6 +504,13 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size)
|
||||
goto out;
|
||||
}
|
||||
*size = var_payload->size;
|
||||
+
|
||||
+ #if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
|
||||
+ if (*size > FFA_SHARED_MM_BUFFER_SIZE)
|
||||
+ *size = FFA_SHARED_MM_BUFFER_SIZE - MM_COMMUNICATE_HEADER_SIZE -
|
||||
+ MM_VARIABLE_COMMUNICATE_SIZE;
|
||||
+ #endif
|
||||
+
|
||||
/*
|
||||
* There seems to be a bug in EDK2 miscalculating the boundaries and
|
||||
* size checks, so deduct 2 more bytes to fulfill this requirement. Fix
|
||||
@@ -697,7 +950,7 @@ void efi_variables_boot_exit_notify(void)
|
||||
ret = EFI_NOT_FOUND;
|
||||
|
||||
if (ret != EFI_SUCCESS)
|
||||
- log_err("Unable to notify StMM for ExitBootServices\n");
|
||||
+ log_err("Unable to notify the MM partition for ExitBootServices\n");
|
||||
free(comm_buf);
|
||||
|
||||
/*
|
||||
--
|
||||
2.17.1
|
||||
|
||||
+14
-18
@@ -1,7 +1,7 @@
|
||||
From c0b01dff84d74f1b5aaff0d9b594e0aaec16c744 Mon Sep 17 00:00:00 2001
|
||||
From 01d1487cebc37834e2a5d259e0417a610539a0f5 Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Tue, 2 Nov 2021 16:44:39 +0000
|
||||
Subject: [PATCH 10/24] arm_ffa: corstone1000: enable FF-A and MM support
|
||||
Date: Thu, 9 Jun 2022 12:47:35 +0100
|
||||
Subject: [PATCH 15/26] arm_ffa: corstone1000: enable FF-A and MM support
|
||||
|
||||
This commit allows corstone1000 platform to perform
|
||||
MM communication between u-boot and the secure world
|
||||
@@ -9,38 +9,33 @@ using FF-A transport.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
|
||||
---
|
||||
configs/corstone1000_defconfig | 1 +
|
||||
include/configs/corstone1000.h | 15 +++++++++++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
configs/corstone1000_defconfig | 2 ++
|
||||
include/configs/corstone1000.h | 9 +++++++++
|
||||
2 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index e573fe6fe6a2..b042d4e49419 100644
|
||||
index e573fe6fe6..c299dda49f 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -44,6 +44,7 @@ CONFIG_USB=y
|
||||
@@ -44,6 +44,8 @@ CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_USB_ISP1760=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ARM_FFA_TRANSPORT=y
|
||||
+CONFIG_ARM_FFA_EFI_RUNTIME_MODE=y
|
||||
CONFIG_EFI_MM_COMM_TEE=y
|
||||
# CONFIG_OPTEE is not set
|
||||
# CONFIG_GENERATE_SMBIOS_TABLE is not set
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index 8ba0effb0ab2..afc9ccfc192b 100644
|
||||
index 8ba0effb0a..5960c6b4be 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -14,6 +14,21 @@
|
||||
@@ -14,6 +14,15 @@
|
||||
|
||||
#include <linux/sizes.h>
|
||||
|
||||
+/* MM SP UUID binary data (little-endian format) */
|
||||
+#define MM_SP_UUID_DATA \
|
||||
+ 0xed, 0x32, 0xd5, 0x33, \
|
||||
+ 0x99, 0xe6, 0x42, 0x09, \
|
||||
+ 0x9c, 0xc0, 0x2d, 0x72, \
|
||||
+ 0xcd, 0xd9, 0x98, 0xa7
|
||||
+
|
||||
+#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
|
||||
+
|
||||
+/*
|
||||
@@ -48,10 +43,11 @@ index 8ba0effb0ab2..afc9ccfc192b 100644
|
||||
+ * u-boot and the MM SP
|
||||
+ */
|
||||
+#define FFA_SHARED_MM_BUFFER_ADDR (0x023F8000)
|
||||
+#define FFA_SHARED_MM_BUFFER_OFFSET (0)
|
||||
+
|
||||
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f00000)
|
||||
#define CONFIG_SKIP_LOWLEVEL_INIT
|
||||
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+31
-52
@@ -1,7 +1,7 @@
|
||||
From 652259af2f795a5d69c628ae7b1e79d33c234abd Mon Sep 17 00:00:00 2001
|
||||
From 10e155a677192731481ebe7f302e2d9ad790346a Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Thu, 11 Nov 2021 16:27:59 +0000
|
||||
Subject: [PATCH 11/24] efi: corstone1000: introduce EFI capsule update
|
||||
Date: Thu, 28 Jul 2022 15:01:55 +0100
|
||||
Subject: [PATCH 16/26] efi: corstone1000: introduce EFI capsule update
|
||||
|
||||
This commit provides capsule update feature for Corstone1000.
|
||||
|
||||
@@ -20,16 +20,17 @@ SE Proxy FW update service. This event is generated on each boot.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 18 +++++
|
||||
include/efi_loader.h | 4 +-
|
||||
lib/efi_loader/efi_boottime.c | 47 ++++++++++++
|
||||
lib/efi_loader/efi_capsule.c | 135 ++++++++++++++++++++++++++++++++-
|
||||
lib/efi_loader/efi_boottime.c | 36 ++++++++++
|
||||
lib/efi_loader/efi_capsule.c | 124 ++++++++++++++++++++++++++++++++-
|
||||
lib/efi_loader/efi_setup.c | 15 ++++
|
||||
5 files changed, 215 insertions(+), 4 deletions(-)
|
||||
5 files changed, 193 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index afc9ccfc192b..a400cdef69d0 100644
|
||||
index 5960c6b4be..fe5ec0adcd 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -14,6 +14,24 @@
|
||||
@@ -54,11 +55,11 @@ index afc9ccfc192b..a400cdef69d0 100644
|
||||
+ EFI_GUID(0x3a770ddc, 0x409b, 0x48b2, 0x81, 0x41, \
|
||||
+ 0x93, 0xb7, 0xc6, 0x0b, 0x20, 0x9e)
|
||||
+
|
||||
/* MM SP UUID binary data (little-endian format) */
|
||||
#define MM_SP_UUID_DATA \
|
||||
0xed, 0x32, 0xd5, 0x33, \
|
||||
#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
|
||||
|
||||
/*
|
||||
diff --git a/include/efi_loader.h b/include/efi_loader.h
|
||||
index 5b41985244e2..796419b69b40 100644
|
||||
index 5b41985244..796419b69b 100644
|
||||
--- a/include/efi_loader.h
|
||||
+++ b/include/efi_loader.h
|
||||
@@ -984,11 +984,11 @@ extern const struct efi_firmware_management_protocol efi_fmp_fit;
|
||||
@@ -76,10 +77,10 @@ index 5b41985244e2..796419b69b40 100644
|
||||
efi_uintn_t capsule_count,
|
||||
u64 *maximum_capsule_size,
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index c68d9ed4f0bd..f2b5c7834c01 100644
|
||||
index cede7826bd..9bf2596597 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -2095,6 +2095,44 @@ static void efi_exit_caches(void)
|
||||
@@ -2095,6 +2095,33 @@ static void efi_exit_caches(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -95,28 +96,17 @@ index c68d9ed4f0bd..f2b5c7834c01 100644
|
||||
+ */
|
||||
+static int efi_corstone1000_kernel_started_event(void)
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u16 part_id = CORSTONE1000_SEPROXY_PART_ID;
|
||||
+
|
||||
+ log_debug("[%s]\n", __func__);
|
||||
+
|
||||
+ /*
|
||||
+ * telling the driver which partition to use
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(part_id);
|
||||
+ func_data.data0 = &part_id;
|
||||
+
|
||||
+ /*
|
||||
+ * setting the kernel started event arguments
|
||||
+ */
|
||||
+ msg.a3 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID;
|
||||
+ msg.a5 = CORSTONE1000_KERNEL_STARTED_EVT;
|
||||
+ msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
+ msg.data2 = CORSTONE1000_KERNEL_STARTED_EVT; /* x5 */
|
||||
+
|
||||
+ func_data.data1_size = sizeof(msg);
|
||||
+ func_data.data1 = &msg;
|
||||
+
|
||||
+ return ffa_helper_msg_send_direct_req(&func_data);
|
||||
+ return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
@@ -124,7 +114,7 @@ index c68d9ed4f0bd..f2b5c7834c01 100644
|
||||
/**
|
||||
* efi_exit_boot_services() - stop all boot services
|
||||
* @image_handle: handle of the loaded image
|
||||
@@ -2208,6 +2246,15 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
@@ -2210,6 +2237,15 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
/* Recalculate CRC32 */
|
||||
efi_update_table_header_crc32(&systab.hdr);
|
||||
|
||||
@@ -141,7 +131,7 @@ index c68d9ed4f0bd..f2b5c7834c01 100644
|
||||
efi_set_watchdog(0);
|
||||
WATCHDOG_RESET();
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index a6b98f066a0b..a0689ba912fc 100644
|
||||
index a6b98f066a..c0f3427a60 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -25,6 +25,14 @@
|
||||
@@ -149,7 +139,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
#include <linux/err.h>
|
||||
|
||||
+#ifdef CONFIG_TARGET_CORSTONE1000
|
||||
+#include <arm_ffa_helper.h>
|
||||
+#include <arm_ffa.h>
|
||||
+#include <cpu_func.h>
|
||||
+
|
||||
+void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
|
||||
@@ -159,7 +149,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
const efi_guid_t efi_guid_capsule_report = EFI_CAPSULE_REPORT_GUID;
|
||||
@@ -512,6 +520,89 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
@@ -512,6 +520,78 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
}
|
||||
#endif /* CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT */
|
||||
|
||||
@@ -220,36 +210,25 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
+ */
|
||||
+static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_size)
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u16 part_id = CORSTONE1000_SEPROXY_PART_ID;
|
||||
+
|
||||
+ log_debug("[%s]\n", __func__);
|
||||
+
|
||||
+ /*
|
||||
+ * telling the driver which partition to use
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(part_id);
|
||||
+ func_data.data0 = &part_id;
|
||||
+
|
||||
+ /*
|
||||
+ * setting the buffer ready event arguments
|
||||
+ */
|
||||
+ msg.a3 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID;
|
||||
+ msg.a4 = capsule_image_size;
|
||||
+ msg.a5 = CORSTONE1000_BUFFER_READY_EVT;
|
||||
+ msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
+ msg.data1 = capsule_image_size; /* x4 */
|
||||
+ msg.data2 = CORSTONE1000_BUFFER_READY_EVT; /* x5 */
|
||||
+
|
||||
+ func_data.data1_size = sizeof(msg);
|
||||
+ func_data.data1 = &msg;
|
||||
+
|
||||
+ return ffa_helper_msg_send_direct_req(&func_data);
|
||||
+ return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* efi_update_capsule() - process information from operating system
|
||||
* @capsule_header_array: Array of virtual address pointers
|
||||
@@ -525,7 +616,7 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
@@ -525,7 +605,7 @@ static efi_status_t efi_capsule_update_firmware(
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
@@ -258,7 +237,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
struct efi_capsule_header **capsule_header_array,
|
||||
efi_uintn_t capsule_count,
|
||||
u64 scatter_gather_list)
|
||||
@@ -542,6 +633,13 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
@@ -542,6 +622,13 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -272,7 +251,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
ret = EFI_SUCCESS;
|
||||
for (i = 0, capsule = *capsule_header_array; i < capsule_count;
|
||||
i++, capsule = *(++capsule_header_array)) {
|
||||
@@ -554,6 +652,39 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
@@ -554,6 +641,39 @@ efi_status_t EFIAPI efi_update_capsule(
|
||||
|
||||
log_debug("Capsule[%d] (guid:%pUs)\n",
|
||||
i, &capsule->capsule_guid);
|
||||
@@ -312,7 +291,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
if (!guidcmp(&capsule->capsule_guid,
|
||||
&efi_guid_firmware_management_capsule_id)) {
|
||||
ret = efi_capsule_update_firmware(capsule);
|
||||
@@ -592,7 +723,7 @@ out:
|
||||
@@ -592,7 +712,7 @@ out:
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
@@ -322,7 +301,7 @@ index a6b98f066a0b..a0689ba912fc 100644
|
||||
efi_uintn_t capsule_count,
|
||||
u64 *maximum_capsule_size,
|
||||
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
|
||||
index 492ecf4cb15c..bfd4687e10b5 100644
|
||||
index 492ecf4cb1..bfd4687e10 100644
|
||||
--- a/lib/efi_loader/efi_setup.c
|
||||
+++ b/lib/efi_loader/efi_setup.c
|
||||
@@ -16,6 +16,13 @@
|
||||
@@ -355,5 +334,5 @@ index 492ecf4cb15c..bfd4687e10b5 100644
|
||||
ret = efi_set_variable_int(u"CapsuleMax",
|
||||
&efi_guid_capsule_report,
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+7
-10
@@ -1,7 +1,7 @@
|
||||
From 1ff229c8e02bdd3c859d581787636cfdf674eec1 Mon Sep 17 00:00:00 2001
|
||||
From a84f6be14f1bb31edea987fc02efd5a079a28db1 Mon Sep 17 00:00:00 2001
|
||||
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Date: Wed, 17 Nov 2021 15:28:06 +0000
|
||||
Subject: [PATCH 12/24] corstone1000: Update FFA shared buffer address
|
||||
Subject: [PATCH 17/26] corstone1000: Update FFA shared buffer address
|
||||
|
||||
FFA shared buffer address changed to 0x02000000.
|
||||
|
||||
@@ -10,28 +10,25 @@ Optee so the virtual address returned to the SMM gateway is 0x0000.
|
||||
So the buffer is moved to 0x02000000.
|
||||
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
%% original patch: 0025-Update-FFA-shared-buffer-address.patch
|
||||
|
||||
%% original patch: 0025-Update-FFA-shared-buffer-address.patch
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index a400cdef69d0..db0f91335cef 100644
|
||||
index fe5ec0adcd..2d89a8966e 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -45,7 +45,7 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
* shared buffer physical address used for communication between
|
||||
* u-boot and the MM SP
|
||||
*/
|
||||
-#define FFA_SHARED_MM_BUFFER_ADDR (0x023F8000)
|
||||
+#define FFA_SHARED_MM_BUFFER_ADDR (0x02000000)
|
||||
#define FFA_SHARED_MM_BUFFER_OFFSET (0)
|
||||
|
||||
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f00000)
|
||||
#define CONFIG_SKIP_LOWLEVEL_INIT
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+5
-4
@@ -1,18 +1,19 @@
|
||||
From 340ba3fbb0ea388578e30aede92695886f221eaf Mon Sep 17 00:00:00 2001
|
||||
From 3f8d35ccbb0d59d4820b81f7f939ada95b3cd92c Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Fri, 4 Mar 2022 15:56:09 +0000
|
||||
Subject: [PATCH 14/24] arm: corstone1000: fix unrecognized filesystem type
|
||||
Subject: [PATCH 18/26] arm: corstone1000: fix unrecognized filesystem type
|
||||
|
||||
Some usb sticks are not recognized by usb, just add a
|
||||
delay before checking status.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
common/usb_storage.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/common/usb_storage.c b/common/usb_storage.c
|
||||
index eaa31374ef73..79cf4297d4f4 100644
|
||||
index eaa31374ef..79cf4297d4 100644
|
||||
--- a/common/usb_storage.c
|
||||
+++ b/common/usb_storage.c
|
||||
@@ -784,6 +784,9 @@ static int usb_stor_BBB_transport(struct scsi_cmd *srb, struct us_data *us)
|
||||
@@ -26,5 +27,5 @@ index eaa31374ef73..79cf4297d4f4 100644
|
||||
result = usb_bulk_msg(us->pusb_dev, pipein, csw, UMASS_BBB_CSW_SIZE,
|
||||
&actlen, USB_CNTL_TIMEOUT*5);
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
From 460406b46b51b6c585788001147a8961c95cc73c Mon Sep 17 00:00:00 2001
|
||||
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Date: Sat, 11 Dec 2021 21:05:10 +0000
|
||||
Subject: [PATCH 18/24] arm_ffa: removing the cast when using binary OR on
|
||||
FIELD_PREP macros
|
||||
|
||||
When the GENMASK used is above 16-bits wide a u16 cast will cause
|
||||
loss of data.
|
||||
|
||||
This commit fixes that.
|
||||
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
drivers/arm-ffa/arm_ffa_prv.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/arm-ffa/arm_ffa_prv.h b/drivers/arm-ffa/arm_ffa_prv.h
|
||||
index 38ea4ba83efc..d0db3ef508a1 100644
|
||||
--- a/drivers/arm-ffa/arm_ffa_prv.h
|
||||
+++ b/drivers/arm-ffa/arm_ffa_prv.h
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
#define PREP_SELF_ENDPOINT_ID_MASK GENMASK(31, 16)
|
||||
#define PREP_SELF_ENDPOINT_ID(x) \
|
||||
- ((u16)(FIELD_PREP(PREP_SELF_ENDPOINT_ID_MASK, (x))))
|
||||
+ (FIELD_PREP(PREP_SELF_ENDPOINT_ID_MASK, (x)))
|
||||
|
||||
/* Partition endpoint ID mask (partition with which u-boot communicates with) */
|
||||
|
||||
#define PREP_PART_ENDPOINT_ID_MASK GENMASK(15, 0)
|
||||
#define PREP_PART_ENDPOINT_ID(x) \
|
||||
- ((u16)(FIELD_PREP(PREP_PART_ENDPOINT_ID_MASK, (x))))
|
||||
+ (FIELD_PREP(PREP_PART_ENDPOINT_ID_MASK, (x)))
|
||||
|
||||
/* The FF-A SMC function prototype definition */
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
From 936c857add300f41bc58c300793a0e10b48ff69f Mon Sep 17 00:00:00 2001
|
||||
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Date: Mon, 13 Dec 2021 15:25:23 +0000
|
||||
Subject: [PATCH 19/24] Use correct buffer size
|
||||
|
||||
The comm buffer created has additional 4 bytes length which
|
||||
needs to be trimmed. This change will reduce the size of the
|
||||
comm buffer to what is expected.
|
||||
|
||||
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
---
|
||||
include/mm_communication.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/mm_communication.h b/include/mm_communication.h
|
||||
index e65fbde60d0a..bb9919095649 100644
|
||||
--- a/include/mm_communication.h
|
||||
+++ b/include/mm_communication.h
|
||||
@@ -123,7 +123,7 @@ struct __packed efi_mm_communicate_header {
|
||||
*
|
||||
* Defined in EDK2 as SMM_VARIABLE_COMMUNICATE_HEADER.
|
||||
*/
|
||||
-struct smm_variable_communicate_header {
|
||||
+struct __packed smm_variable_communicate_header {
|
||||
efi_uintn_t function;
|
||||
efi_status_t ret_status;
|
||||
u8 data[];
|
||||
@@ -145,7 +145,7 @@ struct smm_variable_communicate_header {
|
||||
* Defined in EDK2 as SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE.
|
||||
*
|
||||
*/
|
||||
-struct smm_variable_access {
|
||||
+struct __packed smm_variable_access {
|
||||
efi_guid_t guid;
|
||||
efi_uintn_t data_size;
|
||||
efi_uintn_t name_size;
|
||||
--
|
||||
2.37.1
|
||||
|
||||
+16
-15
@@ -1,7 +1,7 @@
|
||||
From 4c249de0915750b328e456c34f18546f92850afd Mon Sep 17 00:00:00 2001
|
||||
From 3bb5826af8e3891617d41a30419de0ce089f9fc3 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 10 Dec 2021 20:03:35 +0000
|
||||
Subject: [PATCH 15/24] efi_capsule: corstone1000: pass interface id and buffer
|
||||
Subject: [PATCH 19/26] efi_capsule: corstone1000: pass interface id and buffer
|
||||
event id using register w4
|
||||
|
||||
Initially the interface/event IDs are passed to the SP using register
|
||||
@@ -16,13 +16,14 @@ firmware update.
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 6 ++++++
|
||||
lib/efi_loader/efi_capsule.c | 11 +++++++----
|
||||
2 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index db0f91335cef..a7445e61348b 100644
|
||||
index 2d89a8966e..4637dd5d5d 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -24,6 +24,12 @@
|
||||
@@ -39,20 +40,20 @@ index db0f91335cef..a7445e61348b 100644
|
||||
#define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index a0689ba912fc..e08e97cf3fb7 100644
|
||||
index c0f3427a60..bf8bd68256 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -28,6 +28,8 @@
|
||||
#ifdef CONFIG_TARGET_CORSTONE1000
|
||||
#include <arm_ffa_helper.h>
|
||||
#include <arm_ffa.h>
|
||||
#include <cpu_func.h>
|
||||
+#include <linux/bitfield.h>
|
||||
+#include <linux/bitops.h>
|
||||
|
||||
void *__efi_runtime_data corstone1000_capsule_buf; /* capsule shared buffer virtual address */
|
||||
efi_guid_t corstone1000_capsule_guid = EFI_CORSTONE1000_CAPSULE_ID_GUID;
|
||||
@@ -590,11 +592,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
|
||||
func_data.data0 = &part_id;
|
||||
@@ -582,11 +584,12 @@ static int __efi_runtime efi_corstone1000_buffer_ready_event(u32 capsule_image_s
|
||||
log_debug("[%s]\n", __func__);
|
||||
|
||||
/*
|
||||
- * setting the buffer ready event arguments
|
||||
@@ -60,14 +61,14 @@ index a0689ba912fc..e08e97cf3fb7 100644
|
||||
+ * - capsule update interface ID (31:16)
|
||||
+ * - the buffer ready event ID (15:0)
|
||||
*/
|
||||
- msg.a3 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID;
|
||||
- msg.a4 = capsule_image_size;
|
||||
- msg.a5 = CORSTONE1000_BUFFER_READY_EVT;
|
||||
+ msg.a4 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT);
|
||||
- msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
- msg.data1 = capsule_image_size; /* x4 */
|
||||
- msg.data2 = CORSTONE1000_BUFFER_READY_EVT; /* x5 */
|
||||
+ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_BUFFER_READY_EVT); /* w4 */
|
||||
|
||||
func_data.data1_size = sizeof(msg);
|
||||
func_data.data1 = &msg;
|
||||
return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+14
-13
@@ -1,7 +1,7 @@
|
||||
From e5e1cf36cb7b77a5bb526f1744c0c77164374ca3 Mon Sep 17 00:00:00 2001
|
||||
From 668fe40ccb0db5542ef333cd4655511dbb8572f9 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 10 Dec 2021 20:10:41 +0000
|
||||
Subject: [PATCH 16/24] efi_boottime: corstone1000: pass interface id and
|
||||
Subject: [PATCH 20/26] efi_boottime: corstone1000: pass interface id and
|
||||
kernel event id using register w4
|
||||
|
||||
Initially the interface/event IDs are passed to the SP using register
|
||||
@@ -16,16 +16,17 @@ secure enclave just before ExitbootService().
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_boottime.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index f2b5c7834c01..140d0f4f71da 100644
|
||||
index 9bf2596597..de815484d2 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -27,6 +27,11 @@
|
||||
#include <arm_ffa_helper.h>
|
||||
#include <arm_ffa.h>
|
||||
#endif
|
||||
|
||||
+#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
|
||||
@@ -36,8 +37,8 @@ index f2b5c7834c01..140d0f4f71da 100644
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* Task priority level */
|
||||
@@ -2120,10 +2125,12 @@ static int efi_corstone1000_kernel_started_event(void)
|
||||
func_data.data0 = &part_id;
|
||||
@@ -2112,10 +2117,12 @@ static int efi_corstone1000_kernel_started_event(void)
|
||||
log_debug("[%s]\n", __func__);
|
||||
|
||||
/*
|
||||
- * setting the kernel started event arguments
|
||||
@@ -45,13 +46,13 @@ index f2b5c7834c01..140d0f4f71da 100644
|
||||
+ * setting capsule update interface ID(31:16)
|
||||
+ * the kernel started event ID(15:0)
|
||||
*/
|
||||
- msg.a3 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID;
|
||||
- msg.a5 = CORSTONE1000_KERNEL_STARTED_EVT;
|
||||
+ msg.a4 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_KERNEL_STARTED_EVT);
|
||||
- msg.data0 = CORSTONE1000_SEPROXY_UPDATE_SVC_ID; /* x3 */
|
||||
- msg.data2 = CORSTONE1000_KERNEL_STARTED_EVT; /* x5 */
|
||||
+ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_KERNEL_STARTED_EVT); /* w4 */
|
||||
|
||||
func_data.data1_size = sizeof(msg);
|
||||
func_data.data1 = &msg;
|
||||
return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+7
-6
@@ -1,7 +1,7 @@
|
||||
From 596cf4d04580b191d2f4f6082000534bdab13791 Mon Sep 17 00:00:00 2001
|
||||
From 4d7fd850347dbea10a73cd5cf6eb518607118414 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Sat, 11 Dec 2021 13:23:55 +0000
|
||||
Subject: [PATCH 17/24] efi_loader: corstone1000: remove guid check from
|
||||
Subject: [PATCH 21/26] efi_loader: corstone1000: remove guid check from
|
||||
corstone1000 config option
|
||||
|
||||
Use generic fmp guid and no separte check is required for
|
||||
@@ -9,15 +9,16 @@ CORSTONE1000 target.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_capsule.c | 16 +---------------
|
||||
1 file changed, 1 insertion(+), 15 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index e08e97cf3fb7..891143c33909 100644
|
||||
index bf8bd68256..5db9d30d53 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -657,12 +657,6 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -646,12 +646,6 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
i, &capsule->capsule_guid);
|
||||
|
||||
#if CONFIG_IS_ENABLED(TARGET_CORSTONE1000)
|
||||
@@ -30,7 +31,7 @@ index e08e97cf3fb7..891143c33909 100644
|
||||
if (efi_size_in_pages(capsule->capsule_image_size) >
|
||||
CORSTONE1000_CAPSULE_BUFFER_SIZE) {
|
||||
log_err("Corstone1000: Capsule data size exceeds the shared buffer size\n");
|
||||
@@ -688,15 +682,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -677,15 +671,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
@@ -48,5 +49,5 @@ index e08e97cf3fb7..891143c33909 100644
|
||||
goto out;
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+6
-5
@@ -1,7 +1,7 @@
|
||||
From 5c57ef351882afebde479de430acf2c4f8fdefc8 Mon Sep 17 00:00:00 2001
|
||||
From 720e5ada733b0f7b019baaec57d74603a9dff67e Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 17 Dec 2021 19:49:02 +0000
|
||||
Subject: [PATCH 20/24] efi_loader: populate ESRT table if EFI_ESRT config
|
||||
Subject: [PATCH 22/26] efi_loader: populate ESRT table if EFI_ESRT config
|
||||
option is set
|
||||
|
||||
This change is to call efi_esrt_populate function if CONFIG_EFI_ESRT
|
||||
@@ -9,15 +9,16 @@ is set. This will populte esrt table with firmware image info
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_capsule.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
|
||||
index 891143c33909..7db78f1f7648 100644
|
||||
index 5db9d30d53..65e2fc8296 100644
|
||||
--- a/lib/efi_loader/efi_capsule.c
|
||||
+++ b/lib/efi_loader/efi_capsule.c
|
||||
@@ -679,6 +679,13 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
@@ -668,6 +668,13 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule(
|
||||
ret = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -32,5 +33,5 @@ index 891143c33909..7db78f1f7648 100644
|
||||
#endif
|
||||
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+5
-7
@@ -1,22 +1,20 @@
|
||||
From fcd1dc670d83bd7e7528370d0d6f168bfb44054d Mon Sep 17 00:00:00 2001
|
||||
From 2cad562823976134f201d6e2ef187bf103e17d1e Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 17 Dec 2021 19:50:25 +0000
|
||||
Subject: [PATCH 21/24] efi_firmware: add get_image_info for corstone1000
|
||||
Subject: [PATCH 23/26] efi_firmware: add get_image_info for corstone1000
|
||||
|
||||
This change is to populate get_image_info which eventually
|
||||
will be populated in ESRT table
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
|
||||
%% original patch: 0047-efi_firmware-add-get_image_info-for-corstone1000.patch
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_firmware.c | 71 ++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 70 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index 30cafd15caac..af43d4502f92 100644
|
||||
index 30cafd15ca..af43d4502f 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -17,11 +17,69 @@
|
||||
@@ -120,5 +118,5 @@ index 30cafd15caac..af43d4502f92 100644
|
||||
NULL, NULL))
|
||||
return EFI_EXIT(EFI_DEVICE_ERROR);
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+40
-48
@@ -1,7 +1,7 @@
|
||||
From 902d5c499b6627a505986d298986a4ac430592b8 Mon Sep 17 00:00:00 2001
|
||||
From 709e5d8ff07474f840f1d34d3077135f77795452 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Wed, 5 Jan 2022 17:56:09 +0000
|
||||
Subject: [PATCH 22/24] efi_loader: send bootcomplete message to secure enclave
|
||||
Date: Mon, 15 Aug 2022 15:46:18 +0100
|
||||
Subject: [PATCH 24/26] efi_loader: send bootcomplete message to secure enclave
|
||||
|
||||
On corstone1000 platform, Secure Enclave will be expecting
|
||||
an event from uboot when it performs capsule update. Previously,
|
||||
@@ -11,15 +11,17 @@ to send an uboot efi initialized event at efi sub-system initialization
|
||||
stage.
|
||||
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
include/configs/corstone1000.h | 2 +-
|
||||
lib/efi_loader/efi_boottime.c | 49 ----------------------------------
|
||||
lib/efi_loader/efi_boottime.c | 43 ----------------------------------
|
||||
lib/efi_loader/efi_firmware.c | 2 +-
|
||||
lib/efi_loader/efi_setup.c | 48 +++++++++++++++++++++++++++++++++
|
||||
4 files changed, 50 insertions(+), 51 deletions(-)
|
||||
lib/efi_loader/efi_setup.c | 39 ++++++++++++++++++++++++++++++
|
||||
4 files changed, 41 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index a7445e61348b..06b605e43bdf 100644
|
||||
index 4637dd5d5d..333b1d93b6 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -22,7 +22,7 @@
|
||||
@@ -32,10 +34,22 @@ index a7445e61348b..06b605e43bdf 100644
|
||||
#define PREP_SEPROXY_SVC_ID_MASK GENMASK(31, 16)
|
||||
#define PREP_SEPROXY_SVC_ID(x) (FIELD_PREP(PREP_SEPROXY_SVC_ID_MASK, (x)))
|
||||
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
|
||||
index 140d0f4f71da..6b9f5cf272b8 100644
|
||||
index de815484d2..cede7826bd 100644
|
||||
--- a/lib/efi_loader/efi_boottime.c
|
||||
+++ b/lib/efi_loader/efi_boottime.c
|
||||
@@ -2100,46 +2100,6 @@ static void efi_exit_caches(void)
|
||||
@@ -27,11 +27,6 @@
|
||||
#include <arm_ffa.h>
|
||||
#endif
|
||||
|
||||
-#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
|
||||
-#include <linux/bitfield.h>
|
||||
-#include <linux/bitops.h>
|
||||
-#endif
|
||||
-
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* Task priority level */
|
||||
@@ -2100,35 +2095,6 @@ static void efi_exit_caches(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -51,30 +65,19 @@ index 140d0f4f71da..6b9f5cf272b8 100644
|
||||
- */
|
||||
-static int efi_corstone1000_kernel_started_event(void)
|
||||
-{
|
||||
- struct ffa_interface_data func_data = {0};
|
||||
- struct ffa_send_direct_data msg = {0};
|
||||
- u16 part_id = CORSTONE1000_SEPROXY_PART_ID;
|
||||
-
|
||||
- log_debug("[%s]\n", __func__);
|
||||
-
|
||||
- /*
|
||||
- * telling the driver which partition to use
|
||||
- */
|
||||
- func_data.data0_size = sizeof(part_id);
|
||||
- func_data.data0 = &part_id;
|
||||
-
|
||||
- /*
|
||||
- * setting the kernel started event arguments:
|
||||
- * setting capsule update interface ID(31:16)
|
||||
- * the kernel started event ID(15:0)
|
||||
- */
|
||||
- msg.a4 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
- PREP_SEPROXY_EVT(CORSTONE1000_KERNEL_STARTED_EVT);
|
||||
- msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
- PREP_SEPROXY_EVT(CORSTONE1000_KERNEL_STARTED_EVT); /* w4 */
|
||||
-
|
||||
- func_data.data1_size = sizeof(msg);
|
||||
- func_data.data1 = &msg;
|
||||
-
|
||||
- return ffa_helper_msg_send_direct_req(&func_data);
|
||||
- return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
-}
|
||||
-
|
||||
-#endif
|
||||
@@ -82,7 +85,7 @@ index 140d0f4f71da..6b9f5cf272b8 100644
|
||||
/**
|
||||
* efi_exit_boot_services() - stop all boot services
|
||||
* @image_handle: handle of the loaded image
|
||||
@@ -2253,15 +2213,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
@@ -2244,15 +2210,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
|
||||
/* Recalculate CRC32 */
|
||||
efi_update_table_header_crc32(&systab.hdr);
|
||||
|
||||
@@ -99,7 +102,7 @@ index 140d0f4f71da..6b9f5cf272b8 100644
|
||||
efi_set_watchdog(0);
|
||||
WATCHDOG_RESET();
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index af43d4502f92..25f427b93669 100644
|
||||
index af43d4502f..25f427b936 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -47,7 +47,7 @@ static efi_status_t efi_corstone1000_img_info_get (
|
||||
@@ -112,7 +115,7 @@ index af43d4502f92..25f427b93669 100644
|
||||
}
|
||||
|
||||
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
|
||||
index bfd4687e10b5..a20128e9b582 100644
|
||||
index bfd4687e10..6c9e14c37e 100644
|
||||
--- a/lib/efi_loader/efi_setup.c
|
||||
+++ b/lib/efi_loader/efi_setup.c
|
||||
@@ -17,6 +17,9 @@
|
||||
@@ -121,11 +124,11 @@ index bfd4687e10b5..a20128e9b582 100644
|
||||
#if IS_ENABLED(CONFIG_TARGET_CORSTONE1000)
|
||||
+#include <linux/bitfield.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <arm_ffa_helper.h>
|
||||
+#include <arm_ffa.h>
|
||||
/**
|
||||
* efi_corstone1000_alloc_capsule_shared_buf - allocate capsule shared buffer
|
||||
*/
|
||||
@@ -126,6 +129,44 @@ static efi_status_t efi_init_secure_boot(void)
|
||||
@@ -126,6 +129,34 @@ static efi_status_t efi_init_secure_boot(void)
|
||||
}
|
||||
#endif /* CONFIG_EFI_SECURE_BOOT */
|
||||
|
||||
@@ -141,42 +144,31 @@ index bfd4687e10b5..a20128e9b582 100644
|
||||
+ * */
|
||||
+static int efi_corstone1000_uboot_efi_started_event(void)
|
||||
+{
|
||||
+ struct ffa_interface_data func_data = {0};
|
||||
+ struct ffa_send_direct_data msg = {0};
|
||||
+ u16 part_id = CORSTONE1000_SEPROXY_PART_ID;
|
||||
+
|
||||
+ log_debug("[%s]\n", __func__);
|
||||
+
|
||||
+ /*
|
||||
+ * telling the driver which partition to use
|
||||
+ */
|
||||
+ func_data.data0_size = sizeof(part_id);
|
||||
+ func_data.data0 = &part_id;
|
||||
+ /*
|
||||
+ * setting the uboot efi subsystem started event arguments:
|
||||
+ * setting the kernel started event arguments:
|
||||
+ * setting capsule update interface ID(31:16)
|
||||
+ * the uboot efi subsystem started event ID(15:0)
|
||||
+ * the kernel started event ID(15:0)
|
||||
+ */
|
||||
+ msg.a4 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_UBOOT_EFI_STARTED_EVT);
|
||||
+ msg.data1 = PREP_SEPROXY_SVC_ID(CORSTONE1000_SEPROXY_UPDATE_SVC_ID) |
|
||||
+ PREP_SEPROXY_EVT(CORSTONE1000_UBOOT_EFI_STARTED_EVT); /* w4 */
|
||||
+
|
||||
+ func_data.data1_size = sizeof(msg);
|
||||
+ func_data.data1 = &msg;
|
||||
+
|
||||
+ return ffa_helper_msg_send_direct_req(&func_data);
|
||||
+ return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* efi_init_capsule - initialize capsule update state
|
||||
*
|
||||
@@ -134,8 +175,15 @@ static efi_status_t efi_init_secure_boot(void)
|
||||
static efi_status_t efi_init_capsule(void)
|
||||
{
|
||||
@@ -136,6 +167,14 @@ static efi_status_t efi_init_capsule(void)
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
+ int ffa_ret;
|
||||
|
||||
#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");
|
||||
@@ -187,5 +179,5 @@ index bfd4687e10b5..a20128e9b582 100644
|
||||
if (ret != EFI_SUCCESS) {
|
||||
printf("EFI: Corstone-1000: cannot allocate caspsule shared buffer\n");
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+5
-4
@@ -1,7 +1,7 @@
|
||||
From 383078dde2fbf509dc3d24505f6b328316aee030 Mon Sep 17 00:00:00 2001
|
||||
From 456e616401b02a579e9ea5ec3e5ab1d1c884b389 Mon Sep 17 00:00:00 2001
|
||||
From: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Date: Fri, 14 Jan 2022 15:24:18 +0000
|
||||
Subject: [PATCH 23/24] efi_loader: fix null pointer exception with
|
||||
Subject: [PATCH 25/26] efi_loader: fix null pointer exception with
|
||||
get_image_info
|
||||
|
||||
get_img_info API implemented for corstone1000 target does not
|
||||
@@ -11,12 +11,13 @@ exception.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
lib/efi_loader/efi_firmware.c | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
|
||||
index 25f427b93669..28d9a19edb90 100644
|
||||
index 25f427b936..28d9a19edb 100644
|
||||
--- a/lib/efi_loader/efi_firmware.c
|
||||
+++ b/lib/efi_loader/efi_firmware.c
|
||||
@@ -38,26 +38,29 @@ static efi_status_t efi_corstone1000_img_info_get (
|
||||
@@ -58,5 +59,5 @@ index 25f427b93669..28d9a19edb90 100644
|
||||
IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED;
|
||||
image_info[i].attributes_setting = IMAGE_ATTRIBUTE_IMAGE_UPDATABLE;
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+9
-8
@@ -1,12 +1,13 @@
|
||||
From cc3356c2a30b7aa85a25e9bc7b69a03537df3f27 Mon Sep 17 00:00:00 2001
|
||||
From 5e4c819c7ab0841429016c098106615b33486c8b Mon Sep 17 00:00:00 2001
|
||||
From: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Date: Tue, 5 Apr 2022 10:24:38 +0100
|
||||
Subject: [PATCH 24/24] arm:corstone1000: add mmc for fvp
|
||||
Subject: [PATCH 26/26] arm:corstone1000: add mmc for fvp
|
||||
|
||||
Enable support mmc/sdcard for the corstone1000 FVP.
|
||||
|
||||
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
|
||||
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
arch/arm/dts/corstone1000-fvp.dts | 28 +++++++++++++++
|
||||
board/armltd/corstone1000/corstone1000.c | 46 ++++++++++++++++--------
|
||||
@@ -15,7 +16,7 @@ Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
|
||||
4 files changed, 69 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/dts/corstone1000-fvp.dts b/arch/arm/dts/corstone1000-fvp.dts
|
||||
index 1fcc137a493c..26b0f1b3cea6 100644
|
||||
index 1fcc137a49..26b0f1b3ce 100644
|
||||
--- a/arch/arm/dts/corstone1000-fvp.dts
|
||||
+++ b/arch/arm/dts/corstone1000-fvp.dts
|
||||
@@ -20,4 +20,32 @@
|
||||
@@ -52,7 +53,7 @@ index 1fcc137a493c..26b0f1b3cea6 100644
|
||||
+ };
|
||||
};
|
||||
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
|
||||
index 2fa485ff3799..3d537d7a9052 100644
|
||||
index 2fa485ff37..3d537d7a90 100644
|
||||
--- a/board/armltd/corstone1000/corstone1000.c
|
||||
+++ b/board/armltd/corstone1000/corstone1000.c
|
||||
@@ -46,22 +46,38 @@ static struct mm_region corstone1000_mem_map[] = {
|
||||
@@ -110,7 +111,7 @@ index 2fa485ff3799..3d537d7a9052 100644
|
||||
/* OCVM */
|
||||
.virt = 0x80000000UL,
|
||||
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
|
||||
index b042d4e49419..147c14c94865 100644
|
||||
index c299dda49f..76e07fc20c 100644
|
||||
--- a/configs/corstone1000_defconfig
|
||||
+++ b/configs/corstone1000_defconfig
|
||||
@@ -38,7 +38,13 @@ CONFIG_CMD_EFIDEBUG=y
|
||||
@@ -129,10 +130,10 @@ index b042d4e49419..147c14c94865 100644
|
||||
CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
|
||||
index 06b605e43bdf..d9855bf91ebf 100644
|
||||
index 333b1d93b6..815239590e 100644
|
||||
--- a/include/configs/corstone1000.h
|
||||
+++ b/include/configs/corstone1000.h
|
||||
@@ -95,7 +95,9 @@
|
||||
@@ -89,7 +89,9 @@
|
||||
#define CONFIG_SYS_MAXARGS 64 /* max command args */
|
||||
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
@@ -144,5 +145,5 @@ index 06b605e43bdf..d9855bf91ebf 100644
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
--
|
||||
2.37.1
|
||||
2.17.1
|
||||
|
||||
+1
-3
@@ -1,6 +1,3 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
|
||||
|
||||
From 83f16fe96a86b00f7a4b7c4c4f7416119b80eddd Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan <emekcan.aras@arm.com>
|
||||
Date: Fri, 19 Aug 2022 16:04:48 +0100
|
||||
@@ -10,6 +7,7 @@ It adds external sys driver binding to u-boot
|
||||
device tree.
|
||||
|
||||
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
arch/arm/dts/corstone1000.dtsi | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
+1
-3
@@ -1,6 +1,3 @@
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
|
||||
|
||||
From a1b8b91a43cfa9dbaa2d907a6d9629da6f93fa3e Mon Sep 17 00:00:00 2001
|
||||
From: Emekcan <emekcan.aras@arm.com>
|
||||
Date: Mon, 12 Sep 2022 15:47:06 +0100
|
||||
@@ -11,6 +8,7 @@ device tree. This enables communication between host and
|
||||
the external system.
|
||||
|
||||
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
---
|
||||
arch/arm/dts/corstone1000.dtsi | 50 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 50 insertions(+)
|
||||
@@ -18,34 +18,36 @@ EXTRA_OEMAKE:append:corstone1000 = ' DEVICE_TREE=${CORSTONE1000_DEVICE_TREE}'
|
||||
SYSROOT_DIRS:append:corstone1000 = " /boot"
|
||||
|
||||
SRC_URI:append:corstone1000 = " \
|
||||
file://0001-cmd-load-add-load-command-for-memory-mapped.patch \
|
||||
file://0002-arm-add-support-to-corstone1000-platform.patch \
|
||||
file://0003-usb-common-move-urb-code-to-common.patch \
|
||||
file://0004-usb-add-isp1760-family-driver.patch \
|
||||
file://0005-corstone1000-enable-isp1763-usb-controller.patch \
|
||||
file://0006-arm_ffa-introducing-Arm-FF-A-low-level-driver.patch \
|
||||
file://0007-arm_ffa-introducing-armffa-command.patch \
|
||||
file://0008-arm_ffa-introducing-MM-communication-with-FF-A.patch \
|
||||
file://0009-arm_ffa-introducing-test-module-for-UCLASS_FFA.patch \
|
||||
file://0010-arm_ffa-corstone1000-enable-FF-A-and-MM-support.patch \
|
||||
file://0011-efi-corstone1000-introduce-EFI-capsule-update.patch \
|
||||
file://0012-corstone1000-Update-FFA-shared-buffer-address.patch \
|
||||
file://0013-corstone1000-Make-sure-shared-buffer-contents-are-no.patch \
|
||||
file://0014-arm-corstone1000-fix-unrecognized-filesystem-type.patch \
|
||||
file://0015-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch \
|
||||
file://0016-efi_boottime-corstone1000-pass-interface-id-and-kern.patch \
|
||||
file://0017-efi_loader-corstone1000-remove-guid-check-from-corst.patch \
|
||||
file://0018-arm_ffa-removing-the-cast-when-using-binary-OR-on-FI.patch \
|
||||
file://0019-Use-correct-buffer-size.patch \
|
||||
file://0020-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \
|
||||
file://0021-efi_firmware-add-get_image_info-for-corstone1000.patch \
|
||||
file://0022-efi_loader-send-bootcomplete-message-to-secure-encla.patch \
|
||||
file://0023-efi_loader-fix-null-pointer-exception-with-get_image.patch \
|
||||
file://0024-arm-corstone1000-add-mmc-for-fvp.patch \
|
||||
file://0025-corstone1000-use-a-compressed-kernel.patch \
|
||||
file://0026-Introduce-external-sys-driver-to-device-tree.patch \
|
||||
file://0027-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \
|
||||
"
|
||||
file://0001-cmd-load-add-load-command-for-memory-mapped.patch \
|
||||
file://0002-arm-add-support-to-corstone1000-platform.patch \
|
||||
file://0003-usb-common-move-urb-code-to-common.patch \
|
||||
file://0004-usb-add-isp1760-family-driver.patch \
|
||||
file://0005-corstone1000-enable-isp1763-usb-controller.patch \
|
||||
file://0006-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch \
|
||||
file://0007-arm64-smccc-clear-the-Xn-registers-after-SMC-calls.patch \
|
||||
file://0008-lib-uuid-introduce-be_uuid_str_to_le_bin-function.patch \
|
||||
file://0009-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch \
|
||||
file://0010-arm_ffa-introduce-armffa-command.patch \
|
||||
file://0011-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch \
|
||||
file://0012-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch \
|
||||
file://0013-arm_ffa-introduce-armffa-command-Sandbox-test.patch \
|
||||
file://0014-arm_ffa-introduce-FF-A-MM-communication.patch \
|
||||
file://0015-arm_ffa-corstone1000-enable-FF-A-and-MM-support.patch \
|
||||
file://0016-efi-corstone1000-introduce-EFI-capsule-update.patch \
|
||||
file://0017-corstone1000-Update-FFA-shared-buffer-address.patch \
|
||||
file://0018-arm-corstone1000-fix-unrecognized-filesystem-type.patch \
|
||||
file://0019-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch \
|
||||
file://0020-efi_boottime-corstone1000-pass-interface-id-and-kern.patch \
|
||||
file://0021-efi_loader-corstone1000-remove-guid-check-from-corst.patch \
|
||||
file://0022-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \
|
||||
file://0023-efi_firmware-add-get_image_info-for-corstone1000.patch \
|
||||
file://0024-efi_loader-send-bootcomplete-message-to-secure-encla.patch \
|
||||
file://0025-efi_loader-fix-null-pointer-exception-with-get_image.patch \
|
||||
file://0026-arm-corstone1000-add-mmc-for-fvp.patch \
|
||||
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 \
|
||||
"
|
||||
|
||||
#
|
||||
# FVP BASE
|
||||
|
||||
Reference in New Issue
Block a user