qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel]  [PATCH 3/3] move xen-mapcache.c to hw/i386/xen/
@ 2017-04-05 18:40 Xu, Anthony
  0 siblings, 0 replies; 9+ messages in thread
From: Xu, Anthony @ 2017-04-05 18:40 UTC (permalink / raw)
  To: 'qemu-devel@nongnu.org'
  Cc: sstabellini@kernel.org, anthony.perard@citrix.com,
	'Paolo Bonzini'

move xen-mapcache.c to hw/i386/xen/

Signed-off -by: Anthony Xu <anthony.xu@intel.com>



---
 Makefile.target                    |   3 -
 default-configs/i386-softmmu.mak   |   1 -
 default-configs/x86_64-softmmu.mak |   1 -
 hw/i386/xen/Makefile.objs          |   2 +-
 hw/i386/xen/trace-events           |   6 +
 hw/i386/xen/xen-mapcache.c         | 459 +++++++++++++++++++++++++++++++++++++
 trace-events                       |   5 -
 xen-mapcache.c                     | 459 -------------------------------------
 8 files changed, 466 insertions(+), 470 deletions(-)
 create mode 100644 hw/i386/xen/xen-mapcache.c
 delete mode 100644 xen-mapcache.c

diff --git a/Makefile.target b/Makefile.target
index d5ff0c7..a535980 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -149,9 +149,6 @@ obj-y += dump.o
 obj-y += migration/ram.o migration/savevm.o
 LIBS := $(libs_softmmu) $(LIBS)
 
-# xen support
-obj-$(CONFIG_XEN_I386) += xen-mapcache.o
-
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
 obj-y += hw/sparc64/
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 029e952..d2ab2f6 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=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 d1d7432..9bde2f1 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=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/hw/i386/xen/Makefile.objs b/hw/i386/xen/Makefile.objs
index daf4f53..be9d10c 100644
--- a/hw/i386/xen/Makefile.objs
+++ b/hw/i386/xen/Makefile.objs
@@ -1 +1 @@
-obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o
+obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o xen-mapcache.o
diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events
index f25d622..547438d 100644
--- a/hw/i386/xen/trace-events
+++ b/hw/i386/xen/trace-events
@@ -15,3 +15,9 @@ cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64
 cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
 cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
 cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+
+# xen-mapcache.c
+xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
+xen_remap_bucket(uint64_t index) "index %#"PRIx64
+xen_map_cache_return(void* ptr) "%p"
+
diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
new file mode 100644
index 0000000..31debdf
--- /dev/null
+++ b/hw/i386/xen/xen-mapcache.c
@@ -0,0 +1,459 @@
+/*
+ * Copyright (C) 2011       Citrix Ltd.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+
+#include <sys/resource.h>
+
+#include "hw/xen/xen_backend.h"
+#include "sysemu/blockdev.h"
+#include "qemu/bitmap.h"
+
+#include <xen/hvm/params.h>
+
+#include "sysemu/xen-mapcache.h"
+#include "trace.h"
+
+
+//#define MAPCACHE_DEBUG
+
+#ifdef MAPCACHE_DEBUG
+#  define DPRINTF(fmt, ...) do { \
+    fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
+} while (0)
+#else
+#  define DPRINTF(fmt, ...) do { } while (0)
+#endif
+
+#if HOST_LONG_BITS == 32
+#  define MCACHE_BUCKET_SHIFT 16
+#  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
+#else
+#  define MCACHE_BUCKET_SHIFT 20
+#  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
+#endif
+#define MCACHE_BUCKET_SIZE (1UL << MCACHE_BUCKET_SHIFT)
+
+/* This is the size of the virtual address space reserve to QEMU that will not
+ * be use by MapCache.
+ * From empirical tests I observed that qemu use 75MB more than the
+ * max_mcache_size.
+ */
+#define NON_MCACHE_MEMORY_SIZE (80 * 1024 * 1024)
+
+typedef struct MapCacheEntry {
+    hwaddr paddr_index;
+    uint8_t *vaddr_base;
+    unsigned long *valid_mapping;
+    uint8_t lock;
+    hwaddr size;
+    struct MapCacheEntry *next;
+} MapCacheEntry;
+
+typedef struct MapCacheRev {
+    uint8_t *vaddr_req;
+    hwaddr paddr_index;
+    hwaddr size;
+    QTAILQ_ENTRY(MapCacheRev) next;
+} MapCacheRev;
+
+typedef struct MapCache {
+    MapCacheEntry *entry;
+    unsigned long nr_buckets;
+    QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries;
+
+    /* For most cases (>99.9%), the page address is the same. */
+    MapCacheEntry *last_entry;
+    unsigned long max_mcache_size;
+    unsigned int mcache_bucket_shift;
+
+    phys_offset_to_gaddr_t phys_offset_to_gaddr;
+    QemuMutex lock;
+    void *opaque;
+} MapCache;
+
+static MapCache *mapcache;
+
+static inline void mapcache_lock(void)
+{
+    qemu_mutex_lock(&mapcache->lock);
+}
+
+static inline void mapcache_unlock(void)
+{
+    qemu_mutex_unlock(&mapcache->lock);
+}
+
+static inline int test_bits(int nr, int size, const unsigned long *addr)
+{
+    unsigned long res = find_next_zero_bit(addr, size + nr, nr);
+    if (res >= nr + size)
+        return 1;
+    else
+        return 0;
+}
+
+void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
+{
+    unsigned long size;
+    struct rlimit rlimit_as;
+
+    mapcache = g_malloc0(sizeof (MapCache));
+
+    mapcache->phys_offset_to_gaddr = f;
+    mapcache->opaque = opaque;
+    qemu_mutex_init(&mapcache->lock);
+
+    QTAILQ_INIT(&mapcache->locked_entries);
+
+    if (geteuid() == 0) {
+        rlimit_as.rlim_cur = RLIM_INFINITY;
+        rlimit_as.rlim_max = RLIM_INFINITY;
+        mapcache->max_mcache_size = MCACHE_MAX_SIZE;
+    } else {
+        getrlimit(RLIMIT_AS, &rlimit_as);
+        rlimit_as.rlim_cur = rlimit_as.rlim_max;
+
+        if (rlimit_as.rlim_max != RLIM_INFINITY) {
+            fprintf(stderr, "Warning: QEMU's maximum size of virtual"
+                    " memory is not infinity.\n");
+        }
+        if (rlimit_as.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) {
+            mapcache->max_mcache_size = rlimit_as.rlim_max -
+                NON_MCACHE_MEMORY_SIZE;
+        } else {
+            mapcache->max_mcache_size = MCACHE_MAX_SIZE;
+        }
+    }
+
+    setrlimit(RLIMIT_AS, &rlimit_as);
+
+    mapcache->nr_buckets =
+        (((mapcache->max_mcache_size >> XC_PAGE_SHIFT) +
+          (1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >>
+         (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT));
+
+    size = mapcache->nr_buckets * sizeof (MapCacheEntry);
+    size = (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1);
+    DPRINTF("%s, nr_buckets = %lx size %lu\n", __func__,
+            mapcache->nr_buckets, size);
+    mapcache->entry = g_malloc0(size);
+}
+
+static void xen_remap_bucket(MapCacheEntry *entry,
+                             hwaddr size,
+                             hwaddr address_index)
+{
+    uint8_t *vaddr_base;
+    xen_pfn_t *pfns;
+    int *err;
+    unsigned int i;
+    hwaddr nb_pfn = size >> XC_PAGE_SHIFT;
+
+    trace_xen_remap_bucket(address_index);
+
+    pfns = g_malloc0(nb_pfn * sizeof (xen_pfn_t));
+    err = g_malloc0(nb_pfn * sizeof (int));
+
+    if (entry->vaddr_base != NULL) {
+        ram_block_notify_remove(entry->vaddr_base, entry->size);
+        if (munmap(entry->vaddr_base, entry->size) != 0) {
+            perror("unmap fails");
+            exit(-1);
+        }
+    }
+    g_free(entry->valid_mapping);
+    entry->valid_mapping = NULL;
+
+    for (i = 0; i < nb_pfn; i++) {
+        pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i;
+    }
+
+    vaddr_base = xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE,
+                                      nb_pfn, pfns, err);
+    if (vaddr_base == NULL) {
+        perror("xenforeignmemory_map");
+        exit(-1);
+    }
+
+    entry->vaddr_base = vaddr_base;
+    entry->paddr_index = address_index;
+    entry->size = size;
+    entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) *
+            BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
+
+    ram_block_notify_add(entry->vaddr_base, entry->size);
+    bitmap_zero(entry->valid_mapping, nb_pfn);
+    for (i = 0; i < nb_pfn; i++) {
+        if (!err[i]) {
+            bitmap_set(entry->valid_mapping, i, 1);
+        }
+    }
+
+    g_free(pfns);
+    g_free(err);
+}
+
+static uint8_t *xen_map_cache_unlocked(hwaddr phys_addr, hwaddr size,
+                                       uint8_t lock)
+{
+    MapCacheEntry *entry, *pentry = NULL;
+    hwaddr address_index;
+    hwaddr address_offset;
+    hwaddr cache_size = size;
+    hwaddr test_bit_size;
+    bool translated = false;
+
+tryagain:
+    address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
+    address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
+
+    trace_xen_map_cache(phys_addr);
+
+    /* test_bit_size is always a multiple of XC_PAGE_SIZE */
+    if (size) {
+        test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
+
+        if (test_bit_size % XC_PAGE_SIZE) {
+            test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE);
+        }
+    } else {
+        test_bit_size = XC_PAGE_SIZE;
+    }
+
+    if (mapcache->last_entry != NULL &&
+        mapcache->last_entry->paddr_index == address_index &&
+        !lock && !size &&
+        test_bits(address_offset >> XC_PAGE_SHIFT,
+                  test_bit_size >> XC_PAGE_SHIFT,
+                  mapcache->last_entry->valid_mapping)) {
+        trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
+        return mapcache->last_entry->vaddr_base + address_offset;
+    }
+
+    /* size is always a multiple of MCACHE_BUCKET_SIZE */
+    if (size) {
+        cache_size = size + address_offset;
+        if (cache_size % MCACHE_BUCKET_SIZE) {
+            cache_size += MCACHE_BUCKET_SIZE - (cache_size % MCACHE_BUCKET_SIZE);
+        }
+    } else {
+        cache_size = MCACHE_BUCKET_SIZE;
+    }
+
+    entry = &mapcache->entry[address_index % mapcache->nr_buckets];
+
+    while (entry && entry->lock && entry->vaddr_base &&
+            (entry->paddr_index != address_index || entry->size != cache_size ||
+             !test_bits(address_offset >> XC_PAGE_SHIFT,
+                 test_bit_size >> XC_PAGE_SHIFT,
+                 entry->valid_mapping))) {
+        pentry = entry;
+        entry = entry->next;
+    }
+    if (!entry) {
+        entry = g_malloc0(sizeof (MapCacheEntry));
+        pentry->next = entry;
+        xen_remap_bucket(entry, cache_size, address_index);
+    } else if (!entry->lock) {
+        if (!entry->vaddr_base || entry->paddr_index != address_index ||
+                entry->size != cache_size ||
+                !test_bits(address_offset >> XC_PAGE_SHIFT,
+                    test_bit_size >> XC_PAGE_SHIFT,
+                    entry->valid_mapping)) {
+            xen_remap_bucket(entry, cache_size, address_index);
+        }
+    }
+
+    if(!test_bits(address_offset >> XC_PAGE_SHIFT,
+                test_bit_size >> XC_PAGE_SHIFT,
+                entry->valid_mapping)) {
+        mapcache->last_entry = NULL;
+        if (!translated && mapcache->phys_offset_to_gaddr) {
+            phys_addr = mapcache->phys_offset_to_gaddr(phys_addr, size, mapcache->opaque);
+            translated = true;
+            goto tryagain;
+        }
+        trace_xen_map_cache_return(NULL);
+        return NULL;
+    }
+
+    mapcache->last_entry = entry;
+    if (lock) {
+        MapCacheRev *reventry = g_malloc0(sizeof(MapCacheRev));
+        entry->lock++;
+        reventry->vaddr_req = mapcache->last_entry->vaddr_base + address_offset;
+        reventry->paddr_index = mapcache->last_entry->paddr_index;
+        reventry->size = entry->size;
+        QTAILQ_INSERT_HEAD(&mapcache->locked_entries, reventry, next);
+    }
+
+    trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
+    return mapcache->last_entry->vaddr_base + address_offset;
+}
+
+uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
+                       uint8_t lock)
+{
+    uint8_t *p;
+
+    mapcache_lock();
+    p = xen_map_cache_unlocked(phys_addr, size, lock);
+    mapcache_unlock();
+    return p;
+}
+
+ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
+{
+    MapCacheEntry *entry = NULL;
+    MapCacheRev *reventry;
+    hwaddr paddr_index;
+    hwaddr size;
+    ram_addr_t raddr;
+    int found = 0;
+
+    mapcache_lock();
+    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
+        if (reventry->vaddr_req == ptr) {
+            paddr_index = reventry->paddr_index;
+            size = reventry->size;
+            found = 1;
+            break;
+        }
+    }
+    if (!found) {
+        fprintf(stderr, "%s, could not find %p\n", __func__, ptr);
+        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
+            DPRINTF("   "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index,
+                    reventry->vaddr_req);
+        }
+        abort();
+        return 0;
+    }
+
+    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
+    while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {
+        entry = entry->next;
+    }
+    if (!entry) {
+        DPRINTF("Trying to find address %p that is not in the mapcache!\n", ptr);
+        raddr = 0;
+    } else {
+        raddr = (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +
+             ((unsigned long) ptr - (unsigned long) entry->vaddr_base);
+    }
+    mapcache_unlock();
+    return raddr;
+}
+
+static void xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
+{
+    MapCacheEntry *entry = NULL, *pentry = NULL;
+    MapCacheRev *reventry;
+    hwaddr paddr_index;
+    hwaddr size;
+    int found = 0;
+
+    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
+        if (reventry->vaddr_req == buffer) {
+            paddr_index = reventry->paddr_index;
+            size = reventry->size;
+            found = 1;
+            break;
+        }
+    }
+    if (!found) {
+        DPRINTF("%s, could not find %p\n", __func__, buffer);
+        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
+            DPRINTF("   "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index, reventry->vaddr_req);
+        }
+        return;
+    }
+    QTAILQ_REMOVE(&mapcache->locked_entries, reventry, next);
+    g_free(reventry);
+
+    if (mapcache->last_entry != NULL &&
+        mapcache->last_entry->paddr_index == paddr_index) {
+        mapcache->last_entry = NULL;
+    }
+
+    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
+    while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {
+        pentry = entry;
+        entry = entry->next;
+    }
+    if (!entry) {
+        DPRINTF("Trying to unmap address %p that is not in the mapcache!\n", buffer);
+        return;
+    }
+    entry->lock--;
+    if (entry->lock > 0 || pentry == NULL) {
+        return;
+    }
+
+    pentry->next = entry->next;
+    ram_block_notify_remove(entry->vaddr_base, entry->size);
+    if (munmap(entry->vaddr_base, entry->size) != 0) {
+        perror("unmap fails");
+        exit(-1);
+    }
+    g_free(entry->valid_mapping);
+    g_free(entry);
+}
+
+void xen_invalidate_map_cache_entry(uint8_t *buffer)
+{
+    mapcache_lock();
+    xen_invalidate_map_cache_entry_unlocked(buffer);
+    mapcache_unlock();
+}
+
+void xen_invalidate_map_cache(void)
+{
+    unsigned long i;
+    MapCacheRev *reventry;
+
+    /* Flush pending AIO before destroying the mapcache */
+    bdrv_drain_all();
+
+    mapcache_lock();
+
+    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
+        DPRINTF("There should be no locked mappings at this time, "
+                "but "TARGET_FMT_plx" -> %p is present\n",
+                reventry->paddr_index, reventry->vaddr_req);
+    }
+
+    for (i = 0; i < mapcache->nr_buckets; i++) {
+        MapCacheEntry *entry = &mapcache->entry[i];
+
+        if (entry->vaddr_base == NULL) {
+            continue;
+        }
+        if (entry->lock > 0) {
+            continue;
+        }
+
+        if (munmap(entry->vaddr_base, entry->size) != 0) {
+            perror("unmap fails");
+            exit(-1);
+        }
+
+        entry->paddr_index = 0;
+        entry->vaddr_base = NULL;
+        entry->size = 0;
+        g_free(entry->valid_mapping);
+        entry->valid_mapping = NULL;
+    }
+
+    mapcache->last_entry = NULL;
+
+    mapcache_unlock();
+}
diff --git a/trace-events b/trace-events
index 4e14487..e582d63 100644
--- a/trace-events
+++ b/trace-events
@@ -48,11 +48,6 @@ spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
 spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
 spice_vmc_event(int event) "spice vmc event %d"
 
