[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2UQ2xNs6R+YC8owEWQ-ooH=tuERa7Fs7acnkwi3N=FeA@mail.gmail.com>
Date: Tue, 30 Jan 2018 15:17:54 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Benjamin Gaignard <benjamin.gaignard@...aro.org>
Cc: Benjamin GAIGNARD <benjamin.gaignard@...com>,
Arnaud POULIQUEN <arnaud.pouliquen@...com>,
"Andy Gross <andy.gross@...aro.org> , David Brown"
<david.brown@...aro.org>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"linux-soc@...r.kernel.org" <linux-soc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Compilation error report for: drivers/firmware/qcom_scm.c:469:47: error: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer type
On Tue, Jan 30, 2018 at 3:00 PM, Benjamin Gaignard
<benjamin.gaignard@...aro.org> wrote:
> 2018-01-30 14:25 GMT+01:00 Arnd Bergmann <arnd@...db.de>:
>> On Tue, Jan 30, 2018 at 11:11 AM, Benjamin GAIGNARD
>> <benjamin.gaignard@...com> wrote:
>>>
>>> On 01/12/2018 05:11 PM, Arnaud Pouliquen wrote:
>>>> Hello Andy,David,
>>> + Arnd
>>>
>>> I have the same issue on drm-misc-next.
>>> Does Arnaud's fix make sense or should we update/change the way of how
>>> we compile the kernel ?
>>
>> We've hit a couple of bugs with qcom drivers confusing physical addresses
>> and DMA addresses in the past, usually the drivers were buggy in
>> some form, and tried to use dma_alloc_coherent() to get a buffer
>> that gets passed into a firmware interface taking a physical address,
>> which is of course completely wrong.
>>
>>>> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
>>>> index af4c752..8dfbe61 100644
>>>> --- a/drivers/firmware/qcom_scm.c
>>>> +++ b/drivers/firmware/qcom_scm.c
>>>> @@ -448,7 +448,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t
>>>> mem_sz,
>>>> struct qcom_scm_mem_map_info *mem_to_map;
>>>> phys_addr_t mem_to_map_phys;
>>>> phys_addr_t dest_phys;
>>>> - phys_addr_t ptr_phys;
>>>> + dma_addr_t ptr_phys;
>>>> size_t mem_to_map_sz;
>>>> size_t dest_sz;
>>>> size_t src_sz;
>>
>> This would be bad: you can basically never have a 'dma_addr_t ptr_phys': it can
>> be exactly one of 'dma address', 'physical address' or a pointer,
>> this claims that the
>> struct member is all three of them.
>>
>> The proper fix here is to stop using dma_alloc_coherent.
>
> Okay but that doesn't explain why we are the only ones to get an issue
> while the parameter
> doesn't match function prototype
For almost all configurations, dma_addr_t and phys_addr_t are the
same width, and gcc treats them as compatible.
I usually get the warning during randconfig builds, but you seem to
have started with a configuration like this.
Arnd
Powered by blists - more mailing lists