linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/msm/mdp5: Find correct node for creating gem address space
@ 2019-07-08 15:12 Jeffrey Hugo
  2019-07-08 16:10 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Hugo @ 2019-07-08 15:12 UTC (permalink / raw)
  To: robdclark, sean, airlied, daniel, bjorn.andersson
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jeffrey Hugo

Creating the msm gem address space requires a reference to the dev where
the iommu is located.  The driver currently assumes this is the same as
the platform device, which breaks when the iommu is outside of the
platform device (ie in the parent).  Default to using the platform device,
but check to see if that has an iommu reference, and if not, use the parent
device instead.  This should handle all the various iommu designs for
mdp5 supported systems.

Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
---

v2: It turns out there isn't a universal way to get the iommu device, so 
check to see if its in the current node or parent

 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 4a60f5fca6b0..02dc7d426cb0 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -663,6 +663,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	struct msm_kms *kms;
 	struct msm_gem_address_space *aspace;
 	int irq, i, ret;
+	struct device *iommu_dev;
 
 	/* priv->kms would have been populated by the MDP5 driver */
 	kms = priv->kms;
@@ -702,7 +703,11 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	mdelay(16);
 
 	if (config->platform.iommu) {
-		aspace = msm_gem_address_space_create(&pdev->dev,
+		iommu_dev = &pdev->dev;
+		if (!iommu_dev->iommu_fwspec)
+			iommu_dev = iommu_dev->parent;
+
+		aspace = msm_gem_address_space_create(iommu_dev,
 				config->platform.iommu, "mdp5");
 		if (IS_ERR(aspace)) {
 			ret = PTR_ERR(aspace);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] drm/msm/mdp5: Find correct node for creating gem address space
  2019-07-08 15:12 [PATCH v2] drm/msm/mdp5: Find correct node for creating gem address space Jeffrey Hugo
@ 2019-07-08 16:10 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2019-07-08 16:10 UTC (permalink / raw)
  To: Jeffrey Hugo
  Cc: robdclark, sean, airlied, daniel, linux-arm-msm, dri-devel,
	freedreno, linux-kernel

On Mon 08 Jul 08:12 PDT 2019, Jeffrey Hugo wrote:

> Creating the msm gem address space requires a reference to the dev where
> the iommu is located.  The driver currently assumes this is the same as
> the platform device, which breaks when the iommu is outside of the
> platform device (ie in the parent).  Default to using the platform device,
> but check to see if that has an iommu reference, and if not, use the parent
> device instead.  This should handle all the various iommu designs for
> mdp5 supported systems.
> 
> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>

Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
> 
> v2: It turns out there isn't a universal way to get the iommu device, so 
> check to see if its in the current node or parent
> 
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index 4a60f5fca6b0..02dc7d426cb0 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -663,6 +663,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
>  	struct msm_kms *kms;
>  	struct msm_gem_address_space *aspace;
>  	int irq, i, ret;
> +	struct device *iommu_dev;
>  
>  	/* priv->kms would have been populated by the MDP5 driver */
>  	kms = priv->kms;
> @@ -702,7 +703,11 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
>  	mdelay(16);
>  
>  	if (config->platform.iommu) {
> -		aspace = msm_gem_address_space_create(&pdev->dev,
> +		iommu_dev = &pdev->dev;
> +		if (!iommu_dev->iommu_fwspec)
> +			iommu_dev = iommu_dev->parent;
> +
> +		aspace = msm_gem_address_space_create(iommu_dev,
>  				config->platform.iommu, "mdp5");
>  		if (IS_ERR(aspace)) {
>  			ret = PTR_ERR(aspace);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-08 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 15:12 [PATCH v2] drm/msm/mdp5: Find correct node for creating gem address space Jeffrey Hugo
2019-07-08 16:10 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).