-# xen-mapcache.c
-xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
-xen_remap_bucket(uint64_t index) "index %#"PRIx64
-xen_map_cache_return(void* ptr) "%p"
-
 # monitor.c
 monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
 monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
diff --git a/xen-mapcache.c b/xen-mapcache.c
deleted file mode 100644
index 1a96d2e..0000000
--- a/xen-mapcache.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * Copyright (C) 2011       Citrix Ltd.
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- * Contributions after 2012-01-13 are licensed under the terms of the
- * GNU GPL, version 2 or (at your option) any later version.
- */
-
-#include "qemu/osdep.h"
-
-#include <sys/resource.h>
-
-#include "hw/xen/xen_backend.h"
-#include "sysemu/blockdev.h"
-#include "qemu/bitmap.h"
-
-#include <xen/hvm/params.h>
-
-#include "sysemu/xen-mapcache.h"
-#include "trace-root.h"
-
-
-//#define MAPCACHE_DEBUG
-
-#ifdef MAPCACHE_DEBUG
-#  define DPRINTF(fmt, ...) do { \
-    fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
-} while (0)
-#else
-#  define DPRINTF(fmt, ...) do { } while (0)
-#endif
-
-#if HOST_LONG_BITS == 32
-#  define MCACHE_BUCKET_SHIFT 16
-#  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
-#else
-#  define MCACHE_BUCKET_SHIFT 20
-#  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
-#endif
-#define MCACHE_BUCKET_SIZE (1UL << MCACHE_BUCKET_SHIFT)
-
-/* This is the size of the virtual address space reserve to QEMU that will not
- * be use by MapCache.
- * From empirical tests I observed that qemu use 75MB more than the
- * max_mcache_size.
- */
-#define NON_MCACHE_MEMORY_SIZE (80 * 1024 * 1024)
-
-typedef struct MapCacheEntry {
-    hwaddr paddr_index;
-    uint8_t *vaddr_base;
-    unsigned long *valid_mapping;
-    uint8_t lock;
-    hwaddr size;
-    struct MapCacheEntry *next;
-} MapCacheEntry;
-
-typedef struct MapCacheRev {
-    uint8_t *vaddr_req;
-    hwaddr paddr_index;
-    hwaddr size;
-    QTAILQ_ENTRY(MapCacheRev) next;
-} MapCacheRev;
-
-typedef struct MapCache {
-    MapCacheEntry *entry;
-    unsigned long nr_buckets;
-    QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries;
-
-    /* For most cases (>99.9%), the page address is the same. */
-    MapCacheEntry *last_entry;
-    unsigned long max_mcache_size;
-    unsigned int mcache_bucket_shift;
-
-    phys_offset_to_gaddr_t phys_offset_to_gaddr;
-    QemuMutex lock;
-    void *opaque;
-} MapCache;
-
-static MapCache *mapcache;
-
-static inline void mapcache_lock(void)
-{
-    qemu_mutex_lock(&mapcache->lock);
-}
-
-static inline void mapcache_unlock(void)
-{
-    qemu_mutex_unlock(&mapcache->lock);
-}
-
-static inline int test_bits(int nr, int size, const unsigned long *addr)
-{
-    unsigned long res = find_next_zero_bit(addr, size + nr, nr);
-    if (res >= nr + size)
-        return 1;
-    else
-        return 0;
-}
-
-void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
-{
-    unsigned long size;
-    struct rlimit rlimit_as;
-
-    mapcache = g_malloc0(sizeof (MapCache));
-
-    mapcache->phys_offset_to_gaddr = f;
-    mapcache->opaque = opaque;
-    qemu_mutex_init(&mapcache->lock);
-
-    QTAILQ_INIT(&mapcache->locked_entries);
-
-    if (geteuid() == 0) {
-        rlimit_as.rlim_cur = RLIM_INFINITY;
-        rlimit_as.rlim_max = RLIM_INFINITY;
-        mapcache->max_mcache_size = MCACHE_MAX_SIZE;
-    } else {
-        getrlimit(RLIMIT_AS, &rlimit_as);
-        rlimit_as.rlim_cur = rlimit_as.rlim_max;
-
-        if (rlimit_as.rlim_max != RLIM_INFINITY) {
-            fprintf(stderr, "Warning: QEMU's maximum size of virtual"
-                    " memory is not infinity.\n");
-        }
-        if (rlimit_as.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) {
-            mapcache->max_mcache_size = rlimit_as.rlim_max -
-                NON_MCACHE_MEMORY_SIZE;
-        } else {
-            mapcache->max_mcache_size = MCACHE_MAX_SIZE;
-        }
-    }
-
-    setrlimit(RLIMIT_AS, &rlimit_as);
-
-    mapcache->nr_buckets =
-        (((mapcache->max_mcache_size >> XC_PAGE_SHIFT) +
-          (1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >>
-         (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT));
-
-    size = mapcache->nr_buckets * sizeof (MapCacheEntry);
-    size = (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1);
-    DPRINTF("%s, nr_buckets = %lx size %lu\n", __func__,
-            mapcache->nr_buckets, size);
-    mapcache->entry = g_malloc0(size);
-}
-
-static void xen_remap_bucket(MapCacheEntry *entry,
-                             hwaddr size,
-                             hwaddr address_index)
-{
-    uint8_t *vaddr_base;
-    xen_pfn_t *pfns;
-    int *err;
-    unsigned int i;
-    hwaddr nb_pfn = size >> XC_PAGE_SHIFT;
-
-    trace_xen_remap_bucket(address_index);
-
-    pfns = g_malloc0(nb_pfn * sizeof (xen_pfn_t));
-    err = g_malloc0(nb_pfn * sizeof (int));
-
-    if (entry->vaddr_base != NULL) {
-        ram_block_notify_remove(entry->vaddr_base, entry->size);
-        if (munmap(entry->vaddr_base, entry->size) != 0) {
-            perror("unmap fails");
-            exit(-1);
-        }
-    }
-    g_free(entry->valid_mapping);
-    entry->valid_mapping = NULL;
-
-    for (i = 0; i < nb_pfn; i++) {
-        pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i;
-    }
-
-    vaddr_base = xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE,
-                                      nb_pfn, pfns, err);
-    if (vaddr_base == NULL) {
-        perror("xenforeignmemory_map");
-        exit(-1);
-    }
-
-    entry->vaddr_base = vaddr_base;
-    entry->paddr_index = address_index;
-    entry->size = size;
-    entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) *
-            BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
-
-    ram_block_notify_add(entry->vaddr_base, entry->size);
-    bitmap_zero(entry->valid_mapping, nb_pfn);
-    for (i = 0; i < nb_pfn; i++) {
-        if (!err[i]) {
-            bitmap_set(entry->valid_mapping, i, 1);
-        }
-    }
-
-    g_free(pfns);
-    g_free(err);
-}
-
-static uint8_t *xen_map_cache_unlocked(hwaddr phys_addr, hwaddr size,
-                                       uint8_t lock)
-{
-    MapCacheEntry *entry, *pentry = NULL;
-    hwaddr address_index;
-    hwaddr address_offset;
-    hwaddr cache_size = size;
-    hwaddr test_bit_size;
-    bool translated = false;
-
-tryagain:
-    address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
-    address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
-
-    trace_xen_map_cache(phys_addr);
-
-    /* test_bit_size is always a multiple of XC_PAGE_SIZE */
-    if (size) {
-        test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
-
-        if (test_bit_size % XC_PAGE_SIZE) {
-            test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE);
-        }
-    } else {
-        test_bit_size = XC_PAGE_SIZE;
-    }
-
-    if (mapcache->last_entry != NULL &&
-        mapcache->last_entry->paddr_index == address_index &&
-        !lock && !size &&
-        test_bits(address_offset >> XC_PAGE_SHIFT,
-                  test_bit_size >> XC_PAGE_SHIFT,
-                  mapcache->last_entry->valid_mapping)) {
-        trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
-        return mapcache->last_entry->vaddr_base + address_offset;
-    }
-
-    /* size is always a multiple of MCACHE_BUCKET_SIZE */
-    if (size) {
-        cache_size = size + address_offset;
-        if (cache_size % MCACHE_BUCKET_SIZE) {
-            cache_size += MCACHE_BUCKET_SIZE - (cache_size % MCACHE_BUCKET_SIZE);
-        }
-    } else {
-        cache_size = MCACHE_BUCKET_SIZE;
-    }
-
-    entry = &mapcache->entry[address_index % mapcache->nr_buckets];
-
-    while (entry && entry->lock && entry->vaddr_base &&
-            (entry->paddr_index != address_index || entry->size != cache_size ||
-             !test_bits(address_offset >> XC_PAGE_SHIFT,
-                 test_bit_size >> XC_PAGE_SHIFT,
-                 entry->valid_mapping))) {
-        pentry = entry;
-        entry = entry->next;
-    }
-    if (!entry) {
-        entry = g_malloc0(sizeof (MapCacheEntry));
-        pentry->next = entry;
-        xen_remap_bucket(entry, cache_size, address_index);
-    } else if (!entry->lock) {
-        if (!entry->vaddr_base || entry->paddr_index != address_index ||
-                entry->size != cache_size ||
-                !test_bits(address_offset >> XC_PAGE_SHIFT,
-                    test_bit_size >> XC_PAGE_SHIFT,
-                    entry->valid_mapping)) {
-            xen_remap_bucket(entry, cache_size, address_index);
-        }
-    }
-
-    if(!test_bits(address_offset >> XC_PAGE_SHIFT,
-                test_bit_size >> XC_PAGE_SHIFT,
-                entry->valid_mapping)) {
-        mapcache->last_entry = NULL;
-        if (!translated && mapcache->phys_offset_to_gaddr) {
-            phys_addr = mapcache->phys_offset_to_gaddr(phys_addr, size, mapcache->opaque);
-            translated = true;
-            goto tryagain;
-        }
-        trace_xen_map_cache_return(NULL);
-        return NULL;
-    }
-
-    mapcache->last_entry = entry;
-    if (lock) {
-        MapCacheRev *reventry = g_malloc0(sizeof(MapCacheRev));
-        entry->lock++;
-        reventry->vaddr_req = mapcache->last_entry->vaddr_base + address_offset;
-        reventry->paddr_index = mapcache->last_entry->paddr_index;
-        reventry->size = entry->size;
-        QTAILQ_INSERT_HEAD(&mapcache->locked_entries, reventry, next);
-    }
-
-    trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
-    return mapcache->last_entry->vaddr_base + address_offset;
-}
-
-uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
-                       uint8_t lock)
-{
-    uint8_t *p;
-
-    mapcache_lock();
-    p = xen_map_cache_unlocked(phys_addr, size, lock);
-    mapcache_unlock();
-    return p;
-}
-
-ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
-{
-    MapCacheEntry *entry = NULL;
-    MapCacheRev *reventry;
-    hwaddr paddr_index;
-    hwaddr size;
-    ram_addr_t raddr;
-    int found = 0;
-
-    mapcache_lock();
-    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
-        if (reventry->vaddr_req == ptr) {
-            paddr_index = reventry->paddr_index;
-            size = reventry->size;
-            found = 1;
-            break;
-        }
-    }
-    if (!found) {
-        fprintf(stderr, "%s, could not find %p\n", __func__, ptr);
-        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
-            DPRINTF("   "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index,
-                    reventry->vaddr_req);
-        }
-        abort();
-        return 0;
-    }
-
-    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
-    while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {
-        entry = entry->next;
-    }
-    if (!entry) {
-        DPRINTF("Trying to find address %p that is not in the mapcache!\n", ptr);
-        raddr = 0;
-    } else {
-        raddr = (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +
-             ((unsigned long) ptr - (unsigned long) entry->vaddr_base);
-    }
-    mapcache_unlock();
-    return raddr;
-}
-
-static void xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
-{
-    MapCacheEntry *entry = NULL, *pentry = NULL;
-    MapCacheRev *reventry;
-    hwaddr paddr_index;
-    hwaddr size;
-    int found = 0;
-
-    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
-        if (reventry->vaddr_req == buffer) {
-            paddr_index = reventry->paddr_index;
-            size = reventry->size;
-            found = 1;
-            break;
-        }
-    }
-    if (!found) {
-        DPRINTF("%s, could not find %p\n", __func__, buffer);
-        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
-            DPRINTF("   "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index, reventry->vaddr_req);
-        }
-        return;
-    }
-    QTAILQ_REMOVE(&mapcache->locked_entries, reventry, next);
-    g_free(reventry);
-
-    if (mapcache->last_entry != NULL &&
-        mapcache->last_entry->paddr_index == paddr_index) {
-        mapcache->last_entry = NULL;
-    }
-
-    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
-    while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {
-        pentry = entry;
-        entry = entry->next;
-    }
-    if (!entry) {
-        DPRINTF("Trying to unmap address %p that is not in the mapcache!\n", buffer);
-        return;
-    }
-    entry->lock--;
-    if (entry->lock > 0 || pentry == NULL) {
-        return;
-    }
-
-    pentry->next = entry->next;
-    ram_block_notify_remove(entry->vaddr_base, entry->size);
-    if (munmap(entry->vaddr_base, entry->size) != 0) {
-        perror("unmap fails");
-        exit(-1);
-    }
-    g_free(entry->valid_mapping);
-    g_free(entry);
-}
-
-void xen_invalidate_map_cache_entry(uint8_t *buffer)
-{
-    mapcache_lock();
-    xen_invalidate_map_cache_entry_unlocked(buffer);
-    mapcache_unlock();
-}
-
-void xen_invalidate_map_cache(void)
-{
-    unsigned long i;
-    MapCacheRev *reventry;
-
-    /* Flush pending AIO before destroying the mapcache */
-    bdrv_drain_all();
-
-    mapcache_lock();
-
-    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
-        DPRINTF("There should be no locked mappings at this time, "
-                "but "TARGET_FMT_plx" -> %p is present\n",
-                reventry->paddr_index, reventry->vaddr_req);
-    }
-
-    for (i = 0; i < mapcache->nr_buckets; i++) {
-        MapCacheEntry *entry = &mapcache->entry[i];
-
-        if (entry->vaddr_base == NULL) {
-            continue;
-        }
-        if (entry->lock > 0) {
-            continue;
-        }
-
-        if (munmap(entry->vaddr_base, entry->size) != 0) {
-            perror("unmap fails");
-            exit(-1);
-        }
-
-        entry->paddr_index = 0;
-        entry->vaddr_base = NULL;
-        entry->size = 0;
-        g_free(entry->valid_mapping);
-        entry->valid_mapping = NULL;
-    }
-
-    mapcache->last_entry = NULL;
-
-    mapcache_unlock();
-}
--

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory
@ 2017-04-05 23:21 Anthony Xu
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/ Anthony Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Anthony Xu @ 2017-04-05 23:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony.perard, pbonzini, eblake, Anthony Xu


  move xen related files to corresponding xen directory

  move xen-common.c to hw/xen/
  move xen-hvm.c to hw/i386/xen/
  move xen-mapcache.c to hw/i386/xen/

