Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2055581pxu; Sun, 6 Dec 2020 17:21:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNL/2QLnMcWp/PGzh8eUnuxRq8iWAYBUgELD2r/xp2fw31Z5s29RuNx3QsbLvrFIubrnQf X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr17570849edb.339.1607304067995; Sun, 06 Dec 2020 17:21:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607304067; cv=none; d=google.com; s=arc-20160816; b=zch5e5nSAeF4Wl9L7WSfkBm8Sv7iOjbK/K/AboEUEJkxSt7ZOU2qFR0ZVKZ1J837lN hUm6X9s7KSf34Cm37V79G8kLWsLDFk5ZI6Gptym2jUFDvEUa09tOB1w9/CBVTywi7g9G FPTncCY1TH7QM29PfRRap8ez1oQ7W6RWe/Wbi6dqwy8K8OZML2jtPTVNvJ0NNcJOffLL JguWmxkDIXK29d1LRTeLV1rLwEOlfjaUwAP5Ngf+xwAT1flofZWMmswKeCLFfmUOveRQ Dv56j7EQMS60iiWqhUmj0NVQog0Yk2xMciAU/0EcT8eQ71c8V9ysfDhs/UPuPio3RQX7 yZaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=7TfmjyBFgY4gjttvRWrYSs8USIfhnAid8/rgKdYtyDg=; b=SYlpuzXP6Fthun3V7B4yzgOF7hsaXYHs0AwXlPGr/vYWw9agpDwxh/aI0hAG4Bxx8g Puev7SKmmT8AiebeJ5KWSYdOhm2tlj56ILUcVkwadXhH1m+ZzgQWQoBeMY9EatywdoVi dzN2YWxMAJ9hWgBFwrKzZEjOciYzfY6WmUlrYtILp1zt0DVxNukRG8o0Q7VvDpz8N89W Mn3A6ohAAT4qg65BjCvNBCTxffpTs++aqd9343o2IzJpV2q2z1tQh4Jvg77/Pk50tbw0 DlCgsjV5xUxlCUeAa6I9GDk1lc2PseAabLzWHFQMHjElKGaC+dxSgZn3oEYZaM2Pc5kE x10g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YE3Ivck3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si5658439ejm.412.2020.12.06.17.20.44; Sun, 06 Dec 2020 17:21:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YE3Ivck3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbgLGBTF (ORCPT + 99 others); Sun, 6 Dec 2020 20:19:05 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:62932 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728582AbgLGBTE (ORCPT ); Sun, 6 Dec 2020 20:19:04 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20201207011821epoutp024117005ddabe015430edafa777ad7d21~OSmH8Llk-2946029460epoutp024 for ; Mon, 7 Dec 2020 01:18:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20201207011821epoutp024117005ddabe015430edafa777ad7d21~OSmH8Llk-2946029460epoutp024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1607303901; bh=7TfmjyBFgY4gjttvRWrYSs8USIfhnAid8/rgKdYtyDg=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=YE3Ivck3wshTTTeYXVSiXoomipJDZm/R/hGge/VqzcA8c7//bVv3jwi7fB8+qcedM V4cNcy+fbNhLG5fpMNpjHEazW/G1YMgmf4tkzWNdhLIb1KjgU2lw0RE9O8VResCSII QgXK4a8zYAVBT5v0GmQuXIM8bMXF9UEbvp/HruJo= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20201207011821epcas1p1dccd83976be412bbf79f5c64ac2a0eb6~OSmHU-Yf-3249132491epcas1p1W; Mon, 7 Dec 2020 01:18:21 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.157]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Cq56L04wdzMqYkl; Mon, 7 Dec 2020 01:18:18 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id F6.DE.09577.9D28DCF5; Mon, 7 Dec 2020 10:18:17 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201207011817epcas1p294a176e9b21c1536b54c26b38ca8ba30~OSmD-HOBz2471324713epcas1p2F; Mon, 7 Dec 2020 01:18:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201207011817epsmtrp28c08e29263a94ebbe6cec7968e5ee1a0~OSmD_DjLb0055400554epsmtrp2f; Mon, 7 Dec 2020 01:18:17 +0000 (GMT) X-AuditID: b6c32a39-bfdff70000002569-5a-5fcd82d9a43c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AE.02.13470.9D28DCF5; Mon, 7 Dec 2020 10:18:17 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201207011817epsmtip27d4c4edb43284ecee29be7d2bdafb10b~OSmDmdWiE0365303653epsmtip2Q; Mon, 7 Dec 2020 01:18:17 +0000 (GMT) Subject: Re: [PATCH v11 10/10] PM / devfreq: tegra30: Separate configurations per-SoC generation To: Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Georgi Djakov , Rob Herring , Michael Turquette , Stephen Boyd , Peter De Schrijver , MyungJoo Ham , Kyungmin Park , Mikko Perttunen , Viresh Kumar , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski Cc: linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org From: Chanwoo Choi Organization: Samsung Electronics Message-ID: <1c4f7c6f-7fff-60c1-a7b1-a099a88df1c6@samsung.com> Date: Mon, 7 Dec 2020 10:33:06 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: <20201203192439.16177-11-digetx@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Te0xTVxz29F5uW0L1rgIea6J4mYggjwLVgxNiAsNGjSMjOrOHtZS7llHa 2gtmk2WhIhvlYeaDoaXIZGNUBlM6HsLkEew04EorDkQHDqYypqNokcUHmlGuy/jv+33n953v 950HDxP+RYh46ZosWq+RqynCG2++tC4i7OYhuyzSaYtCLvc9L1Rp6/NC3z+6A9CvM1MEKmu3 EuiwqQpHDsd5Lmq6V8dB9kN/c9H1NjOBpktsABkfmwh0rfdN9JvBQqBj9aUA2ce3o/x2Gxe9 HGzA0dO20zj6cfQyscVXOj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/BT8lqMqJ+9V/mdB1R0ml6p23Yz/+8XuSO7Rp3vT Vt/NVlBiKc5INNRiLipOBAArhXXnZwMAAA== X-CMS-MailID: 20201207011817epcas1p294a176e9b21c1536b54c26b38ca8ba30 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20201203192730epcas1p1005aa9bcd60748dd9ecc0374349aac8b References: <20201203192439.16177-1-digetx@gmail.com> <20201203192439.16177-11-digetx@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/4/20 4:24 AM, Dmitry Osipenko wrote: > Previously we were using count-weight of the T124 for T30 in order to > get EMC clock rate that was reasonable for T30. In fact the count-weight > should be x2 times smaller on T30, but then devfreq was producing a bit > too low EMC clock rate for ISO memory clients, like display controller > for example. > > Now both Tegra ACTMON and Tegra DRM display drivers support interconnect > framework and display driver tells to ICC what a minimum memory bandwidth > is needed, preventing FIFO underflows. Thus, now we can use a proper > count-weight value for Tegra30 and MC_ALL device config needs a bit more > aggressive boosting. > > Add a separate ACTMON driver configuration that is specific to Tegra30. > > Tested-by: Peter Geis > Tested-by: Nicolas Chauvet > Acked-by: Chanwoo Choi > Signed-off-by: Dmitry Osipenko > --- > drivers/devfreq/tegra30-devfreq.c | 68 ++++++++++++++++++++++++------- > 1 file changed, 54 insertions(+), 14 deletions(-) > > diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c > index 145ef91ae092..117cad7968ab 100644 > --- a/drivers/devfreq/tegra30-devfreq.c > +++ b/drivers/devfreq/tegra30-devfreq.c > @@ -57,13 +57,6 @@ > #define ACTMON_BELOW_WMARK_WINDOW 3 > #define ACTMON_BOOST_FREQ_STEP 16000 > > -/* > - * Activity counter is incremented every 256 memory transactions, and each > - * transaction takes 4 EMC clocks for Tegra124; So the COUNT_WEIGHT is > - * 4 * 256 = 1024. > - */ > -#define ACTMON_COUNT_WEIGHT 0x400 > - > /* > * ACTMON_AVERAGE_WINDOW_LOG2: default value for @DEV_CTRL_K_VAL, which > * translates to 2 ^ (K_VAL + 1). ex: 2 ^ (6 + 1) = 128 > @@ -111,7 +104,7 @@ enum tegra_actmon_device { > MCCPU, > }; > > -static const struct tegra_devfreq_device_config actmon_device_configs[] = { > +static const struct tegra_devfreq_device_config tegra124_device_configs[] = { > { > /* MCALL: All memory accesses (including from the CPUs) */ > .offset = 0x1c0, > @@ -133,6 +126,28 @@ static const struct tegra_devfreq_device_config actmon_device_configs[] = { > }, > }; > > +static const struct tegra_devfreq_device_config tegra30_device_configs[] = { > + { > + /* MCALL: All memory accesses (including from the CPUs) */ > + .offset = 0x1c0, > + .irq_mask = 1 << 26, > + .boost_up_coeff = 200, > + .boost_down_coeff = 50, > + .boost_up_threshold = 20, > + .boost_down_threshold = 10, > + }, > + { > + /* MCCPU: memory accesses from the CPUs */ > + .offset = 0x200, > + .irq_mask = 1 << 25, > + .boost_up_coeff = 800, > + .boost_down_coeff = 40, > + .boost_up_threshold = 27, > + .boost_down_threshold = 10, > + .avg_dependency_threshold = 16000, /* 16MHz in kHz units */ > + }, > +}; > + > /** > * struct tegra_devfreq_device - state specific to an ACTMON device > * > @@ -155,6 +170,12 @@ struct tegra_devfreq_device { > unsigned long target_freq; > }; > > +struct tegra_devfreq_soc_data { > + const struct tegra_devfreq_device_config *configs; > + /* Weight value for count measurements */ > + unsigned int count_weight; > +}; > + > struct tegra_devfreq { > struct devfreq *devfreq; > struct opp_table *opp_table; > @@ -171,11 +192,13 @@ struct tegra_devfreq { > struct delayed_work cpufreq_update_work; > struct notifier_block cpu_rate_change_nb; > > - struct tegra_devfreq_device devices[ARRAY_SIZE(actmon_device_configs)]; > + struct tegra_devfreq_device devices[2]; > > unsigned int irq; > > bool started; > + > + const struct tegra_devfreq_soc_data *soc; > }; > > struct tegra_actmon_emc_ratio { > @@ -488,7 +511,7 @@ static void tegra_actmon_configure_device(struct tegra_devfreq *tegra, > tegra_devfreq_update_avg_wmark(tegra, dev); > tegra_devfreq_update_wmark(tegra, dev); > > - device_writel(dev, ACTMON_COUNT_WEIGHT, ACTMON_DEV_COUNT_WEIGHT); > + device_writel(dev, tegra->soc->count_weight, ACTMON_DEV_COUNT_WEIGHT); > device_writel(dev, ACTMON_INTR_STATUS_CLEAR, ACTMON_DEV_INTR_STATUS); > > val |= ACTMON_DEV_CTRL_ENB_PERIODIC; > @@ -779,6 +802,8 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > if (!tegra) > return -ENOMEM; > > + tegra->soc = of_device_get_match_data(&pdev->dev); > + > tegra->regs = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(tegra->regs)) > return PTR_ERR(tegra->regs); > @@ -852,9 +877,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > > tegra->max_freq = rate / KHZ; > > - for (i = 0; i < ARRAY_SIZE(actmon_device_configs); i++) { > + for (i = 0; i < ARRAY_SIZE(tegra->devices); i++) { > dev = tegra->devices + i; > - dev->config = actmon_device_configs + i; > + dev->config = tegra->soc->configs + i; > dev->regs = tegra->regs + dev->config->offset; > } > > @@ -916,9 +941,24 @@ static int tegra_devfreq_remove(struct platform_device *pdev) > return 0; > } > > +static const struct tegra_devfreq_soc_data tegra124_soc = { > + .configs = tegra124_device_configs, > + > + /* > + * Activity counter is incremented every 256 memory transactions, > + * and each transaction takes 4 EMC clocks. > + */ > + .count_weight = 4 * 256, > +}; > + > +static const struct tegra_devfreq_soc_data tegra30_soc = { > + .configs = tegra30_device_configs, > + .count_weight = 2 * 256, > +}; > + > static const struct of_device_id tegra_devfreq_of_match[] = { > - { .compatible = "nvidia,tegra30-actmon" }, > - { .compatible = "nvidia,tegra124-actmon" }, > + { .compatible = "nvidia,tegra30-actmon", .data = &tegra30_soc, }, > + { .compatible = "nvidia,tegra124-actmon", .data = &tegra124_soc, }, > { }, > }; > > Applied it. Thanks. -- Best Regards, Chanwoo Choi Samsung Electronics