Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15492235ybl; Tue, 31 Dec 2019 08:49:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyECS9v3xlBhDRmVsnD1BZsxZBzzj+LSP7Eq6NyKek6vR7A1WoOkqW9n3ypUZ8phZF81rp1 X-Received: by 2002:a17:906:9501:: with SMTP id u1mr75027353ejx.113.1577810988183; Tue, 31 Dec 2019 08:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577810988; cv=none; d=google.com; s=arc-20160816; b=mMfCUgOxR+rPT6AUPUufK6u1U/AQWsbqwQ1LMY4M3p2Azu93N68gOwWu1zqfx/4O+H xWtqzvSxi7kEpTroW7v/A187AABJz8u3pEdrO8VJwpkLatK/Hz1qL7JOW4iC/kA8Av1Q 5+SaKYUyqXb+VlNe/EsMwMLPPU0dB75v9E2gQVNS91fGKwBDfUyZH1VSuUTCTwAM/PBC Rfu0LP8JvJ0fVukOFwpcT5ZqZ8pQyz3zdp7QRUxKhS463qdOmEewbsQTa5vA2D1O63iO dOuOlEpB8IDMge34E4Hqiq4YxjdT7Wvjy6M13PBocpT7cyhuqzmOQY37TznKp7fNkiuB 6HSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5cGsByFr4h/gn5GTGed+TWKDlfh+tiGQaOBrL5+LciQ=; b=Zq4hQITdtWSoVBiuANEdYS8hYAy98Khp/gVBtlPf89tLNuXOUmb2zi1cGnfvy8zR6g pl02ZJLBng8Irm3P6SNjAckm2ZPMNpciRbVAYCcZM9eUBeKqx5KcxxBo731NORzcNXP2 TR4yxoNy2E9TI+lteAKp7Vhsjyl6/XuertQEahDdw+9dddBT8QecBR8rkADlUriMhPvP nUbd4gzPaCrNV2MvOWGTs1NSxkdlcBV/EyKg6qLE+ENDaGI9X4up5odjU1EeNrqPuOll 3yNG4USIhUflA55ofrYCD3q/ymennByHs9TmAyzbWQbKsvcmgJIrR19Nimv3rxEfgYNg Haxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=tekFZI5v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z25si31416911ejb.377.2019.12.31.08.49.22; Tue, 31 Dec 2019 08:49:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=tekFZI5v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbfLaQrw (ORCPT + 99 others); Tue, 31 Dec 2019 11:47:52 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37101 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbfLaQrw (ORCPT ); Tue, 31 Dec 2019 11:47:52 -0500 Received: by mail-ed1-f66.google.com with SMTP id cy15so35637110edb.4 for ; Tue, 31 Dec 2019 08:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5cGsByFr4h/gn5GTGed+TWKDlfh+tiGQaOBrL5+LciQ=; b=tekFZI5vkkt/vDaFdbyXiQ9T9oK543WnjVXoBu2WSNurH2ETaVpPDmsqM/K4vBR/SZ QJ9dLI0sWWF7sZt8UB0IgZ9v6sVztJashLl+a+gl5iZq+106TIB6ZxD1SvOu/zmktekT PK+wiOiqUfIlKDh8Kx+4Vkthdbov7erfXrdeg7QSQUADqffINId63yD2I8/yhnGoYU44 Q/uI1s2ZzJ6YVG472BaPdUKx7qXSBEI5Pea9VlVAR95W9Qly/Z+jEFDp/D7AicBTDVir PCRXo3PikLY/zOOZKEFuW6wWRvo5r6hpX65ZhrES6wnNDVWK1AWuc/cwHvqDBVHnKmTQ ipNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5cGsByFr4h/gn5GTGed+TWKDlfh+tiGQaOBrL5+LciQ=; b=kTM7CaqW9xFqAiM86CBzoEMiXoALlyt1y8CwPRnAK0GHhU2HT+F7erg5LlalHU6dsD cpwa5BFpUZ6xzyhv8WdHrxrkeBG35v1pmTazEC38frIuNW8qF7m8QZ8oFhAwLcSsfXl+ HlwOnSF62ib/kXsP14cxs0+wOupoZRMMErGcS7R440ImDRPWJrK4fjupfF1GNUCoztiV XjgIxnwlpUkDny+2Mg+ondyE8u1dtn2CVYD1z9jHNohfRZyph5dzfUPwez0hoyQOUKQe o+6xIG6UIxnPGG5Q6rZqQTg9fyo0uIt00NMEjjfPT7WsjNuhoeERxQsjWmRpm/1j3hpE AF7g== X-Gm-Message-State: APjAAAU2vMgBzLM7Ok9KZ3OjnRkPEh0wGpPoHr9nl6MjaakTnvUwVBpN vuqbVHdjMK3jEB3aXsvHfYzrWljFcJoVEdhEDw0= X-Received: by 2002:a50:fb96:: with SMTP id e22mr77460467edq.18.1577810870473; Tue, 31 Dec 2019 08:47:50 -0800 (PST) MIME-Version: 1.0 References: <20191227173707.20413-1-martin.blumenstingl@googlemail.com> <20191227173707.20413-2-martin.blumenstingl@googlemail.com> In-Reply-To: From: Martin Blumenstingl Date: Tue, 31 Dec 2019 17:47:39 +0100 Message-ID: Subject: Re: [RFC v2 1/1] drm/lima: Add optional devfreq support To: Robin Murphy Cc: yuq825@gmail.com, dri-devel@lists.freedesktop.org, robh@kernel.org, tomeu.vizoso@collabora.com, airlied@linux.ie, linux-kernel@vger.kernel.org, steven.price@arm.com, linux-rockchip@lists.infradead.org, wens@csie.org, alyssa.rosenzweig@collabora.com, daniel@ffwll.ch, linux-amlogic@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robin, On Tue, Dec 31, 2019 at 5:40 PM Robin Murphy wrote: > > On 2019-12-31 2:17 pm, Martin Blumenstingl wrote: > > Hi Robin, > > > > On Mon, Dec 30, 2019 at 1:47 AM Robin Murphy wrote: > >> > >> On 2019-12-29 11:19 pm, Martin Blumenstingl wrote: > >>> Hi Robin, > >>> > >>> On Sun, Dec 29, 2019 at 11:58 PM Robin Murphy wrote: > >>>> > >>>> Hi Martin, > >>>> > >>>> On 2019-12-27 5:37 pm, Martin Blumenstingl wrote: > >>>>> Most platforms with a Mali-400 or Mali-450 GPU also have support for > >>>>> changing the GPU clock frequency. Add devfreq support so the GPU clock > >>>>> rate is updated based on the actual GPU usage when the > >>>>> "operating-points-v2" property is present in the board.dts. > >>>>> > >>>>> The actual devfreq code is taken from panfrost_devfreq.c and modified so > >>>>> it matches what the lima hardware needs: > >>>>> - a call to dev_pm_opp_set_clkname() during initialization because there > >>>>> are two clocks on Mali-4x0 IPs. "core" is the one that actually clocks > >>>>> the GPU so we need to control it using devfreq. > >>>>> - locking when reading or writing the devfreq statistics because (unlike > >>>>> than panfrost) we have multiple PP and GP IRQs which may finish jobs > >>>>> concurrently. > >>>> > >>>> I gave this a quick try on my RK3328, and the clock scaling indeed kicks > >>>> in nicely on the glmark2 scenes that struggle, however something appears > >>>> to be missing in terms of regulator association, as the appropriate OPP > >>>> voltages aren't reflected in the GPU supply (fortunately the initial > >>>> voltage seems close enough to that of the highest OPP not to cause major > >>>> problems, on my box at least). With panfrost on RK3399 I do see the > >>>> supply voltage scaling accordingly, but I don't know my way around > >>>> devfreq well enough to know what matters in the difference :/ > >>> first of all: thank you for trying this out! :-) > >>> > >>> does your kernel include commit 221bc77914cbcc ("drm/panfrost: Use > >>> generic code for devfreq") for your panfrost test? > >>> if I understand the devfreq API correct then I suspect with that > >>> commit panfrost also won't change the voltage anymore. > >> > >> Oh, you're quite right - I was already considering that change as > >> ancient history, but indeed it's only in 5.5-rc, while that board is > >> still on 5.4.y release kernels. No wonder I couldn't make sense of how > >> the (current) code could possibly be working :) > >> > >> I'll try the latest -rc kernel tomorrow to confirm (now that PCIe is > >> hopefully fixed), but I'm already fairly confident you've called it > >> correctly. > > I just tested it with the lima driver (by undervolting the GPU by > > 0.05V) and it seems that dev_pm_opp_set_regulators is really needed. > > I'll fix this in the next version of this patch and also submit a fix > > for panfrost (I won't be able to test that though, so help is > > appreciated in terms of testing :)) > > Yeah, I started hacking something up for panfrost yesterday, but at the > point of realising the core OPP code wants refactoring to actually > handle optional regulators without spewing errors, decided that was > crossing the line into "work" and thus could wait until next week :D I'm not sure what you mean, dev_pm_opp_set_regulators uses regulator_get_optional. doesn't that mean that it is optional already? Martin