Message ID | 20241209094310.5.I41e227ed809ea607114027209b57d02dc0e98384@changeid (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | arm64: errata: Add Qualcomm CPUs to the Spectre mitigation lists | expand |
On Mon, Dec 09, 2024 at 09:43:15AM -0800, Douglas Anderson wrote: > Qualcomm Kryo 500-series Gold cores appear to have a derivative of an > ARM Cortex A77 in them. Since A77 needs Spectre mitigation then the > Kyro 500-series Gold cores also should need Spectre mitigation. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > --- > Yes. I know. This patch DOESN'T COMPILE because > MIDR_QCOM_KRYO_5XX_GOLD is not defined. That value needs to come from > Qualcomm or from testing on hardware, which I don't have. Qualcomm > needs to chime in to confirm that this Spectre mitigation is correct > anyway, though. I'm including this patch so it's obvious that I think > these cores also need the mitigation. Kryo 5xx (SM8250) identify themselves as 0x41/0xd0d (Gold, Prime) and 0x51/0x805 (Silver) > > arch/arm64/kernel/proton-pack.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c > index b1881964e304..212481726f04 100644 > --- a/arch/arm64/kernel/proton-pack.c > +++ b/arch/arm64/kernel/proton-pack.c > @@ -867,6 +867,7 @@ u8 spectre_bhb_loop_affected(int scope) > MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), > MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), > MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), > + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), > {}, > }; > static const struct midr_range spectre_bhb_k11_list[] = { > -- > 2.47.0.338.g60cca15819-goog >
Hi Douglas, kernel test robot noticed the following build errors: [auto build test ERROR on arm64/for-next/core] [also build test ERROR on arm-perf/for-next/perf kvmarm/next soc/for-next arm/for-next arm/fixes linus/master v6.13-rc2 next-20241210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Douglas-Anderson/arm64-errata-Add-QCOM_KRYO_4XX_GOLD-to-the-spectre_bhb_k24_list/20241210-014833 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core patch link: https://lore.kernel.org/r/20241209094310.5.I41e227ed809ea607114027209b57d02dc0e98384%40changeid patch subject: [PATCH 5/6] arm64: errata: Add QCOM_KRYO_5XX_GOLD to the spectre_bhb_k24_list config: arm64-allnoconfig (https://download.01.org/0day-ci/archive/20241210/202412102250.hPlsx2c8-lkp@intel.com/config) compiler: aarch64-linux-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241210/202412102250.hPlsx2c8-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202412102250.hPlsx2c8-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from arch/arm64/include/asm/cache.h:43, from include/linux/cache.h:6, from include/linux/jiffies.h:5, from include/linux/ktime.h:25, from include/linux/timer.h:6, from include/linux/workqueue.h:9, from include/linux/bpf.h:10, from arch/arm64/kernel/proton-pack.c:21: arch/arm64/kernel/proton-pack.c: In function 'spectre_bhb_loop_affected': >> arch/arm64/kernel/proton-pack.c:870:43: error: 'MIDR_QCOM_KRYO_5XX_GOLD' undeclared (first use in this function); did you mean 'MIDR_QCOM_KRYO_4XX_GOLD'? 870 | MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), | ^~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/include/asm/cputype.h:251:26: note: in definition of macro 'MIDR_RANGE' 251 | .model = m, \ | ^ arch/arm64/kernel/proton-pack.c:870:25: note: in expansion of macro 'MIDR_ALL_VERSIONS' 870 | MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), | ^~~~~~~~~~~~~~~~~ arch/arm64/kernel/proton-pack.c:870:43: note: each undeclared identifier is reported only once for each function it appears in 870 | MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), | ^~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/include/asm/cputype.h:251:26: note: in definition of macro 'MIDR_RANGE' 251 | .model = m, \ | ^ arch/arm64/kernel/proton-pack.c:870:25: note: in expansion of macro 'MIDR_ALL_VERSIONS' 870 | MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), | ^~~~~~~~~~~~~~~~~ vim +870 arch/arm64/kernel/proton-pack.c 843 844 /* 845 * This must be called with SCOPE_LOCAL_CPU for each type of CPU, before any 846 * SCOPE_SYSTEM call will give the right answer. 847 */ 848 u8 spectre_bhb_loop_affected(int scope) 849 { 850 u8 k = 0; 851 static u8 max_bhb_k; 852 853 if (scope == SCOPE_LOCAL_CPU) { 854 static const struct midr_range spectre_bhb_k32_list[] = { 855 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78), 856 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78AE), 857 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C), 858 MIDR_ALL_VERSIONS(MIDR_CORTEX_X1), 859 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), 860 MIDR_ALL_VERSIONS(MIDR_CORTEX_X2), 861 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2), 862 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1), 863 {}, 864 }; 865 static const struct midr_range spectre_bhb_k24_list[] = { 866 MIDR_ALL_VERSIONS(MIDR_CORTEX_A76), 867 MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), 868 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), 869 MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), > 870 MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), 871 {}, 872 }; 873 static const struct midr_range spectre_bhb_k11_list[] = { 874 MIDR_ALL_VERSIONS(MIDR_AMPERE1), 875 {}, 876 }; 877 static const struct midr_range spectre_bhb_k8_list[] = { 878 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), 879 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), 880 {}, 881 }; 882 883 if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k32_list)) 884 k = 32; 885 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list)) 886 k = 24; 887 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list)) 888 k = 11; 889 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list)) 890 k = 8; 891 892 max_bhb_k = max(max_bhb_k, k); 893 } else { 894 k = max_bhb_k; 895 } 896 897 return k; 898 } 899
Hi Douglas, kernel test robot noticed the following build errors: [auto build test ERROR on arm64/for-next/core] [also build test ERROR on arm-perf/for-next/perf kvmarm/next soc/for-next arm/for-next arm/fixes linus/master v6.13-rc2 next-20241210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Douglas-Anderson/arm64-errata-Add-QCOM_KRYO_4XX_GOLD-to-the-spectre_bhb_k24_list/20241210-014833 base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core patch link: https://lore.kernel.org/r/20241209094310.5.I41e227ed809ea607114027209b57d02dc0e98384%40changeid patch subject: [PATCH 5/6] arm64: errata: Add QCOM_KRYO_5XX_GOLD to the spectre_bhb_k24_list config: arm64-randconfig-002-20241210 (https://download.01.org/0day-ci/archive/20241210/202412102224.bmEeK15u-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241210/202412102224.bmEeK15u-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202412102224.bmEeK15u-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from arch/arm64/kernel/proton-pack.c:21: In file included from include/linux/bpf.h:21: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:2223: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 505 | item]; | ~~~~ include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 512 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 525 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ >> arch/arm64/kernel/proton-pack.c:870:22: error: use of undeclared identifier 'MIDR_QCOM_KRYO_5XX_GOLD' 870 | MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), | ^ 4 warnings and 1 error generated. vim +/MIDR_QCOM_KRYO_5XX_GOLD +870 arch/arm64/kernel/proton-pack.c 843 844 /* 845 * This must be called with SCOPE_LOCAL_CPU for each type of CPU, before any 846 * SCOPE_SYSTEM call will give the right answer. 847 */ 848 u8 spectre_bhb_loop_affected(int scope) 849 { 850 u8 k = 0; 851 static u8 max_bhb_k; 852 853 if (scope == SCOPE_LOCAL_CPU) { 854 static const struct midr_range spectre_bhb_k32_list[] = { 855 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78), 856 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78AE), 857 MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C), 858 MIDR_ALL_VERSIONS(MIDR_CORTEX_X1), 859 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), 860 MIDR_ALL_VERSIONS(MIDR_CORTEX_X2), 861 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2), 862 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1), 863 {}, 864 }; 865 static const struct midr_range spectre_bhb_k24_list[] = { 866 MIDR_ALL_VERSIONS(MIDR_CORTEX_A76), 867 MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), 868 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), 869 MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), > 870 MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), 871 {}, 872 }; 873 static const struct midr_range spectre_bhb_k11_list[] = { 874 MIDR_ALL_VERSIONS(MIDR_AMPERE1), 875 {}, 876 }; 877 static const struct midr_range spectre_bhb_k8_list[] = { 878 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), 879 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), 880 {}, 881 }; 882 883 if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k32_list)) 884 k = 32; 885 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list)) 886 k = 24; 887 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list)) 888 k = 11; 889 else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list)) 890 k = 8; 891 892 max_bhb_k = max(max_bhb_k, k); 893 } else { 894 k = max_bhb_k; 895 } 896 897 return k; 898 } 899
Hi, On Mon, Dec 9, 2024 at 3:07 PM Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote: > > On Mon, Dec 09, 2024 at 09:43:15AM -0800, Douglas Anderson wrote: > > Qualcomm Kryo 500-series Gold cores appear to have a derivative of an > > ARM Cortex A77 in them. Since A77 needs Spectre mitigation then the > > Kyro 500-series Gold cores also should need Spectre mitigation. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > --- > > Yes. I know. This patch DOESN'T COMPILE because > > MIDR_QCOM_KRYO_5XX_GOLD is not defined. That value needs to come from > > Qualcomm or from testing on hardware, which I don't have. Qualcomm > > needs to chime in to confirm that this Spectre mitigation is correct > > anyway, though. I'm including this patch so it's obvious that I think > > these cores also need the mitigation. > > Kryo 5xx (SM8250) identify themselves as 0x41/0xd0d (Gold, Prime) and > 0x51/0x805 (Silver) Interesting. So the Gold/Prime are actually IDing themselves as straight Cortex A77. The Silver is IDing itself the same as KRYO_4XX_SILVER. ...so in that sense there's nothing to do here for those cores. -Doug
> Interesting. So the Gold/Prime are actually IDing themselves as > straight Cortex A77. The Silver is IDing itself the same as > KRYO_4XX_SILVER. ...so in that sense there's nothing to do here for > those cores. Should we add some comments to cputype.h to record which other products are matched under the same ID?
On Fri, Dec 13, 2024 at 05:28:55PM -0800, Julius Werner wrote: > > Interesting. So the Gold/Prime are actually IDing themselves as > > straight Cortex A77. The Silver is IDing itself the same as > > KRYO_4XX_SILVER. ...so in that sense there's nothing to do here for > > those cores. > > Should we add some comments to cputype.h to record which other > products are matched under the same ID? I'd say, yes.
Hi, On Sat, Dec 14, 2024 at 3:39 AM Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote: > > On Fri, Dec 13, 2024 at 05:28:55PM -0800, Julius Werner wrote: > > > Interesting. So the Gold/Prime are actually IDing themselves as > > > straight Cortex A77. The Silver is IDing itself the same as > > > KRYO_4XX_SILVER. ...so in that sense there's nothing to do here for > > > those cores. > > > > Should we add some comments to cputype.h to record which other > > products are matched under the same ID? > > I'd say, yes. Sure. I'll send a v3 with this tomorrow. -Doug
diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c index b1881964e304..212481726f04 100644 --- a/arch/arm64/kernel/proton-pack.c +++ b/arch/arm64/kernel/proton-pack.c @@ -867,6 +867,7 @@ u8 spectre_bhb_loop_affected(int scope) MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_5XX_GOLD), {}, }; static const struct midr_range spectre_bhb_k11_list[] = {
Qualcomm Kryo 500-series Gold cores appear to have a derivative of an ARM Cortex A77 in them. Since A77 needs Spectre mitigation then the Kyro 500-series Gold cores also should need Spectre mitigation. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Yes. I know. This patch DOESN'T COMPILE because MIDR_QCOM_KRYO_5XX_GOLD is not defined. That value needs to come from Qualcomm or from testing on hardware, which I don't have. Qualcomm needs to chime in to confirm that this Spectre mitigation is correct anyway, though. I'm including this patch so it's obvious that I think these cores also need the mitigation. arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+)