xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Ian.Campbell@citrix.com,
	will.deacon@arm.com, linux@arm.linux.org.uk
Subject: Re: [PATCH v9 01/18] arm: make SWIOTLB available
Date: Tue, 29 Oct 2013 10:20:23 -0400	[thread overview]
Message-ID: <20131029142023.GE20487@phenom.dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1310290441260.26077@kaball.uk.xensource.com>

On Tue, Oct 29, 2013 at 04:41:40AM +0000, Stefano Stabellini wrote:
> ping?

You know you are pinging yourself, right ? :-)

> 
> On Fri, 25 Oct 2013, Stefano Stabellini wrote:
> > Russell,
> > this is the only patch that needs an ack at the moment.
> > As you commented on it before and I have already addressed your comments
> > few versions ago, unless you have any complaints I am going to add it to
> > linux-next and I am thinking of merging it during the next merge window.
> > 
> > On Fri, 25 Oct 2013, Stefano Stabellini wrote:
> > > IOMMU_HELPER is needed because SWIOTLB calls iommu_is_span_boundary,
> > > provided by lib/iommu_helper.c.
> > > 
> > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > CC: will.deacon@arm.com
> > > CC: linux@arm.linux.org.uk
> > > 
> > > 
> > > Changes in v8:
> > > - use __phys_to_pfn and __pfn_to_phys.
> > > 
> > > Changes in v7:
> > > - dma_mark_clean: empty implementation;
> > > - in dma_capable use coherent_dma_mask if dma_mask hasn't been
> > >   allocated.
> > > 
> > > Changes in v6:
> > > - check for dev->dma_mask being NULL in dma_capable.
> > > 
> > > Changes in v5:
> > > - implement dma_mark_clean using dmac_flush_range.
> > > 
> > > Changes in v3:
> > > - dma_capable: do not treat dma_mask as a limit;
> > > - remove SWIOTLB dependency on NEED_SG_DMA_LENGTH.
> > > ---
> > >  arch/arm/Kconfig                   |    6 +++++
> > >  arch/arm/include/asm/dma-mapping.h |   37 ++++++++++++++++++++++++++++++++++++
> > >  2 files changed, 43 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index 1ad6fb6..b08374f 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -1872,6 +1872,12 @@ config CC_STACKPROTECTOR
> > >  	  neutralized via a kernel panic.
> > >  	  This feature requires gcc version 4.2 or above.
> > >  
> > > +config SWIOTLB
> > > +	def_bool y
> > > +
> > > +config IOMMU_HELPER
> > > +	def_bool SWIOTLB
> > > +
> > >  config XEN_DOM0
> > >  	def_bool y
> > >  	depends on XEN
> > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> > > index 5b579b9..01b5a3d 100644
> > > --- a/arch/arm/include/asm/dma-mapping.h
> > > +++ b/arch/arm/include/asm/dma-mapping.h
> > > @@ -10,6 +10,7 @@
> > >  
> > >  #include <asm-generic/dma-coherent.h>
> > >  #include <asm/memory.h>
> > > +#include <asm/cacheflush.h>
> > >  
> > >  #define DMA_ERROR_CODE	(~0)
> > >  extern struct dma_map_ops arm_dma_ops;
> > > @@ -86,6 +87,42 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
> > >  }
> > >  #endif
> > >  
> > > +static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
> > > +{
> > > +	unsigned int offset = paddr & ~PAGE_MASK;
> > > +	return pfn_to_dma(dev, __phys_to_pfn(paddr)) + offset;
> > > +}
> > > +
> > > +static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
> > > +{
> > > +	unsigned int offset = dev_addr & ~PAGE_MASK;
> > > +	return __pfn_to_phys(dma_to_pfn(dev, dev_addr)) + offset;
> > > +}
> > > +
> > > +static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
> > > +{
> > > +	u64 limit, mask;
> > > +	
> > > +	if (dev->dma_mask)
> > > +		mask = *dev->dma_mask;
> > > +	else 
> > > +		mask = dev->coherent_dma_mask;
> > > +
> > > +	if (mask == 0)
> > > +		return 0;
> > > +
> > > +	limit = (mask + 1) & ~mask;
> > > +	if (limit && size > limit)
> > > +		return 0;
> > > +
> > > +	if ((addr | (addr + size - 1)) & ~mask)
> > > +		return 0;
> > > +
> > > +	return 1;
> > > +}
> > > +
> > > +static inline void dma_mark_clean(void *addr, size_t size) { }
> > > +
> > >  /*
> > >   * DMA errors are defined by all-bits-set in the DMA address.
> > >   */
> > > -- 
> > > 1.7.2.5
> > > 
> > 

  reply	other threads:[~2013-10-29 14:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25 10:51 [PATCH v9 0/18] enable swiotlb-xen on arm and arm64 Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 01/18] arm: make SWIOTLB available Stefano Stabellini
2013-10-25 11:08   ` Stefano Stabellini
2013-10-29  4:41     ` Stefano Stabellini
2013-10-29 14:20       ` Konrad Rzeszutek Wilk [this message]
2013-10-29 14:26         ` Russell King - ARM Linux
2013-10-29 17:24           ` Stefano Stabellini
2013-10-29 18:01             ` Russell King - ARM Linux
2013-10-30  1:17               ` Stefano Stabellini
2013-11-04 18:38                 ` Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 02/18] arm64: define DMA_ERROR_CODE Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 03/18] arm/xen,arm64/xen: introduce p2m Stefano Stabellini
2013-11-07 14:42   ` Ian Campbell
2013-11-07 15:52     ` Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 04/18] xen/x86: allow __set_phys_to_machine for autotranslate guests Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 05/18] xen: make xen_create_contiguous_region return the dma address Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 06/18] xen/arm,arm64: enable SWIOTLB_XEN Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 07/18] swiotlb-xen: introduce xen_swiotlb_set_dma_mask Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 08/18] arm/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 09/18] arm64/xen: " Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 10/18] xen: introduce xen_alloc/free_coherent_pages Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 11/18] swiotlb-xen: use xen_alloc/free_coherent_pages Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 12/18] xen: introduce xen_dma_map/unmap_page and xen_dma_sync_single_for_cpu/device Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 13/18] swiotlb-xen: use xen_dma_map/unmap_page, xen_dma_sync_single_for_cpu/device Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 14/18] ASoC: Samsung: Rename dma_ops by samsung_dma_ops Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 15/18] swiotlb: print a warning when the swiotlb is full Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 16/18] arm,arm64: do not always merge biovec if we are running on Xen Stefano Stabellini
2013-11-05 22:46   ` Olof Johansson
2013-11-06 12:40     ` Stefano Stabellini
2013-11-06 15:27       ` Olof Johansson
2013-10-25 10:51 ` [PATCH v9 17/18] grant-table: call set_phys_to_machine after mapping grant refs Stefano Stabellini
2013-10-25 10:51 ` [PATCH v9 18/18] swiotlb-xen: static inline xen_phys_to_bus, xen_bus_to_phys, xen_virt_to_bus and range_straddles_page_boundary Stefano Stabellini

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=20131029142023.GE20487@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=will.deacon@arm.com \
    --cc=xen-devel@lists.xensource.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).