mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [v2] gpu: host1x: avoid IOMMU_API build error
@ 2019-03-06 13:57 Arnd Bergmann
  2019-03-06 14:00 ` Mikko Perttunen
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-03-06 13:57 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen
  Cc: Arnd Bergmann, Dmitry Osipenko, dri-devel, linux-tegra, linux-kernel

When the iommu API is disabled, the host1x driver fails to build:

drivers/gpu/host1x/hw/channel_hw.c: In function 'host1x_channel_set_streamid':
drivers/gpu/host1x/hw/channel_hw.c:118:30: error: implicit declaration of function 'dev_iommu_fwspec_get'; did you mean 'iommu_fwspec_free'? [-Werror=implicit-function-declaration]
  struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
                              ^~~~~~~~~~~~~~~~~~~~
                              iommu_fwspec_free
drivers/gpu/host1x/hw/channel_hw.c:118:30: error: initialization of 'struct iommu_fwspec *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
drivers/gpu/host1x/hw/channel_hw.c:119:23: error: 'struct iommu_fwspec' has no member named 'ids'
  u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;
                       ^~
cc1: all warnings being treated as errors

As Mikko explains, we should program SMMU bypass (0x7f) if that
happens.

Fixes: de5469c21ff9 ("gpu: host1x: Program the channel stream ID")
Suggested-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
v2: fall back to 0x7f sid
---
 drivers/gpu/host1x/hw/channel_hw.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
index 27101c04a827..0c0eb43abf65 100644
--- a/drivers/gpu/host1x/hw/channel_hw.c
+++ b/drivers/gpu/host1x/hw/channel_hw.c
@@ -115,8 +115,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job)
 static void host1x_channel_set_streamid(struct host1x_channel *channel)
 {
 #if HOST1X_HW >= 6
+	u32 sid = 0x7f;
+#ifdef CONFIG_IOMMU_API
 	struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
-	u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;
+	if (spec)
+		sid = spec->ids[0] & 0xffff;
+#endif
 
 	host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID);
 #endif
-- 
2.20.0


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

* Re: [PATCH] [v2] gpu: host1x: avoid IOMMU_API build error
  2019-03-06 13:57 [PATCH] [v2] gpu: host1x: avoid IOMMU_API build error Arnd Bergmann
@ 2019-03-06 14:00 ` Mikko Perttunen
  0 siblings, 0 replies; 2+ messages in thread
From: Mikko Perttunen @ 2019-03-06 14:00 UTC (permalink / raw)
  To: Arnd Bergmann, Thierry Reding
  Cc: Dmitry Osipenko, dri-devel, linux-tegra, linux-kernel

On 6.3.2019 15.57, Arnd Bergmann wrote:
> When the iommu API is disabled, the host1x driver fails to build:
> 
> drivers/gpu/host1x/hw/channel_hw.c: In function 'host1x_channel_set_streamid':
> drivers/gpu/host1x/hw/channel_hw.c:118:30: error: implicit declaration of function 'dev_iommu_fwspec_get'; did you mean 'iommu_fwspec_free'? [-Werror=implicit-function-declaration]
>    struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
>                                ^~~~~~~~~~~~~~~~~~~~
>                                iommu_fwspec_free
> drivers/gpu/host1x/hw/channel_hw.c:118:30: error: initialization of 'struct iommu_fwspec *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
> drivers/gpu/host1x/hw/channel_hw.c:119:23: error: 'struct iommu_fwspec' has no member named 'ids'
>    u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;
>                         ^~
> cc1: all warnings being treated as errors
> 
> As Mikko explains, we should program SMMU bypass (0x7f) if that
> happens.
> 
> Fixes: de5469c21ff9 ("gpu: host1x: Program the channel stream ID")
> Suggested-by: Mikko Perttunen <mperttunen@nvidia.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ----
> v2: fall back to 0x7f sid
> ---
>   drivers/gpu/host1x/hw/channel_hw.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
> index 27101c04a827..0c0eb43abf65 100644
> --- a/drivers/gpu/host1x/hw/channel_hw.c
> +++ b/drivers/gpu/host1x/hw/channel_hw.c
> @@ -115,8 +115,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job)
>   static void host1x_channel_set_streamid(struct host1x_channel *channel)
>   {
>   #if HOST1X_HW >= 6
> +	u32 sid = 0x7f;
> +#ifdef CONFIG_IOMMU_API
>   	struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
> -	u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;
> +	if (spec)
> +		sid = spec->ids[0] & 0xffff;
> +#endif
>   
>   	host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID);
>   #endif
> 

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

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

end of thread, other threads:[~2019-03-06 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 13:57 [PATCH] [v2] gpu: host1x: avoid IOMMU_API build error Arnd Bergmann
2019-03-06 14:00 ` Mikko Perttunen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®