[PATCH v2 6/9] x86: Optimize virt_to_phys() and phys_to_virt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make use of generic implementations and remove x86
specific virt_to_phys() and phys_to_virt() functions.

Cc: Andrew Jones <drjones@xxxxxxxxxx>
Cc: Thomas Huth <thuth@xxxxxxxxxx>
Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
---
 lib/asm-generic/io.h |  2 ++
 lib/x86/asm/io.h     | 10 +---------
 lib/x86/asm/page.h   |  3 +++
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
index 931415a..3585ac0 100644
--- a/lib/asm-generic/io.h
+++ b/lib/asm-generic/io.h
@@ -165,7 +165,9 @@ static inline unsigned long virt_to_phys(volatile void *address)
 {
 	return __pa((unsigned long)address);
 }
+#endif
 
+#ifndef phys_to_virt
 static inline void *phys_to_virt(unsigned long address)
 {
 	return __va(address);
diff --git a/lib/x86/asm/io.h b/lib/x86/asm/io.h
index 5b901a3..74451d5 100644
--- a/lib/x86/asm/io.h
+++ b/lib/x86/asm/io.h
@@ -40,14 +40,6 @@ static inline void outl(unsigned int value, unsigned short port)
     asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
 }
 
-static inline unsigned long virt_to_phys(const void *virt)
-{
-    return (unsigned long)virt;
-}
-
-static inline void *phys_to_virt(unsigned long phys)
-{
-    return (void *)phys;
-}
+#include <asm-generic/io.h>
 
 #endif
diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h
index edfe325..a9280ed 100644
--- a/lib/x86/asm/page.h
+++ b/lib/x86/asm/page.h
@@ -24,4 +24,7 @@
 #define	PGDIR_MASK	1023
 #endif
 
+#define __va(x)		((void *)((unsigned long) (x)))
+#define __pa(x)		((unsigned long) (x))
+
 #endif
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux