2023-05-01 12:59:09

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 0/3] Mark RPMCC XO_A critical

The Arm part is supposed to hold an permanent, active-only vote on the XO
resource to prevent the RPM algorithms from deciding that its main clock
source should be cut off.

Guarantee this by marking XO_A critical.

These patches are extracted from a broader series at Stephen's request:

https://lore.kernel.org/linux-arm-msm/[email protected]/

Signed-off-by: Konrad Dybcio <[email protected]>
---
Konrad Dybcio (3):
clk: qcom: smd-rpm_ Make __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX accept flags
clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A accept flags
clk: qcom: smd-rpm: Make BI_TCXO_AO critical

drivers/clk/qcom/clk-smd-rpm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
base-commit: 92e815cf07ed24ee1c51b122f24ffcf2964b4b13
change-id: 20230501-topic-rpmcc_xo_a-2caec8c8dad5

Best regards,
--
Konrad Dybcio <[email protected]>


2023-05-01 12:59:25

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 3/3] clk: qcom: smd-rpm: Make BI_TCXO_AO critical

We should never let go of the active-only XO vote, as otherwise the
RPM may decide that there are no online users and it can be shut down,
resulting in a total, uncontrolled system collapse.

Guarantee this through adding the CLK_IS_CRITICAL flag.

Signed-off-by: Konrad Dybcio <[email protected]>
---
drivers/clk/qcom/clk-smd-rpm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
index e00889fddc7b..9649f4644d71 100644
--- a/drivers/clk/qcom/clk-smd-rpm.c
+++ b/drivers/clk/qcom/clk-smd-rpm.c
@@ -439,7 +439,8 @@ static const struct clk_ops clk_smd_rpm_branch_ops = {
.recalc_rate = clk_smd_rpm_recalc_rate,
};

-DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, 0);
+/* Disabling BI_TCXO_AO could gate the root clock source of the entire system. */
+DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, CLK_IS_CRITICAL);
DEFINE_CLK_SMD_RPM_BRANCH(qdss, QCOM_SMD_RPM_MISC_CLK, 1, 19200000);
DEFINE_CLK_SMD_RPM_QDSS(qdss, QCOM_SMD_RPM_MISC_CLK, 1);
DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1, 0);

--
2.40.1

2023-05-01 12:59:48

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 2/3] clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A accept flags

In preparation for supporting keepalive clocks which can never be shut off
(as the platform would fall apart otherwise), make the
DEFINE_CLK_SMD_RPM_BRANCH_A macro accept clock flags for the active-only
clock.

Signed-off-by: Konrad Dybcio <[email protected]>
---
drivers/clk/qcom/clk-smd-rpm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
index e559755a86e0..e00889fddc7b 100644
--- a/drivers/clk/qcom/clk-smd-rpm.c
+++ b/drivers/clk/qcom/clk-smd-rpm.c
@@ -129,10 +129,10 @@
_name##_clk, _name##_a_clk, \
type, r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0)

-#define DEFINE_CLK_SMD_RPM_BRANCH_A(_name, type, r_id, r) \
+#define DEFINE_CLK_SMD_RPM_BRANCH_A(_name, type, r_id, r, ao_flags) \
__DEFINE_CLK_SMD_RPM_BRANCH_PREFIX(branch_, \
_name, _name##_a, type, \
- r_id, r, QCOM_RPM_SMD_KEY_ENABLE, 0)
+ r_id, r, QCOM_RPM_SMD_KEY_ENABLE, ao_flags)

#define DEFINE_CLK_SMD_RPM_QDSS(_name, type, r_id) \
__DEFINE_CLK_SMD_RPM(_name##_clk, _name##_a_clk, \
@@ -439,10 +439,10 @@ static const struct clk_ops clk_smd_rpm_branch_ops = {
.recalc_rate = clk_smd_rpm_recalc_rate,
};

-DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000);
+DEFINE_CLK_SMD_RPM_BRANCH_A(bi_tcxo, QCOM_SMD_RPM_MISC_CLK, 0, 19200000, 0);
DEFINE_CLK_SMD_RPM_BRANCH(qdss, QCOM_SMD_RPM_MISC_CLK, 1, 19200000);
DEFINE_CLK_SMD_RPM_QDSS(qdss, QCOM_SMD_RPM_MISC_CLK, 1);
-DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1);
+DEFINE_CLK_SMD_RPM_BRANCH_A(bimc_freq_log, QCOM_SMD_RPM_MISC_CLK, 4, 1, 0);

DEFINE_CLK_SMD_RPM_BRANCH(mss_cfg_ahb, QCOM_SMD_RPM_MCFG_CLK, 0, 19200000);


--
2.40.1

2023-05-20 22:32:41

by Matti Lehtimäki

[permalink] [raw]
Subject: Re: [PATCH 0/3] Mark RPMCC XO_A critical

On 1.5.2023 15.57, Konrad Dybcio wrote:
> The Arm part is supposed to hold an permanent, active-only vote on the XO
> resource to prevent the RPM algorithms from deciding that its main clock
> source should be cut off.
>
> Guarantee this by marking XO_A critical.
>
> These patches are extracted from a broader series at Stephen's request:
>
> https://lore.kernel.org/linux-arm-msm/[email protected]/
>
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> Konrad Dybcio (3):
> clk: qcom: smd-rpm_ Make __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX accept flags
> clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A accept flags
> clk: qcom: smd-rpm: Make BI_TCXO_AO critical
>
> drivers/clk/qcom/clk-smd-rpm.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
> ---
> base-commit: 92e815cf07ed24ee1c51b122f24ffcf2964b4b13
> change-id: 20230501-topic-rpmcc_xo_a-2caec8c8dad5
>
> Best regards,

This series fixes booting samsung,matisse-wifi with 6.4 rc1 and rc2.

For the series:

Tested-by: Matti Lehtimäki <[email protected]>


2023-05-25 05:24:23

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 0/3] Mark RPMCC XO_A critical

On Mon, 01 May 2023 14:57:10 +0200, Konrad Dybcio wrote:
> The Arm part is supposed to hold an permanent, active-only vote on the XO
> resource to prevent the RPM algorithms from deciding that its main clock
> source should be cut off.
>
> Guarantee this by marking XO_A critical.
>
> These patches are extracted from a broader series at Stephen's request:
>
> [...]

Applied, thanks!

[1/3] clk: qcom: smd-rpm_ Make __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX accept flags
commit: 24abad60396865caf5ff8ccfa294894617456524
[2/3] clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A accept flags
commit: 2dd117943f2339d8aba8b139f55edc5e07e1d359
[3/3] clk: qcom: smd-rpm: Make BI_TCXO_AO critical
commit: ffd853c2ea3e39853f0bffc7364c73c12170c595

Best regards,
--
Bjorn Andersson <[email protected]>