From: Baolin Wang <baolin.wang@linaro.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: catalin.marinas@arm.com, will.deacon@arm.com, jroedel@suse.de,
Andrew Morton <akpm@linux-foundation.org>,
Jisheng Zhang <jszhang@marvell.com>,
Suravee.Suthikulpanit@amd.com, Arnd Bergmann <arnd@arndb.de>,
linux-arm-kernel@lists.infradead.org,
LKML <linux-kernel@vger.kernel.org>,
Mark Brown <broonie@kernel.org>, Felipe Balbi <balbi@kernel.org>
Subject: Re: [PATCH] arm64: Implement arch_setup_pdev_archdata hook
Date: Tue, 7 Jun 2016 17:22:25 +0800 [thread overview]
Message-ID: <CAMz4kuJbqdmO=Uk07kWSnpg0+yGkzsZMWwNZdyMPH_-7svDdnQ@mail.gmail.com> (raw)
In-Reply-To: <575690CB.5080501@arm.com>
On 7 June 2016 at 17:15, Robin Murphy <robin.murphy@arm.com> wrote:
> On 07/06/16 09:29, Baolin Wang wrote:
>>
>> Now on ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
>> it did not call 'arch_setup_dma_ops' at device creation time by issuing
>> platform_device_alloc() function, that will cause failure when setting
>> the dma mask for device.
>
>
> Yes, that's rather the whole point. DMA-capable devices are real hardware,
> therefore don't spring out of thin air without being described in DT or
> ACPI.
OK.
>
> Please elaborate on the situation that you're attempting to address here
> (please don't let it be the ongoing Designware USB catastrophe ;))
Yes, like you mentioned, we met problems at DesignWare USB3 controller
host glue, do you have any better solutions to solve this problem?
Thanks.
>
> Robin.
>
>
>> Hence We need to hook the archdata to setup proper dma_ops for these
>> devices.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>> arch/arm64/mm/dma-mapping.c | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
>> index c566ec8..04e057b 100644
>> --- a/arch/arm64/mm/dma-mapping.c
>> +++ b/arch/arm64/mm/dma-mapping.c
>> @@ -26,6 +26,7 @@
>> #include <linux/dma-contiguous.h>
>> #include <linux/vmalloc.h>
>> #include <linux/swiotlb.h>
>> +#include <linux/platform_device.h>
>>
>> #include <asm/cacheflush.h>
>>
>> @@ -961,3 +962,23 @@ void arch_setup_dma_ops(struct device *dev, u64
>> dma_base, u64 size,
>> dev->archdata.dma_coherent = coherent;
>> __iommu_setup_dma_ops(dev, dma_base, size, iommu);
>> }
>> +
>> +void arch_setup_pdev_archdata(struct platform_device *pdev)
>> +{
>> + if (!pdev->dev.archdata.dma_ops)
>> + pdev->dev.archdata.dma_ops = &swiotlb_dma_ops;
>> +
>> + /*
>> + * Set default coherent_dma_mask to 32 bit. Drivers are expected
>> to
>> + * setup the correct supported mask.
>> + */
>> + if (!pdev->dev.coherent_dma_mask)
>> + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>> +
>> + /*
>> + * Set it to coherent_dma_mask by default if the architecture
>> + * code has not set it.
>> + */
>> + if (!pdev->dev.dma_mask)
>> + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
>> +}
>>
>
--
Baolin.wang
Best Regards
next prev parent reply other threads:[~2016-06-07 9:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 8:29 [PATCH] arm64: Implement arch_setup_pdev_archdata hook Baolin Wang
2016-06-07 8:43 ` Arnd Bergmann
2016-06-13 8:26 ` Baolin Wang
2016-06-07 9:15 ` Robin Murphy
2016-06-07 9:22 ` Baolin Wang [this message]
2016-06-14 14:43 ` Catalin Marinas
2016-06-15 2:13 ` Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMz4kuJbqdmO=Uk07kWSnpg0+yGkzsZMWwNZdyMPH_-7svDdnQ@mail.gmail.com' \
--to=baolin.wang@linaro.org \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=balbi@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jroedel@suse.de \
--cc=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).