From: Tom O'Rourke <Tom.O'Rourke@xxxxxxxxx> Add slpc_param_id enum values. Add events for setting/unsetting parameters. v2: use host2guc_slpc update slcp_param_id enum values for SLPC 2015.2.4 return void instead of ignored error code (Paulo) Signed-off-by: Tom O'Rourke <Tom.O'Rourke@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_slpc.c | 104 ++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_slpc.h | 26 +++++++++- 2 files changed, 129 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_slpc.c b/drivers/gpu/drm/i915/intel_slpc.c index 524ad63..e7f49db 100644 --- a/drivers/gpu/drm/i915/intel_slpc.c +++ b/drivers/gpu/drm/i915/intel_slpc.c @@ -88,6 +88,33 @@ static void host2guc_slpc_display_mode_change(struct drm_device *dev) host2guc_slpc(dev_priv, data, 7); } +static void host2guc_slpc_set_param(struct drm_device *dev, + enum slpc_param_id id, u32 value) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + u32 data[4]; + + data[0] = HOST2GUC_ACTION_SLPC_REQUEST; + data[1] = SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2); + data[2] = (u32) id; + data[3] = value; + + host2guc_slpc(dev_priv, data, 4); +} + +static void host2guc_slpc_unset_param(struct drm_device *dev, + enum slpc_param_id id) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + u32 data[3]; + + data[0] = HOST2GUC_ACTION_SLPC_REQUEST; + data[1] = SLPC_EVENT(SLPC_EVENT_PARAMETER_UNSET, 1); + data[2] = (u32) id; + + host2guc_slpc(dev_priv, data, 3); +} + static u8 slpc_get_platform_sku(struct drm_i915_gem_object *obj) { struct drm_device *dev = obj->base.dev; @@ -355,3 +382,80 @@ void intel_slpc_update_display_rr_info(struct drm_device *dev, u32 refresh_rate) host2guc_slpc_display_mode_change(dev); } + +void intel_slpc_unset_param(struct drm_device *dev, enum slpc_param_id id) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_i915_gem_object *obj; + struct page *page; + struct slpc_shared_data *data = NULL; + + obj = dev_priv->guc.slpc.shared_data_obj; + if (obj) { + page = i915_gem_object_get_page(obj, 0); + if (page) + data = kmap_atomic(page); + } + + if (data) { + data->override_parameters_set_bits[id >> 5] + &= (~(1 << (id % 32))); + data->override_parameters_values[id] = 0; + kunmap_atomic(data); + + host2guc_slpc_unset_param(dev, id); + } +} + +void intel_slpc_set_param(struct drm_device *dev, enum slpc_param_id id, + u32 value) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_i915_gem_object *obj; + struct page *page; + struct slpc_shared_data *data = NULL; + + obj = dev_priv->guc.slpc.shared_data_obj; + if (obj) { + page = i915_gem_object_get_page(obj, 0); + if (page) + data = kmap_atomic(page); + } + + if (data) { + data->override_parameters_set_bits[id >> 5] + |= (1 << (id % 32)); + data->override_parameters_values[id] = value; + kunmap_atomic(data); + + host2guc_slpc_set_param(dev, id, value); + } +} + +void intel_slpc_get_param(struct drm_device *dev, enum slpc_param_id id, + int *overriding, u32 *value) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_i915_gem_object *obj; + struct page *page; + struct slpc_shared_data *data = NULL; + u32 bits; + + obj = dev_priv->guc.slpc.shared_data_obj; + if (obj) { + page = i915_gem_object_get_page(obj, 0); + if (page) + data = kmap_atomic(page); + } + + if (data) { + if (overriding) { + bits = data->override_parameters_set_bits[id >> 5]; + *overriding = (0 != (bits & (1 << (id % 32)))); + } + if (value) + *value = data->override_parameters_values[id]; + + kunmap_atomic(data); + } +} diff --git a/drivers/gpu/drm/i915/intel_slpc.h b/drivers/gpu/drm/i915/intel_slpc.h index de2df0c..b7ad440 100644 --- a/drivers/gpu/drm/i915/intel_slpc.h +++ b/drivers/gpu/drm/i915/intel_slpc.h @@ -69,6 +69,26 @@ enum slpc_event_id { #define SLPC_EVENT(id, argc) ((u32) (id) << 8 | (argc)) #define SLPC_EVENT_STATUS_MASK 0xFF +enum slpc_param_id { + SLPC_PARAM_TASK_ENABLE_GTPERF = 0, + SLPC_PARAM_TASK_DISABLE_GTPERF = 1, + SLPC_PARAM_TASK_ENABLE_BALANCER = 2, + SLPC_PARAM_TASK_DISABLE_BALANCER = 3, + SLPC_PARAM_TASK_ENABLE_DCC = 4, + SLPC_PARAM_TASK_DISABLE_DCC = 5, + SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ = 6, + SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ = 7, + SLPC_PARAM_GLOBAL_MIN_GT_SLICE_FREQ_MHZ = 8, + SLPC_PARAM_GLOBAL_MAX_GT_SLICE_FREQ_MHZ = 9, + SLPC_PARAM_DFPS_THRESHOLD_MAX_FPS = 10, + SLPC_PARAM_GLOBAL_DISABLE_GT_FREQ_MANAGEMENT = 11, + SLPC_PARAM_DFPS_DISABLE_FRAMERATE_STALLING = 12, + SLPC_PARAM_GLOBAL_DISABLE_RC6_MODE_CHANGE = 13, + SLPC_PARAM_GLOBAL_OC_UNSLICE_FREQ_MHZ = 14, + SLPC_PARAM_GLOBAL_OC_SLICE_FREQ_MHZ = 15, + SLPC_PARAM_GLOBAL_DISABE_IA_GT_BALANCING = 16, +}; + enum slpc_global_state { SLPC_GLOBAL_STATE_NOT_RUNNING = 0, SLPC_GLOBAL_STATE_INITIALIZING = 1, @@ -180,5 +200,9 @@ void intel_slpc_update_display_mode_info(struct drm_device *dev); void intel_slpc_update_atomic_commit_info(struct drm_device *dev, struct drm_atomic_state *state); void intel_slpc_update_display_rr_info(struct drm_device *dev, u32 refresh_rate); - +void intel_slpc_unset_param(struct drm_device *dev, enum slpc_param_id id); +void intel_slpc_set_param(struct drm_device *dev, enum slpc_param_id id, + u32 value); +void intel_slpc_get_param(struct drm_device *dev, enum slpc_param_id id, + int *overriding, u32 *value); #endif -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx