Skip to contentSkip to conversation

remoteproc: Add support for R5F and DSP processors

PATCH New Lokesh Vutla 3 participants 57 messages Sep 4, 2019 – Oct 12, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover remoteproc: Add support for R5F and DSP processors

This series addds support loading and starting for the following remote processors:
- ARM Cortex-R5F in lockstep and split mode
- C66x DSP
- C7x DSP

Enable these remoteprocessor in AM654-evm and J721E evm.

Changes since v1:
- Reword the comments section for device_to_virt() api.
- Update the stm32_coproc driver to add size checks in device_to_virt() callback.
- Retain the export of rproc_elf32_sanity_check().
- Exported rproc_elf64_sanity_check()
- Added rproc_elf_sanity_check() api
- Added README for J721E.

Kedar Chitnis (1):
armv8: K3: j721e: Updated ddr address regions in MMU table

Lokesh Vutla (15):
dm: core: Add a function to count the children of a device
remoteproc: ops: Add elf section size as input parameter to
device_to_virt api
remoteproc: elf_loader: Always check the validity of the image before
loading
remoteproc: elf-loader: Add 64 bit elf loading support
remoteproc: elf_loader: Introduce a common elf loader and checker
functions
remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() api
remoteproc: tisci_proc: Add helper api for controlling core power
domain
remoteproc: Introduce K3 remoteproc driver for R5F subsystem
remoteproc: Introduce K3 C66 and C71 remoteproc driver
arm: dts: k3-j721e-mcu: Add MCU domain R5F cluster node
arm: dts: k3-j721e-main: Add MAIN domain R5F cluster nodes
arm: dts: k3-j721e-main: Add C66x DSP nodes
arm: dts: k3-j721e-main: Add C71x DSP node
configs: j721e_evm_a72: Enable R5F and DSP remoteproc driver
board: j721e: Add README

Suman Anna (10):
dt-bindings: remoteproc: Add bindings for R5F subsystem on TI K3 SoCs
dt-bindings: remoteproc: Add bindings for DSP C66x clusters on TI K3
SoCs
arm: dts: k3-am65-mcu: Add MCU domain R5F DT nodes
env: ti: k3_rproc: Add common rproc environment variables
env: ti: j721e-evm: Add support to boot rprocs including R5Fs and DSPs
env: ti: am65x_evm: Add env support to boot the MCU R5F rprocs
configs: j721e_evm_a72: Enhance bootcmd to start remoteprocs
configs: am65x_evm_a53: Enable R5F remoteproc driver
configs: am65x_evm_a53: Enhance bootcmd to start remoteprocs
armv8: K3: am65x: Update DDR address regions in MMU table

 arch/arm/dts/k3-am65-mcu.dtsi                 |  40 +-
 arch/arm/dts/k3-am654-base-board.dts          |   5 +
 arch/arm/dts/k3-j721e-common-proc-board.dts   |  12 +
 arch/arm/dts/k3-j721e-main.dtsi               | 111 +++
 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi         |  38 +
 arch/arm/mach-k3/arm64-mmu.c                  |  24 +-
 board/ti/j721e/README                         | 227 +++++
 configs/am65x_evm_a53_defconfig               |   4 +-
 configs/j721e_evm_a72_defconfig               |   5 +-
 .../remoteproc/ti,k3-dsp-rproc.txt            | 101 +++
 .../remoteproc/ti,k3-r5f-rproc.txt            | 164 ++++
 drivers/core/device.c                         |  11 +
 drivers/remoteproc/Kconfig                    |  20 +
 drivers/remoteproc/Makefile                   |   2 +
 drivers/remoteproc/rproc-elf-loader.c         | 179 +++-
 drivers/remoteproc/sandbox_testproc.c         |   4 +-
 drivers/remoteproc/stm32_copro.c              |  21 +-
 drivers/remoteproc/ti_k3_dsp_rproc.c          | 354 ++++++++
 drivers/remoteproc/ti_k3_r5f_rproc.c          | 816 ++++++++++++++++++
 drivers/remoteproc/ti_sci_proc.h              |  27 +
 include/configs/am65x_evm.h                   |  11 +-
 include/configs/j721e_evm.h                   |  14 +-
 include/dm/device.h                           |   9 +
 include/environment/ti/k3_rproc.h             |  52 ++
 include/remoteproc.h                          |  76 +-
 test/dm/bus.c                                 |  41 +-
 test/dm/remoteproc.c                          |   7 +-
 27 files changed, 2316 insertions(+), 59 deletions(-)
 create mode 100644 board/ti/j721e/README
 create mode 100644 doc/device-tree-bindings/remoteproc/ti,k3-dsp-rproc.txt
 create mode 100644 doc/device-tree-bindings/remoteproc/ti,k3-r5f-rproc.txt
 create mode 100644 drivers/remoteproc/ti_k3_dsp_rproc.c
 create mode 100644 drivers/remoteproc/ti_k3_r5f_rproc.c
 create mode 100644 include/environment/ti/k3_rproc.h
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 1/26 dm: core: Add a function to count the children of a device

Add a function to count the available children of a device.

---
 drivers/core/device.c | 11 +++++++++++
 include/dm/device.h   |  9 +++++++++
 test/dm/bus.c         | 41 +++++++++++++++--------------------------
 3 files changed, 35 insertions(+), 26 deletions(-)
drivers/core/device.c +11 -0
index 474c1642ee..beff52009d 100644
@@ -565,6 +565,17 @@ int device_get_child(struct udevice *parent, int index, struct udevice **devp)
 	return -ENODEV;
 }
 
+int device_get_child_count(struct udevice *parent)
+{
+	struct udevice *dev;
+	int count = 0;
+
+	list_for_each_entry(dev, &parent->child_head, sibling_node)
+		count++;
+
+	return count;
+}
+
 int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq,
 			     bool find_req_seq, struct udevice **devp)
 {
include/dm/device.h +9 -0
index 27a6d7b9fd..7e2a097de2 100644
@@ -404,6 +404,15 @@ const char *dev_get_uclass_name(const struct udevice *dev);
  */
 int device_get_child(struct udevice *parent, int index, struct udevice **devp);
 
+/**
+ * device_get_child_count() - Get the available child count of a device
+ *
+ * Returns the number of children to a device.
+ *
+ * @parent:	Parent device to check
+ */
+int device_get_child_count(struct udevice *parent);
+
 /**
  * device_find_child_by_seq() - Find a child device based on a sequence
  *
test/dm/bus.c +15 -26

157 lines not on this page · raw message

Signature · 1 line
2.22.0
#2 lore raw

PATCH v2 1/26 dm: core: Add a function to count the children of a device

Quoted 3 lines · Lokesh Vutla

Add a function to count the available children of a device.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/46cb41ff/attachment.sig>
#3 lore raw

PATCH v2 2/26 remoteproc: ops: Add elf section size as input parameter to device_to_virt api

In reply to Lokesh Vutla

Introduce a new parameter "size" that accepts size of the region to remoteproc ops callback device_to_virt(). This can enforce more checks on the region that device_to_virt() is dealing with.

---
 drivers/remoteproc/rproc-elf-loader.c |  3 ++-
 drivers/remoteproc/sandbox_testproc.c |  4 +++-
 drivers/remoteproc/stm32_copro.c      | 12 ++++++++++--
 include/remoteproc.h                  |  3 ++-
 4 files changed, 17 insertions(+), 5 deletions(-)
drivers/remoteproc/rproc-elf-loader.c +2 -1
index 67937a7595..7574ba3fb3 100644
@@ -86,7 +86,8 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
 			continue;
 
 		if (ops->device_to_virt)
-			dst = ops->device_to_virt(dev, (ulong)dst);
+			dst = ops->device_to_virt(dev, (ulong)dst,
+						  phdr->p_memsz);
 
 		dev_dbg(dev, "Loading phdr %i to 0x%p (%i bytes)\n",
 			i, dst, phdr->p_filesz);
drivers/remoteproc/sandbox_testproc.c +3 -1
index 5f35119ab7..eeee49c4dd 100644
@@ -306,9 +306,11 @@ static int sandbox_testproc_ping(struct udevice *dev)
  * sandbox_testproc_device_to_virt() - Convert device address to virtual address
  * @dev:	device to operate upon
  * @da:		device address
+ * @size:	Size of the memory region @da is pointing to
  * @return converted virtual address
  */
-static void *sandbox_testproc_device_to_virt(struct udevice *dev, ulong da)
+static void *sandbox_testproc_device_to_virt(struct udevice *dev, ulong da,
+					     ulong size)
 {
 	u64 paddr;
 
drivers/remoteproc/stm32_copro.c +10 -2
index ad941f67e8..71895daf9c 100644
@@ -107,11 +107,13 @@ static int stm32_copro_set_hold_boot(struct udevice *dev, bool hold)
  * stm32_copro_device_to_virt() - Convert device address to virtual address
  * @dev:	corresponding STM32 remote processor device
  * @da:		device address
+ * @size:	Size of the memory region @da is pointing to
  * @return converted virtual address
  */
-static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da)
+static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da,
+					ulong size)
 {
-	fdt32_t in_addr = cpu_to_be32(da);
+	fdt32_t in_addr = cpu_to_be32(da), end_addr;
 	u64 paddr;
 
 	paddr = dev_translate_dma_address(dev, &in_addr);
@@ -120,6 +122,12 @@ static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da)
 		return NULL;
 	}
 
+	end_addr = cpu_to_be32(da + size - 1);
+	if (dev_translate_dma_address(dev, &end_addr) == OF_BAD_ADDR) {
+		dev_err(dev, "Unable to convert address %ld\n", da + size - 1);
+		return NULL;
+	}
+
 	return phys_to_virt(paddr);
 }
 
include/remoteproc.h +2 -1
index 4987194905..dbff1ce3cf 100644
@@ -122,9 +122,10 @@ struct dm_rproc_ops {
 	 *
 	 * @dev:	Remote proc device
 	 * @da:		Device address
+	 * @size:	Size of the memory region @da is pointing to
 	 * @return virtual address.
 	 */
-	void * (*device_to_virt)(struct udevice *dev, ulong da);
+	void * (*device_to_virt)(struct udevice *dev, ulong da, ulong size);
 };
 
 /* Accessor */
Signature · 1 line
2.22.0
#4 lore raw

PATCH v2 2/26 remoteproc: ops: Add elf section size as input parameter to device_to_virt api

Hi Lokesh

I have successfully tested this patch for stm32_copro.

BR

Fabien

Quoted 5 lines · Lokesh Vutla

Introduce a new parameter "size" that accepts size of the region to remoteproc ops callback device_to_virt(). This can enforce more checks on the region that device_to_virt() is dealing with.

Quoted 87 lines
---
  drivers/remoteproc/rproc-elf-loader.c |  3 ++-
  drivers/remoteproc/sandbox_testproc.c |  4 +++-
  drivers/remoteproc/stm32_copro.c      | 12 ++++++++++--
  include/remoteproc.h                  |  3 ++-
  4 files changed, 17 insertions(+), 5 deletions(-)
drivers/remoteproc/rproc-elf-loader.c +2 -1
index 67937a7595..7574ba3fb3 100644
@@ -86,7 +86,8 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
  			continue;
 
  		if (ops->device_to_virt)
-			dst = ops->device_to_virt(dev, (ulong)dst);
+			dst = ops->device_to_virt(dev, (ulong)dst,
+						  phdr->p_memsz);
 
  		dev_dbg(dev, "Loading phdr %i to 0x%p (%i bytes)\n",
  			i, dst, phdr->p_filesz);
drivers/remoteproc/sandbox_testproc.c +3 -1
index 5f35119ab7..eeee49c4dd 100644
@@ -306,9 +306,11 @@ static int sandbox_testproc_ping(struct udevice *dev)
   * sandbox_testproc_device_to_virt() - Convert device address to virtual address
   * @dev:	device to operate upon
   * @da:		device address
+ * @size:	Size of the memory region @da is pointing to
   * @return converted virtual address
   */
-static void *sandbox_testproc_device_to_virt(struct udevice *dev, ulong da)
+static void *sandbox_testproc_device_to_virt(struct udevice *dev, ulong da,
+					     ulong size)
  {
  	u64 paddr;
 
drivers/remoteproc/stm32_copro.c +10 -2
index ad941f67e8..71895daf9c 100644
@@ -107,11 +107,13 @@ static int stm32_copro_set_hold_boot(struct udevice *dev, bool hold)
   * stm32_copro_device_to_virt() - Convert device address to virtual address
   * @dev:	corresponding STM32 remote processor device
   * @da:		device address
+ * @size:	Size of the memory region @da is pointing to
   * @return converted virtual address
   */
-static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da)
+static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da,
+					ulong size)
  {
-	fdt32_t in_addr = cpu_to_be32(da);
+	fdt32_t in_addr = cpu_to_be32(da), end_addr;
  	u64 paddr;
 
  	paddr = dev_translate_dma_address(dev, &in_addr);
@@ -120,6 +122,12 @@ static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da)
  		return NULL;
  	}
 
+	end_addr = cpu_to_be32(da + size - 1);
+	if (dev_translate_dma_address(dev, &end_addr) == OF_BAD_ADDR) {
+		dev_err(dev, "Unable to convert address %ld\n", da + size - 1);
+		return NULL;
+	}
+
  	return phys_to_virt(paddr);
  }
 
include/remoteproc.h +2 -1
index 4987194905..dbff1ce3cf 100644
@@ -122,9 +122,10 @@ struct dm_rproc_ops {
  	 *
  	 * @dev:	Remote proc device
  	 * @da:		Device address
+	 * @size:	Size of the memory region @da is pointing to
  	 * @return virtual address.
  	 */
-	void * (*device_to_virt)(struct udevice *dev, ulong da);
+	void * (*device_to_virt)(struct udevice *dev, ulong da, ulong size);
  };
 
  /* Accessor */
#5 lore raw

PATCH v2 2/26 remoteproc: ops: Add elf section size as input parameter to device_to_virt api

In reply to Lokesh Vutla
Quoted 7 lines · Lokesh Vutla

Introduce a new parameter "size" that accepts size of the region to remoteproc ops callback device_to_virt(). This can enforce more checks on the region that device_to_virt() is dealing with.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/dbfd8f2a/attachment.sig>
#6 lore raw

PATCH v2 3/26 remoteproc: elf_loader: Always check the validity of the image before loading

In reply to Lokesh Vutla

rproc_elf32_load_image() rely on user to send a valid address for elf loading. Instead do a sanity check on the address passed by user. This will help all rproc elf users to not call sanity_check explicitly before calling elf_loading.

---
 drivers/remoteproc/rproc-elf-loader.c | 11 ++++++++---
 drivers/remoteproc/stm32_copro.c      |  9 +--------
 include/remoteproc.h                  |  6 ++++--
 test/dm/remoteproc.c                  |  5 +----
 4 files changed, 14 insertions(+), 17 deletions(-)
drivers/remoteproc/rproc-elf-loader.c +8 -3
index 7574ba3fb3..238f51d3b5 100644
@@ -64,13 +64,18 @@ int rproc_elf32_sanity_check(ulong addr, ulong size)
 	return 0;
 }
 
-/* A very simple elf loader, assumes the image is valid */
-int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
 {
 	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
 	Elf32_Phdr *phdr; /* Program header structure pointer */
 	const struct dm_rproc_ops *ops;
-	unsigned int i;
+	unsigned int i, ret;
+
+	ret =  rproc_elf32_sanity_check(addr, size);
+	if (ret) {
+		dev_err(dev, "Invalid ELF32 Image %d\n", ret);
+		return ret;
+	}
 
 	ehdr = (Elf32_Ehdr *)addr;
 	phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
drivers/remoteproc/stm32_copro.c +1 -8
index 71895daf9c..40bba37211 100644
@@ -155,14 +155,7 @@ static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
 		return ret;
 	}
 
-	/* Support only ELF32 image */
-	ret = rproc_elf32_sanity_check(addr, size);
-	if (ret) {
-		dev_err(dev, "Invalid ELF32 image (%d)\n", ret);
-		return ret;
-	}
-
-	return rproc_elf32_load_image(dev, addr);
+	return rproc_elf32_load_image(dev, addr, size);
 }
 
 /**
include/remoteproc.h +4 -2
index dbff1ce3cf..1ef88be7f7 100644
@@ -218,9 +218,10 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
  * rproc_elf32_load_image() - load an ELF32 image
  * @dev:	device loading the ELF32 image
  * @addr:	valid ELF32 image address
+ * @size:	size of the image
  * @return 0 if the image is successfully loaded, else appropriate error value.
  */
-int rproc_elf32_load_image(struct udevice *dev, unsigned long addr);
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -234,7 +235,8 @@ static inline int rproc_is_running(int id) { return -ENOSYS; }
 static inline int rproc_elf32_sanity_check(ulong addr,
 					   ulong size) { return -ENOSYS; }
 static inline int rproc_elf32_load_image(struct udevice *dev,
-					 unsigned long addr) { return -ENOSYS; }
+					 unsigned long addr, ulong size)
+{ return -ENOSYS; }
 #endif
 
 #endif	/* _RPROC_H_ */
test/dm/remoteproc.c +1 -4
index a2c4be7c27..c77361c8f4 100644
@@ -171,11 +171,8 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts)
 	ut_assertnonnull(loaded_firmware);
 	memset(loaded_firmware, 0, loaded_firmware_size);
 
-	/* Verify valid ELF format */
-	ut_assertok(rproc_elf32_sanity_check((ulong)valid_elf32, size));
-
 	/* Load firmware in loaded_firmware, and verify it */
-	ut_assertok(rproc_elf32_load_image(dev, (unsigned long)valid_elf32));
+	ut_assertok(rproc_elf32_load_image(dev, (ulong)valid_elf32, size));
 	ut_assertok(memcmp(loaded_firmware, valid_elf32, loaded_firmware_size));
 	unmap_physmem(loaded_firmware, MAP_NOCACHE);
 
Signature · 1 line
2.22.0
#7 lore raw

PATCH v2 3/26 remoteproc: elf_loader: Always check the validity of the image before loading

Hi Lokesh

Quoted 6 lines · Lokesh Vutla

rproc_elf32_load_image() rely on user to send a valid address for elf loading. Instead do a sanity check on the address passed by user. This will help all rproc elf users to not call sanity_check explicitly before calling elf_loading.

Quoted 96 lines
---
  drivers/remoteproc/rproc-elf-loader.c | 11 ++++++++---
  drivers/remoteproc/stm32_copro.c      |  9 +--------
  include/remoteproc.h                  |  6 ++++--
  test/dm/remoteproc.c                  |  5 +----
  4 files changed, 14 insertions(+), 17 deletions(-)
drivers/remoteproc/rproc-elf-loader.c +8 -3
index 7574ba3fb3..238f51d3b5 100644
@@ -64,13 +64,18 @@ int rproc_elf32_sanity_check(ulong addr, ulong size)
  	return 0;
  }
 
-/* A very simple elf loader, assumes the image is valid */
-int rproc_elf32_load_image(struct udevice *dev, unsigned long addr)
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
  {
  	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
  	Elf32_Phdr *phdr; /* Program header structure pointer */
  	const struct dm_rproc_ops *ops;
-	unsigned int i;
+	unsigned int i, ret;
+
+	ret =  rproc_elf32_sanity_check(addr, size);
+	if (ret) {
+		dev_err(dev, "Invalid ELF32 Image %d\n", ret);
+		return ret;
+	}
 
  	ehdr = (Elf32_Ehdr *)addr;
  	phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
drivers/remoteproc/stm32_copro.c +1 -8
index 71895daf9c..40bba37211 100644
@@ -155,14 +155,7 @@ static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
  		return ret;
  	}
 
-	/* Support only ELF32 image */
-	ret = rproc_elf32_sanity_check(addr, size);
-	if (ret) {
-		dev_err(dev, "Invalid ELF32 image (%d)\n", ret);
-		return ret;
-	}
-
-	return rproc_elf32_load_image(dev, addr);
+	return rproc_elf32_load_image(dev, addr, size);
  }
 
  /**
include/remoteproc.h +4 -2
index dbff1ce3cf..1ef88be7f7 100644
@@ -218,9 +218,10 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
   * rproc_elf32_load_image() - load an ELF32 image
   * @dev:	device loading the ELF32 image
   * @addr:	valid ELF32 image address
+ * @size:	size of the image
   * @return 0 if the image is successfully loaded, else appropriate error value.
   */
-int rproc_elf32_load_image(struct udevice *dev, unsigned long addr);
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
  #else
  static inline int rproc_init(void) { return -ENOSYS; }
  static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -234,7 +235,8 @@ static inline int rproc_is_running(int id) { return -ENOSYS; }
  static inline int rproc_elf32_sanity_check(ulong addr,
  					   ulong size) { return -ENOSYS; }
  static inline int rproc_elf32_load_image(struct udevice *dev,
-					 unsigned long addr) { return -ENOSYS; }
+					 unsigned long addr, ulong size)
+{ return -ENOSYS; }
  #endif
 
  #endif	/* _RPROC_H_ */
test/dm/remoteproc.c +1 -4
index a2c4be7c27..c77361c8f4 100644
@@ -171,11 +171,8 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts)
  	ut_assertnonnull(loaded_firmware);
  	memset(loaded_firmware, 0, loaded_firmware_size);
 
-	/* Verify valid ELF format */
-	ut_assertok(rproc_elf32_sanity_check((ulong)valid_elf32, size));
-
  	/* Load firmware in loaded_firmware, and verify it */
-	ut_assertok(rproc_elf32_load_image(dev, (unsigned long)valid_elf32));
+	ut_assertok(rproc_elf32_load_image(dev, (ulong)valid_elf32, size));
  	ut_assertok(memcmp(loaded_firmware, valid_elf32, loaded_firmware_size));
  	unmap_physmem(loaded_firmware, MAP_NOCACHE);
 
#8 lore raw

PATCH v2 3/26 remoteproc: elf_loader: Always check the validity of the image before loading

In reply to Lokesh Vutla
Quoted 7 lines · Lokesh Vutla

rproc_elf32_load_image() rely on user to send a valid address for elf loading. Instead do a sanity check on the address passed by user. This will help all rproc elf users to not call sanity_check explicitly before calling elf_loading.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/caa054d5/attachment.sig>
#9 lore raw

PATCH v2 4/26 remoteproc: elf-loader: Add 64 bit elf loading support

In reply to Lokesh Vutla

The current rproc-elf-loader supports loading of only 32 bit elf files. Introduce support for loading of 64 bit elf files in rproc-elf-loader.

---
 drivers/remoteproc/rproc-elf-loader.c | 110 ++++++++++++++++++++++++++
 include/remoteproc.h                  |  26 ++++++
 2 files changed, 136 insertions(+)
drivers/remoteproc/rproc-elf-loader.c +110 -0
index 238f51d3b5..1aece2fc31 100644
@@ -64,6 +64,62 @@ int rproc_elf32_sanity_check(ulong addr, ulong size)
 	return 0;
 }
 
+/* Basic function to verify ELF64 image format */
+int rproc_elf64_sanity_check(ulong addr, ulong size)
+{
+	Elf64_Ehdr *ehdr = (Elf64_Ehdr *)addr;
+	char class;
+
+	if (!addr) {
+		pr_debug("Invalid fw address?\n");
+		return -EFAULT;
+	}
+
+	if (size < sizeof(Elf64_Ehdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	class = ehdr->e_ident[EI_CLASS];
+
+	if (!IS_ELF(*ehdr) || ehdr->e_type != ET_EXEC || class != ELFCLASS64) {
+		pr_debug("Not an executable ELF64 image\n");
+		return -EPROTONOSUPPORT;
+	}
+
+	/* We assume the firmware has the same endianness as the host */
+# ifdef __LITTLE_ENDIAN
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+# else /* BIG ENDIAN */
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) {
+# endif
+		pr_debug("Unsupported firmware endianness\n");
+		return -EILSEQ;
+	}
+
+	if (size < ehdr->e_shoff + sizeof(Elf64_Shdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
+		pr_debug("Image is corrupted (bad magic)\n");
+		return -EBADF;
+	}
+
+	if (ehdr->e_phnum == 0) {
+		pr_debug("No loadable segments\n");
+		return -ENOEXEC;
+	}
+
+	if (ehdr->e_phoff > size) {
+		pr_debug("Firmware size is too small\n");
+		return -ENOSPC;
+	}
+
+	return 0;
+}
+
 int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
 {
 	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
@@ -110,3 +166,57 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
 
 	return 0;
 }
+
+int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size)
+{
+	const struct dm_rproc_ops *ops = rproc_get_ops(dev);
+	u64 da, memsz, filesz, offset;
+	Elf64_Ehdr *ehdr;
+	Elf64_Phdr *phdr;
+	int i, ret = 0;
+	void *ptr;
+
+	dev_dbg(dev, "%s: addr = 0x%lx size = 0x%lx\n", __func__, addr, size);
+
+	if (rproc_elf64_sanity_check(addr, size))
+		return -EINVAL;
+
+	ehdr = (Elf64_Ehdr *)addr;
+	phdr = (Elf64_Phdr *)(addr + (ulong)ehdr->e_phoff);
+
+	/* go through the available ELF segments */
+	for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
+		da = phdr->p_paddr;
+		memsz = phdr->p_memsz;
+		filesz = phdr->p_filesz;
+		offset = phdr->p_offset;
+
+		if (phdr->p_type != PT_LOAD)
+			continue;
+
+		dev_dbg(dev, "%s:phdr: type %d da 0x%llx memsz 0x%llx filesz 0x%llx\n",
+			__func__, phdr->p_type, da, memsz, filesz);
+
+		ptr = (void *)(uintptr_t)da;
+		if (ops->device_to_virt) {
+			ptr = ops->device_to_virt(dev, da, phdr->p_memsz);
+			if (!ptr) {
+				dev_err(dev, "bad da 0x%llx mem 0x%llx\n", da,
+					memsz);
+				ret = -EINVAL;
+				break;
+			}
+		}
+
+		if (filesz)
+			memcpy(ptr, (void *)addr + offset, filesz);
+		if (filesz != memsz)
+			memset(ptr + filesz, 0x00, memsz - filesz);
+
+		flush_cache(rounddown((ulong)ptr, ARCH_DMA_MINALIGN),
+			    roundup((ulong)ptr + filesz, ARCH_DMA_MINALIGN) -
+			    rounddown((ulong)ptr, ARCH_DMA_MINALIGN));
+	}
+
+	return ret;
+}
include/remoteproc.h +26 -0
index 1ef88be7f7..56a11db6e3 100644
@@ -214,6 +214,18 @@ int rproc_is_running(int id);
  */
 int rproc_elf32_sanity_check(ulong addr, ulong size);
 
+/**
+ * rproc_elf64_sanity_check() - Verify if an image is a valid ELF32 one
+ *
+ * Check if a valid ELF64 image exists at the given memory location. Verify
+ * basic ELF64 format requirements like magic number and sections size.
+ *
+ * @addr:	address of the image to verify
+ * @size:	size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf64_sanity_check(ulong addr, ulong size);
+
 /**
  * rproc_elf32_load_image() - load an ELF32 image
  * @dev:	device loading the ELF32 image
@@ -222,6 +234,15 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
  * @return 0 if the image is successfully loaded, else appropriate error value.
  */
 int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
+
+/**
+ * rproc_elf64_load_image() - load an ELF64 image
+ * @dev:	device loading the ELF64 image
+ * @addr:	valid ELF64 image address
+ * @size:	size of the image
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -234,9 +255,14 @@ static inline int rproc_ping(int id) { return -ENOSYS; }
 static inline int rproc_is_running(int id) { return -ENOSYS; }
 static inline int rproc_elf32_sanity_check(ulong addr,
 					   ulong size) { return -ENOSYS; }
+static inline int rproc_elf64_sanity_check(ulong addr,
+					   ulong size) { return -ENOSYS; }
 static inline int rproc_elf32_load_image(struct udevice *dev,
 					 unsigned long addr, ulong size)
 { return -ENOSYS; }
+static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
+					 ulong size)
+{ return -ENOSYS; }
 #endif
 
 #endif	/* _RPROC_H_ */
Signature · 1 line
2.22.0
#10 lore raw

PATCH v2 4/26 remoteproc: elf-loader: Add 64 bit elf loading support

Hi Lokesh

Thank you for the patch.

BR

Fabien

Quoted 4 lines · Lokesh Vutla

The current rproc-elf-loader supports loading of only 32 bit elf files. Introduce support for loading of 64 bit elf files in rproc-elf-loader.

Quoted 184 lines
---
  drivers/remoteproc/rproc-elf-loader.c | 110 ++++++++++++++++++++++++++
  include/remoteproc.h                  |  26 ++++++
  2 files changed, 136 insertions(+)
drivers/remoteproc/rproc-elf-loader.c +110 -0
index 238f51d3b5..1aece2fc31 100644
@@ -64,6 +64,62 @@ int rproc_elf32_sanity_check(ulong addr, ulong size)
  	return 0;
  }
 
+/* Basic function to verify ELF64 image format */
+int rproc_elf64_sanity_check(ulong addr, ulong size)
+{
+	Elf64_Ehdr *ehdr = (Elf64_Ehdr *)addr;
+	char class;
+
+	if (!addr) {
+		pr_debug("Invalid fw address?\n");
+		return -EFAULT;
+	}
+
+	if (size < sizeof(Elf64_Ehdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	class = ehdr->e_ident[EI_CLASS];
+
+	if (!IS_ELF(*ehdr) || ehdr->e_type != ET_EXEC || class != ELFCLASS64) {
+		pr_debug("Not an executable ELF64 image\n");
+		return -EPROTONOSUPPORT;
+	}
+
+	/* We assume the firmware has the same endianness as the host */
+# ifdef __LITTLE_ENDIAN
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+# else /* BIG ENDIAN */
+	if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) {
+# endif
+		pr_debug("Unsupported firmware endianness\n");
+		return -EILSEQ;
+	}
+
+	if (size < ehdr->e_shoff + sizeof(Elf64_Shdr)) {
+		pr_debug("Image is too small\n");
+		return -ENOSPC;
+	}
+
+	if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
+		pr_debug("Image is corrupted (bad magic)\n");
+		return -EBADF;
+	}
+
+	if (ehdr->e_phnum == 0) {
+		pr_debug("No loadable segments\n");
+		return -ENOEXEC;
+	}
+
+	if (ehdr->e_phoff > size) {
+		pr_debug("Firmware size is too small\n");
+		return -ENOSPC;
+	}
+
+	return 0;
+}
+
  int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
  {
  	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
@@ -110,3 +166,57 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
 
  	return 0;
  }
+
+int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size)
+{
+	const struct dm_rproc_ops *ops = rproc_get_ops(dev);
+	u64 da, memsz, filesz, offset;
+	Elf64_Ehdr *ehdr;
+	Elf64_Phdr *phdr;
+	int i, ret = 0;
+	void *ptr;
+
+	dev_dbg(dev, "%s: addr = 0x%lx size = 0x%lx\n", __func__, addr, size);
+
+	if (rproc_elf64_sanity_check(addr, size))
+		return -EINVAL;
+
+	ehdr = (Elf64_Ehdr *)addr;
+	phdr = (Elf64_Phdr *)(addr + (ulong)ehdr->e_phoff);
+
+	/* go through the available ELF segments */
+	for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
+		da = phdr->p_paddr;
+		memsz = phdr->p_memsz;
+		filesz = phdr->p_filesz;
+		offset = phdr->p_offset;
+
+		if (phdr->p_type != PT_LOAD)
+			continue;
+
+		dev_dbg(dev, "%s:phdr: type %d da 0x%llx memsz 0x%llx filesz 0x%llx\n",
+			__func__, phdr->p_type, da, memsz, filesz);
+
+		ptr = (void *)(uintptr_t)da;
+		if (ops->device_to_virt) {
+			ptr = ops->device_to_virt(dev, da, phdr->p_memsz);
+			if (!ptr) {
+				dev_err(dev, "bad da 0x%llx mem 0x%llx\n", da,
+					memsz);
+				ret = -EINVAL;
+				break;
+			}
+		}
+
+		if (filesz)
+			memcpy(ptr, (void *)addr + offset, filesz);
+		if (filesz != memsz)
+			memset(ptr + filesz, 0x00, memsz - filesz);
+
+		flush_cache(rounddown((ulong)ptr, ARCH_DMA_MINALIGN),
+			    roundup((ulong)ptr + filesz, ARCH_DMA_MINALIGN) -
+			    rounddown((ulong)ptr, ARCH_DMA_MINALIGN));
+	}
+
+	return ret;
+}
include/remoteproc.h +26 -0
index 1ef88be7f7..56a11db6e3 100644
@@ -214,6 +214,18 @@ int rproc_is_running(int id);
   */
  int rproc_elf32_sanity_check(ulong addr, ulong size);
 
+/**
+ * rproc_elf64_sanity_check() - Verify if an image is a valid ELF32 one
+ *
+ * Check if a valid ELF64 image exists at the given memory location. Verify
+ * basic ELF64 format requirements like magic number and sections size.
+ *
+ * @addr:	address of the image to verify
+ * @size:	size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf64_sanity_check(ulong addr, ulong size);
+
  /**
   * rproc_elf32_load_image() - load an ELF32 image
   * @dev:	device loading the ELF32 image
@@ -222,6 +234,15 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
   * @return 0 if the image is successfully loaded, else appropriate error value.
   */
  int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
+
+/**
+ * rproc_elf64_load_image() - load an ELF64 image
+ * @dev:	device loading the ELF64 image
+ * @addr:	valid ELF64 image address
+ * @size:	size of the image
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
  #else
  static inline int rproc_init(void) { return -ENOSYS; }
  static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -234,9 +255,14 @@ static inline int rproc_ping(int id) { return -ENOSYS; }
  static inline int rproc_is_running(int id) { return -ENOSYS; }
  static inline int rproc_elf32_sanity_check(ulong addr,
  					   ulong size) { return -ENOSYS; }
+static inline int rproc_elf64_sanity_check(ulong addr,
+					   ulong size) { return -ENOSYS; }
  static inline int rproc_elf32_load_image(struct udevice *dev,
  					 unsigned long addr, ulong size)
  { return -ENOSYS; }
+static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
+					 ulong size)
+{ return -ENOSYS; }
  #endif
 
  #endif	/* _RPROC_H_ */
#11 lore raw

PATCH v2 4/26 remoteproc: elf-loader: Add 64 bit elf loading support

In reply to Lokesh Vutla
Quoted 5 lines · Lokesh Vutla

The current rproc-elf-loader supports loading of only 32 bit elf files. Introduce support for loading of 64 bit elf files in rproc-elf-loader.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/1a6a61d7/attachment.sig>
#12 lore raw

PATCH v2 5/26 remoteproc: elf_loader: Introduce a common elf loader and checker functions

In reply to Lokesh Vutla

Introduce a common remoteproc elf loader and checker functions that automatically detects the 64 bit elf file or 32 bit elf file and loads/checks the sections accordingly.

---
 drivers/remoteproc/rproc-elf-loader.c | 31 +++++++++++++++++++++++++++
 include/remoteproc.h                  | 29 +++++++++++++++++++++++++
 2 files changed, 60 insertions(+)
drivers/remoteproc/rproc-elf-loader.c +31 -0
index 1aece2fc31..42a78f4207 100644
@@ -120,6 +120,22 @@ int rproc_elf64_sanity_check(ulong addr, ulong size)
 	return 0;
 }
 
+/* Basic function to verify ELF image format */
+int rproc_elf_sanity_check(ulong addr, ulong size)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	if (!addr) {
+		dev_err(dev, "Invalid firmware address\n");
+		return -EFAULT;
+	}
+
+	if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+		return rproc_elf64_sanity_check(addr, size);
+	else
+		return rproc_elf32_sanity_check(addr, size);
+}
+
 int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
 {
 	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
@@ -220,3 +236,18 @@ int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size)
 
 	return ret;
 }
+
+int rproc_elf_load_image(struct udevice *dev, ulong addr, ulong size)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	if (!addr) {
+		dev_err(dev, "Invalid firmware address\n");
+		return -EFAULT;
+	}
+
+	if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+		return rproc_elf64_load_image(dev, addr, size);
+	else
+		return rproc_elf32_load_image(dev, addr, size);
+}
include/remoteproc.h +29 -0
index 56a11db6e3..812e0f47c4 100644
@@ -226,6 +226,19 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
  */
 int rproc_elf64_sanity_check(ulong addr, ulong size);
 
+/**
+ * rproc_elf_sanity_check() - Verify if an image is a valid ELF one
+ *
+ * Check if a valid ELF image exists at the given memory location. Auto
+ * detects ELF32/ELF64 and verifies basic ELF64/ELF32 format requirements
+ * like magic number and sections size.
+ *
+ * @addr:	address of the image to verify
+ * @size:	size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf_sanity_check(ulong addr, ulong size);
+
 /**
  * rproc_elf32_load_image() - load an ELF32 image
  * @dev:	device loading the ELF32 image
@@ -243,6 +256,17 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
  * @return 0 if the image is successfully loaded, else appropriate error value.
  */
 int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
+
+/**
+ * rproc_elf_load_image() - load an ELF image
+ * @dev:	device loading the ELF image
+ * @addr:	valid ELF image address
+ * @size:	size of the image
+ *
+ * Auto detects if the image is ELF32 or ELF64 image and load accordingly.
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -257,12 +281,17 @@ static inline int rproc_elf32_sanity_check(ulong addr,
 					   ulong size) { return -ENOSYS; }
 static inline int rproc_elf64_sanity_check(ulong addr,
 					   ulong size) { return -ENOSYS; }
+static inline int rproc_elf_sanity_check(ulong addr,
+					 ulong size) { return -ENOSYS; }
 static inline int rproc_elf32_load_image(struct udevice *dev,
 					 unsigned long addr, ulong size)
 { return -ENOSYS; }
 static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
 					 ulong size)
 { return -ENOSYS; }
+static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
+				       ulong size)
+{ return -ENOSYS; }
 #endif
 
 #endif	/* _RPROC_H_ */
Signature · 1 line
2.22.0
#13 lore raw

PATCH v2 5/26 remoteproc: elf_loader: Introduce a common elf loader and checker functions

Hi Lokesh

Quoted 5 lines · Lokesh Vutla

Introduce a common remoteproc elf loader and checker functions that automatically detects the 64 bit elf file or 32 bit elf file and loads/checks the sections accordingly.

Quoted 111 lines
---
  drivers/remoteproc/rproc-elf-loader.c | 31 +++++++++++++++++++++++++++
  include/remoteproc.h                  | 29 +++++++++++++++++++++++++
  2 files changed, 60 insertions(+)
drivers/remoteproc/rproc-elf-loader.c +31 -0
index 1aece2fc31..42a78f4207 100644
@@ -120,6 +120,22 @@ int rproc_elf64_sanity_check(ulong addr, ulong size)
  	return 0;
  }
 
+/* Basic function to verify ELF image format */
+int rproc_elf_sanity_check(ulong addr, ulong size)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	if (!addr) {
+		dev_err(dev, "Invalid firmware address\n");
+		return -EFAULT;
+	}
+
+	if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+		return rproc_elf64_sanity_check(addr, size);
+	else
+		return rproc_elf32_sanity_check(addr, size);
+}
+
  int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size)
  {
  	Elf32_Ehdr *ehdr; /* Elf header structure pointer */
@@ -220,3 +236,18 @@ int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size)
 
  	return ret;
  }
+
+int rproc_elf_load_image(struct udevice *dev, ulong addr, ulong size)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	if (!addr) {
+		dev_err(dev, "Invalid firmware address\n");
+		return -EFAULT;
+	}
+
+	if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+		return rproc_elf64_load_image(dev, addr, size);
+	else
+		return rproc_elf32_load_image(dev, addr, size);
+}
include/remoteproc.h +29 -0
index 56a11db6e3..812e0f47c4 100644
@@ -226,6 +226,19 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
   */
  int rproc_elf64_sanity_check(ulong addr, ulong size);
 
+/**
+ * rproc_elf_sanity_check() - Verify if an image is a valid ELF one
+ *
+ * Check if a valid ELF image exists at the given memory location. Auto
+ * detects ELF32/ELF64 and verifies basic ELF64/ELF32 format requirements
+ * like magic number and sections size.
+ *
+ * @addr:	address of the image to verify
+ * @size:	size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf_sanity_check(ulong addr, ulong size);
+
  /**
   * rproc_elf32_load_image() - load an ELF32 image
   * @dev:	device loading the ELF32 image
@@ -243,6 +256,17 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
   * @return 0 if the image is successfully loaded, else appropriate error value.
   */
  int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
+
+/**
+ * rproc_elf_load_image() - load an ELF image
+ * @dev:	device loading the ELF image
+ * @addr:	valid ELF image address
+ * @size:	size of the image
+ *
+ * Auto detects if the image is ELF32 or ELF64 image and load accordingly.
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
  #else
  static inline int rproc_init(void) { return -ENOSYS; }
  static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -257,12 +281,17 @@ static inline int rproc_elf32_sanity_check(ulong addr,
  					   ulong size) { return -ENOSYS; }
  static inline int rproc_elf64_sanity_check(ulong addr,
  					   ulong size) { return -ENOSYS; }
+static inline int rproc_elf_sanity_check(ulong addr,
+					 ulong size) { return -ENOSYS; }
  static inline int rproc_elf32_load_image(struct udevice *dev,
  					 unsigned long addr, ulong size)
  { return -ENOSYS; }
  static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
  					 ulong size)
  { return -ENOSYS; }
+static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
+				       ulong size)
+{ return -ENOSYS; }
  #endif
 
  #endif	/* _RPROC_H_ */
#14 lore raw

PATCH v2 5/26 remoteproc: elf_loader: Introduce a common elf loader and checker functions

In reply to Lokesh Vutla
Quoted 6 lines · Lokesh Vutla

Introduce a common remoteproc elf loader and checker functions that automatically detects the 64 bit elf file or 32 bit elf file and loads/checks the sections accordingly.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/cca902ac/attachment.sig>
#15 lore raw

PATCH v2 6/26 remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() api

In reply to Lokesh Vutla

Introduce rproc_elf_get_boot_addr() that returns the entry point of the elf file. This api auto detects the 64/32 bit elf file and returns the boot addr accordingly.

---
 drivers/remoteproc/rproc-elf-loader.c | 24 ++++++++++++++++++++++++
 include/remoteproc.h                  | 12 ++++++++++++
 test/dm/remoteproc.c                  |  2 ++
 3 files changed, 38 insertions(+)
drivers/remoteproc/rproc-elf-loader.c +24 -0
index 42a78f4207..b38a226065 100644
@@ -251,3 +251,27 @@ int rproc_elf_load_image(struct udevice *dev, ulong addr, ulong size)
 	else
 		return rproc_elf32_load_image(dev, addr, size);
 }
+
+static ulong rproc_elf32_get_boot_addr(ulong addr)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	return ehdr->e_entry;
+}
+
+static ulong rproc_elf64_get_boot_addr(ulong addr)
+{
+	Elf64_Ehdr *ehdr = (Elf64_Ehdr *)addr;
+
+	return ehdr->e_entry;
+}
+
+ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr)
+{
+	Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
+
+	if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
+		return rproc_elf64_get_boot_addr(addr);
+	else
+		return rproc_elf32_get_boot_addr(addr);
+}
include/remoteproc.h +12 -0
index 812e0f47c4..046cd9e54e 100644
@@ -267,6 +267,16 @@ int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
  * @return 0 if the image is successfully loaded, else appropriate error value.
  */
 int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
+
+/**
+ * rproc_elf_get_boot_addr() - Get rproc's boot address.
+ * @dev:	device loading the ELF image
+ * @addr:	valid ELF image address
+ *
+ * This function returns the entry point address of the ELF
+ * image.
+ */
+ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -292,6 +302,8 @@ static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
 static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
 				       ulong size)
 { return -ENOSYS; }
+static inline ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr)
+{ return 0; }
 #endif
 
 #endif	/* _RPROC_H_ */
test/dm/remoteproc.c +2 -0
index c77361c8f4..1d9a9b32d5 100644
@@ -174,6 +174,8 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts)
 	/* Load firmware in loaded_firmware, and verify it */
 	ut_assertok(rproc_elf32_load_image(dev, (ulong)valid_elf32, size));
 	ut_assertok(memcmp(loaded_firmware, valid_elf32, loaded_firmware_size));
+	ut_asserteq(rproc_elf_get_boot_addr(dev, (unsigned long)valid_elf32),
+		    0x08000000);
 	unmap_physmem(loaded_firmware, MAP_NOCACHE);
 
 	/* Invalid ELF Magic */
Signature · 1 line
2.22.0
#16 lore raw

PATCH v2 6/26 remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() api

Quoted 5 lines · Lokesh Vutla

Introduce rproc_elf_get_boot_addr() that returns the entry point of the elf file. This api auto detects the 64/32 bit elf file and returns the boot addr accordingly.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/a893a9c3/attachment.sig>
#17 lore raw

PATCH v2 7/26 remoteproc: tisci_proc: Add helper api for controlling core power domain

In reply to Lokesh Vutla

Power domain for the remote cores needs to be handled in a right sequence as mandated by the spec. Introduce tisci helper apis that can control power-domains of remote cores. TISCI clients can use this api and control the remote cores power domain instead of hooking it to power-domain layer.

---
 drivers/remoteproc/ti_sci_proc.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/remoteproc/ti_sci_proc.h +27 -0
index ccfc39ec88..f8299d1aff 100644
@@ -19,12 +19,14 @@
  * @proc_id: processor id for the consumer remoteproc device
  * @host_id: host id to pass the control over for this consumer remoteproc
  *	     device
+ * @dev_id: Device ID as identified by system controller.
  */
 struct ti_sci_proc {
 	const struct ti_sci_handle *sci;
 	const struct ti_sci_proc_ops *ops;
 	u8 proc_id;
 	u8 host_id;
+	u16 dev_id;
 };
 
 static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
@@ -118,4 +120,29 @@ static inline int ti_sci_proc_set_control(struct ti_sci_proc *tsp,
 	return ret;
 }
 
+static inline int ti_sci_proc_power_domain_on(struct ti_sci_proc *tsp)
+{
+	int ret;
+
+	debug("%s: dev_id = %d\n", __func__, tsp->dev_id);
+
+	ret = tsp->sci->ops.dev_ops.get_device_exclusive(tsp->sci, tsp->dev_id);
+	if (ret)
+		pr_err("Power-domain on failed for dev = %d\n", tsp->dev_id);
+
+	return ret;
+}
+
+static inline int ti_sci_proc_power_domain_off(struct ti_sci_proc *tsp)
+{
+	int ret;
+
+	debug("%s: dev_id = %d\n", __func__, tsp->dev_id);
+
+	ret = tsp->sci->ops.dev_ops.put_device(tsp->sci, tsp->dev_id);
+	if (ret)
+		pr_err("Power-domain off failed for dev = %d\n", tsp->dev_id);
+
+	return ret;
+}
 #endif /* REMOTEPROC_TI_SCI_PROC_H */
Signature · 1 line
2.22.0
#18 lore raw

PATCH v2 7/26 remoteproc: tisci_proc: Add helper api for controlling core power domain

Quoted 7 lines · Lokesh Vutla

Power domain for the remote cores needs to be handled in a right sequence as mandated by the spec. Introduce tisci helper apis that can control power-domains of remote cores. TISCI clients can use this api and control the remote cores power domain instead of hooking it to power-domain layer.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/21be49aa/attachment.sig>
#19 lore raw

PATCH v2 8/26 dt-bindings: remoteproc: Add bindings for R5F subsystem on TI K3 SoCs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

The Texas Instruments K3 family of SoCs have one of more dual-core Arm Cortex R5F processor subsystems/clusters (R5FSS). Add the device tree bindings document for these R5F subsystem devices. These R5F processors do not have an MMU, and so require fixed memory carveout regions matching the firmware image addresses. The nodes require more than one memory region, with the first memory region used for DMA allocations at runtime. The remaining memory regions are reserved and are used for the loading and running of the R5F remote processors.

The added example illustrates the DT nodes for the single R5FSS device present on K3 AM65x family of SoCs.

---
 .../remoteproc/ti,k3-r5f-rproc.txt            | 164 ++++++++++++++++++
 1 file changed, 164 insertions(+)
 create mode 100644 doc/device-tree-bindings/remoteproc/ti,k3-r5f-rproc.txt
doc/device-tree-bindings/remoteproc/ti,k3-r5f-rproc.txt new file +164 -0
new file mode 100644
index 0000000000..c2fa6e8344
@@ -0,0 +1,164 @@
+TI K3 R5F processor subsystems
+==============================
+
+The TI K3 family of SoCs usually have one or more dual-core Arm Cortex
+R5F processor subsystems/clusters (R5FSS). The dual core cluster can be
+used either in a LockStep mode providing safety/fault tolerance features
+or in a Split mode providing two individual compute cores for doubling
+the compute capacity. These are used together with other processors
+present on the SoC to achieve various system level goals.
+
+R5F Sub-System Device Node:
+===========================
+Each Dual-Core R5F sub-system is represented as a single DTS node representing
+the cluster, with a pair of child DT nodes representing the individual R5F
+cores. Each node has a number of required or optional properties that enable
+the OS running on the host processor to perform the device management of the
+remote processor and to communicate with the remote processor.
+
+Required properties:
+--------------------
+The following are the mandatory properties:
+
+- compatible:		Should be one of the following,
+			    "ti,am654-r5fss" for R5F clusters/subsystems on
+			                       K3 AM65x SoCs
+			    "ti,j721e-r5fss" for R5F clusters/subsystems on
+			                       K3 J721E SoCs
+- power-domains:	Should contain a phandle to a PM domain provider node
+			and an args specifier containing the R5FSS device id
+			value. This property is as per the binding,
+			Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
+- #address-cells:	Should be 1
+- #size-cells:		Should be 1
+- ranges:		Standard ranges definition providing translations for
+			R5F TCM address spaces
+
+Optional properties:
+--------------------
+- lockstep-mode:	Configuration Mode for the Dual R5F cores within the R5F
+			cluster. Should be either a value of 1 (LockStep mode) or
+			0 (Split mode), default is LockStep mode if omitted.
+
+
+R5F Processor Child Nodes:
+==========================
+The R5F Sub-System device node should define two R5F child nodes, each node
+representing a TI instantiation of the Arm Cortex R5F core. There are some
+specific integration differences for the IP like the usage of a Region Address
+Translator (RAT) for translating the larger SoC bus addresses into a 32-bit
+address space for the processor.
+
+Required properties:
+--------------------
+The following are the mandatory properties:
+
+- compatible:		Should be one of the following,
+			    "ti,am654-r5f" for the R5F cores in K3 AM65x SoCs
+			    "ti,j721e-r5f" for the R5F cores in K3 J721E SOCs
+- reg:			Should contain an entry for each value in 'reg-names'.
+			Each entry should have the memory region's start address
+			and the size of the region, the representation matching
+			the parent node's '#address-cells' and '#size-cells' values.
+- reg-names:		Should contain strings with the following names, each
+			representing a specific internal memory region, and
+			should be defined in this order,
+			     "atcm", "btcm"
+- ti,sci:		Should be a phandle to the TI-SCI System Controller node
+- ti,sci-dev-id:	Should contain the TI-SCI device id corresponding to the
+			R5F Core. Please refer to the corresponding System
+			Controller documentation for valid values for the R5F
+			cores.
+- ti,sci-proc-ids:	Should contain 2 integer values. The first cell should
+			contain the TI-SCI processor id for the R5F core device
+			and the second cell should contain the TI-SCI host id to
+			which the processor control ownership should be
+			transferred to.
+- resets:		Should contain the phandle to the reset controller node
+			managing the resets for this device, and a reset
+			specifier. Please refer to the following reset bindings
+			for the reset argument specifier,
+			Documentation/devicetree/bindings/reset/ti,sci-reset.txt
+			    for AM65x and J721E SoCs
+
+Optional properties:
+--------------------
+The following properties are optional properties for each of the R5F cores:
+
+- atcm-enable:		R5F core configuration mode dictating if ATCM should be
+			enabled. Should be either a value of 1 (enabled) or
+			0 (disabled), default is disabled if omitted. R5F view
+			of ATCM dictated by loczrama property.
+- btcm-enable:		R5F core configuration mode dictating if BTCM should be
+			enabled. Should be either a value of 1 (enabled) or
+			0 (disabled), default is enabled if omitted. R5F view
+			of BTCM dictated by loczrama property.
+- loczrama:		R5F core configuration mode dictating which TCM should
+			appear at address 0 (from core's view). Should be either
+			a value of 1 (ATCM at 0x0) or 0 (BTCM at 0x0), default
+			value is 1 if omitted.
+
+Example:
+--------
+1. AM654 SoC
+	/* AM65x remoteproc alias */
+	aliases {
+		remoteproc0 = &mcu_r5fss0_core0;
+	};
+
+	cbass_main: interconnect at 100000 {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges = <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>,
+			 <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>,
+			 <0x00 0x41c00000 0x00 0x41c00000 0x00 0x00080000>;
+
+		cbass_mcu: interconnect at 28380000 {
+			compatible = "simple-bus";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x00 0x41000000 0x00 0x41000000 0x00 0x00020000>, /* MCU R5F Core0 */
+				 <0x00 0x41400000 0x00 0x41400000 0x00 0x00020000>, /* MCU R5F Core1 */
+				 <0x00 0x41c00000 0x00 0x41c00000 0x00 0x00080000>; /* MCU SRAM */
+
+			/* AM65x MCU R5FSS node */
+			mcu_r5fss0: r5fss at 41000000 {
+				compatible = "ti,am654-r5fss";
+				power-domains = <&k3_pds 129>;
+				lockstep-mode = <1>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0x41000000 0x00 0x41000000 0x20000>,
+					 <0x41400000 0x00 0x41400000 0x20000>;
+
+				mcu_r5f0: r5f at 41000000 {
+					compatible = "ti,am654-r5f";
+					reg = <0x41000000 0x00008000>,
+					      <0x41010000 0x00008000>;
+					reg-names = "atcm", "btcm";
+					ti,sci = <&dmsc>;
+					ti,sci-dev-id = <159>;
+					ti,sci-proc-ids = <0x01 0xFF>;
+					resets = <&k3_reset 159 1>;
+					atcm-enable = <1>;
+					btcm-enable = <1>;
+					loczrama = <1>;
+				};
+
+				mcu_r5f1: r5f at 41400000 {
+					compatible = "ti,am654-r5f";
+					reg = <0x41400000 0x00008000>,
+					      <0x41410000 0x00008000>;
+					reg-names = "atcm", "btcm";
+					ti,sci = <&dmsc>;
+					ti,sci-dev-id = <245>;
+					ti,sci-proc-ids = <0x02 0xFF>;
+					resets = <&k3_reset 245 1>;
+					atcm-enable = <1>;
+					btcm-enable = <1>;
+					loczrama = <1>;
+				};
+			};
+		};
+	};
Signature · 1 line
2.22.0
#20 lore raw

PATCH v2 8/26 dt-bindings: remoteproc: Add bindings for R5F subsystem on TI K3 SoCs

Quoted 11 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

The Texas Instruments K3 family of SoCs have one of more dual-core Arm Cortex R5F processor subsystems/clusters (R5FSS). Add the device tree bindings document for these R5F subsystem devices. These R5F processors do not have an MMU, and so require fixed memory carveout regions matching the firmware image addresses. The nodes require more than one memory region, with the first memory region used for DMA allocations at runtime. The remaining memory regions are reserved and are used for the loading and running of the R5F remote processors.

Quoted 5 lines

The added example illustrates the DT nodes for the single R5FSS device present on K3 AM65x family of SoCs.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/84504be0/attachment.sig>
#21 lore raw

PATCH v2 9/26 remoteproc: Introduce K3 remoteproc driver for R5F subsystem

In reply to Lokesh Vutla

SoCs with K3 architecture have an integrated Arm Cortex-R5F subsystem that is comprised of dual-core Arm Cortex-R5F processor cores. This R5 subsytem can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. This subsystem has each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - TCMA and TCMB.

Add a remoteproc driver to support this subsystem to be able to load and boot the R5 cores primarily in LockStep mode or split mode.

---
 drivers/remoteproc/Kconfig           |  10 +
 drivers/remoteproc/Makefile          |   1 +
 drivers/remoteproc/ti_k3_r5f_rproc.c | 816 +++++++++++++++++++++++++++
 3 files changed, 827 insertions(+)
 create mode 100644 drivers/remoteproc/ti_k3_r5f_rproc.c
drivers/remoteproc/Kconfig +10 -0
index f54a245424..c2d59ba000 100644
@@ -52,6 +52,16 @@ config REMOTEPROC_TI_K3_ARM64
 	  on various TI K3 family of SoCs through the remote processor
 	  framework.
 
+config REMOTEPROC_TI_K3_R5F
+	bool "TI K3 R5F remoteproc support"
+	select REMOTEPROC
+	depends on ARCH_K3
+	depends on TI_SCI_PROTOCOL
+	help
+	  Say y here to support TI's R5F remote processor subsystems
+	  on various TI K3 family of SoCs through the remote processor
+	  framework.
+
 config REMOTEPROC_TI_POWER
 	bool "Support for TI Power processor"
 	select REMOTEPROC
drivers/remoteproc/Makefile +1 -0
index 271ba55b09..9d247ba5e7 100644
@@ -11,4 +11,5 @@ obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o
 obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o
 obj-$(CONFIG_REMOTEPROC_STM32_COPRO) += stm32_copro.o
 obj-$(CONFIG_REMOTEPROC_TI_K3_ARM64) += ti_k3_arm64_rproc.o
+obj-$(CONFIG_REMOTEPROC_TI_K3_R5F) += ti_k3_r5f_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_POWER) += ti_power_proc.o
drivers/remoteproc/ti_k3_r5f_rproc.c new file +816 -0

