From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>,
Stefano Stabellini <sstabellini@kernel.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org,
x86@kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint
Date: Fri, 16 Aug 2019 14:37:58 +0100 [thread overview]
Message-ID: <8585fb27-14e0-888c-6749-6862b4e16418@arm.com> (raw)
In-Reply-To: <20190816130013.31154-4-hch@lst.de>
On 16/08/2019 14:00, Christoph Hellwig wrote:
> Instead of taking apart the dma address in both callers do it inside
> dma_cache_maint itself.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/arm/xen/mm.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
> index 90574d89d0d4..d9da24fda2f7 100644
> --- a/arch/arm/xen/mm.c
> +++ b/arch/arm/xen/mm.c
> @@ -43,13 +43,15 @@ static bool hypercall_cflush = false;
>
> /* functions called by SWIOTLB */
>
> -static void dma_cache_maint(dma_addr_t handle, unsigned long offset,
> - size_t size, enum dma_data_direction dir, enum dma_cache_op op)
> +static void dma_cache_maint(dma_addr_t handle, size_t size,
> + enum dma_data_direction dir, enum dma_cache_op op)
> {
> struct gnttab_cache_flush cflush;
> unsigned long xen_pfn;
> + unsigned long offset = handle & ~PAGE_MASK;
> size_t left = size;
>
> + offset &= PAGE_MASK;
Ahem... presumably that should be handle, not offset.
Robin.
> xen_pfn = (handle >> XEN_PAGE_SHIFT) + offset / XEN_PAGE_SIZE;
> offset %= XEN_PAGE_SIZE;
>
> @@ -86,13 +88,13 @@ static void dma_cache_maint(dma_addr_t handle, unsigned long offset,
> static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle,
> size_t size, enum dma_data_direction dir)
> {
> - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_UNMAP);
> + dma_cache_maint(handle, size, dir, DMA_UNMAP);
> }
>
> static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle,
> size_t size, enum dma_data_direction dir)
> {
> - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_MAP);
> + dma_cache_maint(handle, size, dir, DMA_MAP);
> }
>
> void __xen_dma_map_page(struct device *hwdev, struct page *page,
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-16 13:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 13:00 swiotlb-xen cleanups Christoph Hellwig
2019-08-16 13:00 ` [PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance Christoph Hellwig
2019-08-19 11:45 ` [Xen-devel] " Julien Grall
2019-08-26 9:20 ` Christoph Hellwig
2019-08-16 13:00 ` [PATCH 02/11] xen/arm: use dev_is_dma_coherent Christoph Hellwig
2019-08-19 11:31 ` [Xen-devel] " Julien Grall
2019-08-16 13:00 ` [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint Christoph Hellwig
2019-08-16 13:37 ` Robin Murphy [this message]
2019-08-16 16:43 ` Christoph Hellwig
2019-08-16 13:00 ` [PATCH 04/11] xen/arm: remove xen_dma_ops Christoph Hellwig
2019-08-19 11:38 ` [Xen-devel] " Julien Grall
2019-08-16 13:00 ` [PATCH 05/11] xen: remove the exports for xen_{create, destroy}_contiguous_region Christoph Hellwig
2019-08-16 13:00 ` [PATCH 06/11] swiotlb-xen: always use dma-direct helpers to alloc coherent pages Christoph Hellwig
2019-08-16 13:00 ` [PATCH 07/11] swiotlb-xen: provide a single page-coherent.h header Christoph Hellwig
2019-08-16 22:40 ` [Xen-devel] " Julien Grall
2019-08-17 6:50 ` Christoph Hellwig
2019-08-17 18:20 ` Julien Grall
2019-08-16 13:00 ` [PATCH 08/11] swiotlb-xen: use the same foreign page check everywhere Christoph Hellwig
2019-08-19 13:53 ` [Xen-devel] " Julien Grall
2019-08-16 13:00 ` [PATCH 09/11] swiotlb-xen: simplify cache maintainance Christoph Hellwig
2019-08-16 13:00 ` [PATCH 10/11] swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page Christoph Hellwig
2019-08-16 13:00 ` [PATCH 11/11] arm64: use asm-generic/dma-mapping.h Christoph Hellwig
2019-08-19 7:32 ` Will Deacon
2019-08-27 2:00 ` swiotlb-xen cleanups Stefano Stabellini
2019-08-27 6:21 ` Christoph Hellwig
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=8585fb27-14e0-888c-6749-6862b4e16418@arm.com \
--to=robin.murphy@arm.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sstabellini@kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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).