devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Mike Leach <mike.leach@linaro.org>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Coresight ML <coresight@lists.linaro.org>,
	devicetree@vger.kernel.org,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	"Suzuki K. Poulose" <suzuki.poulose@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	agross@kernel.org
Subject: Re: [PATCH v6 05/15] dt-bindings: arm: Adds CoreSight CTI hardware definitions.
Date: Sat, 14 Dec 2019 21:26:31 +0100	[thread overview]
Message-ID: <20191214202631.2h7jzfafkdqew2js@gilmour.lan> (raw)
In-Reply-To: <CAJ9a7VjhbAxmJPc1TT2EfzEC6EPinf7Kq8qbv1ZQ-_S0qmfXow@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 8012 bytes --]

On Fri, Dec 13, 2019 at 03:04:35PM +0000, Mike Leach wrote:
> > > +    type: object
> > > +    description:
> > > +      A trigger connections child node which describes the trigger signals
> > > +      between this CTI and another hardware device. This device may be a CPU,
> > > +      CoreSight device, any other hardware device or simple external IO lines.
> > > +      The connection may have both input and output triggers, or only one or the
> > > +      other.
> > > +
> > > +    properties:
> > > +
> > > +      arm,trig-in-sigs:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +        minItems: 1
> > > +        maxItems: 32
> > > +        description:
> > > +          List of CTI trigger in signal numbers in use by a trig-conns node.
> > > +
> > > +      arm,trig-in-types:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +        minItems: 1
> > > +        maxItems: 32
> > > +        description:
> > > +          List of constants representing the types for the CTI trigger in
> > > +          signals. Types in this array match to the corresponding signal in the
> > > +          arm,trig-in-sigs array. If the -types array is smaller, or omitted
> > > +          completely, then the types will default to GEN_IO.
> > > +
> > > +      arm,trig-out-sigs:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +        minItems: 1
> > > +        maxItems: 32
> > > +        description:
> > > +          List of CTI trigger out signal numbers in use by a trig-conns node.
> > > +
> > > +      arm,trig-out-types:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +        minItems: 1
> > > +        maxItems: 32
> > > +        description:
> > > +          List of constants representing the types for the CTI trigger out
> > > +          signals. Types in this array match to the corresponding signal
> > > +          in the arm,trig-out-sigs array. If the "-types" array is smaller,
> > > +          or omitted completely, then the types will default to GEN_IO.
> > > +
> > > +      arm,trig-filters:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +        minItems: 1
> > > +        maxItems: 32
> > > +        description:
> > > +          List of CTI trigger out signals that will be blocked from becoming
> > > +          active, unless filtering is disabled on the driver.
> > > +
> > > +      arm,trig-conn-name:
> > > +        allOf:
> > > +          - $ref: /schemas/types.yaml#/definitions/string
> > > +        description:
> > > +          Defines a connection name that will be displayed, if the cpu or
> > > +          arm,cs-dev-assoc properties are not being used in this connection.
> > > +          Principle use for CTI that are connected to non-CoreSight devices, or
> > > +          external IO.
> > > +
> > > +    anyOf:
> > > +      - required:
> > > +        - arm,trig-in-sigs
> > > +      - required:
> > > +        - arm,trig-out-sigs
> > > +    oneOf:
> > > +      - required:
> > > +        - arm,trig-conn-name
> > > +      - required:
> > > +        - cpu
> > > +      - required:
> > > +        - arm,cs-dev-assoc
> >
> > This would mean that either arm,trig-conn-name, cpu xor
> > arm,cs-dev-assoc is required in the trig_conn child nodes, but they
> > don't seem to be defined at this level but in the parent node?
> >
>
> cpu and rm,cs-dev-assoc can appear in the parent node if the
> arm,coresight-cti-v8-arch compatible string is used - hence declared
> at that level. See the examples for the v8 compatible layout.
>
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> > > +  - clock-names
> > > +
> > > +examples:
> > > +  # minimum CTI definition. DEVID register used to set number of triggers.
> > > +  - |
> > > +    cti@20020000 {
> > > +      compatible = "arm,coresight-cti", "arm,primecell";
> > > +      reg = <0x20020000 0x1000>;
> > > +
> > > +      clocks = <&soc_smc50mhz>;
> > > +      clock-names = "apb_pclk";
> > > +    };
> > > +  #  v8 architecturally defined CTI - CPU + ETM connections generated by the
> > > +  #  driver according to the v8 architecture specification.
> > > +  - |
> > > +    cti@859000 {
> > > +      compatible = "arm,coresight-cti-v8-arch", "arm,coresight-cti",
> > > +                   "arm,primecell";
> > > +      reg = <0x859000 0x1000>;
> > > +
> > > +      clocks = <&soc_smc50mhz>;
> > > +      clock-names = "apb_pclk";
> > > +
> > > +      cpu = <&CPU1>;
> > > +      arm,cs-dev-assoc = <&etm1>;
> >
> > and it looks like arm,cs-dev-assoc and cpu can be combined?
> >
> Absolutely - a CTI can and is connected to both the CPU and an
> optional ETM attached to the CPU in a v8 architecture system.

That's not what

> > > +    oneOf:
> > > +      - required:
> > > +        - arm,trig-conn-name
> > > +      - required:
> > > +        - cpu
> > > +      - required:
> > > +        - arm,cs-dev-assoc

Is saying though. oneOf is a xor, you can have one of the three
schemas that are valid, but not more than that.

> > > +    };
> > > +  # Implementation defined CTI - CPU + ETM connections explicitly defined..
> > > +  # Shows use of type constants from dt-bindings/arm/coresight-cti-dt.h
> > > +  - |
> > > +    #include <dt-bindings/arm/coresight-cti-dt.h>
> > > +
> > > +    cti@858000 {
> > > +      compatible = "arm,coresight-cti", "arm,primecell";
> > > +      reg = <0x858000 0x1000>;
> > > +
> > > +      clocks = <&soc_smc50mhz>;
> > > +      clock-names = "apb_pclk";
> > > +
> > > +      arm,cti-ctm-id = <1>;
> > > +
> > > +      trig-conns@0 {
> >
> > So, what I think happened here is that your patternProperties doesn't
> > match anything (underscore vs dash), and since you don't have
> > additionalProperties set to false, it doesn't warn that there's
> > properties that aren't defined in the binding. Meaning that none of
> > the child nodes in the bindings are effectively validated.
> >
>
> OK - fixing the name should fix this.
> I can't use additionalProperties as this is prohibited for bindings
> that use ref: (according to the example-schema.yaml)

Ah right, I missed that one, sorry. In this case, you can use the
keyword unevaluatedProperties instead. As its name suggests, it will
report an error if there's a property that hasn't been validated by
any schemas.

Note that this is a keyword introduced by the latest schemas spec
(draft 2019-09) which isn't supported by the DT tools yet. But putting
it into your schema will at least allow to have that check when the
tools will support it.

> > > +            arm,trig-in-sigs = <4 5 6 7>;
> > > +            arm,trig-in-types = <ETM_EXTOUT
> > > +                                 ETM_EXTOUT
> > > +                                 ETM_EXTOUT
> > > +                                 ETM_EXTOUT>;
> > > +            arm,trig-out-sigs = <4 5 6 7>;
> > > +            arm,trig-out-types = <ETM_EXTIN
> > > +                                  ETM_EXTIN
> > > +                                  ETM_EXTIN
> > > +                                  ETM_EXTIN>;
> > > +            arm,cs-dev-assoc = <&etm0>;
> > > +      };
> >
> > Nodes with unit-address must have a matching reg property. This will
> > generate a dtc warning too.
>
> That's interesting - I don't get any dtc warnings when compiling or
> when running make dt_binding_checl

Linux disables a lot of DTC warnings. You can see all (I think?) the
warnings by passing W=1 in the environment when you compile the device
trees.

> Is this rule documented anywhere? I cannot see it in the 0.2 spec
> version from devicetree.org or any of the examples / docs in the
> kernel tree.

The commit adding it to DTC is this one
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=852e9ecbe1976927057402f8a8f71ee8e8a49098

It just seems that while valid, it's against best practices.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2019-12-14 20:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 23:08 [PATCH v6 05/15] dt-bindings: arm: Adds CoreSight CTI hardware definitions Mike Leach
2019-12-13 11:40 ` Maxime Ripard
2019-12-13 15:04   ` Mike Leach
2019-12-14 20:26     ` Maxime Ripard [this message]
2019-12-16 19:09       ` Mike Leach
2019-12-17 11:42 ` Suzuki Kuruppassery Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191214202631.2h7jzfafkdqew2js@gilmour.lan \
    --to=maxime@cerno.tech \
    --cc=agross@kernel.org \
    --cc=coresight@lists.linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).