diff mbox series

[v3,1/3] dt-bindings: mailbox: Add mediatek,gce-props.yaml

Message ID 20240119063224.29671-2-jason-jh.lin@mediatek.com
State Superseded
Headers show
Series Add mediatek,gce-props.yaml for other bindings reference | expand

Commit Message

Jason-JH.Lin Jan. 19, 2024, 6:32 a.m. UTC
Add mediatek,gce-props.yaml for common GCE properties that is used for
both mailbox providers and consumers. We place the common property
"mediatek,gce-events" in this binding currently.

The property "mediatek,gce-events" is used for GCE event ID corresponding
to a hardware event signal sent by the hardware or a sofware driver.
If the mailbox providers or consumers want to manipulate the value of
the event ID, they need to know the specific event ID.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
---
 .../bindings/mailbox/mediatek,gce-props.yaml  | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml

Comments

AngeloGioacchino Del Regno Jan. 19, 2024, 10:53 a.m. UTC | #1
Il 19/01/24 07:32, Jason-JH.Lin ha scritto:
> Add mediatek,gce-props.yaml for common GCE properties that is used for
> both mailbox providers and consumers. We place the common property
> "mediatek,gce-events" in this binding currently.
> 
> The property "mediatek,gce-events" is used for GCE event ID corresponding
> to a hardware event signal sent by the hardware or a sofware driver.
> If the mailbox providers or consumers want to manipulate the value of
> the event ID, they need to know the specific event ID.
> 
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> ---
>   .../bindings/mailbox/mediatek,gce-props.yaml  | 52 +++++++++++++++++++
>   1 file changed, 52 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> new file mode 100644
> index 000000000000..68b519ff089f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mailbox/mediatek,gce-props.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek Global Command Engine Common Propertes
> +
> +maintainers:
> +  - Houlong Wei <houlong.wei@mediatek.com>
> +
> +description:
> +  The Global Command Engine (GCE) is an instruction based, multi-threaded,
> +  single-core command dispatcher for MediaTek hardware. The Command Queue
> +  (CMDQ) mailbox driver is a driver for GCE, implemented using the Linux
> +  mailbox framework. It is used to receive messages from mailbox consumers
> +  and configure GCE to execute the specified instruction set in the message.
> +  We use mediatek,gce-mailbox.yaml to define the properties for CMDQ mailbox
> +  driver. A device driver that uses the CMDQ driver to configure its hardware
> +  registers is a mailbox consumer. The mailbox consumer can request a mailbox
> +  channel corresponding to a GCE hardware thread to send a message, specifying
> +  that the GCE thread to configure its hardware. The mailbox provider can also
> +  reserved a mailbox channel to configure GCE hardware register by the spcific
> +  GCE thread. This binding defines the common GCE properties for both mailbox
> +  provider and consumers.
> +
> +properties:
> +  mediatek,gce-events:
> +    description:
> +      GCE has an event table in SRAM, consisting of 1024 event IDs (0~1023).
> +      Each event ID has a boolean event value with the default value 0.
> +      The property mediatek,gce-events is used to obtain the event IDs.
> +      Some gce-events are hardware-bound and cannot be changed by software.
> +      For instance, in MT8195, when VDO0_MUTEX is stream done, VDO_MUTEX will
> +      send an event signal to GCE, setting the value of event ID 597 to 1.
> +      Similarly, in MT8188, the value of event ID 574 will be set to 1 when
> +      VOD0_MUTEX is stream done.
> +      On the other hand, some gce-events are not hardware-bound and can be
> +      changed by software. For example, in MT8188, we can set the value of
> +      event ID 855, which is not bound to any hardware, to 1 when the driver
> +      in the secure world completes a task. However, in MT8195, event ID 855
> +      is already bound to VDEC_LAT1, so we need to select another event ID to
> +      achieve the same purpose. This event ID can be any ID that is not bound
> +      to any hardware and is not yet used in any software driver.
> +      To determine if the event ID is bound to the hardware or used by a
> +      software driver, refer to the GCE header
> +      include/dt-bindings/gce/<chip>-gce.h of each chip.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 1
> +    maxItems: 1024

maxItems: 1024 seems to be a bit too many... this means that one devicetree node
may have up to 1024 gce events, which is impossible! If a driver needed all of
the 1024 events, this means that it's not an user of the GCE, but the GCE itself!

Imagine seeing a devicetree node with 1024 array entries for mediatek,gce-events...

I'd set that to a more sensible value of 32 - eventually we can extend it later,
if ever needed.

Besides, nice job about all this documentation of the GCE and its events: love it!

Cheers,
Angelo
Conor Dooley Jan. 19, 2024, 4:44 p.m. UTC | #2
Rob,

On Fri, Jan 19, 2024 at 02:32:22PM +0800, Jason-JH.Lin wrote:
> Add mediatek,gce-props.yaml for common GCE properties that is used for
> both mailbox providers and consumers. We place the common property
> "mediatek,gce-events" in this binding currently.
> 
> The property "mediatek,gce-events" is used for GCE event ID corresponding
> to a hardware event signal sent by the hardware or a sofware driver.
> If the mailbox providers or consumers want to manipulate the value of
> the event ID, they need to know the specific event ID.
> 
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> ---
>  .../bindings/mailbox/mediatek,gce-props.yaml  | 52 +++++++++++++++++++

Is bindings/mailbox the correct directory to put this in?

>  1 file changed, 52 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> new file mode 100644
> index 000000000000..68b519ff089f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mailbox/mediatek,gce-props.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek Global Command Engine Common Propertes
> +
> +maintainers:
> +  - Houlong Wei <houlong.wei@mediatek.com>
> +
> +description:
> +  The Global Command Engine (GCE) is an instruction based, multi-threaded,
> +  single-core command dispatcher for MediaTek hardware. The Command Queue
> +  (CMDQ) mailbox driver is a driver for GCE, implemented using the Linux
> +  mailbox framework. It is used to receive messages from mailbox consumers
> +  and configure GCE to execute the specified instruction set in the message.
> +  We use mediatek,gce-mailbox.yaml to define the properties for CMDQ mailbox
> +  driver. A device driver that uses the CMDQ driver to configure its hardware
> +  registers is a mailbox consumer. The mailbox consumer can request a mailbox
> +  channel corresponding to a GCE hardware thread to send a message, specifying
> +  that the GCE thread to configure its hardware. The mailbox provider can also
> +  reserved a mailbox channel to configure GCE hardware register by the spcific
> +  GCE thread. This binding defines the common GCE properties for both mailbox
> +  provider and consumers.
> +
> +properties:
> +  mediatek,gce-events:
> +    description:
> +      GCE has an event table in SRAM, consisting of 1024 event IDs (0~1023).
> +      Each event ID has a boolean event value with the default value 0.
> +      The property mediatek,gce-events is used to obtain the event IDs.
> +      Some gce-events are hardware-bound and cannot be changed by software.
> +      For instance, in MT8195, when VDO0_MUTEX is stream done, VDO_MUTEX will
> +      send an event signal to GCE, setting the value of event ID 597 to 1.
> +      Similarly, in MT8188, the value of event ID 574 will be set to 1 when
> +      VOD0_MUTEX is stream done.
> +      On the other hand, some gce-events are not hardware-bound and can be
> +      changed by software. For example, in MT8188, we can set the value of
> +      event ID 855, which is not bound to any hardware, to 1 when the driver
> +      in the secure world completes a task. However, in MT8195, event ID 855
> +      is already bound to VDEC_LAT1, so we need to select another event ID to
> +      achieve the same purpose. This event ID can be any ID that is not bound
> +      to any hardware and is not yet used in any software driver.
> +      To determine if the event ID is bound to the hardware or used by a
> +      software driver, refer to the GCE header
> +      include/dt-bindings/gce/<chip>-gce.h of each chip.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 1
> +    maxItems: 1024
> +
> +additionalProperties: true
> -- 
> 2.18.0
>
Jason-JH.Lin Jan. 20, 2024, 9:48 a.m. UTC | #3
Hi Angelo,

Thanks for the reviews.

