[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 3/5] exec: guard Xen HVM hooks with CONFIG_XEN_I386
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 <wei.liu2@xxxxxxxxxx> --- 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, _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |