All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Andrii Anisov <andrii.anisov@gmail.com>
Cc: sstabellini@kernel.org, andrii_anisov@epam.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>,
	konrad.wilk@oracle.com, julien.grall@arm.com,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 1/2] swiotlb-xen: implement xen_swiotlb_dma_mmap callback
Date: Mon, 16 Jan 2017 14:43:20 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1701161438060.2960@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <1484565815-25015-2-git-send-email-andrii.anisov@gmail.com>

On Mon, 16 Jan 2017, Andrii Anisov wrote:
> From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> This function creates userspace mapping for the DMA-coherent memory.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>
> Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
> ---
>  arch/arm/xen/mm.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
> index bd62d94..ff812a2 100644
> --- a/arch/arm/xen/mm.c
> +++ b/arch/arm/xen/mm.c
> @@ -163,6 +163,19 @@ bool xen_arch_need_swiotlb(struct device *dev,
>  		!is_device_dma_coherent(dev));
>  }
>  
> +/*
> + * Create userspace mapping for the DMA-coherent memory.
> + */
> +static int xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma,
> +			 void *cpu_addr, dma_addr_t dma_addr, size_t size,
> +			 unsigned long attrs)
> +{
> +	if (__generic_dma_ops(dev)->mmap)
> +		return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr, dma_addr, size, attrs);
> +
> +	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
> +}
> +
>  int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
>  				 unsigned int address_bits,
>  				 dma_addr_t *dma_handle)
> @@ -198,6 +211,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
>  	.unmap_page = xen_swiotlb_unmap_page,
>  	.dma_supported = xen_swiotlb_dma_supported,
>  	.set_dma_mask = xen_swiotlb_set_dma_mask,
> +	.mmap = xen_swiotlb_dma_mmap,
>  };
>  
>  int __init xen_mm_init(void)

The patch should work fine and looks OK. It is better written like this,
compared to the previous versions that reimplemented dma_common_mmap. I
like the fact that we are reusing the arm specific generic mmap
functions via __generic_dma_ops.

For consistency, I would prefer to have xen_swiotlb_dma_mmap in
drivers/xen/swiotlb-xen.c, even if it needs to be #ifdef'ed CONFIG_ARM
(at least the __generic_dma_ops calls need to be #ifdef'ed).

Konrad, what do you think?

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-01-16 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 11:23 [PATCH v2 0/2] XEN SWIOTLB for ARM dma operations extension Andrii Anisov
2017-01-16 11:23 ` [PATCH v2 1/2] swiotlb-xen: implement xen_swiotlb_dma_mmap callback Andrii Anisov
2017-01-16 22:43   ` Stefano Stabellini [this message]
2017-01-16 22:56     ` Stefano Stabellini
2017-01-18 11:31       ` Andrii Anisov
2017-01-18 20:23         ` Stefano Stabellini
2017-01-16 11:23 ` [PATCH v2 2/2] swiotlb-xen: implement xen_swiotlb_get_sgtable callback Andrii Anisov
  -- strict thread matches above, loose matches on Subject: below --
2017-01-16 11:19 [PATCH v2 0/2] XEN SWIOTLB for ARM dma operations extension Andrii Anisov
2017-01-16 11:19 ` [PATCH v2 1/2] swiotlb-xen: implement xen_swiotlb_dma_mmap callback Andrii Anisov

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=alpine.DEB.2.10.1701161438060.2960@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=andrii.anisov@gmail.com \
    --cc=andrii_anisov@epam.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=oleksandr.dmytryshyn@globallogic.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.