I915 component master
Subsystems (4)
cover I915 component master
i915_driver_load registers a component master and i915 driver registration is moved into the bind call of that component master.
If any component of the particular features are registered with this I915 component master's match, then I915 registration will wait until all registered components are added to the framework.
In third patch component from mei_hdcp module is registered to component_match of I915 master component.
Hence I915 registration will wait until mei device is binded with mei_hdcp driver and adds the component to the component framework.
Ramalingam C (3):
component: alloc component_match without any comp to match drm/i915: component master at i915 driver load drm/i915: Initialize HDCP2.2 and its MEI interface
drivers/base/component.c | 30 ++++++++++++++ drivers/gpu/drm/i915/i915_drv.c | 87 +++++++++++++++++++++++++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 ++- drivers/gpu/drm/i915/intel_hdcp.c | 78 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- include/drm/i915_component.h | 76 ++++++++++++++++++++++++++++++++++ include/linux/component.h | 2 + 9 files changed, 270 insertions(+), 16 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 1/3 component: alloc component_match without any comp to match
If all the components associated to a component master is not added to the component framework due to the HW capability or Kconfig selection, component_match will be NULL at component_master_add_with_match().
To avoid this, component_match_alloc() is added to the framework, to allcoate the struct component_match with zero associated components. Hence component master can be added with a component_match with zero associated components.
This helps the component master bind call to get triggered always, even if no component is registered for that particular master.
This is useful if we use the component master for waiting for few components(features), only if they are registered, else proceed with the normal flow.
--- drivers/base/component.c | 30 ++++++++++++++++++++++++++++++ include/linux/component.h | 2 ++ 2 files changed, 32 insertions(+)
drivers/base/component.c +30 -0
@@ -312,6 +312,36 @@ static int component_match_realloc(struct device *dev, }/* +* Allocate the match without any component_match_array elements. +* +* This function is useful when the component master might end up +* registering itself without any matching components. +*/ +void component_match_alloc (struct device *master, +struct component_match **matchptr) +{ +struct component_match *match = *matchptr; + +if (IS_ERR (match)) +return ; + +if (match) +return ; + + match =devres_alloc (devm_component_match_release, +sizeof (*match),GFP_KERNEL ); +if (!match) { + *matchptr =ERR_PTR (-ENOMEM ); +return ; + } + +devres_add (master, match); + + *matchptr = match; +} +EXPORT_SYMBOL (component_match_alloc); + +/* * Add a component to be matched, with a release function. * * The match array is first created or extended if necessary.
include/linux/component.h +2 -0
@@ -37,6 +37,8 @@ void component_match_add_release(struct device *master,struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); +void component_match_alloc (struct device *master, +struct component_match **matchptr); static inline void component_match_add(struct device *master, struct component_match **matchptr,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 1/3] component: alloc component_match without any comp to match
Quoted 10 lines · Ramalingam C
If all the components associated to a component master is not added to the component framework due to the HW capability or
Kconfigselection,component_matchwill be NULL atcomponent_master_add_with_match().To avoid this,
component_match_alloc()is added to the framework, to allcoate the structcomponent_matchwith zero associated components. Hence component master can be added with acomponent_matchwith zero associated components.
Quoted 6 lines
This helps the component master bind call to get triggered always, even if no component is registered for that particular master.
This is useful if we use the component master for waiting for few components(features), only if they are registered, else proceed with the normal flow.
registered is a bit confusing here, I'd go with "supported by the underlying hw". And maybe also explain that this is for big pci device drivers where only some small/optional things are external components, so different use-case from SoC drivers where the entire driver is always built up from lots of small components.
When you submit this for real please also run script/get_maintainers.pl for the full Cc: list.
Quoted 2 lines
Signed-off-by Ramalingam C <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Uh, don't do this, ever. I didn't put my s-o-b onto this patch. If you want to credit me for the suggestion, use
s-o-b has legal meaning and is like signing a contract, you've just forged my signature here. Same applies to reviewed-by tags btw. -Daniel
Quoted 62 lines
--- drivers/base/component.c | 30 ++++++++++++++++++++++++++++++ include/linux/component.h | 2 ++ 2 files changed, 32 insertions(+)drivers/base/component.c +30
-0@@ -312,6 +312,36 @@ static int component_match_realloc(struct device *dev, }/* +* Allocate the match without any component_match_array elements. +* +* This function is useful when the component master might end up +* registering itself without any matching components. +*/ +void component_match_alloc (struct device *master, +struct component_match **matchptr) +{ +struct component_match *match = *matchptr; + +if (IS_ERR (match)) +return ; + +if (match) +return ; + + match =devres_alloc (devm_component_match_release, +sizeof (*match),GFP_KERNEL ); +if (!match) { + *matchptr =ERR_PTR (-ENOMEM ); +return ; + } + +devres_add (master, match); + + *matchptr = match; +} +EXPORT_SYMBOL (component_match_alloc); + +/* * Add a component to be matched, with a release function. * * The match array is first created or extended if necessary. include/linux/component.h +2
-0@@ -37,6 +37,8 @@ void component_match_add_release(struct device *master,struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); +void component_match_alloc (struct device *master, +struct component_match **matchptr); static inline void component_match_add(struct device *master, struct component_match **matchptr,Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 1/3] component: alloc component_match without any comp to match
Quoted 17 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C
If all the components associated to a component master is not added to the component framework due to the HW capability or
Kconfigselection,component_matchwill be NULL atcomponent_master_add_with_match().To avoid this,
component_match_alloc()is added to the framework, to allcoate the structcomponent_matchwith zero associated components. Hence component master can be added with acomponent_matchwith zero associated components.Quoted 6 lines
This helps the component master bind call to get triggered always, even if no component is registered for that particular master.
This is useful if we use the component master for waiting for few components(features), only if they are registered, else proceed with the normal flow.
Quoted 8 lines
registered is a bit confusing here, I'd go with "supported by the underlying hw". And maybe also explain that this is for big pci device drivers where only some small/optional things are external components, so different use-case from SoC drivers where the entire driver is always built up from lots of small components.
When you submit this for real please also run
script/get_maintainers.plfor the full Cc: list.
sure.
Quoted 10 lines
Quoted 3 lines
Signed-off-by Ramalingam C <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Uh, don't do this, ever. I didn't put my s-o-b onto this patch. If you want to credit me for the suggestion, use
Suggested-by ...s-o-b has legal meaning and is like signing a contract, you've just forged my signature here. Same applies to reviewed-by tags btw.
Since the idea is suggested by you, thought that its my responsibility to give the credit. Sure got your point.
I will add Suggested-by: instead.
Thanks,
Ram.
Quoted 59 lines
-Daniel
Quoted 57 lines
--- drivers/base/component.c | 30 ++++++++++++++++++++++++++++++ include/linux/component.h | 2 ++ 2 files changed, 32 insertions(+)drivers/base/component.c +30
-0@@ -312,6 +312,36 @@ static int component_match_realloc(struct device *dev, }/* +* Allocate the match without any component_match_array elements. +* +* This function is useful when the component master might end up +* registering itself without any matching components. +*/ +void component_match_alloc (struct device *master, +struct component_match **matchptr) +{ +struct component_match *match = *matchptr; + +if (IS_ERR (match)) +return ; + +if (match) +return ; + + match =devres_alloc (devm_component_match_release, +sizeof (*match),GFP_KERNEL ); +if (!match) { + *matchptr =ERR_PTR (-ENOMEM ); +return ; + } + +devres_add (master, match); + + *matchptr = match; +} +EXPORT_SYMBOL (component_match_alloc); + +/* * Add a component to be matched, with a release function. * * The match array is first created or extended if necessary. include/linux/component.h +2
-0@@ -37,6 +37,8 @@ void component_match_add_release(struct device *master,struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); +void component_match_alloc (struct device *master, +struct component_match **matchptr);
Quoted 5 lines
Quoted 5 lines
include/linux/component.h +0
-0static inline void component_match_add(struct device *master, struct component_match **matchptr,Signature · 1 line
2.7.4
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 2/3 drm/i915: component master at i915 driver load
In reply to Ramalingam CA generic component master is added to hold the i915 registration untill 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 will be triggered with no wait.
--- drivers/gpu/drm/i915/i915_drv.c | 87 +++++++++++++++++++++++++++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 3 ++ include/drm/i915_component.h | 16 ++++++++ 3 files changed, 94 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +75 -12
@@ -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"
@@ -1247,8 +1249,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
@@ -1310,6 +1310,47 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)DRM_INFO ("DRM_I915_DEBUG_GEM enabled\n" ); } +static void i915_driver_load_tail (struct drm_i915_private *dev_priv) +{ +i915_driver_register (dev_priv); + +intel_runtime_pm_enable (dev_priv); + +intel_init_ipc (dev_priv); + +intel_runtime_pm_put (dev_priv); + +i915_welcome_messages (dev_priv); +} + +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); + +component_unbind_all (dev, dev_priv->comp_master); + +/* TO-DO: Whether I915 should be unloaded on any component unbind!? */ +} + +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
@@ -1341,12 +1382,25 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_free; } + 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; + } + dev_priv->drm.pdev = pdev; dev_priv->drm.dev_private = dev_priv; ret =pci_enable_device (pdev);if (ret) - goto out_fini; + goto out_comp_master_clean;pci_set_drvdata (pdev, &dev_priv->drm);/*
@@ -1389,18 +1443,21 @@ 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); - -intel_runtime_pm_enable (dev_priv); - -intel_init_ipc (dev_priv); - -intel_runtime_pm_put (dev_priv); - -i915_welcome_messages (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; + } +intel_audio_init (dev_priv); +DRM_DEV_INFO (&pdev->dev,"I915 waits for Components (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:
@@ -1410,6 +1467,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);drm_dev_fini (&dev_priv->drm);
@@ -1428,6 +1487,10 @@ void i915_driver_unload(struct drm_device *dev)if (i915_gem_suspend (dev_priv))DRM_ERROR ("failed to idle hardware; continuing to unload!\n" ); +component_master_del (dev_priv->drm.dev, + &i915_component_master_ops); +kfree (dev_priv->comp_master); +intel_display_power_get (dev_priv,POWER_DOMAIN_INIT );drm_atomic_helper_shutdown (dev);
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2119,6 +2119,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.
include/drm/i915_component.h +16 -0
@@ -121,4 +121,20 @@ struct i915_audio_component { const struct i915_audio_component_audio_ops *audio_ops; }; +/** +* struct i915_component_master - Used for communication between i915 +* and any other drivers for the services of different feature. +*/ +struct i915_component_master { +/** +* @i915_kdev: Kdev of I915. Used from the client component for +* removing the reference to mei_cldev. +*/ +struct device *i915_kdev; + +/* +* Add here the interface details between I915 and interested modules. +*/ +}; +#endif /* _I915_COMPONENT_H_ */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 2/3] drm/i915: component master at i915 driver load
Quoted 76 lines · Ramalingam C
A generic component master is added to hold the i915 registration untill 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 tocomponent_matchof 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 will be triggered with no wait.
Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 87 +++++++++++++++++++++++++++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 3 ++ include/drm/i915_component.h | 16 ++++++++ 3 files changed, 94 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_drv.c +26
-2@@ -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" @@ -1247,8 +1249,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 @@ -1310,6 +1310,47 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)DRM_INFO ("DRM_I915_DEBUG_GEM enabled\n" ); } +static void i915_driver_load_tail (struct drm_i915_private *dev_priv) +{ +i915_driver_register (dev_priv); + +intel_runtime_pm_enable (dev_priv); + +intel_init_ipc (dev_priv); + +intel_runtime_pm_put (dev_priv); + +i915_welcome_messages (dev_priv); +} + +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); +
drivers/gpu/drm/i915/i915_drv.c static void i915_welcome_messages(struct drm_i915_private *dev_priv) · line 1346
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +10
-0+return 0 ; +} + +static void i915_component_master_unbind (struct device *dev) +{ +struct drm_i915_private *dev_priv =kdev_to_i915 (dev); + +component_unbind_all (dev, dev_priv->comp_master); + +/* TO-DO: Whether I915 should be unloaded on any component unbind!? */
I think we also need a FIXME here because the audio side will blow up if we do this?
If that's not the case then yes I think we should do the i915_dev_unregister call from here, for symmetry. That way we should be able to unload mei, and it should force the i915 driver out too.
This also depends upon how the entire mei reset story pans out ofc.
Aside from this tiny nit I think the load side here looks good now. -Daniel
Quoted 49 lines
drivers/gpu/drm/i915/i915_drv.c +21
-9+} + +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 @@ -1341,12 +1382,25 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_free; } + 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; + } + dev_priv->drm.pdev = pdev; dev_priv->drm.dev_private = dev_priv; ret =pci_enable_device (pdev);if (ret) - goto out_fini; + goto out_comp_master_clean;pci_set_drvdata (pdev, &dev_priv->drm);/* @@ -1389,18 +1443,21 @@ 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); - -intel_runtime_pm_enable (dev_priv); - -intel_init_ipc (dev_priv); - -intel_runtime_pm_put (dev_priv); -
drivers/gpu/drm/i915/i915_drv.c int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1454
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +9
-1-i915_welcome_messages (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; + } +intel_audio_init (dev_priv);
I think a FIXME comment explaining what's going on here would be good:
/*
* FIXME: component.c doesn't (yet) support recursion, and snd-hda
* doesn't handle delayed component registration correctly. For
* now just uncoditionally register the audio component here,
* outside of the master->bind callback.
*/
Hopefully we can untangle this later on, but for now I think this approach is good.
Quoted 71 lines
drivers/gpu/drm/i915/i915_drv.c +9
-0+DRM_DEV_INFO (&pdev->dev,"I915 waits for Components (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:@@ -1410,6 +1467,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);drm_dev_fini (&dev_priv->drm);@@ -1428,6 +1487,10 @@ void i915_driver_unload(struct drm_device *dev)if (i915_gem_suspend (dev_priv))DRM_ERROR ("failed to idle hardware; continuing to unload!\n" ); +component_master_del (dev_priv->drm.dev, + &i915_component_master_ops); +kfree (dev_priv->comp_master); +intel_display_power_get (dev_priv,POWER_DOMAIN_INIT );drm_atomic_helper_shutdown (dev);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2119,6 +2119,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. include/drm/i915_component.h +16
-0@@ -121,4 +121,20 @@ struct i915_audio_component { const struct i915_audio_component_audio_ops *audio_ops; }; +/** +* struct i915_component_master - Used for communication between i915 +* and any other drivers for the services of different feature. +*/ +struct i915_component_master { +/** +* @i915_kdev: Kdev of I915. Used from the client component for +* removing the reference to mei_cldev. +*/ +struct device *i915_kdev; + +/* +* Add here the interface details between I915 and interested modules. +*/ +}; +#endif /* _I915_COMPONENT_H_ */ Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 2/3] drm/i915: component master at i915 driver load
Quoted 81 lines · Daniel Vetter
Quoted 80 lines · Ramalingam C
A generic component master is added to hold the i915 registration untill 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 tocomponent_matchof 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 will be triggered with no wait.
Signed-off-by Ramalingam C <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 87 +++++++++++++++++++++++++++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 3 ++ include/drm/i915_component.h | 16 ++++++++ 3 files changed, 94 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_drv.c +30
-2@@ -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" @@ -1247,8 +1249,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 @@ -1310,6 +1310,47 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)DRM_INFO ("DRM_I915_DEBUG_GEM enabled\n" ); } +static void i915_driver_load_tail (struct drm_i915_private *dev_priv) +{ +i915_driver_register (dev_priv); + +intel_runtime_pm_enable (dev_priv); + +intel_init_ipc (dev_priv); + +intel_runtime_pm_put (dev_priv); + +i915_welcome_messages (dev_priv); +} + +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)
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c static void i915_welcome_messages(struct drm_i915_private *dev_priv) · line 1346
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.c +6
-0+{ +struct drm_i915_private *dev_priv =kdev_to_i915 (dev); + +component_unbind_all (dev, dev_priv->comp_master); + +/* TO-DO: Whether I915 should be unloaded on any component unbind!? */ I think we also need a FIXME here because the audio side will blow up if we do this?
With audio_init is moved out of bind i dont see the audio failure message. May be we should get the hdac tested with these changes along with INTEL_MEI_HDCP as y/n/m.
Quoted 6 lines
If that's not the case then yes I think we should do the
i915_dev_unregistercall from here, for symmetry. That way we should be able to unload mei, and it should force the i915 driver out too.This also depends upon how the entire mei reset story pans out ofc.
I will start a thread straight away to understand the freq of ME reset and duration of it.
Quoted 138 lines
Aside from this tiny nit I think the load side here looks good now. -Daniel
Quoted 49 lines
drivers/gpu/drm/i915/i915_drv.c +21
-9+} + +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 @@ -1341,12 +1382,25 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_free; } + 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; + } + dev_priv->drm.pdev = pdev; dev_priv->drm.dev_private = dev_priv; ret =pci_enable_device (pdev);if (ret) - goto out_fini; + goto out_comp_master_clean;pci_set_drvdata (pdev, &dev_priv->drm);/* @@ -1389,18 +1443,21 @@ 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); - -intel_runtime_pm_enable (dev_priv); - -intel_init_ipc (dev_priv); - -intel_runtime_pm_put (dev_priv); -drivers/gpu/drm/i915/i915_drv.c int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1454
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +9
-1-i915_welcome_messages (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; + } +intel_audio_init (dev_priv);I think a FIXME comment explaining what's going on here would be good:
/*
* FIXME:component.cdoesn't (yet) support recursion, and snd-hda
* doesn't handle delayed component registration correctly. For
* now just uncoditionally register the audio component here,
* outside of themaster->bindcallback.
*/Hopefully we can untangle this later on, but for now I think this approach is good.
Quoted 63 lines
drivers/gpu/drm/i915/i915_drv.c +9
-0+DRM_DEV_INFO (&pdev->dev,"I915 waits for Components (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:@@ -1410,6 +1467,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);drm_dev_fini (&dev_priv->drm);@@ -1428,6 +1487,10 @@ void i915_driver_unload(struct drm_device *dev)if (i915_gem_suspend (dev_priv))DRM_ERROR ("failed to idle hardware; continuing to unload!\n" ); +component_master_del (dev_priv->drm.dev, + &i915_component_master_ops); +kfree (dev_priv->comp_master); +intel_display_power_get (dev_priv,POWER_DOMAIN_INIT );drm_atomic_helper_shutdown (dev);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2119,6 +2119,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. include/drm/i915_component.h +12
-0@@ -121,4 +121,20 @@ struct i915_audio_component {const struct i915_audio_component_audio_ops *audio_ops; }; +/** +* struct i915_component_master - Used for communication between i915 +* and any other drivers for the services of different feature. +*/ +struct i915_component_master { +/** +* @i915_kdev: Kdev of I915. Used from the client component for +* removing the reference to mei_cldev. +*/ +struct device *i915_kdev; + +/*
Quoted 8 lines
Quoted 8 lines
include/drm/i915_component.h +4
-0+* Add here the interface details between I915 and interested modules. + */ +}; +#endif /* _I915_COMPONENT_H_ */ Signature · 1 line
2.7.4
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 3/3 drm/i915: Initialize HDCP2.2 and its MEI interface
In reply to Ramalingam CInitialize HDCP2.2 support. This includes the mei interface initialization along with required component registration.
v2:
mei interface handle is protected with mutex. [Chris Wilson]
v3:
Notifiers are used for the mei interface state.
v4:
Poll for mei client device state
Error msg for out of mem [Uma]
Inline req for init function removed [Uma]
v5:
Rebase as Part of reordering.
Component is used for the I915 and MEI_HDCP interface [Daniel]
v6:
HDCP2.2 uses the I915 component master to communicate with mei_hdcp [Daniel]
--- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 5 ++- drivers/gpu/drm/i915/intel_hdcp.c | 78 ++++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- include/drm/i915_component.h | 60 ++++++++++++++++++++++++++++++ 5 files changed, 144 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -6406,7 +6406,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,intel_dp_add_properties (intel_dp, connector);if (is_hdcp_supported (dev_priv, port) && !intel_dp_is_edp (intel_dp)) { -int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim); +int ret =intel_hdcp_init (intel_connector, &intel_dp_hdcp_shim, + false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
drivers/gpu/drm/i915/intel_drv.h +4 -1
@@ -1963,11 +1963,14 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,struct drm_connector_state *old_state, struct drm_connector_state *new_state);int intel_hdcp_init (struct intel_connector *connector, -const struct intel_hdcp_shim *hdcp_shim); +const struct intel_hdcp_shim *hdcp_shim, +bool hdcp2_supported);int intel_hdcp_enable (struct intel_connector *connector);int intel_hdcp_disable (struct intel_connector *connector);int intel_hdcp_check_link (struct intel_connector *connector);bool is_hdcp_supported (struct drm_i915_private *dev_priv,enum port port); +int intel_hdcp_component_init (struct drm_i915_private *dev_priv); +bool is_hdcp2_supported (struct drm_i915_private *dev_priv);/* intel_psr.c */ #define CAN_PSR (dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
drivers/gpu/drm/i915/intel_hdcp.c +77 -1
110 lines not on this page · raw message
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -2366,7 +2366,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,if (is_hdcp_supported (dev_priv, port)) {int ret =intel_hdcp_init (intel_connector, - &intel_hdmi_hdcp_shim); + &intel_hdmi_hdcp_shim, false);if (ret)DRM_DEBUG_KMS ("HDCP init failed, skipping.\n" ); }
include/drm/i915_component.h +60 -0
78 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for I915 component master
In reply to Ramalingam C== Series Details ==
== Series Details ==
Series: I915 component master
URL : https://patchwork.freedesktop.org/series/46312/
State : failure
== Summary ==
Applying: component: alloc component_match without any comp to match
Applying: drm/i915: component master at i915 driver load
Applying: drm/i915: Initialize HDCP2.2 and its MEI interface
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/intel_drv.h).
error: could not build fake ancestor
Patch failed at 0003 drm/i915: Initialize HDCP2.2 and its MEI interface Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx