All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org,
	martin.peres@intel.com
Subject: Re: [Intel-gfx] [PATCH v2 2/2] drm/i915: Add a new debugfs to request HDCP version
Date: Mon, 15 Jun 2020 10:15:43 +0530	[thread overview]
Message-ID: <20200615044542.GD14085@intel.com> (raw)
In-Reply-To: <20200608100103.19472-3-ankit.k.nautiyal@intel.com>

On 2020-06-08 at 15:31:03 +0530, Ankit Nautiyal wrote:
> As per the current HDCP design, the driver selects the highest
> version of HDCP that can be used to satisfy the content-protection
> requirements of the user. Due to this, the content-protection
> tests cannot test a lower version of HDCP, if the platform and the
> display panel, both support higher HDCP version.
> 
> To provide some support for testing and debugging, a per-connector
> debugfs is required to set the HDCP version via debugfs that the
> kernel can consider, while enabling HDCP.
> 
> This patch adds a new debugfs entry for each connector that supports
> HDCP. For enforcing a particular HDCP version for a connector, the user
> can write into the debugfs for that connector.
IMHO this doesn't feel like a debugfs per connector, even if it is a
global singleton resource for all connectors, i don't see any problem in
that, may be a global debugfs would make sense here ?
> 
> v2: As suggested by Jani Nikula:
> -used kstrtouint_from_user() to directly read as uint from user buffer.
> -used 32 bit flag instead of 64 bit for hdcp_ver flag.
> -removed unnecessary prints and fixed other minor formatting issues.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  .../drm/i915/display/intel_display_debugfs.c  | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index 70525623bcdf..c01653d412e7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -2185,6 +2185,72 @@ static const struct file_operations i915_dsc_fec_support_fops = {
>  	.write = i915_dsc_fec_support_write
>  };
>  
> +static int i915_hdcp_ver_request_show(struct seq_file *m, void *data)
> +{
> +	struct drm_connector *connector = m->private;
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	u32 hdcp_ver_flag;
> +
> +	if (connector->status != connector_status_connected)
> +		return -ENODEV;
> +
> +	/* HDCP is supported by connector */
> +	if (!intel_connector->hdcp.shim)
> +		return -EINVAL;
> +
> +	hdcp_ver_flag = intel_connector->hdcp.debugfs_ver_request;
> +	seq_printf(m, "HDCP_VER_FLAGS: %u\n", hdcp_ver_flag);
> +
> +	return 0;
> +}
> +
> +static int i915_hdcp_ver_request_open(struct inode *inode,
> +				      struct file *file)
> +{
> +	return single_open(file, i915_hdcp_ver_request_show,
> +			   inode->i_private);
> +}
> +
> +static ssize_t i915_hdcp_ver_request_write(struct file *file,
> +					   const char __user *ubuf,
> +					   size_t len, loff_t *offp)
> +{
> +	unsigned int hdcp_ver = 0;
> +	int ret;
> +	struct drm_connector *connector =
> +		((struct seq_file *)file->private_data)->private;
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	struct intel_hdcp *hdcp = &intel_connector->hdcp;
> +
> +	if (!hdcp->shim)
> +		return -EINVAL;
> +
> +	if (len == 0)
> +		return 0;
> +
> +	ret = kstrtouint_from_user(ubuf, len, 0, &hdcp_ver);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (hdcp_ver > HDCP_VERSION_MASK)
> +		return -EINVAL;
> +
> +	hdcp->debugfs_ver_request = hdcp_ver;
A lockless assignment, this would probably not scale.
Could u please add some comment here for current IGT need this is ok,
but for any concurrent usgaes proper locking is required.
Thanks,
Anshuman
> +
> +	*offp += len;
> +
> +	return len;
> +}
> +
> +static const struct file_operations i915_hdcp_ver_request_fops = {
> +	.owner = THIS_MODULE,
> +	.open = i915_hdcp_ver_request_open,
> +	.read = seq_read,
> +	.llseek = seq_lseek,
> +	.release = single_release,
> +	.write = i915_hdcp_ver_request_write
> +};
> +
>  /**
>   * intel_connector_debugfs_add - add i915 specific connector debugfs files
>   * @connector: pointer to a registered drm_connector
> @@ -2215,6 +2281,8 @@ int intel_connector_debugfs_add(struct drm_connector *connector)
>  	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) {
>  		debugfs_create_file("i915_hdcp_sink_capability", S_IRUGO, root,
>  				    connector, &i915_hdcp_sink_capability_fops);
> +		debugfs_create_file("i915_hdcp_version_request", 0444, root,
> +				    connector, &i915_hdcp_ver_request_fops);
>  	}
>  
>  	if (INTEL_GEN(dev_priv) >= 10 &&
> -- 
> 2.17.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-06-15  4:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 10:01 [Intel-gfx] [PATCH v2 0/2] Add debugfs for requesting HDCP version Ankit Nautiyal
2020-06-08 10:01 ` [Intel-gfx] [PATCH v2 1/2] drm/i915: Add support for considering HDCP ver requested via debugfs Ankit Nautiyal
2020-06-15  4:29   ` Anshuman Gupta
2020-06-15 10:06     ` Nautiyal, Ankit K
2020-06-08 10:01 ` [Intel-gfx] [PATCH v2 2/2] drm/i915: Add a new debugfs to request HDCP version Ankit Nautiyal
2020-06-15  4:45   ` Anshuman Gupta [this message]
2020-06-15 10:18     ` Nautiyal, Ankit K
2020-06-08 11:52 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Add debugfs for requesting " Patchwork
2020-06-08 12:13 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-06-08 14:53 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200615044542.GD14085@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=martin.peres@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.