Skip to content

Commit a6399bd

Browse files
committed
perf/x86/uncore: Apply the unit control RB tree to MMIO uncore units
jira LE-2177 Rebuild_History Non-Buildable kernel-5.14.0-503.19.1.el9_5 commit-author Kan Liang <kan.liang@linux.intel.com> commit 80580da The unit control RB tree has the unit control and unit ID information for all the units. Use it to replace the box_ctls/mmio_offsets to get an accurate unit control address for MMIO uncore units. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Yunying Sun <yunying.sun@intel.com> Link: https://lore.kernel.org/r/20240614134631.1092359-5-kan.liang@linux.intel.com (cherry picked from commit 80580da) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 01a9af5 commit a6399bd

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

arch/x86/events/intel/uncore_discovery.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -606,34 +606,30 @@ static struct intel_uncore_ops generic_uncore_pci_ops = {
606606

607607
#define UNCORE_GENERIC_MMIO_SIZE 0x4000
608608

609-
static u64 generic_uncore_mmio_box_ctl(struct intel_uncore_box *box)
610-
{
611-
struct intel_uncore_type *type = box->pmu->type;
612-
613-
if (!type->box_ctls || !type->box_ctls[box->dieid] || !type->mmio_offsets)
614-
return 0;
615-
616-
return type->box_ctls[box->dieid] + type->mmio_offsets[box->pmu->pmu_idx];
617-
}
618-
619609
void intel_generic_uncore_mmio_init_box(struct intel_uncore_box *box)
620610
{
621-
u64 box_ctl = generic_uncore_mmio_box_ctl(box);
611+
static struct intel_uncore_discovery_unit *unit;
622612
struct intel_uncore_type *type = box->pmu->type;
623613
resource_size_t addr;
624614

625-
if (!box_ctl) {
615+
unit = intel_uncore_find_discovery_unit(type->boxes, box->dieid, box->pmu->pmu_idx);
616+
if (!unit) {
617+
pr_warn("Uncore type %d id %d: Cannot find box control address.\n",
618+
type->type_id, box->pmu->pmu_idx);
619+
return;
620+
}
621+
622+
if (!unit->addr) {
626623
pr_warn("Uncore type %d box %d: Invalid box control address.\n",
627-
type->type_id, type->box_ids[box->pmu->pmu_idx]);
624+
type->type_id, unit->id);
628625
return;
629626
}
630627

631-
addr = box_ctl;
628+
addr = unit->addr;
632629
box->io_addr = ioremap(addr, UNCORE_GENERIC_MMIO_SIZE);
633630
if (!box->io_addr) {
634631
pr_warn("Uncore type %d box %d: ioremap error for 0x%llx.\n",
635-
type->type_id, type->box_ids[box->pmu->pmu_idx],
636-
(unsigned long long)addr);
632+
type->type_id, unit->id, (unsigned long long)addr);
637633
return;
638634
}
639635

@@ -722,6 +718,8 @@ static bool uncore_update_uncore_type(enum uncore_access_type type_id,
722718
uncore->box_ctls = type->box_ctrl_die;
723719
uncore->mmio_offsets = type->box_offset;
724720
uncore->mmio_map_size = UNCORE_GENERIC_MMIO_SIZE;
721+
uncore->boxes = &type->units;
722+
uncore->num_boxes = type->num_units;
725723
break;
726724
default:
727725
return false;

0 commit comments

Comments
 (0)