Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D602C433EF for ; Wed, 2 Mar 2022 15:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pRTwY5dBr41/qSprOx6FuFaA6EgiFr0bUMHlG534j3Y=; b=J7/LkR+cdIfrl/ UrO9/W2gquvjLqlkSakusFixmXrcLsJz8iiuXt+JQ1zak84Se6yJo6tXP52wrYchoMsRQd1LLKZpa cXjxPk2z//Vf9jx3RAqgNA2h2A5VS49SYuliViGLfqNCACjrpeglkiv4saGv7md78qFtNiUOsrJ82 wpMu/PkWwWGhzOx5lTZqOcT5IEqxd8NcU0w3eS1Xk3PDtrWS1pake1B8m5+xT1FgMYO3h7dD5kDYB Xk2KZDasdXNcPqCHrG8l5rjiYYO6OhcBmBq4pSniLehHVP166eCDFmsRpvUkCjY9mcYwpu9/WAal/ r6n77sVwtijmKyMHGZWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPQyg-003BQS-2y; Wed, 02 Mar 2022 15:33:22 +0000 Received: from mail-oo1-f52.google.com ([209.85.161.52]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPQyc-003BOu-C8 for linux-arm-kernel@lists.infradead.org; Wed, 02 Mar 2022 15:33:20 +0000 Received: by mail-oo1-f52.google.com with SMTP id i6-20020a4ac506000000b0031c5ac6c078so2285278ooq.6 for ; Wed, 02 Mar 2022 07:33:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oLj7/mquirclwzxhWpquLjogqqAcXjbb3rwAG20s0gI=; b=wvE4nE7qXSVN99bhlFcDJxizjYvfUGbh73LdAMsp4pO1jSF2xotTfdmtrM9DJFaHTM FsMzvApJo4JhxR6nFmqX1xqLx+1DcKrMWA7gu9ht0vbM5l/coyVfCTeEu7j8uyb9stLY py0wVpB8P4gQoRw6UTh5xHHS+BxuFRohkPjryVR4H/Z0WodIj6HI75BX2PatkBSjChYP 6xwl1r0UyJW3SNslAcHRdkIQxBIbnRWPfWVuT+5FRZLzbuUUN8T3UfsrNX4XKiI+MhmE BkwkHLMY6A7H7LXwG88WHlgDAd5rOwQkAe4VKpMQXE3tdyXLFMPxMuRQwYW7AWBADp2n IUdw== X-Gm-Message-State: AOAM532mxQ+J0xtWiDm5/sByfFtE8zDMMFj9nZCqL269Pj9+dOhdaREm FfX/w8/vw2/c7qUNwCli4w== X-Google-Smtp-Source: ABdhPJxDU5/knSYgy29W3VyuecrHnwhmrNLjwWrc+FzGMcZnybKbUNkN7F5KlQ/e1MEKXyiIiGteVA== X-Received: by 2002:a05:6870:709a:b0:d6:fca5:69b6 with SMTP id v26-20020a056870709a00b000d6fca569b6mr321058oae.18.1646235196103; Wed, 02 Mar 2022 07:33:16 -0800 (PST) Received: from robh.at.kernel.org (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.gmail.com with ESMTPSA id h14-20020a4ad00e000000b0031c172d4eddsm7641677oor.27.2022.03.02.07.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 07:33:15 -0800 (PST) Received: (nullmailer pid 3736605 invoked by uid 1000); Wed, 02 Mar 2022 15:33:14 -0000 Date: Wed, 2 Mar 2022 09:33:14 -0600 From: Rob Herring To: Robin Murphy Cc: will@kernel.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, jean-philippe@linaro.org, leo.yan@linaro.org, noda.akio@socionext.com Subject: Re: [PATCH 3/6] iommu/arm-smmu: Add DT PMU support Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220302_073318_444737_EF30ACD6 X-CRM114-Status: GOOD ( 32.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Send DT patches to the DT list if you want them reviewed with some guarantee that I'll see them. (Except right now as PW stopped getting mail. :( ) On Thu, Feb 17, 2022 at 02:24:17PM +0000, Robin Murphy wrote: > Since IORT describes PMU interrupts rather inflexibly as an inherent What's IORT? ;) > part of the SMMU, the best way to avoid excessive complexity is to make > the way we handle DT look as similar as possible. Fortunately the > de-facto standard for mentioning PMU interrupts at all under the current > binding has been to include them in the global interrupt count, listing > them after the actual fault interrupt(s), so we can capitalise on that. > It's about 9 years too late to redefine "#global-interrupts" to exclude > anything other than context interrupts without breaking compatibility, > so we're stuck with a slightly convoluted definition of PMU interrupts > as an optional subdivision of the "global" interrupts, but it works. > > Signed-off-by: Robin Murphy > > --- > > Not sure whether the count-backwards-from-the-middle nature of "number > of PMU interrupts" is too ugly and "index of first PMU interrupt" might > be any better. Can this be solved with 'interrupt-names' instead deprecating #global-interrupts along the way? > --- > .../devicetree/bindings/iommu/arm,smmu.yaml | 19 ++++++++++++++++++- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 4 ++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > index da5381c8ee11..9d39df42528a 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > @@ -87,10 +87,18 @@ properties: > > '#global-interrupts': > description: The number of global interrupts exposed by the device. > + Includes the count of PMU interrupts, if present. > $ref: /schemas/types.yaml#/definitions/uint32 > minimum: 0 > maximum: 260 # 2 secure, 2 non-secure, and up to 256 perf counters > > + '#pmu-interrupts': It would have been great if everything that's a count/size used '#', but that didn't happen. So I'm not that wild about using '#' randomly at all. This needs a vendor prefix (arm,). > + description: The number of PMU interrupts. Must be equal to the number of > + implemented counter groups. > + $ref: /schemas/types.yaml#/definitions/uint32 > + minimum: 1 > + maximum: 256 > + > '#iommu-cells': > enum: [ 1, 2 ] > description: | > @@ -115,6 +123,10 @@ properties: > context bank. In the case of a single, combined interrupt, it must be > listed multiple times. > > + If a PMU is present, the global interrupt entries consist of any fault > + interrupts first, followed by #pmu-interrupts entries, one per implemented > + counter group, specified in order of their indexing by the SMMU. > + > dma-coherent: > description: | > Present if page table walks made by the SMMU are cache coherent with the > @@ -190,9 +202,14 @@ examples: > smmu1: iommu@ba5e0000 { > compatible = "arm,smmu-v1"; > reg = <0xba5e0000 0x10000>; > - #global-interrupts = <2>; > + #global-interrupts = <6>; /* 2 fault + 4 PMU */ > + #pmu-interrupts = <4>; > interrupts = <0 32 4>, > <0 33 4>, > + <0 94 4>, /* This is the first PMU interrupt */ > + <0 95 4>, > + <0 96 4>, > + <0 97 4>, > <0 34 4>, /* This is the first context interrupt */ > <0 35 4>, > <0 36 4>, > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index cbfe4cc914f0..8d6c8106fc1d 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -1995,6 +1995,10 @@ static int arm_smmu_device_dt_probe(struct arm_smmu_device *smmu, > return dev_err_probe(dev, -ENODEV, > "missing #global-interrupts property\n"); > *pmu_irqs = 0; > + of_property_read_u32(dev->of_node, "#pmu-interrupts", pmu_irqs); > + if (*pmu_irqs > *global_irqs) > + return dev_err_probe(dev, -EINVAL, "invalid #pmu_interrupts property"); > + *global_irqs -= *pmu_irqs; > > data = of_device_get_match_data(dev); > smmu->version = data->version; > -- > 2.28.0.dirty > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel