Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp182172rdb; Thu, 21 Dec 2023 06:25:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8EGkuw99l/REcPZorxSi+WQaez+oz4voYRDO40CeAxNSfNZm6ZZLagwyZoDDZdYB1se1Q X-Received: by 2002:ac2:4555:0:b0:50e:2737:f603 with SMTP id j21-20020ac24555000000b0050e2737f603mr3633847lfm.48.1703168746776; Thu, 21 Dec 2023 06:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703168746; cv=none; d=google.com; s=arc-20160816; b=C1/PoXheVyacZHZr26KluDX3Zm9lYPu2NiNt+mR8+uOMOFHFNIuM8aj6ky8YUthbMf xEUZQkTHX78wMtT9TFXuTlFnYl4p/cBUWhICPhEdd6XSNkAfcDYbvkYxMS9JA8K/f8hs +XRcpwLgrCPPYxy7b+BTRBycgHZK/aGWIaLd8JqcyOyVJJ4bOPEXm+S65dugDTB8xsoq ETLg13ubfXHazws7jBgf1O5AFpRr4mM753WMOfEu9hvWg6VEpFgH/nrICA4qAt6wA1TL 29g82aJzuDqudI1n5YM58/wBsXvvZV45cEOOtEYs0EBIKmLAmAKhxBU5u2iyT4KqnjUR 6uKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rJ2TpvT7ZuFEjOlietvHNM+8fyd6PyW+h5qA11wxag0=; fh=K7p30RvKNhp3UOXiqFxs+1Zr0rreDTCapTKveE7BPHw=; b=qDKmt3bjFjbURHOtxT8vI9hl6WAdlbS8nfi92fGM3E+K3s1muS+gXcIGiRjAXYG7Sh DzS9+bMiER/s46SinNvbQJhuGqW2Q6y66z3ncsIcBnGjZ5pUnuF+uau3nPQ7p97Wx/G+ MHhdufB9j7bfrEaV80LC1e5ThQK+ZkR405egNP9wRO9Mp3pBG8IHAZXQulz9i0XJCY2A zo0lt0WCIx9wx3F4HmW7ok++KcIUqzVLgyGrm20ofolMI7R3vHsE9aPOCU3dDmgsLK1b uQ2VTYUx4DcUvRe34sxpifGM+MEeQHcsFdWiG3uDFSuEGLH01m8VWz7dgDhLvZ68dd7R w86Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pc+AlV7s; spf=pass (google.com: domain of linux-kernel+bounces-8567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id rs19-20020a170907037300b00a2362d2929asi877760ejb.940.2023.12.21.06.25.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 06:25:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pc+AlV7s; spf=pass (google.com: domain of linux-kernel+bounces-8567-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8567-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 59C591F2239B for ; Thu, 21 Dec 2023 14:25:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 060D136089; Thu, 21 Dec 2023 14:25:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pc+AlV7s" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F676D6E7; Thu, 21 Dec 2023 14:25:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A357C433C7; Thu, 21 Dec 2023 14:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703168733; bh=ocQ9EjUsxyh5+RDobb40P0qaPVGGj9nzip9H6VJRjIw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pc+AlV7s1dtCyqu4IrWCCGACCZu9yLIdhMIzQRLpBXdoKWGiXBJxvM2Ds9jMZWG0k NUQt/C/vK8TGMgTuTBK5C3c5lmYkqfDw7TRsjzwPFwjLgWZkNodisFNfZTzS77Reiu yzt38yfyi6c2woJl0Ki98nG3tqtaWxmQ/PkWo9Col6uoxU8uc89d8JsY/AbaPZXAix f8STa19wkKXWWTI4qENq2qqU0REDMp+XRrQ8oxq7qyOZf4ISgdCWlinhYhiFT2a+7G S/Uk//E2GOQ3AnVgldnXvquQ3MiY9sDKHa4nFG/5CsIsfRk+6cTuzhppajYOL5MX4p xpKmbmqvyvSSg== Received: (nullmailer pid 3842774 invoked by uid 1000); Thu, 21 Dec 2023 14:25:31 -0000 Date: Thu, 21 Dec 2023 08:25:31 -0600 From: Rob Herring To: Georgi Djakov 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 Message-ID: <20231221142531.GA3730284-robh@kernel.org> References: <20231220060236.18600-1-quic_c_gdjako@quicinc.com> <20231220060236.18600-2-quic_c_gdjako@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > .../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 > + > +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 > + #include > + #include > + #include > + #include > + #include > + > + 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 = , > + ; > + #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>; > + }; > + }; > + > +...