// SPDX-License-Identifier: GPL-2.0 /* * RISC-V performance counter support. * * Copyright (C) 2021 Western Digital Corporation or its affiliates. * * This implementation is based on old RISC-V perf and ARM perf event code * which are in turn based on sparc64 and x86 code.
*/
/* For legacy config & counter index are same */ staticint pmu_legacy_event_map(struct perf_event *event, u64 *config)
{ return pmu_legacy_ctr_get_idx(event);
}
/* cycle & instret are always 64 bit, one bit less according to SBI spec */ staticint pmu_legacy_ctr_get_width(int idx)
{ return 63;
}
/** * The legacy method doesn't really have a start/stop method. * It also can not update the counter with a initial value. * But we still need to set the prev_count so that read() can compute * the delta. Just use the current counter value to set the prev_count.
*/
local64_set(&hwc->prev_count, initial_val);
}
/* * This is just a simple implementation to allow legacy implementations * compatible with new RISC-V PMU driver framework. * This driver only allows reading two counters i.e CYCLE & INSTRET. * However, it can not start or stop the counter. Thus, it is not very useful * will be removed in future.
*/ staticvoid pmu_legacy_init(struct riscv_pmu *pmu)
{
pr_info("Legacy PMU implementation is available\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.