Takashi Iwai 3817fb
From 4a8a77abf0e2b6468ba0281e33384cbec5fb476a Mon Sep 17 00:00:00 2001
Takashi Iwai 3817fb
From: Luca Weiss <luca@z3ntu.xyz>
Takashi Iwai 3817fb
Date: Sun, 30 Jan 2022 12:45:35 +0100
Takashi Iwai 3817fb
Subject: [PATCH] cpufreq: qcom-cpufreq-nvmem: fix reading of PVS Valid fuse
Takashi Iwai 3817fb
Git-commit: 4a8a77abf0e2b6468ba0281e33384cbec5fb476a
Takashi Iwai 3817fb
Patch-mainline: v5.18-rc1
Takashi Iwai 3817fb
References: git-fixes
Takashi Iwai 3817fb
Takashi Iwai 3817fb
The fuse consists of 64 bits, with this statement we're supposed to get
Takashi Iwai 3817fb
the upper 32 bits but it actually read out of bounds and got 0 instead
Takashi Iwai 3817fb
of the desired value which lead to the "PVS bin not set." codepath being
Takashi Iwai 3817fb
run resetting our pvs value.
Takashi Iwai 3817fb
Takashi Iwai 3817fb
Fixes: a8811ec764f9 ("cpufreq: qcom: Add support for krait based socs")
Takashi Iwai 3817fb
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Takashi Iwai 3817fb
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Takashi Iwai 3817fb
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 3817fb
Takashi Iwai 3817fb
---
Takashi Iwai 3817fb
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 2 +-
Takashi Iwai 3817fb
 1 file changed, 1 insertion(+), 1 deletion(-)
Takashi Iwai 3817fb
Takashi Iwai 3817fb
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
Takashi Iwai 3817fb
index d1744b5d9619..6dfa86971a75 100644
Takashi Iwai 3817fb
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
Takashi Iwai 3817fb
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
Takashi Iwai 3817fb
@@ -130,7 +130,7 @@ static void get_krait_bin_format_b(struct device *cpu_dev,
Takashi Iwai 3817fb
 	}
Takashi Iwai 3817fb
 
Takashi Iwai 3817fb
 	/* Check PVS_BLOW_STATUS */
Takashi Iwai 3817fb
-	pte_efuse = *(((u32 *)buf) + 4);
Takashi Iwai 3817fb
+	pte_efuse = *(((u32 *)buf) + 1);
Takashi Iwai 3817fb
 	pte_efuse &= BIT(21);
Takashi Iwai 3817fb
 	if (pte_efuse) {
Takashi Iwai 3817fb
 		dev_dbg(cpu_dev, "PVS bin: %d\n", *pvs);
Takashi Iwai 3817fb
-- 
Takashi Iwai 3817fb
2.31.1
Takashi Iwai 3817fb