Skip to content

Commit 15a3e84

Browse files
osenftKAGA-KOKO
authored andcommitted
perf/x86/intel/uncore: Fix SBOX support for Broadwell CPUs
SBOX on some Broadwell CPUs is broken because it's enabled unconditionally despite the fact that there are no SBOXes available. Check the Power Control Unit CAPID4 register to determine the number of available SBOXes on the particular CPU before trying to enable them. If there are none, nullify the SBOX descriptor so it isn't tried to be initialized. Signed-off-by: Oskar Senft <osk@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Mark van Dijk <mark@voidzero.net> Reviewed-by: Kan Liang <kan.liang@intel.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: ak@linux.intel.com Cc: peterz@infradead.org Cc: eranian@google.com Link: https://lkml.kernel.org/r/1521810690-2576-2-git-send-email-kan.liang@linux.intel.com
1 parent d771758 commit 15a3e84

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3060,14 +3060,25 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = {
30603060

30613061
void bdx_uncore_cpu_init(void)
30623062
{
3063+
int pkg = topology_phys_to_logical_pkg(0);
3064+
30633065
if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
30643066
bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
30653067
uncore_msr_uncores = bdx_msr_uncores;
30663068

30673069
/* BDX-DE doesn't have SBOX */
3068-
if (boot_cpu_data.x86_model == 86)
3070+
if (boot_cpu_data.x86_model == 86) {
30693071
uncore_msr_uncores[BDX_MSR_UNCORE_SBOX] = NULL;
3072+
/* Detect systems with no SBOXes */
3073+
} else if (uncore_extra_pci_dev[pkg].dev[HSWEP_PCI_PCU_3]) {
3074+
struct pci_dev *pdev;
3075+
u32 capid4;
30703076

3077+
pdev = uncore_extra_pci_dev[pkg].dev[HSWEP_PCI_PCU_3];
3078+
pci_read_config_dword(pdev, 0x94, &capid4);
3079+
if (((capid4 >> 6) & 0x3) == 0)
3080+
bdx_msr_uncores[BDX_MSR_UNCORE_SBOX] = NULL;
3081+
}
30713082
hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints;
30723083
}
30733084

@@ -3285,6 +3296,11 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = {
32853296
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46),
32863297
.driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2),
32873298
},
3299+
{ /* PCU.3 (for Capability registers) */
3300+
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0),
3301+
.driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
3302+
HSWEP_PCI_PCU_3),
3303+
},
32883304
{ /* end: all zeroes */ }
32893305
};
32903306

0 commit comments

Comments
 (0)