[PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops

From: Zide Chen

Date: Fri Dec 04 2026 - 22:34:49 EST


Now that snbep_uncore_pci_enable_event() programs the upper dword and
ivbep_uncore_pci_init_box() uses uncore_pci_box_ctl(), customized PCI
ops for SKX, SNR and ICX become redundant with ivbep_uncore_pci_ops.

Switch the SKX UPI/M2M, SNR M2M and ICX UPI/M2M types to
ivbep_uncore_pci_ops and drop their custom init_box and ops.

No functional change intended.

Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
---
arch/x86/events/intel/uncore_snbep.c | 61 +++-------------------------
1 file changed, 5 insertions(+), 56 deletions(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 4bc7e10fcaba..4e93b185790e 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -4168,23 +4168,6 @@ static const struct attribute_group skx_upi_uncore_format_group = {
.attrs = skx_upi_uncore_formats_attr,
};

-static int skx_upi_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
-
- return pci_write_config_dword(pdev, uncore_pci_box_ctl(box),
- IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops skx_upi_uncore_pci_ops = {
- .init_box = skx_upi_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static umode_t
skx_upi_mapping_visible(struct kobject *kobj, struct attribute *attr, int die)
{
@@ -4322,7 +4305,7 @@ static struct intel_uncore_type skx_uncore_upi = {
.event_mask_ext = SKX_UPI_CTL_UMASK_EXT,
.box_ctl = SKX_UPI_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_upi_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &skx_upi_uncore_format_group,
.attr_update = skx_upi_attr_update,
.get_topology = skx_upi_get_topology,
@@ -4330,23 +4313,6 @@ static struct intel_uncore_type skx_uncore_upi = {
.cleanup_mapping = skx_upi_cleanup_mapping,
};

-static int skx_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
-
- return pci_write_config_dword(pdev, SKX_M2M_PCI_PMON_BOX_CTL,
- IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops skx_m2m_uncore_pci_ops = {
- .init_box = skx_m2m_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static struct intel_uncore_type skx_uncore_m2m = {
.name = "m2m",
.num_counters = 4,
@@ -4357,7 +4323,7 @@ static struct intel_uncore_type skx_uncore_m2m = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.box_ctl = SKX_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &skx_uncore_format_group,
};

@@ -4839,23 +4805,6 @@ void snr_uncore_cpu_init(void)
uncore_msr_uncores = snr_msr_uncores;
}

-static int snr_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
- int box_ctl = uncore_pci_box_ctl(box);
-
- return pci_write_config_dword(pdev, box_ctl, IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops snr_m2m_uncore_pci_ops = {
- .init_box = snr_m2m_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static struct attribute *snr_m2m_uncore_formats_attr[] = {
&format_attr_event.attr,
&format_attr_umask_ext3.attr,
@@ -4881,7 +4830,7 @@ static struct intel_uncore_type snr_uncore_m2m = {
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &snr_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};

@@ -5430,7 +5379,7 @@ static struct intel_uncore_type icx_uncore_m2m = {
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &snr_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};

@@ -5530,7 +5479,7 @@ static struct intel_uncore_type icx_uncore_upi = {
.event_mask_ext = ICX_UPI_CTL_UMASK_EXT,
.box_ctl = ICX_UPI_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_upi_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &icx_upi_uncore_format_group,
.attr_update = icx_upi_attr_update,
.get_topology = icx_upi_get_topology,
--
2.56.1