On Fri, 2024-01-19 at 11:53 +0100, AngeloGioacchino Del Regno wrote:
> Il 19/01/24 07:32, Jason-JH.Lin ha scritto:
> > Add mediatek,gce-props.yaml for common GCE properties that is used
> > for
> > both mailbox providers and consumers. We place the common property
> > "mediatek,gce-events" in this binding currently.
> > 
> > The property "mediatek,gce-events" is used for GCE event ID
> > corresponding
> > to a hardware event signal sent by the hardware or a sofware
> > driver.
> > If the mailbox providers or consumers want to manipulate the value
> > of
> > the event ID, they need to know the specific event ID.
> > 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> >   .../bindings/mailbox/mediatek,gce-props.yaml  | 52
> > +++++++++++++++++++
> >   1 file changed, 52 insertions(+)
> >   create mode 100644
> > Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml 
> > b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
> > new file mode 100644
> > index 000000000000..68b519ff089f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mailbox/mediatek,gce-
> > props.yaml
> > @@ -0,0 +1,52 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: 
> > https://urldefense.com/v3/__http://devicetree.org/schemas/mailbox/mediatek,gce-props.yaml*__;Iw!!CTRNKA9wMg0ARbw!kMCkhwQ_az8HouSQgqMuDC5QpKFizQrWMlwaWPfYp1GphlueXVfPfS9FA83806_7K_qqcfHOaprqAWNOoBkzsTJNUSZpugRS_Q$
> >  
> > +$schema: 
> > https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!kMCkhwQ_az8HouSQgqMuDC5QpKFizQrWMlwaWPfYp1GphlueXVfPfS9FA83806_7K_qqcfHOaprqAWNOoBkzsTJNUSYsot_sog$
> >  
> > +
> > +title: MediaTek Global Command Engine Common Propertes
> > +
> > +maintainers:
> > +  - Houlong Wei <houlong.wei@mediatek.com>
> > +
> > +description:
> > +  The Global Command Engine (GCE) is an instruction based, multi-
> > threaded,
> > +  single-core command dispatcher for MediaTek hardware. The
> > Command Queue
> > +  (CMDQ) mailbox driver is a driver for GCE, implemented using the
> > Linux
> > +  mailbox framework. It is used to receive messages from mailbox
> > consumers
> > +  and configure GCE to execute the specified instruction set in
> > the message.
> > +  We use mediatek,gce-mailbox.yaml to define the properties for
> > CMDQ mailbox
> > +  driver. A device driver that uses the CMDQ driver to configure
> > its hardware
> > +  registers is a mailbox consumer. The mailbox consumer can
> > request a mailbox
> > +  channel corresponding to a GCE hardware thread to send a
> > message, specifying
> > +  that the GCE thread to configure its hardware. The mailbox
> > provider can also
> > +  reserved a mailbox channel to configure GCE hardware register by
> > the spcific
> > +  GCE thread. This binding defines the common GCE properties for
> > both mailbox
> > +  provider and consumers.
> > +
> > +properties:
> > +  mediatek,gce-events:
> > +    description:
> > +      GCE has an event table in SRAM, consisting of 1024 event IDs
> > (0~1023).
> > +      Each event ID has a boolean event value with the default
> > value 0.
> > +      The property mediatek,gce-events is used to obtain the event
> > IDs.
> > +      Some gce-events are hardware-bound and cannot be changed by
> > software.
> > +      For instance, in MT8195, when VDO0_MUTEX is stream done,
> > VDO_MUTEX will
> > +      send an event signal to GCE, setting the value of event ID
> > 597 to 1.
> > +      Similarly, in MT8188, the value of event ID 574 will be set
> > to 1 when
> > +      VOD0_MUTEX is stream done.
> > +      On the other hand, some gce-events are not hardware-bound
> > and can be
> > +      changed by software. For example, in MT8188, we can set the
> > value of
> > +      event ID 855, which is not bound to any hardware, to 1 when
> > the driver
> > +      in the secure world completes a task. However, in MT8195,
> > event ID 855
> > +      is already bound to VDEC_LAT1, so we need to select another
> > event ID to
> > +      achieve the same purpose. This event ID can be any ID that
> > is not bound
> > +      to any hardware and is not yet used in any software driver.
> > +      To determine if the event ID is bound to the hardware or
> > used by a
> > +      software driver, refer to the GCE header
> > +      include/dt-bindings/gce/<chip>-gce.h of each chip.
> > +    $ref: /schemas/types.yaml#/definitions/uint32-array
> > +    minItems: 1
> > +    maxItems: 1024
> 
> maxItems: 1024 seems to be a bit too many... this means that one
> devicetree node
> may have up to 1024 gce events, which is impossible! If a driver
> needed all of
> the 1024 events, this means that it's not an user of the GCE, but the
> GCE itself!
> 
> Imagine seeing a devicetree node with 1024 array entries for
> mediatek,gce-events...
> 
Yes, that's impossible to set up to 1024 array entries.
I just have used the maximum value to cover all the possible cases.

> I'd set that to a more sensible value of 32 - eventually we can
> extend it later,
> if ever needed.
> 
OK, I agree with that!
I'll change the maxItems to 32.

> Besides, nice job about all this documentation of the GCE and its
> events: love it!
> 
I'm appreciate you love it :)

Regards,
Jason-JH.Lin

> Cheers,
> Angelo
> 
>
Conor Dooley Jan. 23, 2024, 5:01 p.m. UTC | #4
On Mon, Jan 22, 2024 at 11:38:15AM +0100, AngeloGioacchino Del Regno wrote:
> Il 19/01/24 17:44, Conor Dooley ha scritto:
> > Rob,
> > 
> > On Fri, Jan 19, 2024 at 02:32:22PM +0800, Jason-JH.Lin wrote:
> > > Add mediatek,gce-props.yaml for common GCE properties that is used for
> > > both mailbox providers and consumers. We place the common property
> > > "mediatek,gce-events" in this binding currently.
> > > 
> > > The property "mediatek,gce-events" is used for GCE event ID corresponding
> > > to a hardware event signal sent by the hardware or a sofware driver.
> > > If the mailbox providers or consumers want to manipulate the value of
> > > the event ID, they need to know the specific event ID.
> > > 
> > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > > ---
> > >   .../bindings/mailbox/mediatek,gce-props.yaml  | 52 +++++++++++++++++++
> > 
> > Is bindings/mailbox the correct directory to put this in?
> > 
> 
> Well, the GCE is a mailbox :-)
> 
> ...but I get why you're asking... and I don't think that this should go to
> arm/mediatek/ as it's really just only referring to extra properties for kind of
> "special" mailbox client events...

gce is a mailbox, but this isn't a binding for the mailbox itself, hence
me wondering. I haven't been able to think of something better though,
so
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
new file mode 100644
index 000000000000..68b519ff089f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/mediatek,gce-props.yaml
@@ -0,0 +1,52 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/mediatek,gce-props.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Global Command Engine Common Propertes
+
+maintainers:
+  - Houlong Wei <houlong.wei@mediatek.com>
+
+description:
+  The Global Command Engine (GCE) is an instruction based, multi-threaded,
+  single-core command dispatcher for MediaTek hardware. The Command Queue
+  (CMDQ) mailbox driver is a driver for GCE, implemented using the Linux
+  mailbox framework. It is used to receive messages from mailbox consumers
+  and configure GCE to execute the specified instruction set in the message.
+  We use mediatek,gce-mailbox.yaml to define the properties for CMDQ mailbox
+  driver. A device driver that uses the CMDQ driver to configure its hardware
+  registers is a mailbox consumer. The mailbox consumer can request a mailbox
+  channel corresponding to a GCE hardware thread to send a message, specifying
+  that the GCE thread to configure its hardware. The mailbox provider can also
+  reserved a mailbox channel to configure GCE hardware register by the spcific
+  GCE thread. This binding defines the common GCE properties for both mailbox
+  provider and consumers.
+
+properties:
+  mediatek,gce-events:
+    description:
+      GCE has an event table in SRAM, consisting of 1024 event IDs (0~1023).
+      Each event ID has a boolean event value with the default value 0.
+      The property mediatek,gce-events is used to obtain the event IDs.
+      Some gce-events are hardware-bound and cannot be changed by software.
+      For instance, in MT8195, when VDO0_MUTEX is stream done, VDO_MUTEX will
+      send an event signal to GCE, setting the value of event ID 597 to 1.
+      Similarly, in MT8188, the value of event ID 574 will be set to 1 when
+      VOD0_MUTEX is stream done.
+      On the other hand, some gce-events are not hardware-bound and can be
+      changed by software. For example, in MT8188, we can set the value of
+      event ID 855, which is not bound to any hardware, to 1 when the driver
+      in the secure world completes a task. However, in MT8195, event ID 855
+      is already bound to VDEC_LAT1, so we need to select another event ID to
+      achieve the same purpose. This event ID can be any ID that is not bound
+      to any hardware and is not yet used in any software driver.
+      To determine if the event ID is bound to the hardware or used by a
+      software driver, refer to the GCE header
+      include/dt-bindings/gce/<chip>-gce.h of each chip.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 1024
+
+additionalProperties: true