Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9697866imu; Wed, 5 Dec 2018 08:52:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/WEX+IMsblWWlIoUmdG/U4eJ/GDMTll7dHbcWxhFcMuVnqlGYgJqKTvCpLM1VYXS/elxCXE X-Received: by 2002:a17:902:a70b:: with SMTP id w11mr24824082plq.84.1544028746193; Wed, 05 Dec 2018 08:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544028746; cv=none; d=google.com; s=arc-20160816; b=BG56k2u43vnfD3i1EqbHl50Xh9MJGfquh1wD+uE64LNFnIgYfHBDYTWXzVshQFhUyl i34NB1oq1ZqkogfdmOhenWBdAktdH/EkP9B9ypTNFBIKr+1VwMdvio5+Kdf8RcuJZj/q 6E7VfMAutuqN8lCweZQ90/JqfIZAbTyVtHstVd+uyH5R7+8WOUOh26FKpdKLlkAANYTO 7uzEqScI+JK0nU1UcBuCqZR4UlurMUVO0d5AxLx5meS+jByV5M6WSs89XUhst/p8uITm gumPPf2j1EPzuFmT679JeXfv1bfXwkWepHvtoKvdMfMHex5mIHTD7vjttsuHfMpfcfZ6 4y+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature; bh=X3usTYZfXX3aofxjmqxFblGcRfhazquZXhm963dbMrs=; b=Ey+lbb687/OBxefkVeOwg8+/La49aYoj9XB60GKbiOZ7WtcQNtzlzjmmmjtH+XJ1lK 1AJQksJlR/YlR8hTYFz6cmy0104cGAyQecvS30/4LgcRbpnBCIZc6IX88TiM/GMJSQIx Hv4Er06lzfei2MUg5sRKke75Y4xB2LFzAYowIHdvRvDXybsu4mR1VfjmIK+QZP6ErqY3 1RBw9wGE5o3wYO4Vm7Ny7I85/kjP5cad8EWW54RTH0iPVCGUCiIxWwyCDL5eAA6e6x0+ iXFxPzmRk33JgzeI62RKNhiLwn+unvCXc33WfLXjsG6y0SeEjc1Z7bAwpFlN35btVGgG 558A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ktM8Wipb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17si18461993pgj.142.2018.12.05.08.52.10; Wed, 05 Dec 2018 08:52:26 -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=@linaro.org header.s=google header.b=ktM8Wipb; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbeLEQvG (ORCPT + 99 others); Wed, 5 Dec 2018 11:51:06 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36487 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbeLEQvE (ORCPT ); Wed, 5 Dec 2018 11:51:04 -0500 Received: by mail-wm1-f66.google.com with SMTP id a18so13683191wmj.1 for ; Wed, 05 Dec 2018 08:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=X3usTYZfXX3aofxjmqxFblGcRfhazquZXhm963dbMrs=; b=ktM8WipbQJl5wlH6V7gNIKev6w46mkvOWrxj91dyiMYUB4dETwsvrxy04ao4wSbYW3 2ZkmCSi4RWucBWMbiy7/SYaHqa0GkDUUKBfIKavXIzDVN20DFrsGrtsoafj9gKll0VkB TyFumMtKKRbsl+ZOCuOanK1ab/KzjLGIRug24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=X3usTYZfXX3aofxjmqxFblGcRfhazquZXhm963dbMrs=; b=gA/7N98Aj0ZWFR+76nvFs4Kd1C/IEhowRPX+NlNhoA4o2v7/2aFxZ5Jad0dxFIvq+G 0WmJqXKWmN2l+HIidWxZ/WHGOctrVElvUtIFj5iZqlr8TIhWBY0kB0/xY9HuZSq36Hls sjtTmGbZBgJuYaUl2p76kOb/zfcbsrKel3+2/HyQ2cRqM1L5IAY6gv9jdSPoE5MRd46F MkJLLGB1Vxhp6VOMkC9ozQXu9y0Ea4v2QC8wmN13/4TTl40f2uWSdZSmfT+rK7SyRmU1 jp4bBnJWI3LzklmxqkPmAOW4GOmYC0a3XikU+aBjAIXDvefZIt4eKeqVJQYivpiBoYFO /sMA== X-Gm-Message-State: AA+aEWadTsNrSWZJdKQuPPGK2i7xGTZ0S8d8B/udBhB5FKaiBHIrdFIv Up50CYwR+n9gK17+4kwOoZ5REA== X-Received: by 2002:a1c:a183:: with SMTP id k125mr16037876wme.25.1544028661746; Wed, 05 Dec 2018 08:51:01 -0800 (PST) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id z8sm18922728wrr.52.2018.12.05.08.51.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:51:01 -0800 (PST) Subject: Re: [PATCH 1/1] drm/msm/a6xx: Add support for an interconnect path To: Jordan Crouse Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org References: <20181129172636.12839-1-jcrouse@codeaurora.org> <20181129172636.12839-2-jcrouse@codeaurora.org> From: Georgi Djakov Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNxscnGMh2VlY2rezmqJdcK4G4Lprkc0jOHotV/6oJ mj9h95Ouvbq5TDHx+ERn8uytPygDBR67kNHs18LkvrEex/Z1cQARAQABzShHZW9yZ2kgRGph a292IDxnZW9yZ2kuZGpha292QGxpbmFyby5vcmc+wsF+BBMBAgAoBQJY07kXAhsDBQkHhM4A BgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCyi/eZcnWWUuvsD/4miikUeAO6fU2Xy3fT l7RUCeb2Uuh1/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org> Date: Wed, 5 Dec 2018 18:51:00 +0200 MIME-Version: 1.0 In-Reply-To: <20181129172636.12839-2-jcrouse@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jordan, Thanks for the patch! On 11/29/18 19:26, Jordan Crouse wrote: > Try to get the interconnect path for the GPU and vote for the maximum > bandwidth to support all frequencies. This is needed for performance. > Later we will want to scale the bandwidth based on the frequency to > also optimize for power but that will require some device tree > infrastructure that does not yet exist. > > v3: Absolute bandwidth values should be specified in KBps btw. now i have also included macros in the header, that can be used to specify the bandwidth units. So now you can now use kBps_to_icc or MBps_to_icc etc. If we decide at some point that we change the units we use internally, we will not have update all the users. > > Signed-off-by: Jordan Crouse > --- > drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 20 ++++++++++++++++++++ > drivers/gpu/drm/msm/adreno/adreno_gpu.c | 9 +++++++++ > drivers/gpu/drm/msm/msm_gpu.h | 3 +++ > 3 files changed, 32 insertions(+) > > diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c > index 546599a7ab05..fe0f5b10fd9c 100644 > --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c > +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c > @@ -3,6 +3,7 @@ > > #include > #include > +#include > #include Alphabetic order maybe? > #include "a6xx_gpu.h" > @@ -63,6 +64,9 @@ static bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu) > > static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) > { > + struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); > + struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; > + struct msm_gpu *gpu = &adreno_gpu->base; > int ret; > > gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0); > @@ -85,6 +89,12 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index) > dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret); > > gmu->freq = gmu->gpu_freqs[index]; > + > + /* > + * Eventually we will want to scale the path vote with the frequency but > + * for now leave it t at max so that the performance is nominal. An extra t above. > + */ > + icc_set(gpu->icc_path, 0, 7216000); > } > > void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq) > @@ -680,6 +690,8 @@ int a6xx_gmu_reset(struct a6xx_gpu *a6xx_gpu) > > int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) > { > + struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; > + struct msm_gpu *gpu = &adreno_gpu->base; > struct a6xx_gmu *gmu = &a6xx_gpu->gmu; > int status, ret; > > @@ -695,6 +707,9 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) > if (ret) > goto out; > > + /* Set the bus quota to a reasonable value for boot */ > + icc_set(gpu->icc_path, 0, 3072000); Here you can do: icc_set(gpu->icc_path, 0, MBps_to_icc(3072)); > + > a6xx_gmu_irq_enable(gmu); > > /* Check to see if we are doing a cold or warm boot */ > @@ -735,6 +750,8 @@ bool a6xx_gmu_isidle(struct a6xx_gmu *gmu) > > int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu) > { > + struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; > + struct msm_gpu *gpu = &adreno_gpu->base; > struct a6xx_gmu *gmu = &a6xx_gpu->gmu; > u32 val; > > @@ -781,6 +798,9 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu) > /* Tell RPMh to power off the GPU */ > a6xx_rpmh_stop(gmu); > > + /* Remove the bus vote */ > + icc_set(gpu->icc_path, 0, 0); > + > clk_bulk_disable_unprepare(gmu->nr_clocks, gmu->clocks); > > pm_runtime_put_sync(gmu->dev); > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c > index 93d70f4a2154..9bab491912cf 100644 > --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c > +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c > @@ -21,6 +21,7 @@ > #include > #include > #include > +#include Alphabetic order? > #include "adreno_gpu.h" > #include "msm_gem.h" > #include "msm_mmu.h" > @@ -695,6 +696,11 @@ static int adreno_get_pwrlevels(struct device *dev, > > DBG("fast_rate=%u, slow_rate=27000000", gpu->fast_rate); > > + /* Check for an interconnect path for the bus */ > + gpu->icc_path = of_icc_get(dev, "port0"); I was wondering if port0 is appropriate name here. I assume this is the port to DDR. Maybe we could name it gfx-mem or gpu-mem. Are there any other interconnects that need to be scaled on the a6xx? > + if (IS_ERR(gpu->icc_path)) > + gpu->icc_path = NULL; > + > return 0; > } > > @@ -733,10 +739,13 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, > > void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu) > { > + struct msm_gpu *gpu = &adreno_gpu->base; > unsigned int i; > > for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++) > release_firmware(adreno_gpu->fw[i]); > > + icc_put(gpu->icc_path); > + > msm_gpu_cleanup(&adreno_gpu->base); > } > diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h > index f82bac086666..7b04d1665555 100644 > --- a/drivers/gpu/drm/msm/msm_gpu.h > +++ b/drivers/gpu/drm/msm/msm_gpu.h > @@ -20,6 +20,7 @@ > > #include > #include > +#include Alphabetic order? > > #include "msm_drv.h" > #include "msm_fence.h" > @@ -119,6 +120,8 @@ struct msm_gpu { > struct clk *ebi1_clk, *core_clk, *rbbmtimer_clk; > uint32_t fast_rate; > > + struct icc_path *icc_path; > + > /* Hang and Inactivity Detection: > */ > #define DRM_MSM_INACTIVE_PERIOD 66 /* in ms (roughly four frames) */ Can this driver be a module or is always built-in? If it is built-in and the interconnect support is a module we will have a problem. Maybe add something like this in the Kconfig: depends on INTERCONNECT || !INTERCONNECT Thanks, Georgi