* [PATCH] xtensa: implement arch_dma_coherent_to_pfn
@ 2019-10-15 21:25 Max Filippov
2019-10-16 7:08 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2019-10-15 21:25 UTC (permalink / raw)
To: linux-xtensa; +Cc: Chris Zankel, Christoph Hellwig, linux-kernel, Max Filippov
Add trivial implementation for arch_dma_coherent_to_pfn.
This change enables communication with PCI ALSA devices through mmapped
buffers.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
arch/xtensa/Kconfig | 1 +
arch/xtensa/kernel/pci-dma.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index bf492f9e1f75..f78e6b6f8b6f 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -3,6 +3,7 @@ config XTENSA
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_HAS_BINFMT_FLAT if !MMU
+ select ARCH_HAS_DMA_COHERENT_TO_PFN
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
select ARCH_USE_QUEUED_RWLOCKS
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 154979d62b73..6a114ce23084 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -200,3 +200,9 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
if (!dma_release_from_contiguous(dev, page, count))
__free_pages(page, get_order(size));
}
+
+long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr,
+ dma_addr_t dma_addr)
+{
+ return __phys_to_pfn(dma_to_phys(dev, dma_addr));
+}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xtensa: implement arch_dma_coherent_to_pfn
2019-10-15 21:25 [PATCH] xtensa: implement arch_dma_coherent_to_pfn Max Filippov
@ 2019-10-16 7:08 ` Christoph Hellwig
2019-10-16 7:40 ` Max Filippov
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2019-10-16 7:08 UTC (permalink / raw)
To: Max Filippov; +Cc: linux-xtensa, Chris Zankel, Christoph Hellwig, linux-kernel
On Tue, Oct 15, 2019 at 02:25:26PM -0700, Max Filippov wrote:
> Add trivial implementation for arch_dma_coherent_to_pfn.
> This change enables communication with PCI ALSA devices through mmapped
> buffers.
This looks fine, although I'd much rather convert xtensa to the
generic DMA remap / uncached segment support.
Do you want this fix for 5.4? If so please queue it up ASAP so that
I can do the proper thing for 5.5. If you don't need it that urgent
I'd rather go straight to the generic code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xtensa: implement arch_dma_coherent_to_pfn
2019-10-16 7:08 ` Christoph Hellwig
@ 2019-10-16 7:40 ` Max Filippov
0 siblings, 0 replies; 3+ messages in thread
From: Max Filippov @ 2019-10-16 7:40 UTC (permalink / raw)
To: Christoph Hellwig
Cc: open list:TENSILICA XTENSA PORT (xtensa), Chris Zankel, LKML
Hi Christoph,
On Wed, Oct 16, 2019 at 12:08 AM Christoph Hellwig <hch@lst.de> wrote:
> On Tue, Oct 15, 2019 at 02:25:26PM -0700, Max Filippov wrote:
> > Add trivial implementation for arch_dma_coherent_to_pfn.
> > This change enables communication with PCI ALSA devices through mmapped
> > buffers.
>
> This looks fine, although I'd much rather convert xtensa to the
> generic DMA remap / uncached segment support.
Thanks for the review.
> Do you want this fix for 5.4? If so please queue it up ASAP so that
> I can do the proper thing for 5.5. If you don't need it that urgent
> I'd rather go straight to the generic code.
There's no rush, I'll keep my version privately and will switch to the
generic version once it's available.
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-16 7:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 21:25 [PATCH] xtensa: implement arch_dma_coherent_to_pfn Max Filippov
2019-10-16 7:08 ` Christoph Hellwig
2019-10-16 7:40 ` Max Filippov
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).