mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
drm/amd/display: update memory QoS measurement interface
[how] - Consolidate memory QoS measurement functions into a single interface for better maintainability and usability. - Update function naming for improved clarity. - Unify latency measurements into a single function call with update programming sequence. - Add `start_measuring_urgent_assertion_count` and `get_urgent_assertion_count` interfaces. - Add `start_measuring_prefetch_data_size` and `get_prefetch_data_size` interfaces. - Update start_measuring_unbounded_bandwidth implementation to measure 200 data returns in the middle of prefetch window. Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Matthew Stewart <matthew.stewart2@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e53278b220
commit
1417281ca8
|
|
@ -7143,22 +7143,24 @@ void dc_log_preos_dmcub_info(const struct dc *dc)
|
|||
bool dc_get_qos_info(struct dc *dc, struct dc_qos_info *info)
|
||||
{
|
||||
const struct dc_clocks *clk = &dc->current_state->bw_ctx.bw.dcn.clk;
|
||||
struct memory_qos qos;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
// Check if all measurement functions are available
|
||||
if (!dc->hwss.measure_peak_bw_mbps ||
|
||||
!dc->hwss.measure_avg_bw_mbps ||
|
||||
!dc->hwss.measure_max_latency_ns ||
|
||||
!dc->hwss.measure_avg_latency_ns) {
|
||||
// Check if measurement function is available
|
||||
if (!dc->hwss.measure_memory_qos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Call measurement functions to get actual values
|
||||
info->actual_peak_bw_in_mbps = dc->hwss.measure_peak_bw_mbps(dc);
|
||||
info->actual_avg_bw_in_mbps = dc->hwss.measure_avg_bw_mbps(dc);
|
||||
info->actual_max_latency_in_ns = dc->hwss.measure_max_latency_ns(dc);
|
||||
info->actual_avg_latency_in_ns = dc->hwss.measure_avg_latency_ns(dc);
|
||||
// Call unified measurement function
|
||||
dc->hwss.measure_memory_qos(dc, &qos);
|
||||
|
||||
// Populate info from measured qos
|
||||
info->actual_peak_bw_in_mbps = qos.peak_bw_mbps;
|
||||
info->actual_avg_bw_in_mbps = qos.avg_bw_mbps;
|
||||
info->actual_min_latency_in_ns = qos.min_latency_ns;
|
||||
info->actual_max_latency_in_ns = qos.max_latency_ns;
|
||||
info->actual_avg_latency_in_ns = qos.avg_latency_ns;
|
||||
info->dcn_bandwidth_ub_in_mbps = (uint32_t)(clk->fclk_khz / 1000 * 64);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -962,6 +962,7 @@ struct dc_qos_info {
|
|||
uint32_t actual_avg_bw_in_mbps;
|
||||
uint32_t calculated_avg_bw_in_mbps;
|
||||
uint32_t actual_max_latency_in_ns;
|
||||
uint32_t actual_min_latency_in_ns;
|
||||
uint32_t qos_max_latency_ub_in_ns;
|
||||
uint32_t actual_avg_latency_in_ns;
|
||||
uint32_t qos_avg_latency_ub_in_ns;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct drr_params;
|
|||
struct dc_underflow_debug_data;
|
||||
struct dsc_optc_config;
|
||||
struct vm_system_aperture_param;
|
||||
|
||||
struct memory_qos;
|
||||
struct subvp_pipe_control_lock_fast_params {
|
||||
struct dc *dc;
|
||||
bool lock;
|
||||
|
|
@ -1289,40 +1289,14 @@ struct hw_sequencer_funcs {
|
|||
struct dc_underflow_debug_data *out_data);
|
||||
|
||||
/**
|
||||
* measure_peak_bw_mbps - Measure actual peak bandwidth in Mbps
|
||||
* measure_memory_qos - Measure memory QoS metrics
|
||||
* @dc: DC structure
|
||||
* @qos: Pointer to memory_qos struct to populate with measured values
|
||||
*
|
||||
* Returns the measured peak bandwidth value in Mbps from hardware
|
||||
* performance counters or registers.
|
||||
* Populates the provided memory_qos struct with peak bandwidth, average bandwidth,
|
||||
* max latency, min latency, and average latency from hardware performance counters.
|
||||
*/
|
||||
uint32_t (*measure_peak_bw_mbps)(struct dc *dc);
|
||||
|
||||
/**
|
||||
* measure_avg_bw_mbps - Measure actual average bandwidth in Mbps
|
||||
* @dc: DC structure
|
||||
*
|
||||
* Returns the measured average bandwidth value in Mbps from hardware
|
||||
* performance counters or registers.
|
||||
*/
|
||||
uint32_t (*measure_avg_bw_mbps)(struct dc *dc);
|
||||
|
||||
/**
|
||||
* measure_max_latency_ns - Measure actual maximum latency in nanoseconds
|
||||
* @dc: DC structure
|
||||
*
|
||||
* Returns the measured maximum latency value in nanoseconds from hardware
|
||||
* performance counters or registers.
|
||||
*/
|
||||
uint32_t (*measure_max_latency_ns)(struct dc *dc);
|
||||
|
||||
/**
|
||||
* measure_avg_latency_ns - Measure actual average latency in nanoseconds
|
||||
* @dc: DC structure
|
||||
*
|
||||
* Returns the measured average latency value in nanoseconds from hardware
|
||||
* performance counters or registers.
|
||||
*/
|
||||
uint32_t (*measure_avg_latency_ns)(struct dc *dc);
|
||||
void (*measure_memory_qos)(struct dc *dc, struct memory_qos *qos);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -704,4 +704,12 @@ struct dc_bounding_box_max_clk {
|
|||
int max_phyclk_mhz;
|
||||
};
|
||||
|
||||
struct memory_qos {
|
||||
uint32_t peak_bw_mbps;
|
||||
uint32_t avg_bw_mbps;
|
||||
uint32_t max_latency_ns;
|
||||
uint32_t min_latency_ns;
|
||||
uint32_t avg_latency_ns;
|
||||
};
|
||||
|
||||
#endif /* _CORE_TYPES_H_ */
|
||||
|
|
|
|||
|
|
@ -254,30 +254,38 @@ struct hubbub_funcs {
|
|||
bool (*program_arbiter)(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs, bool safe_to_lower);
|
||||
void (*dchvm_init)(struct hubbub *hubbub);
|
||||
|
||||
/* Performance monitoring related functions */
|
||||
struct hubbub_perfmon_funcs {
|
||||
void (*reset)(struct hubbub *hubbub);
|
||||
void (*start_measuring_max_memory_latency_ns)(
|
||||
void (*start_measuring_memory_latencies)(
|
||||
struct hubbub *hubbub);
|
||||
uint32_t (*get_max_memory_latency_ns)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz, uint32_t *sample_count);
|
||||
void (*start_measuring_average_memory_latency_ns)(
|
||||
uint32_t (*get_memory_latencies_ns)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz, uint32_t *min_latency_ns,
|
||||
uint32_t *max_latency_ns, uint32_t *avg_latency_ns);
|
||||
void (*start_measuring_urgent_assertion_count)(
|
||||
struct hubbub *hubbub);
|
||||
uint32_t (*get_average_memory_latency_ns)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz, uint32_t *sample_count);
|
||||
void (*start_measuring_urgent_ramp_latency_ns)(
|
||||
bool (*get_urgent_assertion_count)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz,
|
||||
uint32_t *assertion_count,
|
||||
uint32_t *deassertion_count,
|
||||
uint32_t *timestamp_us);
|
||||
void (*start_measuring_urgent_ramp_latency)(
|
||||
struct hubbub *hubbub,
|
||||
const struct hubbub_urgent_latency_params *params);
|
||||
uint32_t (*get_urgent_ramp_latency_ns)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz);
|
||||
void (*start_measuring_unbounded_bandwidth_mbps)(
|
||||
void (*start_measuring_unbounded_bandwidth)(
|
||||
struct hubbub *hubbub);
|
||||
uint32_t (*get_unbounded_bandwidth_mbps)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz, uint32_t *duration_ns);
|
||||
void (*start_measuring_average_bandwidth_mbps)(
|
||||
void (*start_measuring_in_order_bandwidth)(
|
||||
struct hubbub *hubbub);
|
||||
uint32_t (*get_average_bandwidth_mbps)(struct hubbub *hubbub,
|
||||
uint32_t (*get_in_order_bandwidth_mbps)(struct hubbub *hubbub,
|
||||
uint32_t refclk_mhz, uint32_t min_duration_ns,
|
||||
uint32_t *duration_ns);
|
||||
void (*start_measuring_prefetch_data_size)(
|
||||
struct hubbub *hubbub);
|
||||
uint32_t (*get_prefetch_data_size)(struct hubbub *hubbub);
|
||||
} perfmon;
|
||||
|
||||
struct hubbub_qos_funcs {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user