drm/i915/guc: Split relay control and GuC log level
Those two concepts are really separate. Since GuC is writing data into its own buffer and we even provide a way for userspace to read directly from it using i915_guc_log_dump debugfs, there's no real reason to tie log level with relay creation. Let's create a separate debugfs, giving userspace a way to create a relay on demand, when it wants to read a continuous log rather than a snapshot. v2: Don't touch guc_log_level on relay creation error, adjust locking after rebase, s/dev_priv/i915, pass guc to file->private_data (Sagar) Use struct_mutex rather than runtime.lock for set_log_level v3: Tidy ordering of definitions (Sagar) Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20180319095348.9716-5-michal.winiarski@intel.com
This commit is contained in:

committed by
Chris Wilson

父節點
d3fbf9437b
當前提交
4977a287b9
@@ -2495,32 +2495,73 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i915_guc_log_control_get(void *data, u64 *val)
|
||||
static int i915_guc_log_level_get(void *data, u64 *val)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = data;
|
||||
|
||||
if (!USES_GUC(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
*val = intel_guc_log_control_get(&dev_priv->guc.log);
|
||||
*val = intel_guc_log_level_get(&dev_priv->guc.log);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i915_guc_log_control_set(void *data, u64 val)
|
||||
static int i915_guc_log_level_set(void *data, u64 val)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = data;
|
||||
|
||||
if (!USES_GUC(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
return intel_guc_log_control_set(&dev_priv->guc.log, val);
|
||||
return intel_guc_log_level_set(&dev_priv->guc.log, val);
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_control_fops,
|
||||
i915_guc_log_control_get, i915_guc_log_control_set,
|
||||
DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_level_fops,
|
||||
i915_guc_log_level_get, i915_guc_log_level_set,
|
||||
"%lld\n");
|
||||
|
||||
static int i915_guc_log_relay_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = inode->i_private;
|
||||
|
||||
if (!USES_GUC(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
file->private_data = &dev_priv->guc.log;
|
||||
|
||||
return intel_guc_log_relay_open(&dev_priv->guc.log);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
i915_guc_log_relay_write(struct file *filp,
|
||||
const char __user *ubuf,
|
||||
size_t cnt,
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct intel_guc_log *log = filp->private_data;
|
||||
|
||||
intel_guc_log_relay_flush(log);
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static int i915_guc_log_relay_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = inode->i_private;
|
||||
|
||||
intel_guc_log_relay_close(&dev_priv->guc.log);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations i915_guc_log_relay_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = i915_guc_log_relay_open,
|
||||
.write = i915_guc_log_relay_write,
|
||||
.release = i915_guc_log_relay_release,
|
||||
};
|
||||
|
||||
static const char *psr2_live_status(u32 val)
|
||||
{
|
||||
static const char * const live_status[] = {
|
||||
@@ -4748,7 +4789,8 @@ static const struct i915_debugfs_files {
|
||||
{"i915_dp_test_data", &i915_displayport_test_data_fops},
|
||||
{"i915_dp_test_type", &i915_displayport_test_type_fops},
|
||||
{"i915_dp_test_active", &i915_displayport_test_active_fops},
|
||||
{"i915_guc_log_control", &i915_guc_log_control_fops},
|
||||
{"i915_guc_log_level", &i915_guc_log_level_fops},
|
||||
{"i915_guc_log_relay", &i915_guc_log_relay_fops},
|
||||
{"i915_hpd_storm_ctl", &i915_hpd_storm_ctl_fops},
|
||||
{"i915_ipc_status", &i915_ipc_status_fops},
|
||||
{"i915_drrs_ctl", &i915_drrs_ctl_fops}
|
||||
|
Reference in New Issue
Block a user