public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Georgi Djakov <quic_c_gdjako@quicinc.com>
Cc: krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	will@kernel.org, robin.murphy@arm.com, joro@8bytes.org,
	devicetree@vger.kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, quic_cgoldswo@quicinc.com,
	quic_sukadev@quicinc.com, quic_pdaly@quicinc.com,
	quic_sudaraja@quicinc.com, djakov@kernel.org
Subject: Re: [PATCH v3 1/9] dt-bindings: iommu: Add Translation Buffer Unit bindings
Date: Thu, 21 Dec 2023 08:25:31 -0600	[thread overview]
Message-ID: <20231221142531.GA3730284-robh@kernel.org> (raw)
In-Reply-To: <20231220060236.18600-2-quic_c_gdjako@quicinc.com>

On Tue, Dec 19, 2023 at 10:02:28PM -0800, Georgi Djakov wrote:
> The "apps_smmu" on the Qualcomm sdm845 platform is an implementation
> of the SMMU-500, that consists of a single TCU (Translation Control
> Unit) and multiple TBUs (Translation Buffer Units). The TCU is already
> being described in the generic SMMU DT schema. Add bindings for the
> TBUs to describe their properties and resources that needs to be
> managed in order to operate them.
> 
> In this DT schema, the TBUs are modelled as child devices of the TCU
> and each of them is described with it's register space, clocks, power
> domains, interconnects etc.
> 
> Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
> ---
>  .../devicetree/bindings/iommu/arm,smmu.yaml   | 31 ++++++++
>  .../bindings/iommu/qcom,qsmmuv500-tbu.yaml    | 77 +++++++++++++++++++
>  2 files changed, 108 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iommu/qcom,qsmmuv500-tbu.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> index a4042ae24770..a610af2c7e5e 100644
> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> @@ -235,6 +235,27 @@ properties:
>        enabled for any given device.
>      $ref: /schemas/types.yaml#/definitions/phandle
>  
> +  '#address-cells':
> +    enum: [ 1, 2 ]
> +
> +  '#size-cells':
> +    enum: [ 1, 2 ]
> +
> +  ranges: true
> +
> +patternProperties:
> +  "^tbu@[0-9a-f]+":

Missing '$' on the end.

> +    description: The TBU child node(s)
> +    type: object
> +
> +    properties:
> +      stream-id-range:
> +        $ref: /schemas/types.yaml#/definitions/uint32-array
> +        description: Stream ID range (address and size) that is assigned by the TBU
> +        items:
> +          minItems: 2
> +          maxItems: 2

This is allowing any property in the TBU nodes. This all needs to move 
to a separate TBU schema.

> +
>  required:
>    - compatible
>    - reg
> @@ -312,6 +333,16 @@ allOf:
>                      through the TCU's programming interface.
>                  - description: bus clock required for the smmu ptw
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: qcom,sdm845-smmu-500
> +    then:
> +      patternProperties:
> +        "^tbu@[0-9a-f]+":
> +          $ref: qcom,qsmmuv500-tbu.yaml

TBU nodes are allowed for all other SMMUs. Is that your intent? If not, 
then the node definition up above should be removed and you would just 
have this if/then schema.

> +
>    - if:
>        properties:
>          compatible:
> diff --git a/Documentation/devicetree/bindings/iommu/qcom,qsmmuv500-tbu.yaml b/Documentation/devicetree/bindings/iommu/qcom,qsmmuv500-tbu.yaml
> new file mode 100644
> index 000000000000..c4f148ae5f38
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iommu/qcom,qsmmuv500-tbu.yaml
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iommu/qcom,qsmmuv500-tbu.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm TBU (Translation Buffer Unit)
> +
> +maintainers:
> +  - Georgi Djakov <quic_c_gdjako@quicinc.com>
> +
> +description:
> +  The Qualcomm SMMU500 implementation consists of TCU and TBU. The TBU contains
> +  a Translation Lookaside Buffer (TLB) that caches page tables. TBUs provides
> +  debug features to trace and trigger debug transactions. There are multiple TBU
> +  instances distributes with each client core.
> +
> +properties:
> +
> +  compatible:
> +    const: qcom,qsmmuv500-tbu
> +
> +  reg:
> +    items:
> +      - description: Address and size of the TBU's register space.
> +
> +  clocks:
> +    maxItems: 1
> +
> +  interconnects:
> +    maxItems: 1
> +
> +  power-domains:
> +    maxItems: 1
> +
> +  stream-id-range:
> +    $ref: "arm,smmu.yaml#/patternProperties/^tbu@[0-9a-f]+/properties/stream-id-range"

No. We generally don't reference properties this way. Partly because not 
all regex's work as a path.

You need a base TBU schema of the common properties that is referenced 
at the top level here. That should also solve the above problem.

> +
> +required:
> +  - compatible
> +  - reg
> +  - stream-id-range
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/qcom,gcc-sdm845.h>
> +    #include <dt-bindings/interconnect/qcom,icc.h>
> +    #include <dt-bindings/interconnect/qcom,sdm845.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/power/qcom-rpmpd.h>
> +
> +    apps_smmu: iommu@15000000 {

Drop unused labels.

> +        compatible = "qcom,sdm845-smmu-500", "arm,mmu-500";
> +        reg = <0x15000000 0x80000>;
> +        ranges = <0 0 0 0 0xffffffff>;
> +        #iommu-cells = <2>;
> +        #global-interrupts = <1>;
> +        interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>,
> +                     <GIC_SPI 343 IRQ_TYPE_LEVEL_HIGH>;
> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        anoc_1_pcie_tbu: tbu@150e1000 {
> +            compatible = "qcom,qsmmuv500-tbu";
> +            reg = <0x0 0x150e1000 0x0 0x1000>;
> +            clocks = <&gcc GCC_AGGRE_NOC_PCIE_TBU_CLK>;
> +            interconnects = <&system_noc MASTER_GNOC_SNOC QCOM_ICC_TAG_ACTIVE_ONLY
> +                             &config_noc SLAVE_IMEM_CFG QCOM_ICC_TAG_ACTIVE_ONLY>;
> +            power-domains = <&gcc HLOS1_VOTE_AGGRE_NOC_MMU_PCIE_TBU_GDSC>;
> +            stream-id-range = <0x1c00 0x400>;
> +        };
> +    };
> +
> +...

  reply	other threads:[~2023-12-21 14:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  6:02 [PATCH v3 0/9] Add support for Translation Buffer Units Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 1/9] dt-bindings: iommu: Add Translation Buffer Unit bindings Georgi Djakov
2023-12-21 14:25   ` Rob Herring [this message]
2023-12-20  6:02 ` [PATCH v3 2/9] iommu/arm-smmu-qcom: Add support for TBUs Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 3/9] iommu/arm-smmu-qcom-tbu: Add Qualcomm TBU driver Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 4/9] iommu/arm-smmu: Allow using a threaded handler for context interrupts Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 5/9] iommu/arm-smmu-qcom: Use a custom context fault handler for sdm845 Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 6/9] arm64: dts: qcom: sdm845: Add DT nodes for the TBUs Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 7/9] dt-bindings: arm-smmu: Add TBU support for sc7280 Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 8/9] iommu/arm-smmu-qcom: Use the custom fault handler on more platforms Georgi Djakov
2023-12-20  6:02 ` [PATCH v3 9/9] arm64: dts: qcom: sc7280: Add DT nodes for the TBUs Georgi Djakov

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=20231221142531.GA3730284-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_c_gdjako@quicinc.com \
    --cc=quic_cgoldswo@quicinc.com \
    --cc=quic_pdaly@quicinc.com \
    --cc=quic_sudaraja@quicinc.com \
    --cc=quic_sukadev@quicinc.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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