qemu-img: Avoid duplicate block device IDs
[qemu/ar7.git] / hw / xen / xen_apic.c
blob63bb7f77c6002104b1b387c7dcb6e5d2eb3d8714
1 /*
2 * Xen basic APIC support
4 * Copyright (c) 2012 Citrix
6 * Authors:
7 * Wei Liu <wei.liu2@citrix.com>
9 * This work is licensed under the terms of the GNU GPL version 2 or
10 * later. See the COPYING file in the top-level directory.
12 #include "hw/i386/apic_internal.h"
13 #include "hw/pci/msi.h"
14 #include "hw/xen/xen.h"
16 static uint64_t xen_apic_mem_read(void *opaque, hwaddr addr,
17 unsigned size)
19 return ~(uint64_t)0;
22 static void xen_apic_mem_write(void *opaque, hwaddr addr,
23 uint64_t data, unsigned size)
25 if (size != sizeof(uint32_t)) {
26 fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size);
27 return;
30 xen_hvm_inject_msi(addr, data);
33 static const MemoryRegionOps xen_apic_io_ops = {
34 .read = xen_apic_mem_read,
35 .write = xen_apic_mem_write,
36 .endianness = DEVICE_NATIVE_ENDIAN,
39 static void xen_apic_realize(DeviceState *dev, Error **errp)
41 APICCommonState *s = APIC_COMMON(dev);
43 memory_region_init_io(&s->io_memory, OBJECT(s), &xen_apic_io_ops, s,
44 "xen-apic-msi", APIC_SPACE_SIZE);
46 #if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
47 && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
48 msi_supported = true;
49 #endif
52 static void xen_apic_set_base(APICCommonState *s, uint64_t val)
56 static void xen_apic_set_tpr(APICCommonState *s, uint8_t val)
60 static uint8_t xen_apic_get_tpr(APICCommonState *s)
62 return 0;
65 static void xen_apic_vapic_base_update(APICCommonState *s)
69 static void xen_apic_external_nmi(APICCommonState *s)
73 static void xen_apic_class_init(ObjectClass *klass, void *data)
75 APICCommonClass *k = APIC_COMMON_CLASS(klass);
77 k->realize = xen_apic_realize;
78 k->set_base = xen_apic_set_base;
79 k->set_tpr = xen_apic_set_tpr;
80 k->get_tpr = xen_apic_get_tpr;
81 k->vapic_base_update = xen_apic_vapic_base_update;
82 k->external_nmi = xen_apic_external_nmi;
85 static const TypeInfo xen_apic_info = {
86 .name = "xen-apic",
87 .parent = TYPE_APIC_COMMON,
88 .instance_size = sizeof(APICCommonState),
89 .class_init = xen_apic_class_init,
92 static void xen_apic_register_types(void)
94 type_register_static(&xen_apic_info);
97 type_init(xen_apic_register_types)