816 lines not on this page · raw message

Signature · 1 line
2.22.0
#22 lore raw

PATCH v2 9/26 remoteproc: Introduce K3 remoteproc driver for R5F subsystem

Quoted 7 lines · Lokesh Vutla

SoCs with K3 architecture have an integrated Arm Cortex-R5F subsystem that is comprised of dual-core Arm Cortex-R5F processor cores. This R5 subsytem can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. This subsystem has each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - TCMA and TCMB.

Quoted 5 lines

Add a remoteproc driver to support this subsystem to be able to load and boot the R5 cores primarily in LockStep mode or split mode.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/460cb0ef/attachment.sig>
#23 lore raw

PATCH v2 10/26 dt-bindings: remoteproc: Add bindings for DSP C66x clusters on TI K3 SoCs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

Some Texas Instruments K3 family of SoCs have one of more Digital Signal Processor (DSP) subsystems that are comprised of either a TMS320C66x CorePac and/or a next-generation TMS320C71x CorePac processor subsystem. Add the device tree bindings document for the C66x DSP devices on these SoCs. The added example illustrates the DT nodes for the first C66x DSP device present on the K3 J721E family of SoCs.

---
 .../remoteproc/ti,k3-dsp-rproc.txt            | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 doc/device-tree-bindings/remoteproc/ti,k3-dsp-rproc.txt
doc/device-tree-bindings/remoteproc/ti,k3-dsp-rproc.txt new file +101 -0
new file mode 100644
index 0000000000..80ab7a4090
@@ -0,0 +1,101 @@
+TI K3 DSP devices
+=================
+
+The TI K3 family of SoCs usually have one or more TI DSP Core sub-systems that
+are used to offload some of the processor-intensive tasks or algorithms, for
+achieving various system level goals.
+
+These processor sub-systems usually contain additional sub-modules like L1
+and/or L2 caches/SRAMs, an Interrupt Controller, an external memory controller,
+a dedicated local power/sleep controller etc. The DSP processor cores in the
+K3 SoCs is usually either a TMS320C66x CorePac processor or a TMS320C71x CorePac
+processor.
+
+DSP Device Node:
+================
+Each DSP Core sub-system is represented as a single DT node. Each node has a
+number of required or optional properties that enable the OS running on the
+host processor (Arm CorePac) to perform the device management of the remote
+processor and to communicate with the remote processor.
+
+Required properties:
+--------------------
+The following are the mandatory properties:
+
+- compatible:		Should be one of the following,
+			    "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs
+			    "ti,j721e-c71-dsp" for C71x DSPs on K3 J721E SoCs
+
+- reg:			Should contain an entry for each value in 'reg-names'.
+			Each entry should have the memory region's start address
+			and the size of the region, the representation matching
+			the parent node's '#address-cells' and '#size-cells' values.
+
+- reg-names:		Should contain strings with the following names, each
+			representing a specific internal memory region (if
+			present), and should be defined in this order,
+			     "l2sram", "l1pram", "l1dram"
+			NOTE: C71x DSPs do not have a "l1pram" memory.
+
+- ti,sci:		Should be a phandle to the TI-SCI System Controller node
+
+- ti,sci-dev-id:	Should contain the TI-SCI device id corresponding to the
+			DSP Core. Please refer to the corresponding System
+			Controller documentation for valid values for the DSP
+			cores.
+
+- ti,sci-proc-ids:	Should contain 2 integer values. The first cell should
+			contain the TI-SCI processor id for the DSP core device
+			and the second cell should contain the TI-SCI host id to
+			which the processor control ownership should be
+			transferred to.
+
+- resets:		Should contain the phandle to the reset controller node
+			managing the resets for this device, and a reset
+			specifier. Please refer to the following reset bindings
+			for the reset argument specifier,
+			Documentation/devicetree/bindings/reset/ti,sci-reset.txt
+
+Example:
+---------
+
+1. J721E SoC
+	/* J721E remoteproc alias */
+	aliases {
+		rproc6 = &c66_0;
+		rproc8 = &c71_0;
+	};
+
+	cbass_main: interconnect at 100000 {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges = <0x00 0x64800000 0x00 0x64800000 0x00 0x00800000>, /* C71_0 */
+			 <0x4d 0x80800000 0x4d 0x80800000 0x00 0x00800000>, /* C66_0 */
+			 <0x4d 0x81800000 0x4d 0x81800000 0x00 0x00800000>; /* C66_1 */
+
+		/* J721E C66_0 DSP node */
+		c66_0: dsp at 4d80800000 {
+			compatible = "ti,j721e-c66-dsp";
+			reg = <0x4d 0x80800000 0x00 0x00048000>,
+			      <0x4d 0x80e00000 0x00 0x00008000>,
+			      <0x4d 0x80f00000 0x00 0x00008000>;
+			reg-names = "l2sram", "l1pram", "l1dram";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <142>;
+			ti,sci-proc-ids = <0x03 0xFF>;
+			resets = <&k3_reset 142 1>;
+		};
+
+		/* J721E C71_0 DSP node */
+		c71_0: dsp at 64800000 {
+			compatible = "ti,j721e-c71-dsp";
+			reg = <0x00 0x64800000 0x00 0x00080000>,
+			      <0x00 0x64e00000 0x00 0x0000c000>;
+			reg-names = "l2sram", "l1dram";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <15>;
+			ti,sci-proc-ids = <0x30 0xFF>;
+			resets = <&k3_reset 15 1>;
+		};
+	};
Signature · 1 line
2.22.0
#24 lore raw

PATCH v2 10/26 dt-bindings: remoteproc: Add bindings for DSP C66x clusters on TI K3 SoCs

Quoted 11 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

Some Texas Instruments K3 family of SoCs have one of more Digital Signal Processor (DSP) subsystems that are comprised of either a TMS320C66x CorePac and/or a next-generation TMS320C71x CorePac processor subsystem. Add the device tree bindings document for the C66x DSP devices on these SoCs. The added example illustrates the DT nodes for the first C66x DSP device present on the K3 J721E family of SoCs.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/d7372dc4/attachment.sig>
#25 lore raw

PATCH v2 11/26 remoteproc: Introduce K3 C66 and C71 remoteproc driver

In reply to Lokesh Vutla

Certain SoCs with K3 architecture have integrated a C66 Corepac DSP subsystem and an advanced C71 DSPs. Introduce a remoteproc driver that that does take care of loading an elf to any of the specified DSPs and start it.

---
 drivers/remoteproc/Kconfig           |  10 +
 drivers/remoteproc/Makefile          |   1 +
 drivers/remoteproc/ti_k3_dsp_rproc.c | 354 +++++++++++++++++++++++++++
 3 files changed, 365 insertions(+)
 create mode 100644 drivers/remoteproc/ti_k3_dsp_rproc.c
drivers/remoteproc/Kconfig +10 -0
index c2d59ba000..7c2e4804b5 100644
@@ -52,6 +52,16 @@ config REMOTEPROC_TI_K3_ARM64
 	  on various TI K3 family of SoCs through the remote processor
 	  framework.
 
+config REMOTEPROC_TI_K3_DSP
+	bool "TI K3 C66 and C71 remoteproc support"
+	select REMOTEPROC
+	depends on ARCH_K3
+	depends on TI_SCI_PROTOCOL
+	help
+	  Say y here to support TI's C66/C71 remote processor subsystems
+	  on various TI K3 family of SoCs through the remote processor
+	  framework.
+
 config REMOTEPROC_TI_K3_R5F
 	bool "TI K3 R5F remoteproc support"
 	select REMOTEPROC
drivers/remoteproc/Makefile +1 -0
index 9d247ba5e7..69ae7bd1e8 100644
@@ -11,5 +11,6 @@ obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o
 obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o
 obj-$(CONFIG_REMOTEPROC_STM32_COPRO) += stm32_copro.o
 obj-$(CONFIG_REMOTEPROC_TI_K3_ARM64) += ti_k3_arm64_rproc.o
+obj-$(CONFIG_REMOTEPROC_TI_K3_DSP) += ti_k3_dsp_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_K3_R5F) += ti_k3_r5f_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_POWER) += ti_power_proc.o
drivers/remoteproc/ti_k3_dsp_rproc.c new file +354 -0

354 lines not on this page · raw message

Signature · 1 line
2.22.0
#26 lore raw

PATCH v2 11/26 remoteproc: Introduce K3 C66 and C71 remoteproc driver

Quoted 7 lines · Lokesh Vutla

Certain SoCs with K3 architecture have integrated a C66 Corepac DSP subsystem and an advanced C71 DSPs. Introduce a remoteproc driver that that does take care of loading an elf to any of the specified DSPs and start it.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/cd7136ee/attachment.sig>
#27 lore raw

PATCH v2 12/26 arm: dts: k3-j721e-mcu: Add MCU domain R5F cluster node

In reply to Lokesh Vutla

The J721E SoCs have 3 dual-core Arm Cortex-R5F processor (R5FSS) subsystems/clusters. One R5F cluster (MCU_R5FSS0) is present within the MCU domain, and the remaining two clusters are present in the MAIN domain (MAIN_R5FSS0 & MAIN_R5FSS1). Each of these can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. These subsystems have 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Add the DT node for the MCU domain R5F cluster/subsystem, the two R5 cores are added as child nodes to the main cluster/subsystem node. The cluster is configured to run in LockStep mode by default, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes.

---
 arch/arm/dts/k3-j721e-common-proc-board.dts |  5 +++
 arch/arm/dts/k3-j721e-mcu-wakeup.dtsi       | 38 +++++++++++++++++++++
 2 files changed, 43 insertions(+)
arch/arm/dts/k3-j721e-common-proc-board.dts +5 -0
index b5b8c3c5cc..070d21cd05 100644
@@ -12,6 +12,11 @@
 		stdout-path = "serial2:115200n8";
 		bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
 	};
+
+	aliases {
+		remoteproc0 = &mcu_r5fss0_core0;
+		remoteproc1 = &mcu_r5fss0_core1;
+	};
 };
 
 &wkup_uart0 {
arch/arm/dts/k3-j721e-mcu-wakeup.dtsi +38 -0
index 1175fa9a50..b958b5b3c1 100644
@@ -69,4 +69,42 @@
 		clocks = <&k3_clks 149 0>;
 		clock-names = "fclk";
 	};
+
+	mcu_r5fss0: r5fss at 41000000 {
+		compatible = "ti,j721e-r5fss";
+		lockstep-mode = <1>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0x41000000 0x00 0x41000000 0x20000>,
+			 <0x41400000 0x00 0x41400000 0x20000>;
+		power-domains = <&k3_pds 249 TI_SCI_PD_EXCLUSIVE>;
+
+		mcu_r5fss0_core0: r5f at 41000000 {
+			compatible = "ti,j721e-r5f";
+			reg = <0x41000000 0x00008000>,
+			      <0x41010000 0x00008000>;
+			reg-names = "atcm", "btcm";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <250>;
+			ti,sci-proc-ids = <0x01 0xFF>;
+			resets = <&k3_reset 250 1>;
+			atcm-enable = <1>;
+			btcm-enable = <1>;
+			loczrama = <1>;
+		};
+
+		mcu_r5fss0_core1: r5f at 41400000 {
+			compatible = "ti,j721e-r5f";
+			reg = <0x41400000 0x00008000>,
+			      <0x41410000 0x00008000>;
+			reg-names = "atcm", "btcm";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <251>;
+			ti,sci-proc-ids = <0x02 0xFF>;
+			resets = <&k3_reset 251 1>;
+			atcm-enable = <1>;
+			btcm-enable = <1>;
+			loczrama = <1>;
+		};
+	};
 };
Signature · 1 line
2.22.0
#28 lore raw

PATCH v2 12/26 arm: dts: k3-j721e-mcu: Add MCU domain R5F cluster node

Quoted 22 lines · Lokesh Vutla

The J721E SoCs have 3 dual-core Arm Cortex-R5F processor (R5FSS) subsystems/clusters. One R5F cluster (MCU_R5FSS0) is present within the MCU domain, and the remaining two clusters are present in the MAIN domain (MAIN_R5FSS0 & MAIN_R5FSS1). Each of these can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. These subsystems have 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Add the DT node for the MCU domain R5F cluster/subsystem, the two R5 cores are added as child nodes to the main cluster/subsystem node. The cluster is configured to run in LockStep mode by default, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes.

Quoted 2 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/88d11fd7/attachment.sig>
#29 lore raw

PATCH v2 13/26 arm: dts: k3-j721e-main: Add MAIN domain R5F cluster nodes

In reply to Lokesh Vutla

The J721E SoCs have 3 dual-core Arm Cortex-R5F processor (R5FSS) subsystems/clusters. One R5F cluster (MCU_R5FSS0) is present within the MCU domain, and the remaining two clusters are present in the MAIN domain (MAIN_R5FSS0 & MAIN_R5FSS1). Each of these can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. These subsystems have 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Add the DT nodes for these two MAIN domain R5F cluster/subsystems, the two R5 cores are each added as child nodes to the corresponding main cluster node. Configure SS0 in split mode an SS1 in lockstep mode, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM.

---
 arch/arm/dts/k3-j721e-common-proc-board.dts |  4 ++
 arch/arm/dts/k3-j721e-main.dtsi             | 76 +++++++++++++++++++++
 2 files changed, 80 insertions(+)
arch/arm/dts/k3-j721e-common-proc-board.dts +4 -0
index 070d21cd05..21afdc8ce0 100644
@@ -16,6 +16,10 @@
 	aliases {
 		remoteproc0 = &mcu_r5fss0_core0;
 		remoteproc1 = &mcu_r5fss0_core1;
+		remoteproc2 = &main_r5fss0_core0;
+		remoteproc3 = &main_r5fss0_core1;
+		remoteproc4 = &main_r5fss1_core0;
+		remoteproc5 = &main_r5fss1_core1;
 	};
 };
 
arch/arm/dts/k3-j721e-main.dtsi +76 -0

80 lines not on this page · raw message

Signature · 1 line
2.22.0
#30 lore raw

PATCH v2 13/26 arm: dts: k3-j721e-main: Add MAIN domain R5F cluster nodes

Quoted 14 lines · Lokesh Vutla

The J721E SoCs have 3 dual-core Arm Cortex-R5F processor (R5FSS) subsystems/clusters. One R5F cluster (MCU_R5FSS0) is present within the MCU domain, and the remaining two clusters are present in the MAIN domain (MAIN_R5FSS0 & MAIN_R5FSS1). Each of these can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. These subsystems have 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Quoted 8 lines

Add the DT nodes for these two MAIN domain R5F cluster/subsystems, the two R5 cores are each added as child nodes to the corresponding main cluster node. Configure SS0 in split mode an SS1 in lockstep mode, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/674de0c5/attachment.sig>
#31 lore raw

PATCH v2 14/26 arm: dts: k3-j721e-main: Add C66x DSP nodes

In reply to Lokesh Vutla

The J721E SoCs have two TMS320C66x DSP Core Subsystems (C66x CorePacs) in the MAIN voltage domain, each with a C66x Fixed/Floating-Point DSP Core, and 32 KB of L1P & L1D configurable SRAMs/Cache and an additional 288 KB of L2 configurable SRAM/Cache. These subsystems do not have an MMU but contain a Region Address Translator (RAT) sub-module for translating 32-bit processor addresses into larger bus addresses. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes. Add the DT nodes for these DSP processor sub-systems in the common k3-j721e-main.dtsi file.

---
 arch/arm/dts/k3-j721e-common-proc-board.dts |  2 ++
 arch/arm/dts/k3-j721e-main.dtsi             | 24 +++++++++++++++++++++
 2 files changed, 26 insertions(+)
arch/arm/dts/k3-j721e-common-proc-board.dts +2 -0
index 21afdc8ce0..a548277718 100644
@@ -20,6 +20,8 @@
 		remoteproc3 = &main_r5fss0_core1;
 		remoteproc4 = &main_r5fss1_core0;
 		remoteproc5 = &main_r5fss1_core1;
+		remoteproc6 = &c66_0;
+		remoteproc7 = &c66_1;
 	};
 };
 
arch/arm/dts/k3-j721e-main.dtsi +24 -0
index 59ca4e5686..c3aa0cdcf1 100644
@@ -304,4 +304,28 @@
 			loczrama = <1>;
 		};
 	};
+
+	c66_0: dsp at 4d80800000 {
+		compatible = "ti,j721e-c66-dsp";
+		reg = <0x4d 0x80800000 0x00 0x00048000>,
+		      <0x4d 0x80e00000 0x00 0x00008000>,
+		      <0x4d 0x80f00000 0x00 0x00008000>;
+		reg-names = "l2sram", "l1pram", "l1dram";
+		ti,sci = <&dmsc>;
+		ti,sci-dev-id = <142>;
+		ti,sci-proc-ids = <0x03 0xFF>;
+		resets = <&k3_reset 142 1>;
+	};
+
+	c66_1: dsp at 4d81800000 {
+		compatible = "ti,j721e-c66-dsp";
+		reg = <0x4d 0x81800000 0x00 0x00048000>,
+		      <0x4d 0x81e00000 0x00 0x00008000>,
+		      <0x4d 0x81f00000 0x00 0x00008000>;
+		reg-names = "l2sram", "l1pram", "l1dram";
+		ti,sci = <&dmsc>;
+		ti,sci-dev-id = <143>;
+		ti,sci-proc-ids = <0x04 0xFF>;
+		resets = <&k3_reset 143 1>;
+	};
 };
Signature · 1 line
2.22.0
#32 lore raw

PATCH v2 14/26 arm: dts: k3-j721e-main: Add C66x DSP nodes

Quoted 11 lines · Lokesh Vutla

The J721E SoCs have two TMS320C66x DSP Core Subsystems (C66x CorePacs) in the MAIN voltage domain, each with a C66x Fixed/Floating-Point DSP Core, and 32 KB of L1P & L1D configurable SRAMs/Cache and an additional 288 KB of L2 configurable SRAM/Cache. These subsystems do not have an MMU but contain a Region Address Translator (RAT) sub-module for translating 32-bit processor addresses into larger bus addresses. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes. Add the DT nodes for these DSP processor sub-systems in the common k3-j721e-main.dtsi file.

Quoted 2 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/6c1df2f5/attachment.sig>
#33 lore raw

PATCH v2 15/26 arm: dts: k3-j721e-main: Add C71x DSP node

In reply to Lokesh Vutla

The J721E SoCs have a single TMS320C71x DSP Subsystem in the MAIN voltage domain containing the next-generation C711 CPU core. The subsystem has 32 KB of L1D configurable SRAM/Cache and 512 KB of L2 configurable SRAM/Cache. This subsystem has a CMMU but is not used currently. The inter-processor communication between the main A72 cores and the C711 processor is achieved through shared memory and a Mailbox. Add the DT node for this DSP processor sub-system in the common k3-j721e-main.dtsi file.

---
 arch/arm/dts/k3-j721e-common-proc-board.dts |  1 +
 arch/arm/dts/k3-j721e-main.dtsi             | 11 +++++++++++
 2 files changed, 12 insertions(+)
arch/arm/dts/k3-j721e-common-proc-board.dts +1 -0
index a548277718..b21f597a80 100644
@@ -22,6 +22,7 @@
 		remoteproc5 = &main_r5fss1_core1;
 		remoteproc6 = &c66_0;
 		remoteproc7 = &c66_1;
+		remoteproc8 = &c71_0;
 	};
 };
 
arch/arm/dts/k3-j721e-main.dtsi +11 -0
index c3aa0cdcf1..6bd59bac52 100644
@@ -328,4 +328,15 @@
 		ti,sci-proc-ids = <0x04 0xFF>;
 		resets = <&k3_reset 143 1>;
 	};
+
+	c71_0: dsp at 64800000 {
+		compatible = "ti,j721e-c71-dsp";
+		reg = <0x00 0x64800000 0x00 0x00080000>,
+		      <0x00 0x64e00000 0x00 0x0000c000>;
+		reg-names = "l2sram", "l1dram";
+		ti,sci = <&dmsc>;
+		ti,sci-dev-id = <15>;
+		ti,sci-proc-ids = <0x30 0xFF>;
+		resets = <&k3_reset 15 1>;
+	};
 };
Signature · 1 line
2.22.0
#34 lore raw

PATCH v2 15/26 arm: dts: k3-j721e-main: Add C71x DSP node

Quoted 11 lines · Lokesh Vutla

The J721E SoCs have a single TMS320C71x DSP Subsystem in the MAIN voltage domain containing the next-generation C711 CPU core. The subsystem has 32 KB of L1D configurable SRAM/Cache and 512 KB of L2 configurable SRAM/Cache. This subsystem has a CMMU but is not used currently. The inter-processor communication between the main A72 cores and the C711 processor is achieved through shared memory and a Mailbox. Add the DT node for this DSP processor sub-system in the common k3-j721e-main.dtsi file.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/eda0177b/attachment.sig>
#35 lore raw

PATCH v2 16/26 arm: dts: k3-am65-mcu: Add MCU domain R5F DT nodes

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

The AM65x SoCs has a single dual-core Arm Cortex-R5F processor subsystem/cluster (MCU_R5FSS0) within the MCU domain. This cluster can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. This subsystem has 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Add the DT node for the MCU domain R5F cluster/subsystem, the two R5 cores are added as child nodes to the main cluster/subsystem node. The cluster is configured to run in Split-mode by default, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes.

---
 arch/arm/dts/k3-am65-mcu.dtsi        | 40 +++++++++++++++++++++++++++-
 arch/arm/dts/k3-am654-base-board.dts |  5 ++++
 2 files changed, 44 insertions(+), 1 deletion(-)
arch/arm/dts/k3-am65-mcu.dtsi +39 -1
index c9bfd9b80f..c42e7553c7 100644
@@ -2,7 +2,7 @@
 /*
  * Device Tree Source for AM6 SoC Family MCU Domain peripherals
  *
- * Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2016-2019 Texas Instruments Incorporated - http://www.ti.com/
  */
 
 &cbass_mcu {
@@ -26,4 +26,42 @@
 		clocks = <&k3_clks 114 1>;
 		power-domains = <&k3_pds 114 TI_SCI_PD_EXCLUSIVE>;
 	};
+
+	mcu_r5fss0: r5fss at 41000000 {
+		compatible = "ti,am654-r5fss";
+		lockstep-mode = <0>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0x41000000 0x00 0x41000000 0x20000>,
+			 <0x41400000 0x00 0x41400000 0x20000>;
+		power-domains = <&k3_pds 129 TI_SCI_PD_EXCLUSIVE>;
+
+		mcu_r5fss0_core0: r5f at 41000000 {
+			compatible = "ti,am654-r5f";
+			reg = <0x41000000 0x00008000>,
+			      <0x41010000 0x00008000>;
+			reg-names = "atcm", "btcm";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <159>;
+			ti,sci-proc-ids = <0x01 0xFF>;
+			resets = <&k3_reset 159 1>;
+			atcm-enable = <1>;
+			btcm-enable = <1>;
+			loczrama = <1>;
+		};
+
+		mcu_r5fss0_core1: r5f at 41400000 {
+			compatible = "ti,am654-r5f";
+			reg = <0x41400000 0x00008000>,
+			      <0x41410000 0x00008000>;
+			reg-names = "atcm", "btcm";
+			ti,sci = <&dmsc>;
+			ti,sci-dev-id = <245>;
+			ti,sci-proc-ids = <0x02 0xFF>;
+			resets = <&k3_reset 245 1>;
+			atcm-enable = <1>;
+			btcm-enable = <1>;
+			loczrama = <1>;
+		};
+	};
 };
arch/arm/dts/k3-am654-base-board.dts +5 -0
index e73b9aa6b1..573ead0b4d 100644
@@ -17,6 +17,11 @@
 		bootargs = "earlycon=ns16550a,mmio32,0x02800000";
 	};
 
