Re: [PATCH] gpu: host1x: fix compile error when IOMMU API is not available

From: Dmitry Osipenko
Date: Thu Apr 11 2019 - 07:31:54 EST


11.04.2019 13:06, Mikko Perttunen ÐÐÑÐÑ:
> On 11.4.2019 11.30, Thierry Reding wrote:
>> On Thu, Apr 11, 2019 at 09:23:13AM +0100, Ben Dooks wrote:
>>>
>>>
>>> On 2019-04-10 23:47, Stefan Agner wrote:
>>>> In case the IOMMU API is not available compiling host1x fails with
>>>> the following error:
>>>> ÂÂ In file included from drivers/gpu/host1x/hw/host1x06.c:27:
>>>> ÂÂ 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
>>>>
>>>> Fixes: de5469c21ff9 ("gpu: host1x: Program the channel stream ID")
>>>> Signed-off-by: Stefan Agner <stefan@xxxxxxxx>
>>>
>>> would it be better to provide something like this i nthe header that
>>> defines dev_iommu_fwspec_get() to be:
>>>
>>> static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
>>> { return NULL; }
>>>
>>> although returning an PTR_ERR would have been better.
>>
>> I don't think there's really a large number of failures here. Either
>> your device has an IOMMU fwspec or it doesn't.
>>
>> But yes, I think it'd be better to have the above static inline dummy in
>> iommu.h, but I'll apply this for now in the hopes of getting it in
>> before v5.1 final.
>
> A similar patch was already sent before by someone. That one also programs the bypass stream ID (0x7f) even if IOMMU is disabled. We should pick that patch instead.

For the record.. here is that patch https://patchwork.ozlabs.org/patch/1052364/