xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 07/18] swiotlb-xen: introduce xen_swiotlb_set_dma_mask
Date: Fri, 25 Oct 2013 11:51:42 +0100	[thread overview]
Message-ID: <1382698313-13161-7-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1310251144020.26077@kaball.uk.xensource.com>

Implement xen_swiotlb_set_dma_mask, use it for set_dma_mask on arm.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/mm.c         |    1 +
 drivers/xen/swiotlb-xen.c |   12 ++++++++++++
 include/xen/swiotlb-xen.h |    2 ++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index d56b8c6..0d69b87 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -51,6 +51,7 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
 	.map_page = xen_swiotlb_map_page,
 	.unmap_page = xen_swiotlb_unmap_page,
 	.dma_supported = xen_swiotlb_dma_supported,
+	.set_dma_mask = xen_swiotlb_set_dma_mask,
 };
 
 int __init xen_mm_init(void)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index f0fc1a4..d8ef0bf 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -608,3 +608,15 @@ xen_swiotlb_dma_supported(struct device *hwdev, u64 mask)
 	return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask;
 }
 EXPORT_SYMBOL_GPL(xen_swiotlb_dma_supported);
+
+int
+xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask)
+{
+	if (!dev->dma_mask || !xen_swiotlb_dma_supported(dev, dma_mask))
+		return -EIO;
+
+	*dev->dma_mask = dma_mask;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(xen_swiotlb_set_dma_mask);
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index de8bcc6..7b64465 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -55,4 +55,6 @@ xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
 extern int
 xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
 
+extern int
+xen_swiotlb_set_dma_mask(struct device *dev, u64 dma_mask);
 #endif /* __LINUX_SWIOTLB_XEN_H */
-- 
1.7.2.5

  parent reply	other threads:[~2013-10-25 10:51 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
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 ` Stefano Stabellini [this message]
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=1382698313-13161-7-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).