From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
<intel-gfx@lists.freedesktop.org>,
<intel-xe@lists.freedesktop.org>
Cc: <rodrigo.vivi@intel.com>, <lucas.demarchi@intel.com>,
Gustavo Sousa <gustavo.sousa@intel.com>
Subject: Re: [PATCH v2 5/6] drm/i915/hdcp: migrate away from kdev_to_i915() in GSC messaging
Date: Mon, 2 Sep 2024 14:17:37 +0530 [thread overview]
Message-ID: <a1463321-5e1d-44f7-8c4e-26d4612c950b@intel.com> (raw)
In-Reply-To: <efd5c4c164c01b7ee50ad43f202b074b373fb810.1724942754.git.jani.nikula@intel.com>
On 8/29/2024 8:17 PM, Jani Nikula wrote:
> Use to_intel_display() instead of kdev_to_i915() in the HDCP component
> API hooks. Avoid further drive-by changes at this point, and just
> convert the display pointer to i915, and leave the struct intel_display
> conversion for later.
>
> The NULL error checking in the hooks make this a bit cumbersome. I'm not
> actually sure they're really required, but don't go down that rabbit
> hole just now.
>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
LGTM.
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> .../drm/i915/display/intel_hdcp_gsc_message.c | 67 +++++++++++++------
> 1 file changed, 45 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c b/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
> index 6548e71b4c49..35bdb532bbb3 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
> @@ -7,6 +7,7 @@
> #include <drm/intel/i915_hdcp_interface.h>
>
> #include "i915_drv.h"
> +#include "intel_display_types.h"
> #include "intel_hdcp_gsc_message.h"
>
> int
> @@ -15,17 +16,19 @@ intel_hdcp_gsc_initiate_session(struct device *dev, struct hdcp_port_data *data,
> {
> struct wired_cmd_initiate_hdcp2_session_in session_init_in = {};
> struct wired_cmd_initiate_hdcp2_session_out session_init_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !ake_data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> session_init_in.header.api_version = HDCP_API_VERSION;
> session_init_in.header.command_id = WIRED_INITIATE_HDCP2_SESSION;
> @@ -72,17 +75,19 @@ intel_hdcp_gsc_verify_receiver_cert_prepare_km(struct device *dev,
> {
> struct wired_cmd_verify_receiver_cert_in verify_rxcert_in = {};
> struct wired_cmd_verify_receiver_cert_out verify_rxcert_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> verify_rxcert_in.header.api_version = HDCP_API_VERSION;
> verify_rxcert_in.header.command_id = WIRED_VERIFY_RECEIVER_CERT;
> @@ -135,17 +140,19 @@ intel_hdcp_gsc_verify_hprime(struct device *dev, struct hdcp_port_data *data,
> {
> struct wired_cmd_ake_send_hprime_in send_hprime_in = {};
> struct wired_cmd_ake_send_hprime_out send_hprime_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !rx_hprime)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> send_hprime_in.header.api_version = HDCP_API_VERSION;
> send_hprime_in.header.command_id = WIRED_AKE_SEND_HPRIME;
> @@ -183,17 +190,19 @@ intel_hdcp_gsc_store_pairing_info(struct device *dev, struct hdcp_port_data *dat
> {
> struct wired_cmd_ake_send_pairing_info_in pairing_info_in = {};
> struct wired_cmd_ake_send_pairing_info_out pairing_info_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !pairing_info)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> pairing_info_in.header.api_version = HDCP_API_VERSION;
> pairing_info_in.header.command_id = WIRED_AKE_SEND_PAIRING_INFO;
> @@ -234,17 +243,19 @@ intel_hdcp_gsc_initiate_locality_check(struct device *dev,
> {
> struct wired_cmd_init_locality_check_in lc_init_in = {};
> struct wired_cmd_init_locality_check_out lc_init_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !lc_init_data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> lc_init_in.header.api_version = HDCP_API_VERSION;
> lc_init_in.header.command_id = WIRED_INIT_LOCALITY_CHECK;
> @@ -280,17 +291,19 @@ intel_hdcp_gsc_verify_lprime(struct device *dev, struct hdcp_port_data *data,
> {
> struct wired_cmd_validate_locality_in verify_lprime_in = {};
> struct wired_cmd_validate_locality_out verify_lprime_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !rx_lprime)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> verify_lprime_in.header.api_version = HDCP_API_VERSION;
> verify_lprime_in.header.command_id = WIRED_VALIDATE_LOCALITY;
> @@ -330,17 +343,19 @@ int intel_hdcp_gsc_get_session_key(struct device *dev,
> {
> struct wired_cmd_get_session_key_in get_skey_in = {};
> struct wired_cmd_get_session_key_out get_skey_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data || !ske_data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> get_skey_in.header.api_version = HDCP_API_VERSION;
> get_skey_in.header.command_id = WIRED_GET_SESSION_KEY;
> @@ -382,17 +397,19 @@ intel_hdcp_gsc_repeater_check_flow_prepare_ack(struct device *dev,
> {
> struct wired_cmd_verify_repeater_in verify_repeater_in = {};
> struct wired_cmd_verify_repeater_out verify_repeater_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !rep_topology || !rep_send_ack || !data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> verify_repeater_in.header.api_version = HDCP_API_VERSION;
> verify_repeater_in.header.command_id = WIRED_VERIFY_REPEATER;
> @@ -442,6 +459,7 @@ int intel_hdcp_gsc_verify_mprime(struct device *dev,
> {
> struct wired_cmd_repeater_auth_stream_req_in *verify_mprime_in;
> struct wired_cmd_repeater_auth_stream_req_out verify_mprime_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
> size_t cmd_size;
> @@ -449,11 +467,12 @@ int intel_hdcp_gsc_verify_mprime(struct device *dev,
> if (!dev || !stream_ready || !data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> cmd_size = struct_size(verify_mprime_in, streams, data->k);
> if (cmd_size == SIZE_MAX)
> @@ -504,17 +523,19 @@ int intel_hdcp_gsc_enable_authentication(struct device *dev,
> {
> struct wired_cmd_enable_auth_in enable_auth_in = {};
> struct wired_cmd_enable_auth_out enable_auth_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> enable_auth_in.header.api_version = HDCP_API_VERSION;
> enable_auth_in.header.command_id = WIRED_ENABLE_AUTH;
> @@ -549,17 +570,19 @@ intel_hdcp_gsc_close_session(struct device *dev, struct hdcp_port_data *data)
> {
> struct wired_cmd_close_session_in session_close_in = {};
> struct wired_cmd_close_session_out session_close_out = {};
> + struct intel_display *display;
> struct drm_i915_private *i915;
> ssize_t byte;
>
> if (!dev || !data)
> return -EINVAL;
>
> - i915 = kdev_to_i915(dev);
> - if (!i915) {
> + display = to_intel_display(dev);
> + if (!display) {
> dev_err(dev, "DRM not initialized, aborting HDCP.\n");
> return -ENODEV;
> }
> + i915 = to_i915(display->drm);
>
> session_close_in.header.api_version = HDCP_API_VERSION;
> session_close_in.header.command_id = WIRED_CLOSE_SESSION;
next prev parent reply other threads:[~2024-09-02 12:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 14:47 [PATCH v2 0/6] drm/xe & drm/i915: drvdata usage changes follow-up Jani Nikula
2024-08-29 14:47 ` [PATCH v2 1/6] drm/i915 & drm/xe: save struct drm_device to drvdata Jani Nikula
2024-08-29 14:47 ` [PATCH v2 2/6] drm/i915: support struct device and pci_dev in to_intel_display() Jani Nikula
2024-08-29 14:47 ` [PATCH v2 3/6] drm/i915/audio: migrate away from kdev_to_i915() Jani Nikula
2024-08-29 14:47 ` [PATCH v2 4/6] drm/i915/hdcp: migrate away from kdev_to_i915() in bind/unbind Jani Nikula
2024-08-29 14:47 ` [PATCH v2 5/6] drm/i915/hdcp: migrate away from kdev_to_i915() in GSC messaging Jani Nikula
2024-09-02 8:47 ` Nautiyal, Ankit K [this message]
2024-09-02 8:47 ` Kandpal, Suraj
2024-09-02 8:52 ` Murthy, Arun R
2024-09-02 10:44 ` Kandpal, Suraj
2024-08-29 14:47 ` [PATCH v2 6/6] drm/xe/display: remove unused compat kdev_to_i915() and pdev_to_i915() Jani Nikula
2024-08-29 14:54 ` ✓ CI.Patch_applied: success for drm/xe & drm/i915: drvdata usage changes follow-up Patchwork
2024-08-29 14:55 ` ✓ CI.checkpatch: " Patchwork
2024-08-29 14:56 ` ✓ CI.KUnit: " Patchwork
2024-08-29 15:08 ` ✓ CI.Build: " Patchwork
2024-08-29 15:10 ` ✓ CI.Hooks: " Patchwork
2024-08-29 15:12 ` ✗ CI.checksparse: warning " Patchwork
2024-08-29 15:31 ` ✓ CI.BAT: success " Patchwork
2024-08-30 4:50 ` ✗ CI.FULL: failure " Patchwork
2024-09-02 12:20 ` [PATCH v2 0/6] " Jani Nikula
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=a1463321-5e1d-44f7-8c4e-26d4612c950b@intel.com \
--to=ankit.k.nautiyal@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox