Message ID | 20230608023006.12836-1-sumeet.r.pawnikar@intel.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | powercap: RAPL: fix invalid initialization for pl4_supported field | expand |
+Dave and the x86 maintainers On Thu, Jun 8, 2023 at 4:44 AM Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> wrote: > > The current initialization of the struct x86_cpu_id via > pl4_support_ids[] is partial and wrong. It is initializing > "stepping" field with "X86_FEATURE_ANY" instead of "feature" field. > > Use X86_MATCH_INTEL_FAM6_MODEL macro instead of initializing > each field of the struct x86_cpu_id for pl4_supported list of CPUs. > This X86_MATCH_INTEL_FAM6_MODEL macro internally uses another macro > X86_MATCH_VENDOR_FAM_MODEL_FEATURE for X86 based CPU matching with > appropriate initialized values. > > Reported-by: Dave Hansen <dave.hansen@intel.com> > Closes: https://lore.kernel.org/lkml/28ead36b-2d9e-1a36-6f4e-04684e420260@intel.com/ > Fixes: eb52bc2ae5b8 ("powercap: RAPL: Add Power Limit4 support for Meteor Lake SoC") > Fixes: b08b95cf30f5 ("powercap: RAPL: Add Power Limit4 support for Alder Lake-N and Raptor Lake-P") > Fixes: 515755906921 ("powercap: RAPL: Add Power Limit4 support for RaptorLake") > Fixes: 1cc5b9a411e4 ("powercap: Add Power Limit4 support for Alder Lake SoC") > Fixes: 8365a898fe53 ("powercap: Add Power Limit4 support") > Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> > --- > drivers/powercap/intel_rapl_msr.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c > index a27673706c3d..7be7561f5ad6 100644 > --- a/drivers/powercap/intel_rapl_msr.c > +++ b/drivers/powercap/intel_rapl_msr.c > @@ -137,14 +137,14 @@ static int rapl_msr_write_raw(int cpu, struct reg_action *ra) > > /* List of verified CPUs. */ > static const struct x86_cpu_id pl4_support_ids[] = { > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_TIGERLAKE_L, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_L, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_N, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE_P, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE, X86_FEATURE_ANY }, > - { X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE_L, X86_FEATURE_ANY }, > + X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, NULL), > + X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, NULL), > {} > }; > > -- Tentatively applied as 6.5 material, thanks!
diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c index a27673706c3d..7be7561f5ad6 100644 --- a/drivers/powercap/intel_rapl_msr.c +++ b/drivers/powercap/intel_rapl_msr.c @@ -137,14 +137,14 @@ static int rapl_msr_write_raw(int cpu, struct reg_action *ra) /* List of verified CPUs. */ static const struct x86_cpu_id pl4_support_ids[] = { - { X86_VENDOR_INTEL, 6, INTEL_FAM6_TIGERLAKE_L, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_L, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ALDERLAKE_N, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_RAPTORLAKE_P, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE, X86_FEATURE_ANY }, - { X86_VENDOR_INTEL, 6, INTEL_FAM6_METEORLAKE_L, X86_FEATURE_ANY }, + X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL), + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, NULL), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, NULL), + X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, NULL), + X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, NULL), {} };
The current initialization of the struct x86_cpu_id via pl4_support_ids[] is partial and wrong. It is initializing "stepping" field with "X86_FEATURE_ANY" instead of "feature" field. Use X86_MATCH_INTEL_FAM6_MODEL macro instead of initializing each field of the struct x86_cpu_id for pl4_supported list of CPUs. This X86_MATCH_INTEL_FAM6_MODEL macro internally uses another macro X86_MATCH_VENDOR_FAM_MODEL_FEATURE for X86 based CPU matching with appropriate initialized values. Reported-by: Dave Hansen <dave.hansen@intel.com> Closes: https://lore.kernel.org/lkml/28ead36b-2d9e-1a36-6f4e-04684e420260@intel.com/ Fixes: eb52bc2ae5b8 ("powercap: RAPL: Add Power Limit4 support for Meteor Lake SoC") Fixes: b08b95cf30f5 ("powercap: RAPL: Add Power Limit4 support for Alder Lake-N and Raptor Lake-P") Fixes: 515755906921 ("powercap: RAPL: Add Power Limit4 support for RaptorLake") Fixes: 1cc5b9a411e4 ("powercap: Add Power Limit4 support for Alder Lake SoC") Fixes: 8365a898fe53 ("powercap: Add Power Limit4 support") Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> --- drivers/powercap/intel_rapl_msr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)