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>
v = 0;
v &= 0xf;
if (((address+i) >= 0x60) && ((address+i) <= 0x63))
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. */
}
/* Hand off to default logic. */
static void i440fx_set_irq(qemu_irq *pic, int irq_num, int level)
{
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);
{
switch (addr - 0x10) {
case 0: /* Platform flags */ {
{
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",
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"));
uint32_t vcpu_avail[(HVM_MAX_VCPUS + 31)/32] = {0};
xc_interface *xc_handle;
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";
char domain_name[64] = "Xen-no-name";
#include <stdio.h>
static void i8259_set_irq(void *opaque, int irq, int level) {
#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)
}
qemu_irq *i8259_init(qemu_irq parent_irq)
dma_helper_init();
xc_handle = xc_interface_open(0,0,0); /* fixme check errors */
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
xenstore_init();
if (!strcmp(machine->name, "xenfv")) {
#ifdef CONFIG_STUBDOM
#if defined(CONFIG_BLKTAP1) && !defined(CONFIG_STUBDOM) && !defined(__NetBSD__)
#include "blktaplib.h"
#endif
#if defined(CONFIG_BLKTAP1) && !defined(CONFIG_STUBDOM) && !defined(__NetBSD__)
#include "blktaplib.h"
#endif
+#include "xendevicemodel.h"
#define BIOS_SIZE ((256 + 64) * 1024)
#define BIOS_SIZE ((256 + 64) * 1024)
void main_loop_prepare(void);
extern xc_interface *xc_handle;
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[];
extern int xen_pause_requested;
extern int vcpus;
extern uint32_t vcpu_avail[];
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/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
CPPFLAGS+= -DXC_WANT_COMPAT_MAP_FOREIGN_API
CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include
CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include
LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn
LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab
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
LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog