*/
#include "qemu/osdep.h"
-#include <sys/mman.h>
+#include "cpu.h"
#include "hw/pci/pci.h"
#include "hw/i386/pc.h"
#include "hw/i386/apic-msidef.h"
/* Handle the machine opt max-ram-below-4g. It is basically doing
* min(xen limit, user limit).
*/
+ if (!user_lowmem) {
+ user_lowmem = HVM_BELOW_4G_RAM_END; /* default */
+ }
if (HVM_BELOW_4G_RAM_END <= user_lowmem) {
user_lowmem = HVM_BELOW_4G_RAM_END;
}
MemoryRegionSection *section)
{
XenIOState *state = container_of(listener, XenIOState, io_listener);
+ MemoryRegion *mr = section->mr;
- memory_region_ref(section->mr);
+ if (mr->ops == &unassigned_io_ops) {
+ return;
+ }
+
+ memory_region_ref(mr);
xen_map_io_section(xen_xc, xen_domid, state->ioservid, section);
}
MemoryRegionSection *section)
{
XenIOState *state = container_of(listener, XenIOState, io_listener);
+ MemoryRegion *mr = section->mr;
+
+ if (mr->ops == &unassigned_io_ops) {
+ return;
+ }
xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section);
- memory_region_unref(section->mr);
+ memory_region_unref(mr);
}
static void xen_device_realize(DeviceListener *listener,
{
hwaddr npages = size >> TARGET_PAGE_BITS;
const int width = sizeof(unsigned long) * 8;
- unsigned long bitmap[(npages + width - 1) / width];
+ unsigned long bitmap[DIV_ROUND_UP(npages, width)];
int rc, i, j;
const XenPhysmap *physmap = NULL;
return NULL;
}
-static uint32_t do_inp(pio_addr_t addr, unsigned long size)
+static uint32_t do_inp(uint32_t addr, unsigned long size)
{
switch (size) {
case 1:
case 4:
return cpu_inl(addr);
default:
- hw_error("inp: bad size: %04"FMT_pioaddr" %lx", addr, size);
+ hw_error("inp: bad size: %04x %lx", addr, size);
}
}
-static void do_outp(pio_addr_t addr,
+static void do_outp(uint32_t addr,
unsigned long size, uint32_t val)
{
switch (size) {
case 4:
return cpu_outl(addr, val);
default:
- hw_error("outp: bad size: %04"FMT_pioaddr" %lx", addr, size);
+ hw_error("outp: bad size: %04x %lx", addr, size);
}
}
goto err;
}
- rc = xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid);
- if (rc < 0) {
- perror("xen: ioreq server create");
- goto err;
- }
+ xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid);
state->exit.notify = xen_exit_notifier;
qemu_add_exit_notifier(&state->exit);
error_report("xen backend core setup failed");
goto err;
}
- xen_be_register("console", &xen_console_ops);
- xen_be_register("vkbd", &xen_kbdmouse_ops);
- xen_be_register("qdisk", &xen_blkdev_ops);
+ xen_be_register_common();
xen_read_physmap(state);
return;