[PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
From: Zide Chen
Date: Fri Dec 04 2026 - 22:35:01 EST
Now that generic discovery PCI ops support 64-bit control registers,
spr_uncore_pci_ops is redundant and can be replaced with the generic
PCI ops.
Because SPR UPI and M3UPI bypass uncore_update_uncore_type() and do
not inherit default ops automatically, make generic_uncore_pci_ops
global so that these extra types can assign it explicitly.
Opportunistically, rename it to intel_generic_uncore_pci_ops to match
the generic discovery naming convention.
No functional change intended.
Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
---
arch/x86/events/intel/uncore_discovery.c | 4 ++--
arch/x86/events/intel/uncore_discovery.h | 1 +
arch/x86/events/intel/uncore_snbep.c | 23 ++---------------------
3 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 07df52e2e265..8e4053d7bbd9 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -633,7 +633,7 @@ u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
return count;
}
-static struct intel_uncore_ops generic_uncore_pci_ops = {
+struct intel_uncore_ops intel_generic_uncore_pci_ops = {
.init_box = intel_generic_uncore_pci_init_box,
.disable_box = intel_generic_uncore_pci_disable_box,
.enable_box = intel_generic_uncore_pci_enable_box,
@@ -743,7 +743,7 @@ static bool uncore_update_uncore_type(enum uncore_access_type type_id,
uncore->ops = &generic_uncore_msr_ops;
break;
case UNCORE_ACCESS_PCI:
- uncore->ops = &generic_uncore_pci_ops;
+ uncore->ops = &intel_generic_uncore_pci_ops;
uncore->ctl_offs8 = 1;
break;
case UNCORE_ACCESS_MMIO:
diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
index 58746f9868a7..04778b1c22a9 100644
--- a/arch/x86/events/intel/uncore_discovery.h
+++ b/arch/x86/events/intel/uncore_discovery.h
@@ -168,6 +168,7 @@ void intel_generic_uncore_pci_disable_event(struct intel_uncore_box *box,
struct perf_event *event);
u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
struct perf_event *event);
+extern struct intel_uncore_ops intel_generic_uncore_pci_ops;
struct intel_uncore_type **
intel_uncore_generic_init_uncores(enum uncore_access_type type_id, int num_extra);
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 14232ef4f77b..0b8057d142c1 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -5941,29 +5941,10 @@ static struct intel_uncore_type spr_uncore_imc = {
.event_descs = spr_uncore_imc_events,
};
-static void spr_uncore_pci_enable_event(struct intel_uncore_box *box,
- struct perf_event *event)
-{
- struct pci_dev *pdev = box->pci_dev;
- struct hw_perf_event *hwc = &event->hw;
-
- pci_write_config_dword(pdev, hwc->config_base + 4, (u32)(hwc->config >> 32));
- pci_write_config_dword(pdev, hwc->config_base, (u32)hwc->config);
-}
-
-static struct intel_uncore_ops spr_uncore_pci_ops = {
- .init_box = intel_generic_uncore_pci_init_box,
- .disable_box = intel_generic_uncore_pci_disable_box,
- .enable_box = intel_generic_uncore_pci_enable_box,
- .disable_event = intel_generic_uncore_pci_disable_event,
- .enable_event = spr_uncore_pci_enable_event,
- .read_counter = intel_generic_uncore_pci_read_counter,
-};
-
#define SPR_UNCORE_PCI_COMMON_FORMAT() \
SPR_UNCORE_COMMON_FORMAT(), \
.ctl_offs8 = 1, \
- .ops = &spr_uncore_pci_ops
+ .ops = &intel_generic_uncore_pci_ops
static struct intel_uncore_type spr_uncore_m2m = {
SPR_UNCORE_PCI_COMMON_FORMAT(),
@@ -6093,7 +6074,7 @@ static struct intel_uncore_type spr_uncore_upi = {
.event_mask_ext = SPR_RAW_EVENT_MASK_EXT,
.format_group = &spr_uncore_raw_format_group,
.ctl_offs8 = 1,
- .ops = &spr_uncore_pci_ops,
+ .ops = &intel_generic_uncore_pci_ops,
.name = "upi",
.attr_update = spr_upi_attr_update,
.get_topology = spr_upi_get_topology,
--
2.56.1