Skip to content

Commit

Permalink
drm/i915/perf: prune OA configs
Browse files Browse the repository at this point in the history
In the following commit we'll introduce loadable userspace
configs. This change reworks how configurations are handled in the
perf driver and retains only the test configurations in kernel space.

We now store the test config in dev_priv and resolve the id only once
when opening the perf stream. The OA config is then handled through a
pointer to the structure holding the configuration details.

v2: Rework how test configs are handled (Lionel)

v3: Use u32 to hold number of register (Matthew)

v4: Removed unused dev_priv->perf.oa.current_config variable (Matthew)

v5: Lock device when accessing exclusive_stream (Lionel)

v6: Ensure OACTXCONTROL is always reprogrammed (Lionel)

v7: Switch a couple of index variable from int to u32 (Matthew)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170803165812.2373-3-lionel.g.landwerlin@intel.com
  • Loading branch information
Lionel Landwerlin committed Aug 3, 2017
1 parent 01d928e commit 701f823
Show file tree
Hide file tree
Showing 22 changed files with 509 additions and 29,560 deletions.
44 changes: 24 additions & 20 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,22 @@ struct i915_oa_reg {
u32 value;
};

struct i915_oa_config {
char uuid[UUID_STRING_LEN + 1];
int id;

const struct i915_oa_reg *mux_regs;
u32 mux_regs_len;
const struct i915_oa_reg *b_counter_regs;
u32 b_counter_regs_len;
const struct i915_oa_reg *flex_regs;
u32 flex_regs_len;

struct attribute_group sysfs_metric;
struct attribute *attrs[2];
struct device_attribute sysfs_metric_id;
};

struct i915_perf_stream;

/**
Expand Down Expand Up @@ -2033,6 +2049,11 @@ struct i915_perf_stream {
* type of configured stream.
*/
const struct i915_perf_stream_ops *ops;

/**
* @oa_config: The OA configuration used by the stream.
*/
struct i915_oa_config *oa_config;
};

/**
Expand All @@ -2056,21 +2077,14 @@ struct i915_oa_ops {
*/
void (*init_oa_buffer)(struct drm_i915_private *dev_priv);

/**
* @select_metric_set: The auto generated code that checks whether a
* requested OA config is applicable to the system and if so sets up
* the mux, oa and flex eu register config pointers according to the
* current dev_priv->perf.oa.metrics_set.
*/
int (*select_metric_set)(struct drm_i915_private *dev_priv);

/**
* @enable_metric_set: Selects and applies any MUX configuration to set
* up the Boolean and Custom (B/C) counters that are part of the
* counter reports being sampled. May apply system constraints such as
* disabling EU clock gating as required.
*/
int (*enable_metric_set)(struct drm_i915_private *dev_priv);
int (*enable_metric_set)(struct drm_i915_private *dev_priv,
const struct i915_oa_config *oa_config);

/**
* @disable_metric_set: Remove system constraints associated with using
Expand Down Expand Up @@ -2452,16 +2466,7 @@ struct drm_i915_private {
int period_exponent;
int timestamp_frequency;

int metrics_set;

const struct i915_oa_reg *mux_regs[6];
int mux_regs_lens[6];
int n_mux_configs;

const struct i915_oa_reg *b_counter_regs;
int b_counter_regs_len;
const struct i915_oa_reg *flex_regs;
int flex_regs_len;
struct i915_oa_config test_config;

struct {
struct i915_vma *vma;
Expand Down Expand Up @@ -2548,7 +2553,6 @@ struct drm_i915_private {

struct i915_oa_ops ops;
const struct i915_oa_format *oa_formats;
int n_builtin_sets;
} oa;
} perf;

Expand Down
Loading

0 comments on commit 701f823

Please sign in to comment.