Skip to contentSkip to conversation

firmware: Add K3 Support for TISCI driver

RFC PATCH In review Nishanth Menon 2 participants 6 messages Jun 5, 2018 – Jun 12, 2018

Subsystems (3)
lore
Share & tools
lore

Nishanth Menon

author maintainer
#0 lore raw

cover firmware: Add K3 Support for TISCI driver

Hi,

The following series enables TI System Control Interface(TISCI) support for the newest addition in TI's SoC portfolio - AM654 SoC.

The series is an RFC based off next-20180604 and will post formally once v4.18-rc1 is available.

The series (part 4 of 4) is available here:
https://github.com/nmenon/linux-2.6-playground/commits/upstream/next-20180604/k3-4-am6-tisci

Full Boot log is available here: https://pastebin.ubuntu.com/p/vWCzMKtBCW/

The Linux development follows closely the 66AK2G SoC model in aarch64 with a few additions to handle the flexibility of firmware.

The architecture and dts support depends on part 1 of the series:
https://marc.info/?l=linux-arm-kernel&m=152817866312732&w=2

See AM65x Technical Reference Manual (SPRUID7, April 2018) for further details: http://www.ti.com/lit/pdf/spruid7

Nishanth Menon (3):
Documentation: dt: keystone: ti-sci: Add optional host-id parameter
firmware: ti_sci: Provide host-id as an optional dt parameter
arm64: dts: ti: k3-am6: Add Device Management Security Controller
support

 .../devicetree/bindings/arm/keystone/ti,sci.txt    |  4 +++
 arch/arm64/boot/dts/ti/k3-am6.dtsi                 | 32 ++++++++++++++++++++++
 drivers/firmware/ti_sci.c                          | 24 +++++++++++++---
 3 files changed, 56 insertions(+), 4 deletions(-)
Signature · 1 line
2.15.1
author maintainer
#1 lore raw

RFC PATCH 1/3 Documentation: dt: keystone: ti-sci: Add optional host-id parameter

Texas Instrument's System Control Interface (TISCI) permits the ability for Operating Systems to running in virtual machines to be able to independently communicate with the firmware without the need going through an hypervisor.

The "host-id" in effect is the hardware representation of the host (example: VMs locked to a core) as identified to the System Controller.

This is introduced as an optional parameter to maintain consistency with legacy device tree blobs.

We call this with a vendor prefix to prevent any possible confusion with SCSI ID (m68k) kernel option.

---
 Documentation/devicetree/bindings/arm/keystone/ti,sci.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/arm/keystone/ti,sci.txt +4 -0
index 31f5f9a104cc..b56a02c10ae6 100644
@@ -45,11 +45,15 @@ Optional Properties:
 	debug_messages - Map the Debug message region
 - reg:  register space corresponding to the debug_messages
 - ti,system-reboot-controller: If system reboot can be triggered by SoC reboot
