All of lore.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: sboyd@kernel.org
Cc: mturquette@baylibre.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com, wenst@chromium.org,
	miles.chen@mediatek.com, nfraprado@collabora.com,
	rex-bc.chen@mediatek.com, chun-jie.chen@mediatek.com,
	jose.exposito89@gmail.com, yangyingliang@huawei.com,
	msp@baylibre.com, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 00/10] MTK: Undesired set_rate on main PLLs and GPU DVFS
Date: Mon, 24 Oct 2022 12:22:57 +0200	[thread overview]
Message-ID: <20221024102307.33722-1-angelogioacchino.delregno@collabora.com> (raw)

There's no reason to declare CLK_SET_RATE_PARENT on main system PLL
dividers, as any rate change on those (mainpll, syspll, univpll) will
change clock rates on critical system peripherals and busses.

This change was performed only on SoCs that I could test... I'm sure
that the same can (and should) be done on more MTK clock drivers for
practically all MTK SoCs, but I don't feel confident in pushing things
that I couldn't test, so that's done only for MT8173/83/86/92/95 and
on MT6795.
While at it, I've also added the much needed clock notifier treatment
on MT8186 for GPU DVFS, like done on other clock drivers in the past.

A broader explanation about why this series is needed can be found in
the first commit that drops this flag from fixed dividers of main and
univ PLLs (on MT8186) but, for the ones reading mainly the cover letter,
here's a copy-paste of that commit description:

The mainpll and univpll clocks are used as clock sources for multiple
peripherals of different kind, some of which are critical (like AXIs);
a rate change on any of these two will produce a rate change on many
devices and that's likely to produce system instability if not done
correctly: this is the reason why we have "fixed factor" clocks, used
by MUX clocks to provide different rates based on PLL output dividers.
    
Though, there's one fundamental issue that must be resolved somehow:
    
When performing GPU DVFS, we get a rate request that will try to change
the frequency of MAINPLL due to the CLK_TOP_MFG mux having clk26m,
mfgpll (the GPU dedicated PLL), mainpll_d3, mainpll_d5 (fixed factor
dividers) as possible parents.
    
In order to solve that, there are two ways:
 1. Add new "fake" mainpll_d3_fixed, mainpll_d5_fixed clocks, clones
    of mainpll_d3, mainpll_d5 clocks, for the only purpose of not
    declaring CLK_SET_RATE_PARENT; or
 2. Simply drop said flag from the original dividers.
    
After some careful validation, I cannot see anything calling a rate
change request during runtime for MAINPLL, nor for UNIVPLL (which would,
again, mean that we're reclocking lots of peripherals at once!), so it
is safe *and sane* to simply remove the CLK_SET_RATE_PARENT flag to all
of the main/univpll fixed factor divider clocks.
    
Besides, if for any (doubtful) reason main/univpll rate change will be
required in the future, it's still possible to call that on the PLL main
clocks, so we're still covered anyway.

AngeloGioacchino Del Regno (10):
  clk: mediatek: clk-mtk: Allow specifying flags on mtk_fixed_factor
    clocks
  clk: mediatek: mt8186-topckgen: Drop flags for main/univpll fixed
    factors
  clk: mediatek: mt8183: Compress top_divs array entries
  clk: mediatek: mt8183: Drop flags for sys/univpll fixed factors
  clk: mediatek: mt8173: Drop flags for main/sys/univpll fixed factors
  clk: mediatek: mt6795-topckgen: Drop flags for main/sys/univpll fixed
    factors
  clk: mediatek: mt8192: Drop flags for main/univpll fixed factors
  clk: mediatek: mt8195-topckgen: Drop flags for main/univpll fixed
    factors
  clk: mediatek: mt8186-mfg: Propagate rate changes to parent
  clk: mediatek: mt8186-topckgen: Add GPU clock mux notifier

 drivers/clk/mediatek/clk-mt6795-topckgen.c |  76 ++++----
 drivers/clk/mediatek/clk-mt8173.c          |  76 ++++----
 drivers/clk/mediatek/clk-mt8183.c          | 216 +++++++--------------
 drivers/clk/mediatek/clk-mt8186-mfg.c      |   5 +-
 drivers/clk/mediatek/clk-mt8186-topckgen.c |  89 ++++++---
 drivers/clk/mediatek/clk-mt8192.c          |  76 ++++----
 drivers/clk/mediatek/clk-mt8195-topckgen.c |  78 ++++----
 drivers/clk/mediatek/clk-mtk.c             |   2 +-
 drivers/clk/mediatek/clk-mtk.h             |   7 +-
 9 files changed, 293 insertions(+), 332 deletions(-)

-- 
2.37.2


WARNING: multiple messages have this Message-ID (diff)
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: sboyd@kernel.org
Cc: mturquette@baylibre.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com, wenst@chromium.org,
	miles.chen@mediatek.com, nfraprado@collabora.com,
	rex-bc.chen@mediatek.com, chun-jie.chen@mediatek.com,
	jose.exposito89@gmail.com, yangyingliang@huawei.com,
	msp@baylibre.com, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 00/10] MTK: Undesired set_rate on main PLLs and GPU DVFS
