]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2025 13:29:14 +0000 (14:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2025 13:29:14 +0000 (14:29 +0100)
added patches:
clk-qcom-clk-alpha-pll-fix-alpha-mode-configuration.patch
clk-qcom-clk-rpmh-prevent-integer-overflow-in-recalc_rate.patch

queue-5.4/clk-qcom-clk-alpha-pll-fix-alpha-mode-configuration.patch [new file with mode: 0644]
queue-5.4/clk-qcom-clk-rpmh-prevent-integer-overflow-in-recalc_rate.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/clk-qcom-clk-alpha-pll-fix-alpha-mode-configuration.patch b/queue-5.4/clk-qcom-clk-alpha-pll-fix-alpha-mode-configuration.patch
new file mode 100644 (file)
index 0000000..85cdae7
--- /dev/null
@@ -0,0 +1,81 @@
+From 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <j4g8y7@gmail.com>
+Date: Mon, 21 Oct 2024 19:32:48 +0200
+Subject: clk: qcom: clk-alpha-pll: fix alpha mode configuration
+
+From: Gabor Juhos <j4g8y7@gmail.com>
+
+commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
+
+Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration")
+added support for configuring alpha mode, but it seems that the feature
+was never working in practice.
+
+The value of the alpha_{en,mode}_mask members of the configuration gets
+added to the value parameter passed to the regmap_update_bits() function,
+however the same values are not getting applied to the bitmask. As the
+result, the respective bits in the USER_CTL register are never modifed
+which leads to improper configuration of several PLLs.
+
+The following table shows the PLL configurations where the 'alpha_en_mask'
+member is set and which are passed as a parameter for the
+clk_alpha_pll_configure() function. In the table the 'expected rate' column
+shows the rate the PLL should run at with the given configuration, and
+the 'real rate' column shows the rate the PLL runs at actually. The real
+rates has been verified on hardwareOn IPQ* platforms, on other platforms,
+those are computed values only.
+
+      file                 pll         expected rate   real rate
+  dispcc-qcm2290.c     disp_cc_pll0      768.0 MHz     768.0 MHz
+  dispcc-sm6115.c      disp_cc_pll0      768.0 MHz     768.0 MHz
+  gcc-ipq5018.c        ubi32_pll        1000.0 MHz !=  984.0 MHz
+  gcc-ipq6018.c        nss_crypto_pll   1200.0 MHz    1200.0 MHz
+  gcc-ipq6018.c        ubi32_pll        1497.6 MHz != 1488.0 MHz
+  gcc-ipq8074.c        nss_crypto_pll   1200.0 MHz != 1190.4 MHz
+  gcc-qcm2290.c        gpll11            532.0 MHz !=  518.4 MHz
+  gcc-qcm2290.c        gpll8             533.2 MHz !=  518.4 MHz
+  gcc-qcs404.c         gpll3             921.6 MHz     921.6 MHz
+  gcc-sm6115.c         gpll11            600.0 MHz !=  595.2 MHz
+  gcc-sm6115.c         gpll8             800.0 MHz !=  787.2 MHz
+  gpucc-sdm660.c       gpu_cc_pll0       800.0 MHz !=  787.2 MHz
+  gpucc-sdm660.c       gpu_cc_pll1       740.0 MHz !=  729.6 MHz
+  gpucc-sm6115.c       gpu_cc_pll0      1200.0 MHz != 1190.4 MHz
+  gpucc-sm6115.c       gpu_cc_pll1       640.0 MHz !=  633.6 MHz
+  gpucc-sm6125.c       gpu_pll0         1020.0 MHz != 1017.6 MHz
+  gpucc-sm6125.c       gpu_pll1          930.0 MHz !=  921.6 MHz
+  mmcc-sdm660.c        mmpll8            930.0 MHz !=  921.6 MHz
+  mmcc-sdm660.c        mmpll5            825.0 MHz !=  806.4 MHz
+
+As it can be seen from the above, there are several PLLs which are
+configured incorrectly.
+
+Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask'
+values to the bitmask in order to configure the alpha mode correctly.
+
+Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed
+in the table above. Since the 'alpha_mode_mask' is not used by any driver
+currently, that part of the change causes no functional changes.
+
+Cc: stable@vger.kernel.org
+Fixes: c45ae598fc16 ("clk: qcom: support for alpha mode configuration")
+Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Tested-by: Gabor Juhos <j4g8y7@gmail.com>
+Link: https://lore.kernel.org/r/20241021-fix-alpha-mode-config-v1-1-f32c254e02bc@gmail.com
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/clk/qcom/clk-alpha-pll.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/clk/qcom/clk-alpha-pll.c
++++ b/drivers/clk/qcom/clk-alpha-pll.c
+@@ -236,6 +236,8 @@ void clk_alpha_pll_configure(struct clk_
+       mask |= config->pre_div_mask;
+       mask |= config->post_div_mask;
+       mask |= config->vco_mask;
++      mask |= config->alpha_en_mask;
++      mask |= config->alpha_mode_mask;
+       regmap_update_bits(regmap, PLL_USER_CTL(pll), mask, val);
diff --git a/queue-5.4/clk-qcom-clk-rpmh-prevent-integer-overflow-in-recalc_rate.patch b/queue-5.4/clk-qcom-clk-rpmh-prevent-integer-overflow-in-recalc_rate.patch
new file mode 100644 (file)
index 0000000..2c1a86e
--- /dev/null
@@ -0,0 +1,37 @@
+From 89aa5925d201b90a48416784831916ca203658f9 Mon Sep 17 00:00:00 2001
+From: Anastasia Belova <abelova@astralinux.ru>
+Date: Tue, 3 Dec 2024 11:42:31 +0300
+Subject: clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
+
+From: Anastasia Belova <abelova@astralinux.ru>
+
+commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
+
+aggr_state and unit fields are u32. The result of their
+multiplication may not fit in this type.
+
+Add explicit casting to prevent overflow.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support")
+Cc: stable@vger.kernel.org # 5.4+
+Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
+Link: https://lore.kernel.org/r/20241203084231.6001-1-abelova@astralinux.ru
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/clk/qcom/clk-rpmh.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/clk/qcom/clk-rpmh.c
++++ b/drivers/clk/qcom/clk-rpmh.c
+@@ -331,7 +331,7 @@ static unsigned long clk_rpmh_bcm_recalc
+ {
+       struct clk_rpmh *c = to_clk_rpmh(hw);
+-      return c->aggr_state * c->unit;
++      return (unsigned long)c->aggr_state * c->unit;
+ }
+ static const struct clk_ops clk_rpmh_bcm_ops = {
index 5510115b2b1ed8274ac83efe511c18b0d782163c..b3b5d8873d3b3d6db0df9c9c0b71dc8f6083e7b2 100644 (file)
@@ -118,3 +118,5 @@ kvm-explicitly-verify-target-vcpu-is-online-in-kvm_get_vcpu.patch
 kvm-s390-vsie-fix-some-corner-cases-when-grabbing-vsie-pages.patch
 drm-komeda-add-check-for-komeda_get_layer_fourcc_list.patch
 bluetooth-l2cap-handle-null-sock-pointer-in-l2cap_sock_alloc.patch
+clk-qcom-clk-alpha-pll-fix-alpha-mode-configuration.patch
+clk-qcom-clk-rpmh-prevent-integer-overflow-in-recalc_rate.patch