qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org, qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, peter.maydell@linaro.org,
	Wei Liu <wei.liu2@citrix.com>,
	stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [PATCH RFC 3/5] exec: guard Xen HVM hooks with CONFIG_XEN_I386
Date: Thu, 23 Jan 2014 22:16:04 +0000	[thread overview]
Message-ID: <1390515366-32236-4-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1390515366-32236-1-git-send-email-wei.liu2@citrix.com>

Those are only useful when building QEMU with HVM support.

We need to expose CONFIG_XEN_I386 to source code so we modify configure
and i386/x86_64-softmmu.mak.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 configure                          |    1 +
 default-configs/i386-softmmu.mak   |    1 -
 default-configs/x86_64-softmmu.mak |    1 -
 exec.c                             |   16 ++++++++++++++++
 include/exec/memory-internal.h     |    2 ++
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 10a6562..1e515be 100755
--- a/configure
+++ b/configure
@@ -4472,6 +4472,7 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
 
 if supported_xen_target; then
     echo "CONFIG_XEN=y" >> $config_target_mak
+    echo "CONFIG_XEN_I386=y" >> $config_target_mak
     if test "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
     fi
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 37ef90f..3c89aaa 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -33,7 +33,6 @@ CONFIG_MC146818RTC=y
 CONFIG_PAM=y
 CONFIG_PCI_PIIX=y
 CONFIG_WDT_IB700=y
-CONFIG_XEN_I386=$(CONFIG_XEN)
 CONFIG_ISA_DEBUG=y
 CONFIG_ISA_TESTDEV=y
 CONFIG_VMPORT=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 31bddce..1dc1f85 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -33,7 +33,6 @@ CONFIG_MC146818RTC=y
 CONFIG_PAM=y
 CONFIG_PCI_PIIX=y
 CONFIG_WDT_IB700=y
-CONFIG_XEN_I386=$(CONFIG_XEN)
 CONFIG_ISA_DEBUG=y
 CONFIG_ISA_TESTDEV=y
 CONFIG_VMPORT=y
diff --git a/exec.c b/exec.c
index defe38f..a72efe2 100644
--- a/exec.c
+++ b/exec.c
@@ -1228,7 +1228,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
             fprintf(stderr, "-mem-path not supported with Xen\n");
             exit(1);
         }
+#ifdef CONFIG_XEN_I386
         xen_ram_alloc(new_block->offset, size, mr);
+#endif
     } else {
         if (mem_path) {
             if (phys_mem_alloc != qemu_anon_ram_alloc) {
@@ -1324,7 +1326,9 @@ void qemu_ram_free(ram_addr_t addr)
             if (block->flags & RAM_PREALLOC_MASK) {
                 ;
             } else if (xen_enabled()) {
+#ifdef CONFIG_XEN_I386
                 xen_invalidate_map_cache_entry(block->host);
+#endif
 #ifndef _WIN32
             } else if (block->fd >= 0) {
                 munmap(block->host, block->length);
@@ -1409,6 +1413,7 @@ void *qemu_get_ram_ptr(ram_addr_t addr)
     RAMBlock *block = qemu_get_ram_block(addr);
 
     if (xen_enabled()) {
+#ifdef CONFIG_XEN_I386
         /* We need to check if the requested address is in the RAM
          * because we don't want to map the entire memory in QEMU.
          * In that case just map until the end of the page.
@@ -1419,6 +1424,7 @@ void *qemu_get_ram_ptr(ram_addr_t addr)
             block->host =
                 xen_map_cache(block->offset, block->length, 1);
         }
+#endif
     }
     return block->host + (addr - block->offset);
 }
@@ -1431,7 +1437,11 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, hwaddr *size)
         return NULL;
     }
     if (xen_enabled()) {
+#ifdef CONFIG_XEN_I386
         return xen_map_cache(addr, *size, 1);
+#else
+        return NULL;
+#endif
     } else {
         RAMBlock *block;
 
@@ -1456,8 +1466,10 @@ MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)
     uint8_t *host = ptr;
 
     if (xen_enabled()) {
+#ifdef CONFIG_XEN_I386
         *ram_addr = xen_ram_addr_from_mapcache(ptr);
         return qemu_get_ram_block(*ram_addr)->mr;
+#endif
     }
 
     block = ram_list.mru_block;
@@ -1921,7 +1933,9 @@ static void invalidate_and_set_dirty(hwaddr addr,
         /* set dirty bit */
         cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG));
     }
+#ifdef CONFIG_XEN_I386
     xen_modified_memory(addr, length);
+#endif
 }
 
 static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
@@ -2298,7 +2312,9 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
             }
         }
         if (xen_enabled()) {
+#ifdef CONFIG_XEN_I386
             xen_invalidate_map_cache_entry(buffer);
+#endif
         }
         memory_region_unref(mr);
         return;
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
index d0e0633..b4e76e2 100644
--- a/include/exec/memory-internal.h
+++ b/include/exec/memory-internal.h
@@ -100,7 +100,9 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
     for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
         cpu_physical_memory_set_dirty_flags(addr, dirty_flags);
     }
+#ifdef CONFIG_XEN_I386
     xen_modified_memory(addr, length);
+#endif
 }
 
 static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
-- 
1.7.10.4

  parent reply	other threads:[~2014-01-23 22:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 22:16 [Qemu-devel] [PATCH RFC 0/5] Xen: introduce Xen PV target Wei Liu
2014-01-23 22:16 ` [Qemu-devel] [PATCH RFC 1/5] xen: move Xen PV machine files to hw/xenpv Wei Liu
2014-01-23 22:16 ` [Qemu-devel] [PATCH RFC 2/5] xen: factor out common functions Wei Liu
2014-01-23 22:16 ` Wei Liu [this message]
2014-01-24  7:35   ` [Qemu-devel] [PATCH RFC 3/5] exec: guard Xen HVM hooks with CONFIG_XEN_I386 Paolo Bonzini
2014-01-23 22:16 ` [Qemu-devel] [PATCH RFC 4/5] xen: implement Xen PV target Wei Liu
2014-01-23 22:16 ` [Qemu-devel] [PATCH RFC 5/5] xen: introduce xenpv-softmmu.mak Wei Liu
2014-01-24  7:38   ` Paolo Bonzini
2014-01-24 17:00     ` Wei Liu
2014-01-23 22:30 ` [Qemu-devel] [PATCH RFC 0/5] Xen: introduce Xen PV target Peter Maydell
2014-01-24 14:23   ` Wei Liu
2014-01-24 14:38     ` Paolo Bonzini
2014-01-24 14:50       ` Wei Liu
2014-01-24 14:30   ` Paolo Bonzini
2014-01-24 14:35     ` Peter Maydell
2014-01-24 14:42       ` Paolo Bonzini
2014-01-24 14:56         ` Stefano Stabellini
2014-01-24 15:22           ` [Qemu-devel] [Xen-devel] " Ian Campbell
2014-01-24  7:36 ` [Qemu-devel] " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390515366-32236-4-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).