On 05/25/2010 05:36 PM, Zachary Amsden wrote:
Not for the faint of heart, this patch subverts the code by reassigning a local variable from a macro.
This time, with patch.

>From 97b9230f699aba1c5f47972032b2d4d935a83054 Mon Sep 17 00:00:00 2001
From: Zachary Amsden <[email protected]>
Date: Tue, 25 May 2010 17:17:32 -1000
Subject: [PATCH 4/5] IOMMU API changed

Ugly, dirty, disease ridden fix for IOMMU changes; the module
is now trying to use larger IOMMU intervals; deny it this, and
stick to page size.  This requires forcibly setting page_size
variable through knowledge of the code.  Yuck.  If you have a
better solution, implement it.

Signed-off-by: Zachary Amsden <[email protected]>
---
 external-module-compat-comm.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index c5284e5..708019e 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -1128,3 +1128,15 @@ perf_unregister_guest_info_callbacks(struct 
perf_guest_info_callbacks *cbs)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 #define lockdep_is_held(m)             (1)
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
+/* This is a dirty, nasty trick */
+#define iommu_map(domain, iova, paddr, gfp_order, prot) \
+({ \
+       int _r = iommu_map_range(domain, iova, paddr, PAGE_SIZE, prot); \
+       page_size = PAGE_SIZE; \
+       _r; \
+})
+#define iommu_unmap(domain, iova, gfp_order) \
+       (iommu_unmap_range(domain, iova, PAGE_SIZE),1)
+#endif
-- 
1.7.0.1

Reply via email to