From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6bJ6-0001hH-Hr for qemu-devel@nongnu.org; Fri, 24 Jan 2014 02:36:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6bJ1-0006vh-17 for qemu-devel@nongnu.org; Fri, 24 Jan 2014 02:36:04 -0500 Received: from mail-ea0-x231.google.com ([2a00:1450:4013:c01::231]:38676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6bJ0-0006vd-N9 for qemu-devel@nongnu.org; Fri, 24 Jan 2014 02:35:58 -0500 Received: by mail-ea0-f177.google.com with SMTP id n15so795018ead.22 for ; Thu, 23 Jan 2014 23:35:57 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52E217DA.1020208@redhat.com> Date: Fri, 24 Jan 2014 08:35:54 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1390515366-32236-1-git-send-email-wei.liu2@citrix.com> <1390515366-32236-4-git-send-email-wei.liu2@citrix.com> In-Reply-To: <1390515366-32236-4-git-send-email-wei.liu2@citrix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 3/5] exec: guard Xen HVM hooks with CONFIG_XEN_I386 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Liu , xen-devel@lists.xen.org, qemu-devel@nongnu.org Cc: anthony.perard@citrix.com, peter.maydell@linaro.org, stefano.stabellini@eu.citrix.com Il 23/01/2014 23:16, Wei Liu ha scritto: > 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. I think the right way is to add a xen-hvm-stub.c file and include it in xenpv-softmmu. Since you are at it, xen_platform.o xen_apic.o xen_pvdevice.o can be moved to hw/i386/xen and you can drop CONFIG_XEN_I386 completely. Paolo > Signed-off-by: Wei Liu > --- > 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, >