+- ti,host-id: Integer value corresponding to the host ID assigned by Firmware
+	for identification of host processing entities such as virtual
+	machines
 
 Example (K2G):
 -------------
 	pmmc: pmmc {
 		compatible = "ti,k2g-sci";
+		ti,host-id = <2>;
 		mbox-names = "rx", "tx";
 		mboxes= <&msgmgr &msgmgr_proxy_pmmc_rx>,
 			<&msgmgr &msgmgr_proxy_pmmc_tx>;
Signature · 1 line
2.15.1
maintainer
#2 lore raw

Re: [RFC PATCH 1/3] Documentation: dt: keystone: ti-sci: Add optional host-id parameter

Quoted 2 lines · Nishanth Menon

Texas Instrument's System Control Interface (TISCI) permits the ability for Operating Systems to running in virtual machines to be

...for OSs running in virtual...

Quoted 6 lines

able to independently communicate with the firmware without the need going through an hypervisor.

The "host-id" in effect is the hardware representation of the host (example: VMs locked to a core) as identified to the System Controller.

So the hypervisor will fill in host-id's for each VM instance?

Quoted 35 lines

This is introduced as an optional parameter to maintain consistency with legacy device tree blobs.

We call this with a vendor prefix to prevent any possible confusion with SCSI ID (m68k) kernel option.

---
 Documentation/devicetree/bindings/arm/keystone/ti,sci.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/arm/keystone/ti,sci.txt +4 -0
index 31f5f9a104cc..b56a02c10ae6 100644
@@ -45,11 +45,15 @@ Optional Properties:
 	debug_messages - Map the Debug message region
 - reg:  register space corresponding to the debug_messages
 - ti,system-reboot-controller: If system reboot can be triggered by SoC reboot
+- ti,host-id: Integer value corresponding to the host ID assigned by Firmware
+	for identification of host processing entities such as virtual
+	machines
 
 Example (K2G):
 -------------
 	pmmc: pmmc {
 		compatible = "ti,k2g-sci";
+		ti,host-id = <2>;
 		mbox-names = "rx", "tx";
 		mboxes= <&msgmgr &msgmgr_proxy_pmmc_rx>,
 			<&msgmgr &msgmgr_proxy_pmmc_tx>;
Signature · 1 line
2.15.1
author maintainer
#3 lore raw

Re: [RFC PATCH 1/3] Documentation: dt: keystone: ti-sci: Add optional host-id parameter

Quoted 5 lines · Rob Herring
Quoted 2 lines · Nishanth Menon

Texas Instrument's System Control Interface (TISCI) permits the ability for Operating Systems to running in virtual machines to be

...for OSs running in virtual...

Ack. thanks.

Quoted 9 lines
Quoted 7 lines

able to independently communicate with the firmware without the need going through an hypervisor.

The "host-id" in effect is the hardware representation of the host (example: VMs locked to a core) as identified to the System Controller.

So the hypervisor will fill in host-id's for each VM instance?

Yes OR have it's own device tree blobs representation of it's own host IDs assigned by system firmware. This provides complete independence of VMs to communicate with the system controller (once the host-id is provided) without switching to hyp for arbitration (and yes, verified ability with jailhouse hypervisor and multiple linux instances operating simultaneously). This also has the added benefit of:
1. The burden of hypervisor from being involved in PM functionality as each of the VMs can operate autonomously.
2. In TI SoCs which are heterogeneous, the system firmware plays the role of system master communicating with multiple firmware(running on various uCs) and OSes running on bigger cores.

Signature · 2 lines
Regards,
Nishanth Menon
author maintainer
#4 lore raw

RFC PATCH 2/3 firmware: ti_sci: Provide host-id as an optional dt parameter

In reply to Nishanth Menon

Texas Instrument's System Control Interface (TISCI) permits the ability for Operating Systems to running in virtual machines to be able to independently communicate with the firmware without the need going through an hypervisor.

The "host-id" in effect is the hardware representation of the host (example: VMs locked to a core) as identified to the System Controller.

Provide support as an optional parameter implementation and use the compatible data as default if one is not provided by device tree.

---
 drivers/firmware/ti_sci.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/firmware/ti_sci.c +20 -4
index b74a533ef35b..6b08ee815b24 100644
@@ -66,14 +66,14 @@ struct ti_sci_xfers_info {
 
 /**
  * struct ti_sci_desc - Description of SoC integration
- * @host_id:		Host identifier representing the compute entity
+ * @default_host_id:	Host identifier representing the compute entity
  * @max_rx_timeout_ms:	Timeout for communication with SoC (in Milliseconds)
  * @max_msgs: Maximum number of messages that can be pending
  *		  simultaneously in the system
  * @max_msg_size: Maximum size of data per message that can be handled.
  */
 struct ti_sci_desc {
-	u8 host_id;
+	u8 default_host_id;
 	int max_rx_timeout_ms;
 	int max_msgs;
 	int max_msg_size;
@@ -94,6 +94,7 @@ struct ti_sci_desc {
  * @chan_rx:	Receive mailbox channel
  * @minfo:	Message info
  * @node:	list head
+ * @host_id:	Host ID
  * @users:	Number of users of this instance
  */
 struct ti_sci_info {
@@ -110,6 +111,7 @@ struct ti_sci_info {
 	struct mbox_chan *chan_rx;
 	struct ti_sci_xfers_info minfo;
 	struct list_head node;
+	u8 host_id;
 	/* protected by ti_sci_list_mutex */
 	int users;
 
@@ -370,7 +372,7 @@ static struct ti_sci_xfer *ti_sci_get_one_xfer(struct ti_sci_info *info,
 
 	hdr->seq = xfer_id;
 	hdr->type = msg_type;
-	hdr->host = info->desc->host_id;
+	hdr->host = info->host_id;
 	hdr->flags = msg_flags;
 
 	return xfer;
@@ -1793,7 +1795,7 @@ static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
 
 /* Description for K2G */
 static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
-	.host_id = 2,
+	.default_host_id = 2,
 	/* Conservative duration */
 	.max_rx_timeout_ms = 1000,
 	/* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
@@ -1819,6 +1821,7 @@ static int ti_sci_probe(struct platform_device *pdev)
 	int ret = -EINVAL;
 	int i;
 	int reboot = 0;
+	u32 h_id;
 
 	of_id = of_match_device(ti_sci_of_match, dev);
 	if (!of_id) {
@@ -1833,6 +1836,19 @@ static int ti_sci_probe(struct platform_device *pdev)
 
 	info->dev = dev;
 	info->desc = desc;
+	ret = of_property_read_u32(dev->of_node, "ti,host-id", &h_id);
+	/* if the property is not present in DT, use a default from desc */
+	if (ret < 0) {
+		info->host_id = info->desc->default_host_id;
+	} else {
+		if (!h_id) {
+			dev_warn(dev, "Host ID 0 is reserved for firmware\n");
+			info->host_id = info->desc->default_host_id;
+		} else {
+			info->host_id = h_id;
+		}
+	}
+
 	reboot = of_property_read_bool(dev->of_node,
 				       "ti,system-reboot-controller");
 	INIT_LIST_HEAD(&info->node);
Signature · 1 line
2.15.1
author maintainer
#5 lore raw

RFC PATCH 3/3 arm64: dts: ti: k3-am6: Add Device Management Security Controller support

In reply to Nishanth Menon

Add TISCI compatible System controller for AM6 SoCs.

---
 arch/arm64/boot/dts/ti/k3-am6.dtsi | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/ti/k3-am6.dtsi +32 -0
index 07e9cc05519c..898422e24b27 100644
@@ -97,6 +97,38 @@
 			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		dmsc: dmsc {
+			compatible = "ti,k2g-sci";
+			ti,host-id = <12>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			/*
+			 * In case of rare platforms that does not use am6 as
+			 * system master, use /delete-property/
+			 */
+			ti,system-reboot-controller;
+			mbox-names = "rx", "tx";
+
+			mboxes= <&secure_proxy 11>,
+				<&secure_proxy 13>;
+
+			k3_pds: power-controller {
+				compatible = "ti,sci-pm-domain";
+				#power-domain-cells = <1>;
+			};
+
+			k3_clks: clocks {
+				compatible = "ti,k2g-sci-clk";
+				#clock-cells = <2>;
+			};
+
+			k3_reset: reset-controller {
+				compatible = "ti,sci-reset";
+				#reset-cells = <2>;
+			};
+		};
+
 		wkup_uart0: serial at 42300000 {
 			compatible = "ti,am654-uart", "ti,omap4-uart", "ns16550a";
 			reg = <0x0 0x42300000 0x0 0x100>;
Signature · 1 line
2.15.1