Skip to content

Commit 4148480

Browse files
committed
Merge: platform/x86: intel/pmc: updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/607 Description: Update drivers/platform/x86/pmc JIRA: https://issues.redhat.com/browse/RHEL-79463 Build Info: 67045302 Tested: Successful platform test results on Intel (intel-arrowlake-s-02) system. Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents a0dc7b5 + 8b1ff22 commit 4148480

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

arch/x86/events/intel/pt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/slab.h>
1919
#include <linux/device.h>
2020

21+
#include <asm/cpuid.h>
2122
#include <asm/perf_event.h>
2223
#include <asm/insn.h>
2324
#include <asm/io.h>

arch/x86/events/intel/pt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ struct topa_entry {
3737
u64 rsvd4 : 12;
3838
};
3939

40-
/* TSC to Core Crystal Clock Ratio */
41-
#define CPUID_TSC_LEAF 0x15
42-
4340
struct pt_pmu {
4441
struct pmu pmu;
4542
u32 caps[PT_CPUID_REGS_NUM * PT_CPUID_LEAVES];

arch/x86/include/asm/cpuid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ enum cpuid_regs_idx {
1919
CPUID_EDX,
2020
};
2121

22+
#define CPUID_TSC_LEAF 0x15
23+
2224
#ifdef CONFIG_X86_32
2325
extern int have_cpuid_p(void);
2426
#else

arch/x86/kernel/tsc.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/static_key.h>
1717
#include <linux/static_call.h>
1818

19+
#include <asm/cpuid.h>
1920
#include <asm/hpet.h>
2021
#include <asm/timer.h>
2122
#include <asm/vgtod.h>
@@ -664,13 +665,13 @@ unsigned long native_calibrate_tsc(void)
664665
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
665666
return 0;
666667

667-
if (boot_cpu_data.cpuid_level < 0x15)
668+
if (boot_cpu_data.cpuid_level < CPUID_TSC_LEAF)
668669
return 0;
669670

670671
eax_denominator = ebx_numerator = ecx_hz = edx = 0;
671672

672673
/* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */
673-
cpuid(0x15, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
674+
cpuid(CPUID_TSC_LEAF, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
674675

675676
if (ebx_numerator == 0 || eax_denominator == 0)
676677
return 0;
@@ -1066,18 +1067,16 @@ core_initcall(cpufreq_register_tsc_scaling);
10661067

10671068
#endif /* CONFIG_CPU_FREQ */
10681069

1069-
#define ART_CPUID_LEAF (0x15)
10701070
#define ART_MIN_DENOMINATOR (1)
10711071

1072-
10731072
/*
10741073
* If ART is present detect the numerator:denominator to convert to TSC
10751074
*/
10761075
static void __init detect_art(void)
10771076
{
10781077
unsigned int unused;
10791078

1080-
if (boot_cpu_data.cpuid_level < ART_CPUID_LEAF)
1079+
if (boot_cpu_data.cpuid_level < CPUID_TSC_LEAF)
10811080
return;
10821081

10831082
/*
@@ -1090,7 +1089,7 @@ static void __init detect_art(void)
10901089
tsc_async_resets)
10911090
return;
10921091

1093-
cpuid(ART_CPUID_LEAF, &art_base_clk.denominator,
1092+
cpuid(CPUID_TSC_LEAF, &art_base_clk.denominator,
10941093
&art_base_clk.numerator, &art_base_clk.freq_khz, &unused);
10951094

10961095
art_base_clk.freq_khz /= KHZ;

drivers/platform/x86/intel/pmc/core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/suspend.h>
2323
#include <linux/units.h>
2424

25+
#include <asm/cpuid.h>
2526
#include <asm/cpu_device_id.h>
2627
#include <asm/intel-family.h>
2728
#include <asm/msr.h>
@@ -625,8 +626,8 @@ static u32 convert_ltr_scale(u32 val)
625626
static int pmc_core_ltr_show(struct seq_file *s, void *unused)
626627
{
627628
struct pmc_dev *pmcdev = s->private;
628-
u64 decoded_snoop_ltr, decoded_non_snoop_ltr;
629-
u32 ltr_raw_data, scale, val;
629+
u64 decoded_snoop_ltr, decoded_non_snoop_ltr, val;
630+
u32 ltr_raw_data, scale;
630631
u16 snoop_ltr, nonsnoop_ltr;
631632
unsigned int i, index, ltr_index = 0;
632633

@@ -935,13 +936,13 @@ static unsigned int pmc_core_get_crystal_freq(void)
935936
{
936937
unsigned int eax_denominator, ebx_numerator, ecx_hz, edx;
937938

938-
if (boot_cpu_data.cpuid_level < 0x15)
939+
if (boot_cpu_data.cpuid_level < CPUID_TSC_LEAF)
939940
return 0;
940941

941942
eax_denominator = ebx_numerator = ecx_hz = edx = 0;
942943

943-
/* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */
944-
cpuid(0x15, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
944+
/* TSC/Crystal ratio, plus optionally Crystal Hz */
945+
cpuid(CPUID_TSC_LEAF, &eax_denominator, &ebx_numerator, &ecx_hz, &edx);
945946

946947
if (ebx_numerator == 0 || eax_denominator == 0)
947948
return 0;

drivers/platform/x86/intel/pmc/core_ssram.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ pmc_core_ssram_get_pmc(struct pmc_dev *pmcdev, int pmc_idx, u32 offset)
269269
/*
270270
* The secondary PMC BARS (which are behind hidden PCI devices)
271271
* are read from fixed offsets in MMIO of the primary PMC BAR.
272+
* If a device is not present, the value will be 0.
272273
*/
273274
ssram_base = get_base(tmp_ssram, offset);
275+
if (!ssram_base)
276+
return 0;
277+
274278
ssram = ioremap(ssram_base, SSRAM_HDR_SIZE);
275279
if (!ssram)
276280
return -ENOMEM;

0 commit comments

Comments
 (0)