diff mbox series

[2/4] drm/msm: allow compile_test on !ARM

Message ID 20210924071759.22659-2-christian.koenig@amd.com (mailing list archive)
State Superseded
Headers show
Series [1/4] dma-buf: add dma_fence_describe and dma_resv_describe | expand

Commit Message

Christian König Sept. 24, 2021, 7:17 a.m. UTC
MSM is one of the few drivers which won't even compile
test on !ARM platforms.

Looking into this a bit more it turned out that there is
actually not that much missing to at least let the driver
compile on x86 as well.

So this patch replaces the use of phys_to_page() with the
open coded version and provides a dummy for of_drm_find_bridge().

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/msm/Kconfig   |  4 ++--
 drivers/gpu/drm/msm/msm_gem.c |  2 +-
 include/drm/drm_bridge.h      | 10 +++++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

Comments

Christian König Sept. 27, 2021, 7:01 a.m. UTC | #1
As long as nobody objects I'm going to push this one here to 
drm-misc-next with Rob's rb.

The other patches still need a bit more work, but being able to at least 
compile test MSM on x86 is really helpful.

Christian.

Am 24.09.21 um 09:17 schrieb Christian König:
> MSM is one of the few drivers which won't even compile
> test on !ARM platforms.
>
> Looking into this a bit more it turned out that there is
> actually not that much missing to at least let the driver
> compile on x86 as well.
>
> So this patch replaces the use of phys_to_page() with the
> open coded version and provides a dummy for of_drm_find_bridge().
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/msm/Kconfig   |  4 ++--
>   drivers/gpu/drm/msm/msm_gem.c |  2 +-
>   include/drm/drm_bridge.h      | 10 +++++++++-
>   3 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index e9c6af78b1d7..5879f67bc88c 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
> @@ -3,9 +3,9 @@
>   config DRM_MSM
>   	tristate "MSM DRM"
>   	depends on DRM
> -	depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST)
> +	depends on ARCH_QCOM || SOC_IMX5 || COMPILE_TEST
>   	depends on IOMMU_SUPPORT
> -	depends on OF && COMMON_CLK
> +	depends on (OF && COMMON_CLK) || COMPILE_TEST
>   	depends on QCOM_OCMEM || QCOM_OCMEM=n
>   	depends on QCOM_LLCC || QCOM_LLCC=n
>   	depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 14907622769f..5bd511f07c07 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -85,7 +85,7 @@ static struct page **get_pages_vram(struct drm_gem_object *obj, int npages)
>   
>   	paddr = physaddr(obj);
>   	for (i = 0; i < npages; i++) {
> -		p[i] = phys_to_page(paddr);
> +		p[i] = pfn_to_page(__phys_to_pfn(paddr));
>   		paddr += PAGE_SIZE;
>   	}
>   
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 9cdbd209388e..a445298e1c25 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -790,11 +790,19 @@ drm_priv_to_bridge(struct drm_private_obj *priv)
>   
>   void drm_bridge_add(struct drm_bridge *bridge);
>   void drm_bridge_remove(struct drm_bridge *bridge);
> -struct drm_bridge *of_drm_find_bridge(struct device_node *np);
>   int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>   		      struct drm_bridge *previous,
>   		      enum drm_bridge_attach_flags flags);
>   
> +#ifdef CONFIG_OF
> +struct drm_bridge *of_drm_find_bridge(struct device_node *np);
> +#else
> +static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
> +{
> +	return NULL;
> +}
> +#endif
> +
>   /**
>    * drm_bridge_get_next_bridge() - Get the next bridge in the chain
>    * @bridge: bridge object
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e9c6af78b1d7..5879f67bc88c 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -3,9 +3,9 @@ 
 config DRM_MSM
 	tristate "MSM DRM"
 	depends on DRM
-	depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST)
+	depends on ARCH_QCOM || SOC_IMX5 || COMPILE_TEST
 	depends on IOMMU_SUPPORT
-	depends on OF && COMMON_CLK
+	depends on (OF && COMMON_CLK) || COMPILE_TEST
 	depends on QCOM_OCMEM || QCOM_OCMEM=n
 	depends on QCOM_LLCC || QCOM_LLCC=n
 	depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 14907622769f..5bd511f07c07 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -85,7 +85,7 @@  static struct page **get_pages_vram(struct drm_gem_object *obj, int npages)
 
 	paddr = physaddr(obj);
 	for (i = 0; i < npages; i++) {
-		p[i] = phys_to_page(paddr);
+		p[i] = pfn_to_page(__phys_to_pfn(paddr));
 		paddr += PAGE_SIZE;
 	}
 
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 9cdbd209388e..a445298e1c25 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -790,11 +790,19 @@  drm_priv_to_bridge(struct drm_private_obj *priv)
 
 void drm_bridge_add(struct drm_bridge *bridge);
 void drm_bridge_remove(struct drm_bridge *bridge);
-struct drm_bridge *of_drm_find_bridge(struct device_node *np);
 int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
 		      struct drm_bridge *previous,
 		      enum drm_bridge_attach_flags flags);
 
+#ifdef CONFIG_OF
+struct drm_bridge *of_drm_find_bridge(struct device_node *np);
+#else
+static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
+{
+	return NULL;
+}
+#endif
+
 /**
  * drm_bridge_get_next_bridge() - Get the next bridge in the chain
  * @bridge: bridge object