Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ramalingam C <ramalingam.c@intel.com>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, seanpaul@chromium.org,
	tomas.winkler@intel.com
Subject: Re: [PATCH v9 05/39] drm/i915: component master at i915 driver load
Date: Wed, 19 Dec 2018 14:45:21 +0100	[thread overview]
Message-ID: <20181219134521.GC21184@phenom.ffwll.local> (raw)
In-Reply-To: <1544673701-6353-6-git-send-email-ramalingam.c@intel.com>

On Thu, Dec 13, 2018 at 09:31:07AM +0530, Ramalingam C wrote:
> A generic component master is added to hold the i915 registration
> until all required kernel modules are up and active.
> 
> This is achieved through following steps:
>   - moving the i915 driver registration to the component master's
>     bind call
>   - all required kernel modules will add one component each to
>     component_match of I915 component master.
> 
> If no component is added to the I915 component master, due to CONFIG
> selection or HW limitation, component master's bind call (i915
> registration) will be triggered with no wait.
> 
> Similarly when a associated component is removed for some reasons,
> I915 will be unregistered through component master unbind.
> 
> v2:
>   i915_driver_unregister is added to the unbind of master.
> v3:
>   In master_unbind i915_unregister->drm_atomic_helper_shutdown->
> 	component_unbind_all [Daniel]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 86 +++++++++++++++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/i915_drv.h |  3 ++
>  include/drm/i915_component.h    | 11 ++++++
>  3 files changed, 92 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index b310a897a4ad..b8a204072e60 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -39,12 +39,14 @@
>  #include <linux/vgaarb.h>
>  #include <linux/vga_switcheroo.h>
>  #include <linux/vt.h>
> +#include <linux/component.h>
>  #include <acpi/video.h>
>  
>  #include <drm/drmP.h>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/i915_drm.h>
> +#include <drm/i915_component.h>
>  
>  #include "i915_drv.h"
>  #include "i915_trace.h"
> @@ -1577,8 +1579,6 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
>  	if (IS_GEN5(dev_priv))
>  		intel_gpu_ips_init(dev_priv);
>  
> -	intel_audio_init(dev_priv);
> -
>  	/*
>  	 * Some ports require correctly set-up hpd registers for detection to
>  	 * work properly (leading to ghost connected connector status), e.g. VGA
> @@ -1609,7 +1609,6 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
>  	intel_power_domains_disable(dev_priv);
>  
>  	intel_fbdev_unregister(dev_priv);
> -	intel_audio_deinit(dev_priv);
>  
>  	/*
>  	 * After flushing the fbdev (incl. a late async config which will
> @@ -1694,6 +1693,48 @@ static void i915_driver_destroy(struct drm_i915_private *i915)
>  	pci_set_drvdata(pdev, NULL);
>  }
>  
> +static void i915_driver_load_tail(struct drm_i915_private *dev_priv)
> +{
> +	i915_driver_register(dev_priv);
> +
> +	DRM_INFO("load_tail: I915 driver registered\n");
> +}
> +
> +static void i915_driver_unload_head(struct drm_i915_private *dev_priv)
> +{
> +	i915_driver_unregister(dev_priv);
> +
> +	DRM_INFO("unload_head: I915 driver unregistered\n");
> +}
> +
> +static int i915_component_master_bind(struct device *dev)
> +{
> +	struct drm_i915_private *dev_priv = kdev_to_i915(dev);
> +	int ret;
> +
> +	ret = component_bind_all(dev, dev_priv->comp_master);
> +	if (ret < 0)
> +		return ret;
> +
> +	i915_driver_load_tail(dev_priv);
> +
> +	return 0;
> +}
> +
> +static void i915_component_master_unbind(struct device *dev)
> +{
> +	struct drm_i915_private *dev_priv = kdev_to_i915(dev);
> +
> +	i915_driver_unload_head(dev_priv);
> +	drm_atomic_helper_shutdown(&dev_priv->drm);
> +	component_unbind_all(dev, dev_priv->comp_master);
> +}
> +
> +static const struct component_master_ops i915_component_master_ops = {
> +	.bind = i915_component_master_bind,
> +	.unbind = i915_component_master_unbind,
> +};
> +
>  /**
>   * i915_driver_load - setup chip and create an initial config
>   * @pdev: PCI device
> @@ -1720,9 +1761,22 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (!i915_modparams.nuclear_pageflip && match_info->gen < 5)
>  		dev_priv->drm.driver_features &= ~DRIVER_ATOMIC;
>  
> +	dev_priv->comp_master = kzalloc(sizeof(*dev_priv->comp_master),
> +					GFP_KERNEL);
> +	if (!dev_priv->comp_master) {
> +		ret = -ENOMEM;
> +		goto out_fini;
> +	}
> +
> +	component_match_alloc(dev_priv->drm.dev, &dev_priv->master_match);
> +	if (!dev_priv->master_match) {
> +		ret = -ENOMEM;
> +		goto out_comp_master_clean;
> +	}
> +
>  	ret = pci_enable_device(pdev);
>  	if (ret)
> -		goto out_fini;
> +		goto out_comp_master_clean;
>  
>  	ret = i915_driver_init_early(dev_priv);
>  	if (ret < 0)
> @@ -1742,14 +1796,27 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (ret < 0)
>  		goto out_cleanup_hw;
>  
> -	i915_driver_register(dev_priv);
> +	ret = component_master_add_with_match(dev_priv->drm.dev,
> +					      &i915_component_master_ops,
> +					      dev_priv->master_match);
> +	if (ret < 0) {
> +		DRM_DEV_ERROR(&pdev->dev, "Master comp add failed %d\n",
> +			      ret);
> +		goto out_cleanup_modeset;
> +	}
> +

I think a FIXME here would be nice, all we need to do is have a
component_add_locked functions to handle the recursion. Logically there's
not issue really. Same with intel_audio_deinit() below.

Otoh, the component we expose to snd-hda isn't really related to anything
uapi related, it's just a very low-level interface for power domains and a
few other things. Nothing bad happens if we don't register/unregister that
together with all the uapi/kms/fbdev interfaces.

Either way: Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +	intel_audio_init(dev_priv);
>  
>  	enable_rpm_wakeref_asserts(dev_priv);
>  
>  	i915_welcome_messages(dev_priv);
>  
> +	DRM_INFO("I915 registration waits for req component(s). if any...\n");
> +
>  	return 0;
>  
> +out_cleanup_modeset:
> +	intel_modeset_cleanup(&dev_priv->drm);
>  out_cleanup_hw:
>  	i915_driver_cleanup_hw(dev_priv);
>  out_cleanup_mmio:
> @@ -1759,6 +1826,8 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	i915_driver_cleanup_early(dev_priv);
>  out_pci_disable:
>  	pci_disable_device(pdev);
> +out_comp_master_clean:
> +	kfree(dev_priv->comp_master);
>  out_fini:
>  	i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
>  	i915_driver_destroy(dev_priv);
> @@ -1772,13 +1841,14 @@ void i915_driver_unload(struct drm_device *dev)
>  
>  	disable_rpm_wakeref_asserts(dev_priv);
>  
> -	i915_driver_unregister(dev_priv);
> +	component_master_del(dev_priv->drm.dev, &i915_component_master_ops);
> +	kfree(dev_priv->comp_master);
> +
> +	intel_audio_deinit(dev_priv);
>  
>  	if (i915_gem_suspend(dev_priv))
>  		DRM_ERROR("failed to idle hardware; continuing to unload!\n");
>  
> -	drm_atomic_helper_shutdown(dev);
> -
>  	intel_gvt_cleanup(dev_priv);
>  
>  	intel_modeset_cleanup(dev);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e70707e79386..25dc3d7a1e3b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2002,6 +2002,9 @@ struct drm_i915_private {
>  
>  	struct i915_pmu pmu;
>  
> +	struct i915_component_master *comp_master;
> +	struct component_match *master_match;
> +
>  	/*
>  	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
>  	 * will be rejected. Instead look for a better place.
> diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h
> index fca22d463e1b..6f94ddd3f2c2 100644
> --- a/include/drm/i915_component.h
> +++ b/include/drm/i915_component.h
> @@ -46,4 +46,15 @@ struct i915_audio_component {
>  	int aud_sample_rate[MAX_PORTS];
>  };
>  
> +/**
> + * struct i915_component_master - Used for communication between i915
> + *				  and any other drivers for the services
> + *				  of different feature.
> + */
> +struct i915_component_master {
> +	/*
> +	 * Add here the interface details between I915 and interested modules.
> +	 */
> +};
> +
>  #endif /* _I915_COMPONENT_H_ */
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-12-19 13:45 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13  4:01 [PATCH v9 00/39] drm/i915: Implement HDCP2.2 Ramalingam C
2018-12-13  4:01 ` [PATCH v9 01/39] drm/i915: Gathering the HDCP1.4 routines together Ramalingam C
2018-12-13  8:17   ` Winkler, Tomas
2018-12-13 11:21     ` C, Ramalingam
2018-12-19 13:35   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 02/39] drm: header for i915 - MEI_HDCP interface Ramalingam C
2018-12-17 11:28   ` Winkler, Tomas
2018-12-17 13:27     ` Daniel Vetter
2018-12-17 13:42       ` Winkler, Tomas
2018-12-17 13:59         ` Daniel Vetter
2018-12-19 13:37   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 03/39] drivers/base: use a worker for sysfs unbind Ramalingam C
2018-12-19 13:38   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 04/39] component: alloc component_match without any comp to match Ramalingam C
2018-12-19 13:42   ` Daniel Vetter
2018-12-19 15:04     ` Greg Kroah-Hartman
2018-12-13  4:01 ` [PATCH v9 05/39] drm/i915: component master at i915 driver load Ramalingam C
2018-12-19 13:45   ` Daniel Vetter [this message]
2018-12-13  4:01 ` [PATCH v9 06/39] drm/i915: Initialize HDCP2.2 Ramalingam C
2018-12-19 13:45   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 07/39] drm/i915: MEI interface definition Ramalingam C
2018-12-19 14:00   ` Daniel Vetter
2018-12-19 15:15     ` C, Ramalingam
2018-12-19 15:21       ` Daniel Vetter
2018-12-20 13:18         ` C, Ramalingam
2018-12-20 14:47           ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 08/39] drm/i915: hdcp1.4 CP_IRQ handling and SW encryption tracking Ramalingam C
2018-12-19 15:48   ` Daniel Vetter
2018-12-20 11:29     ` C, Ramalingam
2018-12-20 14:53       ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 09/39] drm/i915: Enable and Disable of HDCP2.2 Ramalingam C
2018-12-19 15:54   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 10/39] drm/i915: Implement HDCP2.2 receiver authentication Ramalingam C
2018-12-19 14:35   ` Daniel Vetter
2018-12-19 15:05     ` C, Ramalingam
2018-12-19 15:35       ` Daniel Vetter
2018-12-19 15:48         ` C, Ramalingam
2018-12-19 18:40       ` Jani Nikula
2018-12-19 21:36         ` Winkler, Tomas
2018-12-20  7:42           ` Jani Nikula
2018-12-20 14:28             ` Winkler, Tomas
2018-12-20 14:55               ` Daniel Vetter
2018-12-21 18:06                 ` Ville Syrjälä
2018-12-13  4:01 ` [PATCH v9 11/39] drm: helper functions for hdcp2 seq_num to from u32 Ramalingam C
2018-12-19 14:38   ` Daniel Vetter
2018-12-13  4:01 ` [PATCH v9 12/39] drm/i915: Implement HDCP2.2 repeater authentication Ramalingam C
2018-12-13  8:22   ` Winkler, Tomas
2018-12-13 11:18     ` C, Ramalingam
2018-12-19 14:48   ` Daniel Vetter
2018-12-19 15:35     ` C, Ramalingam
2018-12-13  4:01 ` [PATCH v9 13/39] drm: HDCP2.2 link check related constants Ramalingam C
2018-12-19 15:16   ` Daniel Vetter
2018-12-19 15:39     ` C, Ramalingam
2018-12-19 15:58       ` Daniel Vetter
2018-12-19 16:22         ` C, Ramalingam
2018-12-19 16:35           ` Daniel Vetter
2018-12-19 17:01             ` C, Ramalingam
2018-12-13  4:01 ` [PATCH v9 14/39] drm/i915: Implement HDCP2.2 link integrity check Ramalingam C
2018-12-13  4:01 ` [PATCH v9 15/39] drm/i915: Handle HDCP2.2 downstream topology change Ramalingam C
2018-12-13  4:01 ` [PATCH v9 16/39] drm/i915: Implement the HDCP2.2 support for DP Ramalingam C
2018-12-13  4:01 ` [PATCH v9 17/39] drm/i915: Implement the HDCP2.2 support for HDMI Ramalingam C
2018-12-13  4:01 ` [PATCH v9 18/39] drm/i915: Add HDCP2.2 support for DP connectors Ramalingam C
2018-12-13  4:01 ` [PATCH v9 19/39] drm/i915: Add HDCP2.2 support for HDMI connectors Ramalingam C
2018-12-13  4:01 ` [PATCH v9 20/39] mei: bus: whitelist hdcp client Ramalingam C
2018-12-13  4:01 ` [PATCH v9 21/39] mei: bus: export to_mei_cl_device for mei client device drivers Ramalingam C
2018-12-13  4:01 ` [PATCH v9 22/39] misc/mei/hdcp: Client driver for HDCP application Ramalingam C
2018-12-13  4:01 ` [PATCH v9 23/39] misc/mei/hdcp: Define ME FW interface for HDCP2.2 Ramalingam C
2018-12-13  4:01 ` [PATCH v9 24/39] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session Ramalingam C
2018-12-13  4:01 ` [PATCH v9 25/39] misc/mei/hdcp: Verify Receiver Cert and prepare km Ramalingam C
2018-12-13  4:01 ` [PATCH v9 26/39] misc/mei/hdcp: Verify H_prime Ramalingam C
2018-12-13  4:01 ` [PATCH v9 27/39] misc/mei/hdcp: Store the HDCP Pairing info Ramalingam C
2018-12-13  4:01 ` [PATCH v9 28/39] misc/mei/hdcp: Initiate Locality check Ramalingam C
2018-12-13  4:01 ` [PATCH v9 29/39] misc/mei/hdcp: Verify L_prime Ramalingam C
2018-12-13  4:01 ` [PATCH v9 30/39] misc/mei/hdcp: Prepare Session Key Ramalingam C
2018-12-13  4:01 ` [PATCH v9 31/39] misc/mei/hdcp: Repeater topology verification and ack Ramalingam C
2018-12-13  4:01 ` [PATCH v9 32/39] misc/mei/hdcp: Verify M_prime Ramalingam C
2018-12-13  4:01 ` [PATCH v9 33/39] misc/mei/hdcp: Enabling the HDCP authentication Ramalingam C
2018-12-13  4:01 ` [PATCH v9 34/39] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session Ramalingam C
2018-12-13  4:01 ` [PATCH v9 35/39] misc/mei/hdcp: Component framework for I915 Interface Ramalingam C
2018-12-13 12:36   ` C, Ramalingam
2018-12-13 16:11     ` Daniel Vetter
2018-12-13 16:27       ` Winkler, Tomas
2018-12-13 17:35         ` Daniel Vetter
2018-12-15 21:20           ` Winkler, Tomas
2018-12-17  9:39             ` Daniel Vetter
2018-12-17  9:59               ` Daniel Vetter
2018-12-17 10:57               ` Winkler, Tomas
2018-12-17 13:46                 ` Daniel Vetter
2018-12-19  6:45                   ` C, Ramalingam
2018-12-20 15:59                     ` C, Ramalingam
2018-12-20 16:06                       ` Winkler, Tomas
2018-12-20 16:47                         ` C, Ramalingam
2018-12-13  4:01 ` [PATCH v9 36/39] drm/i915: Commit CP without modeset Ramalingam C
2018-12-13  4:01 ` [PATCH v9 37/39] drm/i915: Fix KBL HDCP2.2 encrypt status signalling Ramalingam C
2018-12-19 15:40   ` Daniel Vetter
2018-12-19 16:16     ` C, Ramalingam
2018-12-13  4:01 ` [PATCH v9 38/39] FOR_TEST: i915/Kconfig: Select mei_hdcp by I915 Ramalingam C
2018-12-13  4:01 ` [PATCH v9 39/39] FOR_TESTING_ONLY: debugfs: Excluding the LSPCon for HDCP1.4 Ramalingam C
2018-12-13  4:17 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Implement HDCP2.2 (rev11) Patchwork
2018-12-13  4:27 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-13  4:44 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-12-20 16:58 ` ✗ Fi.CI.BAT: failure for drm/i915: Implement HDCP2.2 (rev12) 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=20181219134521.GC21184@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ramalingam.c@intel.com \
    --cc=seanpaul@chromium.org \
    --cc=tomas.winkler@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