Signed-off -by: Anthony Xu <anthony.xu@intel.com>



 Makefile.target                              |  6 ------
 default-configs/i386-softmmu.mak             |  1 -
 default-configs/x86_64-softmmu.mak           |  1 -
 hw/i386/xen/Makefile.objs                    |  2 +-
 hw/i386/xen/trace-events                     | 17 +++++++++++++++++
 xen-hvm.c => hw/i386/xen/xen-hvm.c           |  2 +-
 xen-mapcache.c => hw/i386/xen/xen-mapcache.c |  2 +-
 hw/xen/Makefile.objs                         |  2 +-
 xen-common.c => hw/xen/xen-common.c          |  0
 stubs/Makefile.objs                          |  2 ++
 xen-common-stub.c => stubs/xen-common.c      |  0
 xen-hvm-stub.c => stubs/xen-hvm.c            |  0
 trace-events                                 | 16 ----------------
 13 files changed, 23 insertions(+), 28 deletions(-)
 rename xen-hvm.c => hw/i386/xen/xen-hvm.c (99%)
 rename xen-mapcache.c => hw/i386/xen/xen-mapcache.c (99%)
 rename xen-common.c => hw/xen/xen-common.c (100%)
 rename xen-common-stub.c => stubs/xen-common.c (100%)
 rename xen-hvm-stub.c => stubs/xen-hvm.c (100%)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel]  [PATCH 1/3] move xen-common.c to hw/xen/
  2017-04-05 23:21 [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Anthony Xu
@ 2017-04-05 23:21 ` Anthony Xu
  2017-04-06 15:10   ` Sahid Orentino Ferdjaoui
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/ Anthony Xu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Anthony Xu @ 2017-04-05 23:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony.perard, pbonzini, eblake, Anthony Xu

move xen-common.c to hw/xen/

Signed-off -by: Anthony Xu <anthony.xu@intel.com>


---
 Makefile.target                         | 2 --
 hw/xen/Makefile.objs                    | 2 +-
 xen-common.c => hw/xen/xen-common.c     | 0
 stubs/Makefile.objs                     | 1 +
 xen-common-stub.c => stubs/xen-common.c | 0
 5 files changed, 2 insertions(+), 3 deletions(-)
 rename xen-common.c => hw/xen/xen-common.c (100%)
 rename xen-common-stub.c => stubs/xen-common.c (100%)

diff --git a/Makefile.target b/Makefile.target
index 7df2b8c..48c027f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -150,9 +150,7 @@ obj-y += migration/ram.o migration/savevm.o
 LIBS := $(libs_softmmu) $(LIBS)
 
 # xen support
-obj-$(CONFIG_XEN) += xen-common.o
 obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
-obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
 obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
 
 # Hardware support
diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 4be3ec9..64a70bc 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -1,5 +1,5 @@
 # xen backend driver support
-common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o
+common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o xen-common.o
 
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
diff --git a/xen-common.c b/hw/xen/xen-common.c
similarity index 100%
rename from xen-common.c
rename to hw/xen/xen-common.c
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 224f04b..6c80613 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -37,3 +37,4 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += vmgenid.o
+stub-obj-y += xen-common.o
diff --git a/xen-common-stub.c b/stubs/xen-common.c
similarity index 100%
rename from xen-common-stub.c
rename to stubs/xen-common.c
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/
  2017-04-05 23:21 [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Anthony Xu
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/ Anthony Xu
@ 2017-04-05 23:21 ` Anthony Xu
  2017-04-06 15:24   ` Sahid Orentino Ferdjaoui
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 3/3] move xen-mapcache.c " Anthony Xu
  2017-04-14 18:47 ` [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Stefano Stabellini
  3 siblings, 1 reply; 9+ messages in thread
From: Anthony Xu @ 2017-04-05 23:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony.perard, pbonzini, eblake, Anthony Xu

move xen-hvm.c to hw/i386/xen/


Signed-off -by: Anthony Xu <anthony.xu@intel.com>



---
 Makefile.target                    |  3 +--
 hw/i386/xen/Makefile.objs          |  2 +-
 hw/i386/xen/trace-events           | 11 +++++++++++
 xen-hvm.c => hw/i386/xen/xen-hvm.c |  2 +-
 stubs/Makefile.objs                |  1 +
 xen-hvm-stub.c => stubs/xen-hvm.c  |  0
 trace-events                       | 11 -----------
 7 files changed, 15 insertions(+), 15 deletions(-)
 rename xen-hvm.c => hw/i386/xen/xen-hvm.c (99%)
 rename xen-hvm-stub.c => stubs/xen-hvm.c (100%)

diff --git a/Makefile.target b/Makefile.target
index 48c027f..d5ff0c7 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -150,8 +150,7 @@ obj-y += migration/ram.o migration/savevm.o
 LIBS := $(libs_softmmu) $(LIBS)
 
 # xen support
-obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
-obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
+obj-$(CONFIG_XEN_I386) += xen-mapcache.o
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
diff --git a/hw/i386/xen/Makefile.objs b/hw/i386/xen/Makefile.objs
index 801a68d..daf4f53 100644
--- a/hw/i386/xen/Makefile.objs
+++ b/hw/i386/xen/Makefile.objs
@@ -1 +1 @@
-obj-y += xen_platform.o xen_apic.o xen_pvdevice.o
+obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o
diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events
index 321fe60..f25d622 100644
--- a/hw/i386/xen/trace-events
+++ b/hw/i386/xen/trace-events
@@ -4,3 +4,14 @@ xen_platform_log(char *s) "xen platform: %s"
 # hw/i386/xen/xen_pvdevice.c
 xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
 xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
+
+# xen-hvm.c
+xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx"
+xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
+handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
+cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
+cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
diff --git a/xen-hvm.c b/hw/i386/xen/xen-hvm.c
similarity index 99%
rename from xen-hvm.c
rename to hw/i386/xen/xen-hvm.c
index 5043beb..0892361 100644
--- a/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -22,7 +22,7 @@
 #include "qemu/error-report.h"
 #include "qemu/range.h"
 #include "sysemu/xen-mapcache.h"
-#include "trace-root.h"
+#include "trace.h"
 #include "exec/address-spaces.h"
 
 #include <xen/hvm/ioreq.h>
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 6c80613..f5b47bf 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -38,3 +38,4 @@ stub-obj-y += target-get-monitor-def.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += vmgenid.o
 stub-obj-y += xen-common.o
+stub-obj-y += xen-hvm.o
diff --git a/xen-hvm-stub.c b/stubs/xen-hvm.c
similarity index 100%
rename from xen-hvm-stub.c
rename to stubs/xen-hvm.c
diff --git a/trace-events b/trace-events
index b07a09b..4e14487 100644
--- a/trace-events
+++ b/trace-events
@@ -48,17 +48,6 @@ spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
 spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
 spice_vmc_event(int event) "spice vmc event %d"
 
-# xen-hvm.c
-xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx"
-xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
-handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
-handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
-handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
-cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
-cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
-cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
-cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
-
 # xen-mapcache.c
 xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
 xen_remap_bucket(uint64_t index) "index %#"PRIx64
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 3/3] move xen-mapcache.c to hw/i386/xen/
  2017-04-05 23:21 [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Anthony Xu
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/ Anthony Xu
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/ Anthony Xu
@ 2017-04-05 23:21 ` Anthony Xu
  2017-04-14 18:47 ` [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Stefano Stabellini
  3 siblings, 0 replies; 9+ messages in thread
From: Anthony Xu @ 2017-04-05 23:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: sstabellini, anthony.perard, pbonzini, eblake, Anthony Xu


move xen-mapcache.c to hw/i386/xen/

Signed-off -by: Anthony Xu <anthony.xu@intel.com>



---
 Makefile.target                              | 3 ---
 default-configs/i386-softmmu.mak             | 1 -
 default-configs/x86_64-softmmu.mak           | 1 -
 hw/i386/xen/Makefile.objs                    | 2 +-
 hw/i386/xen/trace-events                     | 6 ++++++
 xen-mapcache.c => hw/i386/xen/xen-mapcache.c | 2 +-
 trace-events                                 | 5 -----
 7 files changed, 8 insertions(+), 12 deletions(-)
 rename xen-mapcache.c => hw/i386/xen/xen-mapcache.c (99%)

diff --git a/Makefile.target b/Makefile.target
index d5ff0c7..a535980 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -149,9 +149,6 @@ obj-y += dump.o
 obj-y += migration/ram.o migration/savevm.o
 LIBS := $(libs_softmmu) $(LIBS)
 
-# xen support
-obj-$(CONFIG_XEN_I386) += xen-mapcache.o
-
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
 obj-y += hw/sparc64/
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 029e952..d2ab2f6 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=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 d1d7432..9bde2f1 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -39,7 +39,6 @@ CONFIG_TPM_TIS=$(CONFIG_TPM)
 CONFIG_MC146818RTC=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/hw/i386/xen/Makefile.objs b/hw/i386/xen/Makefile.objs
index daf4f53..be9d10c 100644
--- a/hw/i386/xen/Makefile.objs
+++ b/hw/i386/xen/Makefile.objs
@@ -1 +1 @@
-obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o
+obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o xen-mapcache.o
diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events
index f25d622..547438d 100644
--- a/hw/i386/xen/trace-events
+++ b/hw/i386/xen/trace-events
@@ -15,3 +15,9 @@ cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64
 cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
 cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
 cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
+
+# xen-mapcache.c
+xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
+xen_remap_bucket(uint64_t index) "index %#"PRIx64
+xen_map_cache_return(void* ptr) "%p"
+
diff --git a/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
similarity index 99%
rename from xen-mapcache.c
rename to hw/i386/xen/xen-mapcache.c
index 1a96d2e..31debdf 100644
--- a/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -19,7 +19,7 @@
 #include <xen/hvm/params.h>
 
 #include "sysemu/xen-mapcache.h"
-#include "trace-root.h"
+#include "trace.h"
 
 
 //#define MAPCACHE_DEBUG
diff --git a/trace-events b/trace-events
index 4e14487..e582d63 100644
--- a/trace-events
+++ b/trace-events
@@ -48,11 +48,6 @@ spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
 spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
 spice_vmc_event(int event) "spice vmc event %d"
 
-# xen-mapcache.c
-xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
-xen_remap_bucket(uint64_t index) "index %#"PRIx64
-xen_map_cache_return(void* ptr) "%p"
-
 # monitor.c
 monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
 monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/ Anthony Xu
@ 2017-04-06 15:10   ` Sahid Orentino Ferdjaoui
  2017-04-06 15:21     ` Eric Blake
  0 siblings, 1 reply; 9+ messages in thread
From: Sahid Orentino Ferdjaoui @ 2017-04-06 15:10 UTC (permalink / raw)
  To: Anthony Xu; +Cc: qemu-devel, anthony.perard, pbonzini, sstabellini

On Wed, Apr 05, 2017 at 04:21:29PM -0700, Anthony Xu wrote:
> move xen-common.c to hw/xen/
> 
> Signed-off -by: Anthony Xu <anthony.xu@intel.com>

nit: s/Signed-off -by/Signed-off-by, not sure if it's really important
or not.

Reviewed-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>

> 
> ---
>  Makefile.target                         | 2 --
>  hw/xen/Makefile.objs                    | 2 +-
>  xen-common.c => hw/xen/xen-common.c     | 0
>  stubs/Makefile.objs                     | 1 +
>  xen-common-stub.c => stubs/xen-common.c | 0
>  5 files changed, 2 insertions(+), 3 deletions(-)
>  rename xen-common.c => hw/xen/xen-common.c (100%)
>  rename xen-common-stub.c => stubs/xen-common.c (100%)
>
> diff --git a/Makefile.target b/Makefile.target
> index 7df2b8c..48c027f 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -150,9 +150,7 @@ obj-y += migration/ram.o migration/savevm.o
>  LIBS := $(libs_softmmu) $(LIBS)
>  
>  # xen support
> -obj-$(CONFIG_XEN) += xen-common.o
>  obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
> -obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
>  obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
>  
>  # Hardware support
> diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
> index 4be3ec9..64a70bc 100644
> --- a/hw/xen/Makefile.objs
> +++ b/hw/xen/Makefile.objs
> @@ -1,5 +1,5 @@
>  # xen backend driver support
> -common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o
> +common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o xen-common.o

Refers to the moved file /xen-common.c to /hw/xen/xen-common.c

>  obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
>  obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
> diff --git a/xen-common.c b/hw/xen/xen-common.c
> similarity index 100%
> rename from xen-common.c
> rename to hw/xen/xen-common.c
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 224f04b..6c80613 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -37,3 +37,4 @@ stub-obj-y += target-monitor-defs.o
>  stub-obj-y += target-get-monitor-def.o
>  stub-obj-y += pc_madt_cpu_entry.o
>  stub-obj-y += vmgenid.o
> +stub-obj-y += xen-common.o

Refers to the moved file /xen-common-stub.c to /hw/xen/stubs/xen-common.c

> diff --git a/xen-common-stub.c b/stubs/xen-common.c
> similarity index 100%
> rename from xen-common-stub.c
> rename to stubs/xen-common.c
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/
  2017-04-06 15:10   ` Sahid Orentino Ferdjaoui
@ 2017-04-06 15:21     ` Eric Blake
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Blake @ 2017-04-06 15:21 UTC (permalink / raw)
  To: Sahid Orentino Ferdjaoui, Anthony Xu
  Cc: anthony.perard, pbonzini, sstabellini, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

On 04/06/2017 10:10 AM, Sahid Orentino Ferdjaoui wrote:
> On Wed, Apr 05, 2017 at 04:21:29PM -0700, Anthony Xu wrote:
>> move xen-common.c to hw/xen/
>>
>> Signed-off -by: Anthony Xu <anthony.xu@intel.com>
> 
> nit: s/Signed-off -by/Signed-off-by, not sure if it's really important
> or not.

Some of the automated tooling may choke on the misspelled variant, and
S-o-b is legally important, so it is worth fixing.

By the way, you can use 'git commit -s' or 'git send-email -s' to add
S-o-b in the proper format at a given stage in your workflow, rather
than having to type it by hand; it becomes obvious that you didn't use
git's automation for adding it when you have a typo or when you have
more than one blank line between your S-o-b and the --- separator.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/ Anthony Xu
@ 2017-04-06 15:24   ` Sahid Orentino Ferdjaoui
  0 siblings, 0 replies; 9+ messages in thread
From: Sahid Orentino Ferdjaoui @ 2017-04-06 15:24 UTC (permalink / raw)
  To: Anthony Xu; +Cc: qemu-devel, anthony.perard, pbonzini, sstabellini

On Wed, Apr 05, 2017 at 04:21:30PM -0700, Anthony Xu wrote:
> move xen-hvm.c to hw/i386/xen/
> 
> 
> Signed-off -by: Anthony Xu <anthony.xu@intel.com>
> 
> 
> 
> ---
>  Makefile.target                    |  3 +--
>  hw/i386/xen/Makefile.objs          |  2 +-
>  hw/i386/xen/trace-events           | 11 +++++++++++
>  xen-hvm.c => hw/i386/xen/xen-hvm.c |  2 +-
>  stubs/Makefile.objs                |  1 +
>  xen-hvm-stub.c => stubs/xen-hvm.c  |  0
>  trace-events                       | 11 -----------
>  7 files changed, 15 insertions(+), 15 deletions(-)
>  rename xen-hvm.c => hw/i386/xen/xen-hvm.c (99%)
>  rename xen-hvm-stub.c => stubs/xen-hvm.c (100%)

Reviewed-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>

> 
> diff --git a/Makefile.target b/Makefile.target
> index 48c027f..d5ff0c7 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -150,8 +150,7 @@ obj-y += migration/ram.o migration/savevm.o
>  LIBS := $(libs_softmmu) $(LIBS)
>  
>  # xen support
> -obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
> -obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o
> +obj-$(CONFIG_XEN_I386) += xen-mapcache.o
>  
>  # Hardware support
>  ifeq ($(TARGET_NAME), sparc64)
> diff --git a/hw/i386/xen/Makefile.objs b/hw/i386/xen/Makefile.objs
> index 801a68d..daf4f53 100644
> --- a/hw/i386/xen/Makefile.objs
> +++ b/hw/i386/xen/Makefile.objs
> @@ -1 +1 @@
> -obj-y += xen_platform.o xen_apic.o xen_pvdevice.o
> +obj-y += xen_platform.o xen_apic.o xen_pvdevice.o xen-hvm.o

Refers to the file moved /xen-hvm.c to /hw/i386/xen/xen-hvm.c

> diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events
> index 321fe60..f25d622 100644
> --- a/hw/i386/xen/trace-events
> +++ b/hw/i386/xen/trace-events
> @@ -4,3 +4,14 @@ xen_platform_log(char *s) "xen platform: %s"
>  # hw/i386/xen/xen_pvdevice.c
>  xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
>  xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
> +
> +# xen-hvm.c
> +xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx"
> +xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
> +handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> +handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> +handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> +cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> +cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
> +cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
> +cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"

comming from /trace-events

> diff --git a/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> similarity index 99%
> rename from xen-hvm.c
> rename to hw/i386/xen/xen-hvm.c
> index 5043beb..0892361 100644
> --- a/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -22,7 +22,7 @@
>  #include "qemu/error-report.h"
>  #include "qemu/range.h"
>  #include "sysemu/xen-mapcache.h"
> -#include "trace-root.h"
> +#include "trace.h"
>  #include "exec/address-spaces.h"
>  
>  #include <xen/hvm/ioreq.h>
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 6c80613..f5b47bf 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -38,3 +38,4 @@ stub-obj-y += target-get-monitor-def.o
>  stub-obj-y += pc_madt_cpu_entry.o
>  stub-obj-y += vmgenid.o
>  stub-obj-y += xen-common.o
> +stub-obj-y += xen-hvm.o

Refers to the file moved /xen-hvm-stub.c to /hw/i386/stubs/xen-hvm.c

> diff --git a/xen-hvm-stub.c b/stubs/xen-hvm.c
> similarity index 100%
> rename from xen-hvm-stub.c
> rename to stubs/xen-hvm.c
> diff --git a/trace-events b/trace-events
> index b07a09b..4e14487 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -48,17 +48,6 @@ spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
>  spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
>  spice_vmc_event(int event) "spice vmc event %d"
>  
> -# xen-hvm.c
> -xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx"
> -xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
> -handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p type=%d dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> -handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p read type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> -handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p write type=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> -cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p pio dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> -cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio read reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
> -cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t size) "I/O=%p pio write reg data=%#"PRIx64" port=%#"PRIx64" size=%d"
> -cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=%p copy dir=%d df=%d ptr=%d port=%#"PRIx64" data=%#"PRIx64" count=%d size=%d"
> -
>  # xen-mapcache.c
>  xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
>  xen_remap_bucket(uint64_t index) "index %#"PRIx64
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory
  2017-04-05 23:21 [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Anthony Xu
                   ` (2 preceding siblings ...)
  2017-04-05 23:21 ` [Qemu-devel] [PATCH 3/3] move xen-mapcache.c " Anthony Xu
@ 2017-04-14 18:47 ` Stefano Stabellini
  3 siblings, 0 replies; 9+ messages in thread
From: Stefano Stabellini @ 2017-04-14 18:47 UTC (permalink / raw)
  To: Anthony Xu; +Cc: qemu-devel, sstabellini, anthony.perard, pbonzini, eblake

On Wed, 5 Apr 2017, Anthony Xu wrote:
> 
>   move xen related files to corresponding xen directory
> 
>   move xen-common.c to hw/xen/
>   move xen-hvm.c to hw/i386/xen/
>   move xen-mapcache.c to hw/i386/xen/
> 
> Signed-off -by: Anthony Xu <anthony.xu@intel.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I queued this series in my "next" branch.


> 
>  Makefile.target                              |  6 ------
>  default-configs/i386-softmmu.mak             |  1 -
>  default-configs/x86_64-softmmu.mak           |  1 -
>  hw/i386/xen/Makefile.objs                    |  2 +-
>  hw/i386/xen/trace-events                     | 17 +++++++++++++++++
>  xen-hvm.c => hw/i386/xen/xen-hvm.c           |  2 +-
>  xen-mapcache.c => hw/i386/xen/xen-mapcache.c |  2 +-
>  hw/xen/Makefile.objs                         |  2 +-
>  xen-common.c => hw/xen/xen-common.c          |  0
>  stubs/Makefile.objs                          |  2 ++
>  xen-common-stub.c => stubs/xen-common.c      |  0
>  xen-hvm-stub.c => stubs/xen-hvm.c            |  0
>  trace-events                                 | 16 ----------------
>  13 files changed, 23 insertions(+), 28 deletions(-)
>  rename xen-hvm.c => hw/i386/xen/xen-hvm.c (99%)
>  rename xen-mapcache.c => hw/i386/xen/xen-mapcache.c (99%)
>  rename xen-common.c => hw/xen/xen-common.c (100%)
>  rename xen-common-stub.c => stubs/xen-common.c (100%)
>  rename xen-hvm-stub.c => stubs/xen-hvm.c (100%)
> 
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-14 18:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-05 23:21 [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Anthony Xu
2017-04-05 23:21 ` [Qemu-devel] [PATCH 1/3] move xen-common.c to hw/xen/ Anthony Xu
2017-04-06 15:10   ` Sahid Orentino Ferdjaoui
2017-04-06 15:21     ` Eric Blake
2017-04-05 23:21 ` [Qemu-devel] [PATCH 2/3] move xen-hvm.c to hw/i386/xen/ Anthony Xu
2017-04-06 15:24   ` Sahid Orentino Ferdjaoui
2017-04-05 23:21 ` [Qemu-devel] [PATCH 3/3] move xen-mapcache.c " Anthony Xu
2017-04-14 18:47 ` [Qemu-devel] [PATCH 0/3] move xen related files to corresponding xen directory Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2017-04-05 18:40 [Qemu-devel] [PATCH 3/3] move xen-mapcache.c to hw/i386/xen/ Xu, Anthony

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).