]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Move mmap_anon_or_hugetblfs() into util
authorMichael Ellerman <michael@ellerman.id.au>
Tue, 17 Jul 2012 05:00:11 +0000 (15:00 +1000)
committerPekka Enberg <penberg@kernel.org>
Tue, 17 Jul 2012 14:07:21 +0000 (17:07 +0300)
So we can use it on powerpc.

Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/include/kvm/util.h
tools/kvm/util/util.c
tools/kvm/x86/kvm.c

index dabf544c6d0c376256d47f276c044a985b91eee0..3d1d9871244fee30df22902143fab15f9a20e899 100644 (file)
@@ -90,6 +90,6 @@ static inline void msleep(unsigned int msecs)
        usleep(MSECS_TO_USECS(msecs));
 }
 
-void *mmap_hugetlbfs(const char *htlbfs_path, u64 size);
+void *mmap_anon_or_hugetlbfs(const char *hugetlbfs_path, u64 size);
 
 #endif /* KVM__UTIL_H */
index e7feebc929d97af399c35e2b731c5ec9d5065042..a80cf86a2b50e4c8c016f11c4c95066fea1ed5c8 100644 (file)
@@ -113,3 +113,16 @@ void *mmap_hugetlbfs(const char *htlbfs_path, u64 size)
 
        return addr;
 }
+
+/* This function wraps the decision between hugetlbfs map (if requested) or normal mmap */
+void *mmap_anon_or_hugetlbfs(const char *hugetlbfs_path, u64 size)
+{
+       if (hugetlbfs_path)
+               /*
+                * We don't /need/ to map guest RAM from hugetlbfs, but we do so
+                * if the user specifies a hugetlbfs path.
+                */
+               return mmap_hugetlbfs(hugetlbfs_path, size);
+       else
+               return mmap(NULL, size, PROT_RW, MAP_ANON_NORESERVE, -1, 0);
+}
index 10a1212431bd8da0f73b5d4bf4a8298e7d6d5c60..8931639aaccce367a5174c81c12ba6e5ae5d6b9e 100644 (file)
@@ -128,19 +128,6 @@ void kvm__arch_set_cmdline(char *cmdline, bool video)
                strcat(cmdline, " console=ttyS0 earlyprintk=serial i8042.noaux=1");
 }
 
-/* This function wraps the decision between hugetlbfs map (if requested) or normal mmap */
-static void *mmap_anon_or_hugetlbfs(const char *hugetlbfs_path, u64 size)
-{
-       if (hugetlbfs_path)
-               /*
-                * We don't /need/ to map guest RAM from hugetlbfs, but we do so
-                * if the user specifies a hugetlbfs path.
-                */
-               return mmap_hugetlbfs(hugetlbfs_path, size);
-       else
-               return mmap(NULL, size, PROT_RW, MAP_ANON_NORESERVE, -1, 0);
-}
-
 /* Architecture-specific KVM init */
 void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
 {