lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1229663480-10757-3-git-send-email-beckyb@kernel.crashing.org>
Date:	Thu, 18 Dec 2008 23:11:13 -0600
From:	Becky Bruce <beckyb@...nel.crashing.org>
To:	mingo@...e.hu, jeremy@...p.org
Cc:	fujita.tomonori@....ntt.co.jp, linux-kernel@...r.kernel.org,
	ian.campbell@...rix.com, jbeulich@...ell.com, joerg.roedel@....com,
	benh@...nel.crashing.org, Becky Bruce <beckyb@...nel.crashing.org>
Subject: [PATCH 02/11] swiotlb: Allow arch to provide address_needs_mapping

Rename it swiotlb_addr_needs_mapping and make it weak
so architectures can override it if needed.

Signed-off-by: Becky Bruce <beckyb@...nel.crashing.org>
---
 lib/swiotlb.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 3d9ac10..9b89a9d 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -272,8 +272,8 @@ cleanup1:
 	return -ENOMEM;
 }
 
-static int
-address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
+int __weak
+swiotlb_addr_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
 {
 	return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
 }
@@ -562,7 +562,8 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
 	 * we can safely return the device addr and not worry about bounce
 	 * buffering it.
 	 */
-	if (!address_needs_mapping(hwdev, dev_addr, size) && !swiotlb_force)
+	if (!swiotlb_addr_needs_mapping(hwdev, dev_addr, size) &&
+	    !swiotlb_force)
 		return dev_addr;
 
 	/*
@@ -579,7 +580,7 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
 	/*
 	 * Ensure that the address returned is DMA'ble
 	 */
-	if (address_needs_mapping(hwdev, dev_addr, size))
+	if (swiotlb_addr_needs_mapping(hwdev, dev_addr, size))
 		panic("map_single: bounce buffer is not DMA'ble");
 
 	return dev_addr;
@@ -723,7 +724,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
 		addr = sg_virt(sg);
 		dev_addr = virt_to_bus(addr);
 		if (swiotlb_force ||
-		    address_needs_mapping(hwdev, dev_addr, sg->length)) {
+		    swiotlb_addr_needs_mapping(hwdev, dev_addr, sg->length)) {
 			void *map = map_single(hwdev, addr, sg->length, dir);
 			if (!map) {
 				/* Don't panic here, we expect map_sg users
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