+	aliases {
+		remoteproc0 = &mcu_r5fss0_core0;
+		remoteproc1 = &mcu_r5fss0_core1;
+	};
+
 	memory at 80000000 {
 		device_type = "memory";
 		/* 4G RAM */
Signature · 1 line
2.22.0
#36 lore raw

PATCH v2 16/26 arm: dts: k3-am65-mcu: Add MCU domain R5F DT nodes

Quoted 22 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

The AM65x SoCs has a single dual-core Arm Cortex-R5F processor subsystem/cluster (MCU_R5FSS0) within the MCU domain. This cluster can be configured at boot time to be either run in a LockStep mode or in an Asymmetric Multi Processing (AMP) fashion in Split-mode. This subsystem has 64 KB each Tightly-Coupled Memory (TCM) internal memories for each core split between two banks - ATCM and BTCM (further interleaved into two banks). There are some IP integration differences from standard Arm R5 clusters such as the absence of an ACP port, presence of an additional TI-specific Region Address Translater (RAT) module for translating 32-bit CPU addresses into larger system bus addresses etc.

Add the DT node for the MCU domain R5F cluster/subsystem, the two R5 cores are added as child nodes to the main cluster/subsystem node. The cluster is configured to run in Split-mode by default, with the ATCMs enabled to allow the R5 cores to execute code from DDR with boot-strapping code from ATCM. The inter-processor communication between the main A72 cores and these processors is achieved through shared memory and Mailboxes.

Quoted 2 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/910c08be/attachment.sig>
#37 lore raw

PATCH v2 17/26 env: ti: k3_rproc: Add common rproc environment variables

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

Add a new file include/environment/ti/k3_rproc.h that defines common environment variables useful for booting various remote processors from U-Boot. This file is expected to be included in the board config files with the EXTRA_ENV_RPROC_SETTINGS added to CONFIG_EXTRA_ENV_SETTINGS and DEFAULT_RPROCS macro overwritten to include the actual list of processors to be booted.

The 'boot_rprocs' variable just needs to be added to the board's bootcmd to automatically boot the processors, and runtime control can be achieved through the 'dorprocboot' variable.

The variables are currently defined to use MMC as the boot media, and can be expanded in the future to include other boot media. The immediate usage is intended for K3 J721E SoCs.

---
 include/environment/ti/k3_rproc.h | 52 +++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 include/environment/ti/k3_rproc.h
include/environment/ti/k3_rproc.h new file +52 -0
new file mode 100644
index 0000000000..3418cb42be
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * rproc environment variable definitions for various TI K3 SoCs.
+ */
+
+#ifndef __TI_RPROC_H
+#define __TI_RPROC_H
+
+/*
+ * should contain a list of <rproc_id fw_name> tuplies,
+ * override in board config files with the actual list
+ */
+#define DEFAULT_RPROCS ""
+
+#ifdef CONFIG_CMD_REMOTEPROC
+#define EXTRA_ENV_RPROC_SETTINGS					\
+	"dorprocboot=0\0"						\
+	"boot_rprocs="							\
+		"if test ${dorprocboot} -eq 1 && test ${boot} = mmc; then "\
+			"rproc init;"					\
+			"run boot_rprocs_mmc;"				\
+		"fi;\0"							\
+	"rproc_load_and_boot_one="					\
+		"if load mmc ${bootpart} $loadaddr ${rproc_fw}; then "	\
+			"if rproc load ${rproc_id} ${loadaddr} ${filesize}; then "\
+				"rproc start ${rproc_id};"		\
+			"fi;"						\
+		"fi\0"							\
+	"boot_rprocs_mmc="						\
+		"env set rproc_id;"					\
+		"env set rproc_fw;"					\
+		"for i in ${rproc_fw_binaries} ; do "			\
+			"if test -z \"${rproc_id}\" ; then "		\
+				"env set rproc_id $i;"			\
+			"else "						\
+				"env set rproc_fw $i;"			\
+				"run rproc_load_and_boot_one;"		\
+				"env set rproc_id;"			\
+				"env set rproc_fw;"			\
+			"fi;"						\
+		"done\0"						\
+	"rproc_fw_binaries="						\
+		DEFAULT_RPROCS						\
+		"\0"
+#else
+#define EXTRA_ENV_RPROC_SETTINGS					\
+	"boot_rprocs= \0"
+#endif /* CONFIG_CMD_REMOTEPROC */
+
+#endif /* __TI_RPROC_H */
Signature · 1 line
2.22.0
#38 lore raw

PATCH v2 17/26 env: ti: k3_rproc: Add common rproc environment variables

Quoted 13 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

Add a new file include/environment/ti/k3_rproc.h that defines common environment variables useful for booting various remote processors from U-Boot. This file is expected to be included in the board config files with the EXTRA_ENV_RPROC_SETTINGS added to CONFIG_EXTRA_ENV_SETTINGS and DEFAULT_RPROCS macro overwritten to include the actual list of processors to be booted.

The 'boot_rprocs' variable just needs to be added to the board's bootcmd to automatically boot the processors, and runtime control can be achieved through the 'dorprocboot' variable.

Quoted 6 lines

The variables are currently defined to use MMC as the boot media, and can be expanded in the future to include other boot media. The immediate usage is intended for K3 J721E SoCs.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/dc0b35e6/attachment.sig>
#39 lore raw

PATCH v2 18/26 env: ti: j721e-evm: Add support to boot rprocs including R5Fs and DSPs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

Add support to boot some remoteprocs at U-boot prompt on the J721E EVM boards by using the 'boot_rprocs' and other env variables defined in the common environment file k3_rproc.h, and updating the 'DEFAULT_RPROCS' macro.

The list of R5F cores to be started before loading and booting the Linux kernel are as follows, and in this order:
Main R5FSS0 (Split) Core1 : 3 /lib/firmware/j7-main-r5f0_1-fw
Main R5FSS1 (LockStep) : 4 /lib/firmware/j7-main-r5f1_0-fw

The MCU R5FSS0 and Main R5FSS1 are currently in LockStep mode, so the equivalent Core1 rprocs (rproc #1 and #5) are not included. The Main R5FSS0 Core0 (rproc #2) is already started by R5 SPL, so is not included in the list either.

The DSP cores are started in the following order before loading and booting the Linux kernel:
C66_0: 6 /lib/firmware/j7-c66_0-fw
C66_1: 7 /lib/firmware/j7-c66_1-fw
C71_0: 8 /lib/firmware/j7-c71_0-fw

The order of the rprocs to boot can be changed at runtime if desired by overwriting the 'rproc_fw_binaries' environment variable at U-boot prompt.

---
 include/configs/j721e_evm.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
include/configs/j721e_evm.h +13 -1
index 5fe77ef16d..dbe226b46d 100644
@@ -12,6 +12,7 @@
 #include <linux/sizes.h>
 #include <config_distro_bootcmd.h>
 #include <environment/ti/mmc.h>
+#include <environment/ti/k3_rproc.h>
 
 #define CONFIG_ENV_SIZE			(128 << 10)
 
@@ -87,11 +88,22 @@
 	"get_kern_mmc=load mmc ${bootpart} ${loadaddr} "		\
 		"${bootdir}/${name_kern}\0"
 
+#ifdef DEFAULT_RPROCS
+#undef DEFAULT_RPROCS
+#endif
+#define DEFAULT_RPROCS	""						\
+		"3 /lib/firmware/j7-main-r5f0_1-fw "			\
+		"4 /lib/firmware/j7-main-r5f1_0-fw "			\
+		"6 /lib/firmware/j7-c66_0-fw "				\
+		"7 /lib/firmware/j7-c66_1-fw "				\
+		"8 /lib/firmware/j7-c71_0-fw "
+
 /* Incorporate settings into the U-Boot environment */
 #define CONFIG_EXTRA_ENV_SETTINGS					\
 	DEFAULT_MMC_TI_ARGS						\
 	EXTRA_ENV_J721E_BOARD_SETTINGS					\
-	EXTRA_ENV_J721E_BOARD_SETTINGS_MMC
+	EXTRA_ENV_J721E_BOARD_SETTINGS_MMC				\
+	EXTRA_ENV_RPROC_SETTINGS
 
 /* Now for the remaining common defines */
 #include <configs/ti_armv7_common.h>
Signature · 1 line
2.22.0
#40 lore raw

PATCH v2 18/26 env: ti: j721e-evm: Add support to boot rprocs including R5Fs and DSPs

Quoted 23 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

Add support to boot some remoteprocs at U-boot prompt on the J721E EVM boards by using the 'boot_rprocs' and other env variables defined in the common environment file k3_rproc.h, and updating the 'DEFAULT_RPROCS' macro.

The list of R5F cores to be started before loading and booting the Linux kernel are as follows, and in this order:

   Main R5FSS0 (Split) Core1 : 3 /lib/firmware/j7-main-r5f0_1-fw
   Main R5FSS1 (LockStep)    : 4 /lib/firmware/j7-main-r5f1_0-fw

The MCU R5FSS0 and Main R5FSS1 are currently in LockStep mode, so the equivalent Core1 rprocs (rproc #1 and #5) are not included. The Main R5FSS0 Core0 (rproc #2) is already started by R5 SPL, so is not included in the list either.

The DSP cores are started in the following order before loading and booting the Linux kernel:

   C66_0: 6 /lib/firmware/j7-c66_0-fw
   C66_1: 7 /lib/firmware/j7-c66_1-fw
   C71_0: 8 /lib/firmware/j7-c71_0-fw
Quoted 6 lines

The order of the rprocs to boot can be changed at runtime if desired by overwriting the 'rproc_fw_binaries' environment variable at U-boot prompt.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/86642ed6/attachment.sig>
#41 lore raw

PATCH v2 19/26 env: ti: am65x_evm: Add env support to boot the MCU R5F rprocs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

Add support to boot the MCU domain R5F Core0 remoteproc at U-boot prompt on the AM65x EVM boards by using the 'boot_rprocs' and other env variables defined in the common environment file k3_rproc.h, and updating the 'DEFAULT_RPROCS' macro.

The default configuration is to use the MCU R5F in Split mode, so both the R5F Core0 and Core1 are started before loading and booting the Linux kernel using the following firmware:
MCU R5FSS0 Core0 (Split) : 0 /lib/firmware/am65x-mcu-r5f0_0-fw MCU R5FSS0 Core1 (Split) : 1 /lib/firmware/am65x-mcu-r5f0_1-fw

The MCU R5FSS was initially running the R5 SPL in LockStep mode with ATCM disabled, and is actually shutdown to enable it to be reconfigured and booted by either A53 U-Boot or Linux kernel in remoteproc mode and using ATCM.

The MCU R5FSS would need to be reconfigured for Lockstep mode through DT if a fault-tolerant/safety application were to be run on the cluster with the DEFAULT_RPROCS macro updated to remove the Core1 firmware.

---
 include/configs/am65x_evm.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
include/configs/am65x_evm.h +10 -1
index 6072e4a48c..5c44b22ead 100644
@@ -12,6 +12,7 @@
 #include <linux/sizes.h>
 #include <config_distro_bootcmd.h>
 #include <environment/ti/mmc.h>
+#include <environment/ti/k3_rproc.h>
 
 #define CONFIG_ENV_SIZE			(128 << 10)
 
@@ -96,11 +97,19 @@
 		"${bootdir}/${name_kern}\0"				\
 	"partitions=" PARTS_DEFAULT
 
+#ifdef DEFAULT_RPROCS
+#undef DEFAULT_RPROCS
+#endif
+#define DEFAULT_RPROCS	""						\
+		"0 /lib/firmware/am65x-mcu-r5f0_0-fw "			\
+		"1 /lib/firmware/am65x-mcu-r5f0_1-fw "
+
 /* Incorporate settings into the U-Boot environment */
 #define CONFIG_EXTRA_ENV_SETTINGS					\
 	DEFAULT_MMC_TI_ARGS						\
 	EXTRA_ENV_AM65X_BOARD_SETTINGS					\
-	EXTRA_ENV_AM65X_BOARD_SETTINGS_MMC
+	EXTRA_ENV_AM65X_BOARD_SETTINGS_MMC				\
+	EXTRA_ENV_RPROC_SETTINGS
 
 /* MMC ENV related defines */
 #ifdef CONFIG_ENV_IS_IN_MMC
Signature · 1 line
2.22.0
#42 lore raw

PATCH v2 19/26 env: ti: am65x_evm: Add env support to boot the MCU R5F rprocs

Quoted 18 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

Add support to boot the MCU domain R5F Core0 remoteproc at U-boot prompt on the AM65x EVM boards by using the 'boot_rprocs' and other env variables defined in the common environment file k3_rproc.h, and updating the 'DEFAULT_RPROCS' macro.

The default configuration is to use the MCU R5F in Split mode, so both the R5F Core0 and Core1 are started before loading and booting the Linux kernel using the following firmware:

   MCU R5FSS0 Core0 (Split) : 0 /lib/firmware/am65x-mcu-r5f0_0-fw
   MCU R5FSS0 Core1 (Split) : 1 /lib/firmware/am65x-mcu-r5f0_1-fw

The MCU R5FSS was initially running the R5 SPL in LockStep mode with ATCM disabled, and is actually shutdown to enable it to be reconfigured and booted by either A53 U-Boot or Linux kernel in remoteproc mode and using ATCM.

Quoted 6 lines

The MCU R5FSS would need to be reconfigured for Lockstep mode through DT if a fault-tolerant/safety application were to be run on the cluster with the DEFAULT_RPROCS macro updated to remove the Core1 firmware.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/78750ce8/attachment.sig>
#43 lore raw

PATCH v2 20/26 configs: j721e_evm_a72: Enable R5F and DSP remoteproc driver

In reply to Lokesh Vutla

Enable R5F and DSP remoteproc drivers for j721e running on a72.

---
 configs/j721e_evm_a72_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/j721e_evm_a72_defconfig +3 -0
index 6e355f5247..6e0c3f05fb 100644
@@ -34,6 +34,7 @@ CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_MMC=y
+CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SF=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
@@ -72,6 +73,8 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_REMOTEPROC_TI_K3_DSP=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
 CONFIG_DM_RESET=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
Signature · 1 line
2.22.0
#44 lore raw

PATCH v2 20/26 configs: j721e_evm_a72: Enable R5F and DSP remoteproc driver

Quoted 3 lines · Lokesh Vutla

Enable R5F and DSP remoteproc drivers for j721e running on a72.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/ade6b76a/attachment.sig>
#45 lore raw

PATCH v2 21/26 configs: j721e_evm_a72: Enhance bootcmd to start remoteprocs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

The A72 U-boot can support early booting of any of the R5F or C66x or C71x remote processors from U-boot prompt to achieve various system usecases before booting the Linux kernel. Update the default BOOTCOMMAND to provide an automatic and easier way to start various remote processors through added environment variables.

---
 configs/j721e_evm_a72_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/j721e_evm_a72_defconfig +1 -1
index 6e0c3f05fb..56df452fb6 100644
@@ -17,7 +17,7 @@ CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_TEXT_BASE=0x80080000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
Signature · 1 line
2.22.0
#46 lore raw

PATCH v2 21/26 configs: j721e_evm_a72: Enhance bootcmd to start remoteprocs

Quoted 10 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

The A72 U-boot can support early booting of any of the R5F or C66x or C71x remote processors from U-boot prompt to achieve various system usecases before booting the Linux kernel. Update the default BOOTCOMMAND to provide an automatic and easier way to start various remote processors through added environment variables.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/21533a65/attachment.sig>
#47 lore raw

PATCH v2 22/26 configs: am65x_evm_a53: Enable R5F remoteproc driver

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

Enable the R5F remoteproc driver for the AM65x GP EVM so that the MCU domain R5F cores can be booted from A53 U-boot.

---
 configs/am65x_evm_a53_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/am65x_evm_a53_defconfig +2 -0
index 9d02dbc01a..d6a0d8583c 100644
@@ -35,6 +35,7 @@ CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_REMOTEPROC=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 # CONFIG_ISO_PARTITION is not set
@@ -83,6 +84,7 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_TI_SCI_POWER_DOMAIN=y
+CONFIG_REMOTEPROC_TI_K3_R5F=y
 CONFIG_DM_RESET=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
Signature · 1 line
2.22.0
#48 lore raw

PATCH v2 22/26 configs: am65x_evm_a53: Enable R5F remoteproc driver

Quoted 7 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

Enable the R5F remoteproc driver for the AM65x GP EVM so that the MCU domain R5F cores can be booted from A53 U-boot.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/7bcb95bf/attachment.sig>
#49 lore raw

PATCH v2 23/26 configs: am65x_evm_a53: Enhance bootcmd to start remoteprocs

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

The A53 U-boot can support early booting of the MCU R5F remote processor(s) from U-boot prompt to achieve various system usecases before booting the Linux kernel. Update the default BOOTCOMMAND to provide an automatic and easier way to start the MCU R5F cores through added environment variables.

---
 configs/am65x_evm_a53_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/am65x_evm_a53_defconfig +1 -1
index d6a0d8583c..2d91d25b6a 100644
@@ -16,7 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
+CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_TEXT_BASE=0x80080000
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
Signature · 1 line
2.22.0
#50 lore raw

PATCH v2 23/26 configs: am65x_evm_a53: Enhance bootcmd to start remoteprocs

Quoted 9 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

The A53 U-boot can support early booting of the MCU R5F remote processor(s) from U-boot prompt to achieve various system usecases before booting the Linux kernel. Update the default BOOTCOMMAND to provide an automatic and easier way to start the MCU R5F cores through added environment variables.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/55f8b75f/attachment.sig>
#51 lore raw

PATCH v2 24/26 armv8: K3: am65x: Update DDR address regions in MMU table

In reply to Lokesh Vutla

From: Suman Anna <[email protected]>

The A53 U-Boot code can load and boot the MCU domain R5F cores (either a single core in LockStep mode or 2 cores in Split mode) to achieve various early system functionalities. Change the memory attributes for the DDR regions used by the remote processors so that the cores can see and execute the proper code loaded by U-Boot.

These regions are currently limited to 0xa0000000 to 0xa2100000 as per the DDR carveouts assigned for these R5F cores in the overall DDR memory map.

---
 arch/arm/mach-k3/arm64-mmu.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
arch/arm/mach-k3/arm64-mmu.c +14 -2
index 82778d2197..98c5a777e5 100644
@@ -14,7 +14,7 @@
 
 #ifdef CONFIG_SOC_K3_AM6
 /* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 3)
+#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 5)
 
 /* ToDo: Add 64bit IO */
 struct mm_region am654_mem_map[NR_MMU_REGIONS] = {
@@ -28,7 +28,19 @@ struct mm_region am654_mem_map[NR_MMU_REGIONS] = {
 	}, {
 		.virt = 0x80000000UL,
 		.phys = 0x80000000UL,
-		.size = 0x80000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.virt = 0xa0000000UL,
+		.phys = 0xa0000000UL,
+		.size = 0x02100000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.virt = 0xa2100000UL,
+		.phys = 0xa2100000UL,
+		.size = 0x5df00000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
Signature · 1 line
2.22.0
#52 lore raw

PATCH v2 24/26 armv8: K3: am65x: Update DDR address regions in MMU table

Quoted 8 lines · Lokesh Vutla

From: Suman Anna <[email protected]>

The A53 U-Boot code can load and boot the MCU domain R5F cores (either a single core in LockStep mode or 2 cores in Split mode) to achieve various early system functionalities. Change the memory attributes for the DDR regions used by the remote processors so that the cores can see and execute the proper code loaded by U-Boot.

Quoted 6 lines

These regions are currently limited to 0xa0000000 to 0xa2100000 as per the DDR carveouts assigned for these R5F cores in the overall DDR memory map.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/72bddca7/attachment-0001.sig>
#53 lore raw

PATCH v2 25/26 armv8: K3: j721e: Updated ddr address regions in MMU table

In reply to Lokesh Vutla

From: Kedar Chitnis <[email protected]>

The A72 U-Boot code loads and boots a number of remote processors including the C71x DSP, both the C66_0 and C66_1 DSPs, and the various Main R5FSS Cores. In order to view the code loaded by the U-Boot by remote cores, U-Boot should configure the memory region with right memory attributes. Right now U-Boot carves out a memory region which is not sufficient for all the images to be loaded. So, increase this carve out region by 256MB.

---
 arch/arm/mach-k3/arm64-mmu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-k3/arm64-mmu.c +4 -4
index 98c5a777e5..7f908eee80 100644
@@ -80,13 +80,13 @@ struct mm_region j721e_mem_map[NR_MMU_REGIONS] = {
 	}, {
 		.virt = 0xa0000000UL,
 		.phys = 0xa0000000UL,
-		.size = 0x0bc00000UL,
+		.size = 0x1bc00000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
 			 PTE_BLOCK_NON_SHARE
 	}, {
-		.virt = 0xabc00000UL,
-		.phys = 0xabc00000UL,
-		.size = 0x54400000UL,
+		.virt = 0xbbc00000UL,
+		.phys = 0xbbc00000UL,
+		.size = 0x44400000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
Signature · 1 line
2.22.0
#54 lore raw

PATCH v2 25/26 armv8: K3: j721e: Updated ddr address regions in MMU table

Quoted 10 lines · Lokesh Vutla

From: Kedar Chitnis <[email protected]>

The A72 U-Boot code loads and boots a number of remote processors including the C71x DSP, both the C66_0 and C66_1 DSPs, and the various Main R5FSS Cores. In order to view the code loaded by the U-Boot by remote cores, U-Boot should configure the memory region with right memory attributes. Right now U-Boot carves out a memory region which is not sufficient for all the images to be loaded. So, increase this carve out region by 256MB.

Quoted 2 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/b8874664/attachment.sig>
#55 lore raw

PATCH v2 26/26 board: j721e: Add README

In reply to Lokesh Vutla

Add README file explaining the build and boot procedure for J721E evm.

---
 board/ti/j721e/README | 227 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 227 insertions(+)
 create mode 100644 board/ti/j721e/README
board/ti/j721e/README new file +227 -0
new file mode 100644
index 0000000000..5be7d099db
@@ -0,0 +1,227 @@
+Introduction:
+-------------
+The J721e family of SoCs are part of K3 Multicore SoC architecture platform
+targeting automotive applications. They are designed as a low power, high
+performance and highly integrated device architecture, adding significant
+enhancement on processing power, graphics capability, video and imaging
+processing, virtualization and coherent memory support.
+
+The device is partitioned into three functional domains, each containing
+specific processing cores and peripherals:
+1. Wake-up (WKUP) domain:
+	- Device Management and Security Controller (DMSC)
+2. Microcontroller (MCU) domain:
+	- Dual Core ARM Cortex-R5F processor
+3. MAIN domain:
+	- Dual core 64-bit ARM Cortex-A72
+	- 2 x Dual cortex ARM Cortex-R5 subsystem
+	- 2 x C66x Digital signal processor sub system
+	- C71x Digital signal processor sub-system with MMA.
+
+More info can be found in TRM: http://www.ti.com/lit/pdf/spruil1
+
+Boot Flow:
+----------
+Boot flow is similar to that of AM65x SoC and extending it with remoteproc
+support. Below is the pictorial representation of boot flow:
+
++------------------------------------------------------------------------+-----------------------+
+|        DMSC            |      MCU R5           |        A72            |  MAIN R5/C66x/C7x     |
++------------------------------------------------------------------------+-----------------------+
+|    +--------+          |                       |                       |                       |
+|    |  Reset |          |                       |                       |                       |
+|    +--------+          |                       |                       |                       |
+|         :              |                       |                       |                       |
+|    +--------+          |   +-----------+       |                       |                       |
+|    | *ROM*  |----------|-->| Reset rls |       |                       |                       |
+|    +--------+          |   +-----------+       |                       |                       |
+|    |        |          |         :             |                       |                       |
+|    |  ROM   |          |         :             |                       |                       |
+|    |services|          |         :             |                       |                       |
+|    |        |          |   +-------------+     |                       |                       |
+|    |        |          |   |  *R5 ROM*   |     |                       |                       |
+|    |        |          |   +-------------+     |                       |                       |
+|    |        |<---------|---|Load and auth|     |                       |                       |
+|    |        |          |   | tiboot3.bin |     |                       |                       |
+|    |        |          |   +-------------+     |                       |                       |
+|    |        |          |         :             |                       |                       |
+|    |        |          |         :             |                       |                       |
+|    |        |          |         :             |                       |                       |
+|    |        |          |   +-------------+     |                       |                       |
+|    |        |          |   |  *R5 SPL*   |     |                       |                       |
+|    |        |          |   +-------------+     |                       |                       |
+|    |        |          |   |    Load     |     |                       |                       |
+|    |        |          |   |  sysfw.itb  |     |                       |                       |
+|    | Start  |          |   +-------------+     |                       |                       |
+|    | System |<---------|---|    Start    |     |                       |                       |
+|    |Firmware|          |   |    SYSFW    |     |                       |                       |
+|    +--------+          |   +-------------+     |                       |                       |
+|        :               |   |             |     |                       |                       |
+|    +---------+         |   |   Load      |     |                       |                       |
+|    | *SYSFW* |         |   |   system    |     |                       |                       |
+|    +---------+         |   | Config data |     |                       |                       |
+|    |         |<--------|---|             |     |                       |                       |
+|    |         |         |   +-------------+     |                       |                       |
+|    |         |         |   |    DDR      |     |                       |                       |
+|    |         |         |   |   config    |     |                       |                       |
+|    |         |         |   +-------------+     |                       |                       |
+|    |         |         |   |    Load     |     |                       |                       |
+|    |         |         |   |  tispl.bin  |     |                       |                       |
+|    |         |         |   +-------------+     |                       |                       |
+|    |         |         |   |   Load R5   |     |                       |                       |
+|    |         |         |   |   firmware  |     |                       |                       |
+|    |         |         |   +-------------+     |                       |                       |
+|    |         |<--------|---| Start A72   |     |                       |                       |
+|    |         |         |   | and jump to |     |                       |                       |
+|    |         |         |   | next image  |     |                       |                       |
+|    |         |         |   +-------------+     |                       |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |---------|-----------------------|---->| Reset rls |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |  DMSC   |         |                       |          :            |                       |
+|    |Services |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|---->|*ATF/OPTEE*|     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |         |                       |          :            |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|---->| *A72 SPL* |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |         |                       |     |   Load    |     |                       |
+|    |         |         |                       |     | u-boot.img|     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |         |                       |          :            |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|---->| *U-Boot*  |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |         |                       |     |  prompt   |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |         |                       |     |  Load R5  |     |                       |
+|    |         |         |                       |     |  Firmware |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|-----|  Start R5 |     |      +-----------+    |
+|    |         |---------|-----------------------|-----+-----------+-----|----->| R5 starts |    |
+|    |         |         |                       |     |  Load C6  |     |      +-----------+    |
+|    |         |         |                       |     |  Firmware |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|-----|  Start C6 |     |      +-----------+    |
+|    |         |---------|-----------------------|-----+-----------+-----|----->| C6 starts |    |
+|    |         |         |                       |     |  Load C7  |     |      +-----------+    |
+|    |         |         |                       |     |  Firmware |     |                       |
+|    |         |         |                       |     +-----------+     |                       |
+|    |         |<--------|-----------------------|-----|  Start C7 |     |      +-----------+    |
+|    |         |---------|-----------------------|-----+-----------+-----|----->| C7 starts |    |
+|    +---------+         |                       |                       |      +-----------+    |
+|                        |                       |                       |                       |
++------------------------------------------------------------------------+-----------------------+
+
+- Here DMSC acts as master and provides all the critical services. R5/A72
+requests DMSC to get these services done as shown in the above diagram.
+
+Sources:
+--------
+1. SYSFW:
+	Tree: git://git.ti.com/processor-firmware/system-firmware-image-gen.git
+	Branch: master
+
+2. ATF:
+	Tree: https://github.com/ARM-software/arm-trusted-firmware.git
+	Branch: master
+
+3. OPTEE:
+	Tree: https://github.com/OP-TEE/optee_os.git
+	Branch: master
+
+4. U-Boot:
+	Tree: https://gitlab.denx.de/u-boot/u-boot
+	Branch: master
+
+Build procedure:
+----------------
+1. SYSFW:
+$ make CROSS_COMPILE=arm-linux-gnueabihf-
+
+2. ATF:
+$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed
+
+3. OPTEE:
+$ make PLATFORM=k3-j721e CFG_ARM64_core=y
+
+4. U-Boot:
+
+4.1. R5:
+$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- j721e_evm_r5_defconfig O=/tmp/r5
+$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5
+
+4.2. A72:
+$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- j721e_evm_a72_defconfig O=/tmp/a72
+$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- ATF=<path to ATF dir>/build/k3/generic/release/bl31.bin TEE=<path to OPTEE OS dir>/out/arm-plat-k3/core/tee-pager.bin O=/tmp/a72
+
+Target Images
+--------------
+Copy the below images to an SD card and boot:
+- sysfw.itb from step 1
+- tiboot3.bin from step 4.1
+- tispl.bin, u-boot.img from 4.2
+
+Image formats:
+--------------
+
+- tiboot3.bin:
+                +-----------------------+
+                |        X.509          |
+                |      Certificate      |
+                | +-------------------+ |
+                | |                   | |
+                | |        R5         | |
+                | |   u-boot-spl.bin  | |
+                | |                   | |
+                | +-------------------+ |
+                | |                   | |
+                | |     FIT header    | |
+                | | +---------------+ | |
+                | | |               | | |
+                | | |   DTB 1...N   | | |
+                | | +---------------+ | |
+                | +-------------------+ |
+                +-----------------------+
+
+- tispl.bin
+                +-----------------------+
+                |                       |
+                |       FIT HEADER      |
+                | +-------------------+ |
+                | |                   | |
+                | |      A72 ATF      | |
+                | +-------------------+ |
+                | |                   | |
+                | |     A72 OPTEE     | |
+                | +-------------------+ |
+                | |                   | |
+                | |      A72 SPL      | |
+                | +-------------------+ |
+                | |                   | |
+                | |   SPL DTB 1...N   | |
+                | +-------------------+ |
+                +-----------------------+
+
+- sysfw.itb
+                +-----------------------+
+                |                       |
+                |       FIT HEADER      |
+                | +-------------------+ |
+                | |                   | |
+                | |     sysfw.bin     | |
+                | +-------------------+ |
+                | |                   | |
+                | |    board config   | |
+                | +-------------------+ |
+                | |                   | |
+                | |     PM config     | |
+                | +-------------------+ |
+                | |                   | |
+                | |     RM config     | |
+                | +-------------------+ |
+                | |                   | |
+                | |    Secure config  | |
+                | +-------------------+ |
+                +-----------------------+
Signature · 1 line
2.22.0
#56 lore raw

PATCH v2 26/26 board: j721e: Add README

Quoted 3 lines · Lokesh Vutla

Add README file explaining the build and boot procedure for J721E evm.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/ab52b263/attachment.sig>