NVIDIA: SAUCE: perf: arm_cspmu: add stop counters to impl ops

Adds stop_counters function pointer to implementation ops
to allow for vendor implementations of this function. The
default implementation is set to the existing stop_counters
function.

Signed-off-by: Eric Funsten <efunsten@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
This commit is contained in:
Eric Funsten
2024-05-07 16:01:02 +00:00
committed by Noah Wager
parent d54415d9f3
commit faa69f679e
2 changed files with 7 additions and 2 deletions
+5 -2
View File
@@ -137,6 +137,8 @@ static DEFINE_MUTEX(arm_cspmu_lock);
static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
struct hw_perf_event *hwc, u32 filter);
static inline void arm_cspmu_stop_counters(struct arm_cspmu *cspmu);
static struct acpi_apmt_node *arm_cspmu_apmt_node(struct device *dev)
{
struct acpi_apmt_node **ptr = dev_get_platdata(dev);
@@ -491,6 +493,7 @@ static int arm_cspmu_init_impl_ops(struct arm_cspmu *cspmu)
DEFAULT_IMPL_OP(event_filter),
DEFAULT_IMPL_OP(set_ev_filter),
DEFAULT_IMPL_OP(event_attr_is_visible),
DEFAULT_IMPL_OP(stop_counters),
};
/* Firmware may override implementer/product ID from PMIIDR */
@@ -625,7 +628,7 @@ static void arm_cspmu_disable(struct pmu *pmu)
{
struct arm_cspmu *cspmu = to_arm_cspmu(pmu);
arm_cspmu_stop_counters(cspmu);
cspmu->impl.ops.stop_counters(cspmu);
}
static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
@@ -1103,7 +1106,7 @@ static irqreturn_t arm_cspmu_handle_irq(int irq_num, void *dev)
DECLARE_BITMAP(pmovs, ARM_CSPMU_MAX_HW_CNTRS);
bool handled = false;
arm_cspmu_stop_counters(cspmu);
cspmu->impl.ops.stop_counters(cspmu);
has_overflowed = arm_cspmu_get_reset_overflow(cspmu, (u32 *)pmovs);
if (!has_overflowed)
+2
View File
@@ -121,6 +121,8 @@ struct arm_cspmu_impl_ops {
/* Hide/show unsupported events */
umode_t (*event_attr_is_visible)(struct kobject *kobj,
struct attribute *attr, int unused);
/* Disable all counters */
void (*stop_counters)(struct arm_cspmu *cspmu);
};
/* Vendor/implementer registration parameter. */