Message ID | 20230323090822.61766-3-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2805663wrt; Thu, 23 Mar 2023 02:24:27 -0700 (PDT) X-Google-Smtp-Source: AK7set+QHajM5Iyty01R/m9oCxM1oVzhxpQ1ZCEqKtdx/7qhbN1IrFGfYmZCI7OnG4f+4G2cAIuc X-Received: by 2002:a05:6a20:4e1a:b0:da:38d2:c27a with SMTP id gk26-20020a056a204e1a00b000da38d2c27amr2407765pzb.1.1679563466757; Thu, 23 Mar 2023 02:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679563466; cv=none; d=google.com; s=arc-20160816; b=mJIiTnl7R+L/eVJazj7qy8jhyXHx+/mjb5b1xSigHF4g/v/6k3/FTEC4NGWpL/U9gF 9djr4lFabp3cyHeqggsoSX/xcnvlQfB6h5j9Fw+qWKRbX/k3sIjSga0v8wrbl44m1F+Q XOmMwXOfnEyQJ919BRTi1VAu7vByfj1nHFkoEar9qRS7TUuja/8MyBcG4l/qaJC7EwPf QqzBVtgZfqpXWU/NZU0gDnvPm6a9lErB7JhbI4TbC1+9CpO/Syy15FHhbMw4LrldiMUP zyWAabPRHa9l2J1ncYn1FDEF9u2nn/9yEZRqEZhn2dg2YeJuNj6uVui/2uJPdH39wBVG Qdkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OD4Ni99lz0vbInh+660W6jwaUbIKLSiOiTEgVWz1lyw=; b=JU8UjgXnGhAUjk82XKDdaa4DoZTO1I97Vg2mtemgobfYfii9h733nVi+cn4QAry464 AXHDX1CAyz3oLsBxtX1mXHYRy3zB6VubSC1dEhARGyp20WgQSx5dbluauB+szz+8Xd4Q tPCqnE+Iu0J6k9LC1UzpP6GKmdj7Y+GVWF8c41sxOn1i0WMYv8u2oWUDcOpm0fuqqdVL dvW+Wqmyh+xI7IraRZSB2ojoZtyVYJqu7upooS4Mdf95sa11fos/ET9vZzyE66h2aYCn 94yy8gL8cGm6Ebpj/Tzh5R+exUW0g/T/8A6jpX9+TxdTQYhUPjJNO49+H2fztwt2IvMb 4zrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="Yt//uoEk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a056a0010cf00b006221fa0b8d1si18265942pfu.71.2023.03.23.02.24.14; Thu, 23 Mar 2023 02:24:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="Yt//uoEk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230122AbjCWJJh (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Thu, 23 Mar 2023 05:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231367AbjCWJJR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Mar 2023 05:09:17 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF03E1E1FF; Thu, 23 Mar 2023 02:08:31 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 25A4A66030C0; Thu, 23 Mar 2023 09:08:30 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1679562510; bh=2/LIFSrMCDoyTlFa4VDWRrfC/Sm1DtA+dl9eYJSJR1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yt//uoEkj/BWkf0EBe+96syvd9Bu0BOr19S3kLHTikmPp7PfL15jVOl1ZLyOPkxJV T4YcpH3oExuHfHzEQvv70Fhcucgf6SFBxtXa/ed9HHKgZf4np7vDrHja7j6h4Tj74z SpAYDtAYtpcIE4Uzzw99WG3zT6M0M57CJ9vwZgbQbAD+H/ma/DaOscrfBErRoOBhrp TX+1sJqcED6Tr7jQobIW+foKmaYPgDwdz/YUw19+d9KfBl0LQ1MHjjpZ8XY6IkB/kH v9movDENfui0+J6C+uGPOCDmCDTSUZEJ8HlbuqDNFVUFBkViONVieTGrzVs3hqRir1 ypVrB0FCXDkGw== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: airlied@gmail.com Cc: daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, wenst@chromium.org, steven.price@arm.com, alyssa.rosenzweig@collabora.com, robh@kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Subject: [PATCH v1 RESEND 2/2] drm/panfrost: Add basic support for speed binning Date: Thu, 23 Mar 2023 10:08:22 +0100 Message-Id: <20230323090822.61766-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230323090822.61766-1-angelogioacchino.delregno@collabora.com> References: <20230323090822.61766-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761149941710618791?= X-GMAIL-MSGID: =?utf-8?q?1761149941710618791?= |
Series |
Panfrost: GPU Speed-binning support via OPP
|
|
Commit Message
AngeloGioacchino Del Regno
March 23, 2023, 9:08 a.m. UTC
Some SoCs implementing ARM Mali GPUs are subject to speed binning:
this means that some versions of the same SoC model may need to be
limited to a slower frequency compared to the other:
this is being addressed by reading nvmem (usually, an eFuse array)
containing a number that identifies the speed binning of the chip,
which is usually related to silicon quality.
To address such situation, add basic support for reading the
speed-bin through nvmem, as to make it possible to specify the
supported hardware in the OPP table for GPUs.
This commit also keeps compatibility with any platform that does
not specify (and does not even support) speed-binning.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 30 +++++++++++++++++++++
1 file changed, 30 insertions(+)
Comments
Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto: > Some SoCs implementing ARM Mali GPUs are subject to speed binning: > this means that some versions of the same SoC model may need to be > limited to a slower frequency compared to the other: > this is being addressed by reading nvmem (usually, an eFuse array) > containing a number that identifies the speed binning of the chip, > which is usually related to silicon quality. > > To address such situation, add basic support for reading the > speed-bin through nvmem, as to make it possible to specify the > supported hardware in the OPP table for GPUs. > This commit also keeps compatibility with any platform that does > not specify (and does not even support) speed-binning. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Hello maintainers, I've seen that this got archived in the dri-devel patchwork; because of that and only that, I'm sending this ping to get this patch reviewed. (perhaps we can even get it picked for v6.4?) Regards, Angelo > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 30 +++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index fe5f12f16a63..58dfb15a8757 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -4,6 +4,7 @@ > #include <linux/clk.h> > #include <linux/devfreq.h> > #include <linux/devfreq_cooling.h> > +#include <linux/nvmem-consumer.h> > #include <linux/platform_device.h> > #include <linux/pm_opp.h> > > @@ -82,6 +83,31 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > .get_dev_status = panfrost_devfreq_get_dev_status, > }; > > +static int panfrost_read_speedbin(struct device *dev) > +{ > + u32 val; > + int ret; > + > + ret = nvmem_cell_read_variable_le_u32(dev, "speed-bin", &val); > + if (ret) { > + /* > + * -ENOENT means that this platform doesn't support speedbins > + * as it didn't declare any speed-bin nvmem: in this case, we > + * keep going without it; any other error means that we are > + * supposed to read the bin value, but we failed doing so. > + */ > + if (ret != -ENOENT) { > + DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret); > + return ret; > + } > + > + return 0; > + } > + DRM_DEV_DEBUG(dev, "Using speed-bin = 0x%x\n", val); > + > + return devm_pm_opp_set_supported_hw(dev, &val, 1); > +} > + > int panfrost_devfreq_init(struct panfrost_device *pfdev) > { > int ret; > @@ -101,6 +127,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > return 0; > } > > + ret = panfrost_read_speedbin(dev); > + if (ret) > + return ret; > + > ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names); > if (ret) { > /* Continue if the optional regulator is missing */
On Fri, 31 Mar 2023 10:11:07 +0200 AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto: > > Some SoCs implementing ARM Mali GPUs are subject to speed binning: > > this means that some versions of the same SoC model may need to be > > limited to a slower frequency compared to the other: > > this is being addressed by reading nvmem (usually, an eFuse array) > > containing a number that identifies the speed binning of the chip, > > which is usually related to silicon quality. > > > > To address such situation, add basic support for reading the > > speed-bin through nvmem, as to make it possible to specify the > > supported hardware in the OPP table for GPUs. > > This commit also keeps compatibility with any platform that does > > not specify (and does not even support) speed-binning. > > > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > > Hello maintainers, > I've seen that this got archived in the dri-devel patchwork; because of that and > only that, I'm sending this ping to get this patch reviewed. Looks good to me. If you can get a DT maintainer to review the binding (Rob?), I'd be happy to queue the series to drm-misc-next. > > (perhaps we can even get it picked for v6.4?) > > Regards, > Angelo > > > --- > > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 30 +++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > index fe5f12f16a63..58dfb15a8757 100644 > > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > > @@ -4,6 +4,7 @@ > > #include <linux/clk.h> > > #include <linux/devfreq.h> > > #include <linux/devfreq_cooling.h> > > +#include <linux/nvmem-consumer.h> > > #include <linux/platform_device.h> > > #include <linux/pm_opp.h> > > > > @@ -82,6 +83,31 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > > .get_dev_status = panfrost_devfreq_get_dev_status, > > }; > > > > +static int panfrost_read_speedbin(struct device *dev) > > +{ > > + u32 val; > > + int ret; > > + > > + ret = nvmem_cell_read_variable_le_u32(dev, "speed-bin", &val); > > + if (ret) { > > + /* > > + * -ENOENT means that this platform doesn't support speedbins > > + * as it didn't declare any speed-bin nvmem: in this case, we > > + * keep going without it; any other error means that we are > > + * supposed to read the bin value, but we failed doing so. > > + */ > > + if (ret != -ENOENT) { > > + DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret); > > + return ret; > > + } > > + > > + return 0; > > + } > > + DRM_DEV_DEBUG(dev, "Using speed-bin = 0x%x\n", val); > > + > > + return devm_pm_opp_set_supported_hw(dev, &val, 1); > > +} > > + > > int panfrost_devfreq_init(struct panfrost_device *pfdev) > > { > > int ret; > > @@ -101,6 +127,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > > return 0; > > } > > > > + ret = panfrost_read_speedbin(dev); > > + if (ret) > > + return ret; > > + > > ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names); > > if (ret) { > > /* Continue if the optional regulator is missing */ > >
Il 31/03/23 10:49, Boris Brezillon ha scritto: > On Fri, 31 Mar 2023 10:11:07 +0200 > AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > wrote: > >> Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto: >>> Some SoCs implementing ARM Mali GPUs are subject to speed binning: >>> this means that some versions of the same SoC model may need to be >>> limited to a slower frequency compared to the other: >>> this is being addressed by reading nvmem (usually, an eFuse array) >>> containing a number that identifies the speed binning of the chip, >>> which is usually related to silicon quality. >>> >>> To address such situation, add basic support for reading the >>> speed-bin through nvmem, as to make it possible to specify the >>> supported hardware in the OPP table for GPUs. >>> This commit also keeps compatibility with any platform that does >>> not specify (and does not even support) speed-binning. >>> >>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >> >> Hello maintainers, >> I've seen that this got archived in the dri-devel patchwork; because of that and >> only that, I'm sending this ping to get this patch reviewed. > > Looks good to me. If you can get a DT maintainer to review the binding > (Rob?), I'd be happy to queue the series to drm-misc-next. > The binding was acked by Krzysztof already... so, just to be sure: Krzysztof, can the binding [1] get picked? Cheers, Angelo [1]: https://lore.kernel.org/all/20230323090822.61766-2-angelogioacchino.delregno@collabora.com/
On Fri, 31 Mar 2023 10:57:46 +0200 AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Il 31/03/23 10:49, Boris Brezillon ha scritto: > > On Fri, 31 Mar 2023 10:11:07 +0200 > > AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > > wrote: > > > >> Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto: > >>> Some SoCs implementing ARM Mali GPUs are subject to speed binning: > >>> this means that some versions of the same SoC model may need to be > >>> limited to a slower frequency compared to the other: > >>> this is being addressed by reading nvmem (usually, an eFuse array) > >>> containing a number that identifies the speed binning of the chip, > >>> which is usually related to silicon quality. > >>> > >>> To address such situation, add basic support for reading the > >>> speed-bin through nvmem, as to make it possible to specify the > >>> supported hardware in the OPP table for GPUs. > >>> This commit also keeps compatibility with any platform that does > >>> not specify (and does not even support) speed-binning. > >>> > >>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > >> > >> Hello maintainers, > >> I've seen that this got archived in the dri-devel patchwork; because of that and > >> only that, I'm sending this ping to get this patch reviewed. > > > > Looks good to me. If you can get a DT maintainer to review the binding > > (Rob?), I'd be happy to queue the series to drm-misc-next. > > > > The binding was acked by Krzysztof already... so, just to be sure: > > Krzysztof, can the binding [1] get picked? Oops, sorry, I didn't realize Krzysztof is a DT maintainer.
On Fri, 31 Mar 2023 10:11:07 +0200 AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Il 23/03/23 10:08, AngeloGioacchino Del Regno ha scritto: > > Some SoCs implementing ARM Mali GPUs are subject to speed binning: > > this means that some versions of the same SoC model may need to be > > limited to a slower frequency compared to the other: > > this is being addressed by reading nvmem (usually, an eFuse array) > > containing a number that identifies the speed binning of the chip, > > which is usually related to silicon quality. > > > > To address such situation, add basic support for reading the > > speed-bin through nvmem, as to make it possible to specify the > > supported hardware in the OPP table for GPUs. > > This commit also keeps compatibility with any platform that does > > not specify (and does not even support) speed-binning. > > > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > > Hello maintainers, > I've seen that this got archived in the dri-devel patchwork; because of that and > only that, I'm sending this ping to get this patch reviewed. Series queued to drm-misc-next.
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index fe5f12f16a63..58dfb15a8757 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -4,6 +4,7 @@ #include <linux/clk.h> #include <linux/devfreq.h> #include <linux/devfreq_cooling.h> +#include <linux/nvmem-consumer.h> #include <linux/platform_device.h> #include <linux/pm_opp.h> @@ -82,6 +83,31 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { .get_dev_status = panfrost_devfreq_get_dev_status, }; +static int panfrost_read_speedbin(struct device *dev) +{ + u32 val; + int ret; + + ret = nvmem_cell_read_variable_le_u32(dev, "speed-bin", &val); + if (ret) { + /* + * -ENOENT means that this platform doesn't support speedbins + * as it didn't declare any speed-bin nvmem: in this case, we + * keep going without it; any other error means that we are + * supposed to read the bin value, but we failed doing so. + */ + if (ret != -ENOENT) { + DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret); + return ret; + } + + return 0; + } + DRM_DEV_DEBUG(dev, "Using speed-bin = 0x%x\n", val); + + return devm_pm_opp_set_supported_hw(dev, &val, 1); +} + int panfrost_devfreq_init(struct panfrost_device *pfdev) { int ret; @@ -101,6 +127,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) return 0; } + ret = panfrost_read_speedbin(dev); + if (ret) + return ret; + ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names); if (ret) { /* Continue if the optional regulator is missing */