9ae3a8
From e4927c8d2802be4adeb25fbdfd538d15211d925e Mon Sep 17 00:00:00 2001
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Wed, 18 Sep 2013 09:31:07 +0200
9ae3a8
Subject: [PATCH 23/29] exec: Clean up unnecessary S390 ifdeffery
9ae3a8
9ae3a8
RH-Author: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: <1379496669-22778-7-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 54428
9ae3a8
O-Subject: [PATCH 7.0 qemu-kvm 6/8] exec: Clean up unnecessary S390 ifdeffery
9ae3a8
Bugzilla: 1009328
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Another issue missed in commit fdec991 is -mem-path: it needs to be
9ae3a8
rejected only for old S390 KVM, not for any S390.  Not that I
9ae3a8
personally care, but the ifdeffery in qemu_ram_alloc_from_ptr() annoys
9ae3a8
me.
9ae3a8
9ae3a8
Note that this doesn't actually make -mem-path work, as the kernel
9ae3a8
doesn't (yet?)  support large pages in the host for KVM guests.  Clean
9ae3a8
it up anyway.
9ae3a8
9ae3a8
Thanks to Christian Borntraeger for pointing out the S390 kernel
9ae3a8
limitations.
9ae3a8
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9ae3a8
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
9ae3a8
Message-id: 1375276272-15988-7-git-send-email-armbru@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
9ae3a8
(cherry picked from commit e1e84ba050538bae24393e40b737078ecad99747)
9ae3a8
---
9ae3a8
 exec.c | 25 +++++++++++++++++++------
9ae3a8
 1 file changed, 19 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 exec.c |   25 +++++++++++++++++++------
9ae3a8
 1 files changed, 19 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
diff --git a/exec.c b/exec.c
9ae3a8
index 185155c..a75c200 100644
9ae3a8
--- a/exec.c
9ae3a8
+++ b/exec.c
9ae3a8
@@ -839,7 +839,7 @@ void qemu_mutex_unlock_ramlist(void)
9ae3a8
     qemu_mutex_unlock(&ram_list.mutex);
9ae3a8
 }
9ae3a8
 
9ae3a8
-#if defined(__linux__) && !defined(TARGET_S390X)
9ae3a8
+#ifdef __linux__
9ae3a8
 
9ae3a8
 #include <sys/vfs.h>
9ae3a8
 
9ae3a8
@@ -942,6 +942,14 @@ static void *file_ram_alloc(RAMBlock *block,
9ae3a8
     block->fd = fd;
9ae3a8
     return area;
9ae3a8
 }
9ae3a8
+#else
9ae3a8
+static void *file_ram_alloc(RAMBlock *block,
9ae3a8
+                            ram_addr_t memory,
9ae3a8
+                            const char *path)
9ae3a8
+{
9ae3a8
+    fprintf(stderr, "-mem-path not supported on this host\n");
9ae3a8
+    exit(1);
9ae3a8
+}
9ae3a8
 #endif
9ae3a8
 
9ae3a8
 static ram_addr_t find_ram_offset(ram_addr_t size)
9ae3a8
@@ -1075,12 +1083,17 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
9ae3a8
         xen_ram_alloc(new_block->offset, size, mr);
9ae3a8
     } else {
9ae3a8
         if (mem_path) {
9ae3a8
-#if defined (__linux__) && !defined(TARGET_S390X)
9ae3a8
+            if (phys_mem_alloc != qemu_anon_ram_alloc) {
9ae3a8
+                /*
9ae3a8
+                 * file_ram_alloc() needs to allocate just like
9ae3a8
+                 * phys_mem_alloc, but we haven't bothered to provide
9ae3a8
+                 * a hook there.
9ae3a8
+                 */
9ae3a8
+                fprintf(stderr,
9ae3a8
+                        "-mem-path not supported with this accelerator\n");
9ae3a8
+                exit(1);
9ae3a8
+            }
9ae3a8
             new_block->host = file_ram_alloc(new_block, size, mem_path);
9ae3a8
-#else
9ae3a8
-            fprintf(stderr, "-mem-path option unsupported\n");
9ae3a8
-            exit(1);
9ae3a8
-#endif
9ae3a8
         }
9ae3a8
         if (!new_block->host) {
9ae3a8
             new_block->host = phys_mem_alloc(size);
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8