Skip to contentSkip to conversation

staging: vc04_services: Replace "firmware" node with a compatible lookup.

PATCH In review Eric Anholt 3 participants 9 messages Mar 9, 2018 – Mar 18, 2018

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

PATCH v3 1/6 staging: vc04_services: Replace "firmware" node with a compatible lookup.

This was requested by Rob Herring in DT bindings review.

---

v2: new patch
v3: no changes

 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2 -1
index f5cefda49b22..8068c0308b34 100644
@@ -3594,7 +3594,8 @@ static int vchiq_probe(struct platform_device *pdev)
 	struct rpi_firmware *fw;
 	int err;
 
-	fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0);
+	fw_node = of_find_compatible_node(NULL, NULL,
+					  "raspberrypi,bcm2835-firmware");
 	if (!fw_node) {
 		dev_err(&pdev->dev, "Missing firmware node\n");
 		return -ENOENT;
Signature · 1 line
2.16.2
#1 lore raw

PATCH v3 2/6 staging: vc04_services: Remove cache-line-size property (v3)

It's been tempting to replace this with (L1) cache_line_size(), but that's really not what the value is about. It's about coordinating the condition for the pagelist fragment behavior between the two sides. However, the property was not accepted for the upstream DT binding, so we have to use the firmware's fallback value.

---

v2: Kept the property but added documentation.
v3: Remove the DT property again, more documentation.

 .../interface/vchiq_arm/vchiq_2835_arm.c             | 20 +++++++++++---------
 .../interface/vchiq_arm/vchiq_pagelist.h             |  1 -
 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +11 -9
index b59ef14890aa..afdd3e944f3f 100644
@@ -77,7 +77,17 @@ struct vchiq_pagelist_info {
 };
 
 static void __iomem *g_regs;
-static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE);
+/* This value is the size of the L2 cache lines as understood by the
+ * VPU firmware, which determines the required alignment of the
+ * offsets/sizes in pagelists.
+ *
+ * Modern VPU firmware looks for a DT "cache-line-size" property in
+ * the VCHIQ node and will overwrite it with the actual L2 cache size,
+ * which the kernel must then respect.  That property was rejected
+ * upstream, so we have to use the VPU firmware's compatibility value
+ * of 32.
+ */
+static unsigned int g_cache_line_size = 32;
 static unsigned int g_fragments_size;
 static char *g_fragments_base;
 static char *g_free_fragments;
@@ -117,14 +127,6 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
 	if (err < 0)
 		return err;
 
-	err = of_property_read_u32(dev->of_node, "cache-line-size",
-				   &g_cache_line_size);
-
-	if (err) {
-		dev_err(dev, "Missing cache-line-size property\n");
-		return -ENODEV;
-	}
-
 	g_fragments_size = 2 * g_cache_line_size;
 
 	/* Allocate space for the channels in coherent memory */
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h +0 -1
index a6c5f7cc78f0..bec411061554 100644
@@ -34,7 +34,6 @@
 #ifndef VCHIQ_PAGELIST_H
 #define VCHIQ_PAGELIST_H
 
-#define CACHE_LINE_SIZE 32
 #define PAGELIST_WRITE 0
 #define PAGELIST_READ 1
 #define PAGELIST_READ_WITH_FRAGMENTS 2
Signature · 1 line
2.16.2
#2 lore raw

PATCH v3 3/6 dt-bindings: soc: Add a binding for the Broadcom VCHIQ services. (v3)

In reply to Eric Anholt

The VCHIQ communication channel can be provided by BCM283x and Capri SoCs, to communicate with the VPU-side OS services.

---

v2: VCHI->VCHIQ, dropped firmware property, added cache-line-size
v3: Dropped cache-line-size, s/vchi@/mailbox@/

 .../devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +16 -0
new file mode 100644
index 000000000000..8dd7b3a7de65
@@ -0,0 +1,16 @@
+Broadcom VCHIQ firmware services
+
+Required properties:
+
+- compatible:	Should be "brcm,bcm2835-vchiq"
+- reg:		Physical base address and length of the doorbell register pair
+- interrupts:	The interrupt number
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Example:
+
+mailbox at 7e00b840 {
+	compatible = "brcm,bcm2835-vchiq";
+	reg = <0x7e00b840 0xf>;
+	interrupts = <0 2>;
+};
Signature · 1 line
2.16.2
#3 lore raw

Re: [PATCH v3 3/6] dt-bindings: soc: Add a binding for the Broadcom VCHIQ services. (v3)

Hi Eric,

Quoted 24 lines

Eric Anholt <[email protected]> hat am 9. M?rz 2018 um 19:44 geschrieben:

The VCHIQ communication channel can be provided by BCM283x and Capri SoCs, to communicate with the VPU-side OS services.

---

v2: VCHI->VCHIQ, dropped firmware property, added cache-line-size
v3: Dropped cache-line-size, s/vchi@/mailbox@/

 .../devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +2 -0
new file mode 100644
index 000000000000..8dd7b3a7de65
@@ -0,0 +1,16 @@
+Broadcom VCHIQ firmware services
+

Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +10 -0
+Required properties:
+
+- compatible:	Should be "brcm,bcm2835-vchiq"
+- reg:		Physical base address and length of the doorbell register pair
+- interrupts:	The interrupt number
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Example:
+
+mailbox at 7e00b840 {

just a question: do you think this is future-proof to claim the doorbell for VCHIQ?

Stefan

Quoted 12 lines
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +4 -0
+	compatible = "brcm,bcm2835-vchiq";
+	reg = <0x7e00b840 0xf>;
+	interrupts = <0 2>;
+};
Signature · 7 lines
2.16.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

Re: [PATCH v3 3/6] dt-bindings: soc: Add a binding for the Broadcom VCHIQ services. (v3)

Quoted 30 lines · Stefan Wahren

Hi Eric,

Quoted 28 lines

Eric Anholt <[email protected]> hat am 9. M?rz 2018 um 19:44 geschrieben:

The VCHIQ communication channel can be provided by BCM283x and Capri SoCs, to communicate with the VPU-side OS services.

---

v2: VCHI->VCHIQ, dropped firmware property, added cache-line-size
v3: Dropped cache-line-size, s/vchi@/mailbox@/

 .../devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +6 -0
new file mode 100644
index 000000000000..8dd7b3a7de65
@@ -0,0 +1,16 @@
+Broadcom VCHIQ firmware services
+
+Required properties:
+
+- compatible:	Should be "brcm,bcm2835-vchiq"
+- reg:		Physical base address and length of the doorbell register pair
Quoted 8 lines

Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt line 12

Quoted 6 lines
Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt new file +6 -0
+- interrupts:	The interrupt number
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Example:
+
+mailbox at 7e00b840 {

just a question: do you think this is future-proof to claim the doorbell for VCHIQ?

There are 4 and this is the only one used so far, so it seems terribly
unlikely to get reused. If the firmware did for some reason decide to
reuse it for something else, they'd surely go override the DT like they
have in the past.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180309/ccf9d466/attachment.sig>

maintainer Reviewed-by on v3 3/6
#5 lore raw

Re: [PATCH v3 3/6] dt-bindings: soc: Add a binding for the Broadcom VCHIQ services. (v3)

In reply to Eric Anholt
Quoted 4 lines · Eric Anholt

The VCHIQ communication channel can be provided by BCM283x and Capri SoCs, to communicate with the VPU-side OS services.

Quoted 8 lines

---

v2: VCHI->VCHIQ, dropped firmware property, added cache-line-size
v3: Dropped cache-line-size, s/vchi@/mailbox@/

 .../devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-vchiq.txt
#6 lore raw

PATCH v3 4/6 ARM: dts: bcm2835: Add VCHIQ node to the Raspberry Pi boards. (v3)

In reply to Eric Anholt

The VCHIQ firmware communication channel operates in parallel with our other mailbox-based channel. This is the communication channel that exposes the firmware's media decode/encode and ISP interfaces.

---

v2: dropped firmware property, added cache-line-size.
v3: dropped cache-line-size, s/vchi@/mailbox@/

 arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +6 -0
index e36c392a2b8f..593f58d4ac0f 100644
@@ -27,6 +27,12 @@
 			firmware = <&firmware>;
 			#power-domain-cells = <1>;
 		};
+
+		mailbox at 7e00b840 {
+			compatible = "brcm,bcm2835-vchiq";
+			reg = <0x7e00b840 0xf>;
+			interrupts = <0 2>;
+		};
 	};
 };
 
Signature · 1 line
2.16.2
#7 lore raw

PATCH v3 5/6 staging: vc04_services: Mark the "DT bindings" job done.

In reply to Eric Anholt

Now we just need to get the other drivers merged and finish the style cleanups/garbage collecting so we can get out of staging.

---

v2-3: no changes

 drivers/staging/vc04_services/interface/vchi/TODO | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/vc04_services/interface/vchi/TODO +2 -7
index df93154b1aa6..46b20a1961a2 100644
@@ -1,9 +1,4 @@
-1) Write a DT binding doc and get the corresponding DT node merged to
-   bcm2835.
-
-This will let the driver probe when enabled.
-
-2) Import drivers using VCHI.
+1) Import drivers using VCHI.
 
 VCHI is just a tool to let drivers talk to the firmware.  Here are
 some of the ones we want:
@@ -26,7 +21,7 @@ some of the ones we want:
   to manage these buffers as dmabufs so that we can zero-copy import
   camera images into vc4 for rendering/display.
 
-3) Garbage-collect unused code
+2) Garbage-collect unused code
 
 One of the reasons this driver wasn't upstreamed previously was that
 there's a lot code that got built that's probably unnecessary these
Signature · 1 line
2.16.2
#8 lore raw

PATCH v3 6/6 staging: vc04_services: Remove vchiq_queue_bulk_{transmit,receive}.

In reply to Eric Anholt

These are dead code, including in the downstream Raspberry Pi tree.

---

v2-3: no changes

 .../vc04_services/interface/vchiq_arm/vchiq_arm.c    | 20 --------------------
 .../vc04_services/interface/vchiq_arm/vchiq_if.h     | 10 ----------
 2 files changed, 30 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0 -20
index 8068c0308b34..24d456b0a6f0 100644
@@ -406,26 +406,6 @@ VCHIQ_STATUS_T vchiq_open_service(
 }
 EXPORT_SYMBOL(vchiq_open_service);
 
-VCHIQ_STATUS_T
-vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle,
-	const void *data, unsigned int size, void *userdata)
-{
-	return vchiq_bulk_transfer(handle,
-		VCHI_MEM_HANDLE_INVALID, (void *)data, size, userdata,
-		VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_TRANSMIT);
-}
-EXPORT_SYMBOL(vchiq_queue_bulk_transmit);
-
-VCHIQ_STATUS_T
-vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T handle, void *data,
-	unsigned int size, void *userdata)
-{
-	return vchiq_bulk_transfer(handle,
-		VCHI_MEM_HANDLE_INVALID, data, size, userdata,
-		VCHIQ_BULK_MODE_CALLBACK, VCHIQ_BULK_RECEIVE);
-}
-EXPORT_SYMBOL(vchiq_queue_bulk_receive);
-
 VCHIQ_STATUS_T
 vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T handle, const void *data,
 	unsigned int size, void *userdata, VCHIQ_BULK_MODE_T mode)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +0 -10
index 0e270852900d..e4109a83e628 100644
@@ -149,16 +149,6 @@ vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle,
 		    size_t size);
 extern void           vchiq_release_message(VCHIQ_SERVICE_HANDLE_T service,
 	VCHIQ_HEADER_T *header);
-extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service,
-	const void *data, unsigned int size, void *userdata);
-extern VCHIQ_STATUS_T vchiq_queue_bulk_receive(VCHIQ_SERVICE_HANDLE_T service,
-	void *data, unsigned int size, void *userdata);
-extern VCHIQ_STATUS_T vchiq_queue_bulk_transmit_handle(
-	VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle,
-	const void *offset, unsigned int size, void *userdata);
-extern VCHIQ_STATUS_T vchiq_queue_bulk_receive_handle(
-	VCHIQ_SERVICE_HANDLE_T service, VCHI_MEM_HANDLE_T handle,
-	void *offset, unsigned int size, void *userdata);
 extern VCHIQ_STATUS_T vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE_T service,
 	const void *data, unsigned int size, void *userdata,
 	VCHIQ_BULK_MODE_T mode);
Signature · 1 line
2.16.2