Date: Mon, 24 Oct 2022 12:22:57 +0200	[thread overview]
Message-ID: <20221024102307.33722-1-angelogioacchino.delregno@collabora.com> (raw)

There's no reason to declare CLK_SET_RATE_PARENT on main system PLL
dividers, as any rate change on those (mainpll, syspll, univpll) will
change clock rates on critical system peripherals and busses.

This change was performed only on SoCs that I could test... I'm sure
that the same can (and should) be done on more MTK clock drivers for
practically all MTK SoCs, but I don't feel confident in pushing things
that I couldn't test, so that's done only for MT8173/83/86/92/95 and
on MT6795.
While at it, I've also added the much needed clock notifier treatment
on MT8186 for GPU DVFS, like done on other clock drivers in the past.

A broader explanation about why this series is needed can be found in
the first commit that drops this flag from fixed dividers of main and
univ PLLs (on MT8186) but, for the ones reading mainly the cover letter,
here's a copy-paste of that commit description:

The mainpll and univpll clocks are used as clock sources for multiple
peripherals of different kind, some of which are critical (like AXIs);
a rate change on any of these two will produce a rate change on many
devices and that's likely to produce system instability if not done
correctly: this is the reason why we have "fixed factor" clocks, used
by MUX clocks to provide different rates based on PLL output dividers.
    
Though, there's one fundamental issue that must be resolved somehow:
    
When performing GPU DVFS, we get a rate request that will try to change
the frequency of MAINPLL due to the CLK_TOP_MFG mux having clk26m,
mfgpll (the GPU dedicated PLL), mainpll_d3, mainpll_d5 (fixed factor
dividers) as possible parents.
    
In order to solve that, there are two ways:
 1. Add new "fake" mainpll_d3_fixed, mainpll_d5_fixed clocks, clones
    of mainpll_d3, mainpll_d5 clocks, for the only purpose of not
    declaring CLK_SET_RATE_PARENT; or
 2. Simply drop said flag from the original dividers.
    
After some careful validation, I cannot see anything calling a rate
change request during runtime for MAINPLL, nor for UNIVPLL (which would,
again, mean that we're reclocking lots of peripherals at once!), so it
is safe *and sane* to simply remove the CLK_SET_RATE_PARENT flag to all
of the main/univpll fixed factor divider clocks.
    
Besides, if for any (doubtful) reason main/univpll rate change will be
required in the future, it's still possible to call that on the PLL main
clocks, so we're still covered anyway.

AngeloGioacchino Del Regno (10):
  clk: mediatek: clk-mtk: Allow specifying flags on mtk_fixed_factor
    clocks
  clk: mediatek: mt8186-topckgen: Drop flags for main/univpll fixed
    factors
  clk: mediatek: mt8183: Compress top_divs array entries
  clk: mediatek: mt8183: Drop flags for sys/univpll fixed factors
  clk: mediatek: mt8173: Drop flags for main/sys/univpll fixed factors
  clk: mediatek: mt6795-topckgen: Drop flags for main/sys/univpll fixed
    factors
  clk: mediatek: mt8192: Drop flags for main/univpll fixed factors
  clk: mediatek: mt8195-topckgen: Drop flags for main/univpll fixed
    factors
  clk: mediatek: mt8186-mfg: Propagate rate changes to parent
  clk: mediatek: mt8186-topckgen: Add GPU clock mux notifier

 drivers/clk/mediatek/clk-mt6795-topckgen.c |  76 ++++----
 drivers/clk/mediatek/clk-mt8173.c          |  76 ++++----
 drivers/clk/mediatek/clk-mt8183.c          | 216 +++++++--------------
 drivers/clk/mediatek/clk-mt8186-mfg.c      |   5 +-
 drivers/clk/mediatek/clk-mt8186-topckgen.c |  89 ++++++---
 drivers/clk/mediatek/clk-mt8192.c          |  76 ++++----
 drivers/clk/mediatek/clk-mt8195-topckgen.c |  78 ++++----
 drivers/clk/mediatek/clk-mtk.c             |   2 +-
 drivers/clk/mediatek/clk-mtk.h             |   7 +-
 9 files changed, 293 insertions(+), 332 deletions(-)

-- 
2.37.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-10-24 10:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 10:22 AngeloGioacchino Del Regno [this message]
2022-10-24 10:22 ` [PATCH 00/10] MTK: Undesired set_rate on main PLLs and GPU DVFS AngeloGioacchino Del Regno
2022-10-24 10:22 ` [PATCH 01/10] clk: mediatek: clk-mtk: Allow specifying flags on mtk_fixed_factor clocks AngeloGioacchino Del Regno
2022-10-24 10:22   ` AngeloGioacchino Del Regno
2022-10-24 21:57   ` Chen-Yu Tsai
2022-10-24 21:57     ` Chen-Yu Tsai
2022-10-24 10:22 ` [PATCH 02/10] clk: mediatek: mt8186-topckgen: Drop flags for main/univpll fixed factors AngeloGioacchino Del Regno
2022-10-24 10:22   ` AngeloGioacchino Del Regno
2022-10-24 21:58   ` Chen-Yu Tsai
2022-10-24 21:58     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 03/10] clk: mediatek: mt8183: Compress top_divs array entries AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:02   ` Chen-Yu Tsai
2022-10-24 22:02     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 04/10] clk: mediatek: mt8183: Drop flags for sys/univpll fixed factors AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:05   ` Chen-Yu Tsai
2022-10-24 22:05     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 05/10] clk: mediatek: mt8173: Drop flags for main/sys/univpll " AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:06   ` Chen-Yu Tsai
2022-10-24 22:06     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 06/10] clk: mediatek: mt6795-topckgen: " AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:09   ` Chen-Yu Tsai
2022-10-24 22:09     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 07/10] clk: mediatek: mt8192: Drop flags for main/univpll " AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:10   ` Chen-Yu Tsai
2022-10-24 22:10     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 08/10] clk: mediatek: mt8195-topckgen: " AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:10   ` Chen-Yu Tsai
2022-10-24 22:10     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 09/10] clk: mediatek: mt8186-mfg: Propagate rate changes to parent AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:11   ` Chen-Yu Tsai
2022-10-24 22:11     ` Chen-Yu Tsai
2022-10-24 10:23 ` [PATCH 10/10] clk: mediatek: mt8186-topckgen: Add GPU clock mux notifier AngeloGioacchino Del Regno
2022-10-24 10:23   ` AngeloGioacchino Del Regno
2022-10-24 22:12   ` Chen-Yu Tsai
2022-10-24 22:12     ` Chen-Yu Tsai
2022-11-29  7:03 ` [PATCH 00/10] MTK: Undesired set_rate on main PLLs and GPU DVFS Chen-Yu Tsai
2022-11-29  7:03   ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221024102307.33722-1-angelogioacchino.delregno@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=chun-jie.chen@mediatek.com \
    --cc=jose.exposito89@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=miles.chen@mediatek.com \
    --cc=msp@baylibre.com \
    --cc=mturquette@baylibre.com \
    --cc=nfraprado@collabora.com \
    --cc=rex-bc.chen@mediatek.com \
    --cc=sboyd@kernel.org \
    --cc=wenst@chromium.org \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.