]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen-traditional.git/commitdiff
Port to use libxendevicemodel master vwip
authorIan Campbell <ian.campbell@citrix.com>
Fri, 29 Jan 2016 12:59:56 +0000 (12:59 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 2 Feb 2016 15:39:02 +0000 (15:39 +0000)
This is necessary to allow us to remove functionality from libxenctrl
which is replaced by libxendevicemodel i.e. that which is only used
by QEMU (trad or upstream).

This does everything in one batch for simplicity, it's mostly fairly
straight substitutions.

The goal here (unlike with qemu-upstream) is not necessarily to
abolish all uses of libxenctrl.

Note that when opening the xendevicemodel handle we don't care about
any attempts to restrict, since the full gamut of things needed to
make that effective are only targetting QEMU upstream.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
hw/piix_pci.c
hw/xen_platform.c
i386-dm/helper2.c
i386-dm/i8259.c
vl.c
xen-config-host.h
xen-hooks.mak

index 9c5dcf11e2a83472acb2ce2f034cee0919ffbcab..87782f6970b0b995055f42ea8008fb1d8c0ee8c4 100644 (file)
@@ -412,7 +412,7 @@ static void piix3_write_config(PCIDevice *d,
             v = 0;
         v &= 0xf;
         if (((address+i) >= 0x60) && ((address+i) <= 0x63))
-            xc_hvm_set_pci_link_route(xc_handle, domid, address + i - 0x60, v);
+             xendevicemodel_route_pci_intx_to_isa_irq(xen_dm, address + i - 0x60, v);
     }
 
     /* Hand off to default logic. */
@@ -421,6 +421,6 @@ static void piix3_write_config(PCIDevice *d,
 
 static void i440fx_set_irq(qemu_irq *pic, int irq_num, int level)
 {
-    xc_hvm_set_pci_intx_level(xc_handle, domid, 0, 0, irq_num >> 2,
-                              irq_num & 3, level);
+    xendevicemodel_set_pci_intx_level(xen_dm, 0, 0, irq_num >> 2,
+                                      irq_num & 3, level);
 }
index d282f8e77e99df1205e109093f2e2734c0a65e68..04a1e966f283f350f2f424b6b1cf62e1d8e045e4 100644 (file)
@@ -207,16 +207,20 @@ static void platform_fixed_ioport_write1(void *opaque, uint32_t addr, uint32_t v
 {
     switch (addr - 0x10) {
     case 0: /* Platform flags */ {
-        hvmmem_type_t mem_type = (val & PFFLAG_ROM_LOCK) ?
-            HVMMEM_ram_ro : HVMMEM_ram_rw;
-        if (xc_hvm_set_mem_type(xc_handle, domid, mem_type, 0xc0, 0x40))
+       int rc;
+
+       if (val & PFFLAG_ROM_LOCK)
+           rc = xendevicemodel_make_ram_region_ro(xen_dm, 0xc0, 0x40);
+       else
+           rc = xendevicemodel_make_ram_region_rw(xen_dm, 0xc0, 0x40);
+       if (rc)
             fprintf(logfile,"platform_fixed_ioport: unable to change ro/rw "
                     "state of ROM memory area!\n");
         else {
             platform_flags = val & PFFLAG_ROM_LOCK;
             fprintf(logfile,"platform_fixed_ioport: changed ro/rw "
                     "state of ROM memory area. now is %s state.\n",
-                    (mem_type == HVMMEM_ram_ro ? "ro":"rw"));
+                    (val & PFFLAG_ROM_LOCK ? "ro":"rw"));
         }
         break;
     }
index 8c61a243f5fd2cb348c65da935cd9cbfcbb15989..a184bff0d1be6d12dd1e070bf98921814ebefb44 100644 (file)
@@ -85,6 +85,7 @@ int vcpus = 1;
 uint32_t vcpu_avail[(HVM_MAX_VCPUS + 31)/32] = {0};
 
 xc_interface *xc_handle;
+xendevicemodel_handle *xen_dm = NULL;
 
 char domain_name[64] = "Xen-no-name";
 
index 40bbee0bbe795a3aa4645b1333f9fb0f3ed69da3..be41cbcd380b084375eb8058dfd9e4aacb1f6b28 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdio.h>
 
 static void i8259_set_irq(void *opaque, int irq, int level) {
-    xc_hvm_set_isa_irq_level(xc_handle, domid, irq, level);
+    xendevicemodel_set_isa_irq_level(xen_dm, irq, level);
 }
 
 qemu_irq *i8259_init(qemu_irq parent_irq)
diff --git a/vl.c b/vl.c
index c864e7de755498c7b0326a6c9d0b6b9220df1796..3b8c2626a63783fbd3a055ad1c62f712d20ceba8 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -5830,6 +5830,9 @@ int main(int argc, char **argv, char **envp)
     dma_helper_init();
 
     xc_handle = xc_interface_open(0,0,0); /* fixme check errors */
+    /* We don't care about restricting this handle */
+    xen_dm = xendevicemodel_open(0, domid, 0, NULL);
+
     xenstore_init();
     if (!strcmp(machine->name, "xenfv")) {
 #ifdef CONFIG_STUBDOM
index 3a020215ecb621b94aadcfd1cb6ec25adc00e60a..3de16e4ececd978c66d42397c8c34a268fa119b2 100644 (file)
@@ -21,6 +21,7 @@ extern int domid, domid_backend;
 #if defined(CONFIG_BLKTAP1) && !defined(CONFIG_STUBDOM) && !defined(__NetBSD__)
 #include "blktaplib.h"
 #endif
+#include "xendevicemodel.h"
 
 #define BIOS_SIZE ((256 + 64) * 1024)
 
@@ -29,6 +30,8 @@ extern int domid, domid_backend;
 void main_loop_prepare(void);
 
 extern xc_interface *xc_handle;
+extern xendevicemodel_handle *xen_dm;
+
 extern int xen_pause_requested;
 extern int vcpus;
 extern uint32_t vcpu_avail[];
index c1ea4be5edd7118d52c0918b3d1fb38c5a6c2e4d..29d09c7fd061a921c859c31479799d208cd9c8fe 100644 (file)
@@ -1,6 +1,7 @@
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include
+CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/devicemodel/include
 CPPFLAGS+= -DXC_WANT_COMPAT_MAP_FOREIGN_API
 CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include
 CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include
@@ -23,6 +24,7 @@ CFLAGS += $(CMDLINE_CFLAGS)
 
 LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn
 LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab
+LIBS += -L$(XEN_ROOT)/tools/libs/devicemodel -lxendevicemodel
 LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
 LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
 LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog