4 * Copyright (c) 2004-2005 Fabrice Bellard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>
19 #include "qemu/osdep.h"
20 #include "qemu-common.h"
22 #include "qemu/thread.h"
23 #include "hw/i386/apic_internal.h"
24 #include "hw/i386/apic.h"
25 #include "hw/i386/ioapic.h"
26 #include "hw/pci/msi.h"
27 #include "qemu/host-utils.h"
29 #include "hw/i386/pc.h"
30 #include "hw/i386/apic-msidef.h"
31 #include "qapi/error.h"
34 #define MAX_APIC_WORDS 8
36 #define SYNC_FROM_VAPIC 0x1
37 #define SYNC_TO_VAPIC 0x2
38 #define SYNC_ISR_IRR_TO_VAPIC 0x4
40 static APICCommonState
*local_apics
[MAX_APICS
+ 1];
42 #define TYPE_APIC "apic"
44 OBJECT_CHECK(APICCommonState, (obj), TYPE_APIC)
46 static void apic_set_irq(APICCommonState
*s
, int vector_num
, int trigger_mode
);
47 static void apic_update_irq(APICCommonState
*s
);
48 static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask
,
49 uint8_t dest
, uint8_t dest_mode
);
51 /* Find first bit starting from msb */
52 static int apic_fls_bit(uint32_t value
)
54 return 31 - clz32(value
);
57 /* Find first bit starting from lsb */
58 static int apic_ffs_bit(uint32_t value
)
63 static inline void apic_reset_bit(uint32_t *tab
, int index
)
67 mask
= 1 << (index
& 0x1f);
71 /* return -1 if no bit is set */
72 static int get_highest_priority_int(uint32_t *tab
)
75 for (i
= 7; i
>= 0; i
--) {
77 return i
* 32 + apic_fls_bit(tab
[i
]);
83 static void apic_sync_vapic(APICCommonState
*s
, int sync_type
)
85 VAPICState vapic_state
;
90 if (!s
->vapic_paddr
) {
93 if (sync_type
& SYNC_FROM_VAPIC
) {
94 cpu_physical_memory_read(s
->vapic_paddr
, &vapic_state
,
96 s
->tpr
= vapic_state
.tpr
;
98 if (sync_type
& (SYNC_TO_VAPIC
| SYNC_ISR_IRR_TO_VAPIC
)) {
99 start
= offsetof(VAPICState
, isr
);
100 length
= offsetof(VAPICState
, enabled
) - offsetof(VAPICState
, isr
);
102 if (sync_type
& SYNC_TO_VAPIC
) {
103 assert(qemu_cpu_is_self(CPU(s
->cpu
)));
105 vapic_state
.tpr
= s
->tpr
;
106 vapic_state
.enabled
= 1;
108 length
= sizeof(VAPICState
);
111 vector
= get_highest_priority_int(s
->isr
);
115 vapic_state
.isr
= vector
& 0xf0;
117 vapic_state
.zero
= 0;
119 vector
= get_highest_priority_int(s
->irr
);
123 vapic_state
.irr
= vector
& 0xff;
125 cpu_physical_memory_write_rom(&address_space_memory
,
126 s
->vapic_paddr
+ start
,
127 ((void *)&vapic_state
) + start
, length
);
131 static void apic_vapic_base_update(APICCommonState
*s
)
133 apic_sync_vapic(s
, SYNC_TO_VAPIC
);
136 static void apic_local_deliver(APICCommonState
*s
, int vector
)
138 uint32_t lvt
= s
->lvt
[vector
];
141 trace_apic_local_deliver(vector
, (lvt
>> 8) & 7);
143 if (lvt
& APIC_LVT_MASKED
)
146 switch ((lvt
>> 8) & 7) {
148 cpu_interrupt(CPU(s
->cpu
), CPU_INTERRUPT_SMI
);
152 cpu_interrupt(CPU(s
->cpu
), CPU_INTERRUPT_NMI
);
156 cpu_interrupt(CPU(s
->cpu
), CPU_INTERRUPT_HARD
);
160 trigger_mode
= APIC_TRIGGER_EDGE
;
161 if ((vector
== APIC_LVT_LINT0
|| vector
== APIC_LVT_LINT1
) &&
162 (lvt
& APIC_LVT_LEVEL_TRIGGER
))
163 trigger_mode
= APIC_TRIGGER_LEVEL
;
164 apic_set_irq(s
, lvt
& 0xff, trigger_mode
);
168 void apic_deliver_pic_intr(DeviceState
*dev
, int level
)
170 APICCommonState
*s
= APIC(dev
);
173 apic_local_deliver(s
, APIC_LVT_LINT0
);
175 uint32_t lvt
= s
->lvt
[APIC_LVT_LINT0
];
177 switch ((lvt
>> 8) & 7) {
179 if (!(lvt
& APIC_LVT_LEVEL_TRIGGER
))
181 apic_reset_bit(s
->irr
, lvt
& 0xff);
190 static void apic_external_nmi(APICCommonState
*s
)
192 apic_local_deliver(s
, APIC_LVT_LINT1
);
195 #define foreach_apic(apic, deliver_bitmask, code) \
198 for(__i = 0; __i < MAX_APIC_WORDS; __i++) {\
199 uint32_t __mask = deliver_bitmask[__i];\
201 for(__j = 0; __j < 32; __j++) {\
202 if (__mask & (1U << __j)) {\
203 apic = local_apics[__i * 32 + __j];\
213 static void apic_bus_deliver(const uint32_t *deliver_bitmask
,
214 uint8_t delivery_mode
, uint8_t vector_num
,
215 uint8_t trigger_mode
)
217 APICCommonState
*apic_iter
;
219 switch (delivery_mode
) {
221 /* XXX: search for focus processor, arbitration */
225 for(i
= 0; i
< MAX_APIC_WORDS
; i
++) {
226 if (deliver_bitmask
[i
]) {
227 d
= i
* 32 + apic_ffs_bit(deliver_bitmask
[i
]);
232 apic_iter
= local_apics
[d
];
234 apic_set_irq(apic_iter
, vector_num
, trigger_mode
);
244 foreach_apic(apic_iter
, deliver_bitmask
,
245 cpu_interrupt(CPU(apic_iter
->cpu
), CPU_INTERRUPT_SMI
)
250 foreach_apic(apic_iter
, deliver_bitmask
,
251 cpu_interrupt(CPU(apic_iter
->cpu
), CPU_INTERRUPT_NMI
)
256 /* normal INIT IPI sent to processors */
257 foreach_apic(apic_iter
, deliver_bitmask
,
258 cpu_interrupt(CPU(apic_iter
->cpu
),
264 /* handled in I/O APIC code */
271 foreach_apic(apic_iter
, deliver_bitmask
,
272 apic_set_irq(apic_iter
, vector_num
, trigger_mode
) );
275 void apic_deliver_irq(uint8_t dest
, uint8_t dest_mode
, uint8_t delivery_mode
,
276 uint8_t vector_num
, uint8_t trigger_mode
)
278 uint32_t deliver_bitmask
[MAX_APIC_WORDS
];
280 trace_apic_deliver_irq(dest
, dest_mode
, delivery_mode
, vector_num
,
283 apic_get_delivery_bitmask(deliver_bitmask
, dest
, dest_mode
);
284 apic_bus_deliver(deliver_bitmask
, delivery_mode
, vector_num
, trigger_mode
);
287 static void apic_set_base(APICCommonState
*s
, uint64_t val
)
289 s
->apicbase
= (val
& 0xfffff000) |
290 (s
->apicbase
& (MSR_IA32_APICBASE_BSP
| MSR_IA32_APICBASE_ENABLE
));
291 /* if disabled, cannot be enabled again */
292 if (!(val
& MSR_IA32_APICBASE_ENABLE
)) {
293 s
->apicbase
&= ~MSR_IA32_APICBASE_ENABLE
;
294 cpu_clear_apic_feature(&s
->cpu
->env
);
295 s
->spurious_vec
&= ~APIC_SV_ENABLE
;
299 static void apic_set_tpr(APICCommonState
*s
, uint8_t val
)
301 /* Updates from cr8 are ignored while the VAPIC is active */
302 if (!s
->vapic_paddr
) {
308 static uint8_t apic_get_tpr(APICCommonState
*s
)
310 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
314 int apic_get_ppr(APICCommonState
*s
)
319 isrv
= get_highest_priority_int(s
->isr
);
330 static int apic_get_arb_pri(APICCommonState
*s
)
332 /* XXX: arbitration */
338 * <0 - low prio interrupt,
340 * >0 - interrupt number
342 static int apic_irq_pending(APICCommonState
*s
)
346 if (!(s
->spurious_vec
& APIC_SV_ENABLE
)) {
350 irrv
= get_highest_priority_int(s
->irr
);
354 ppr
= apic_get_ppr(s
);
355 if (ppr
&& (irrv
& 0xf0) <= (ppr
& 0xf0)) {
362 /* signal the CPU if an irq is pending */
363 static void apic_update_irq(APICCommonState
*s
)
366 DeviceState
*dev
= (DeviceState
*)s
;
369 if (!qemu_cpu_is_self(cpu
)) {
370 cpu_interrupt(cpu
, CPU_INTERRUPT_POLL
);
371 } else if (apic_irq_pending(s
) > 0) {
372 cpu_interrupt(cpu
, CPU_INTERRUPT_HARD
);
373 } else if (!apic_accept_pic_intr(dev
) || !pic_get_output(isa_pic
)) {
374 cpu_reset_interrupt(cpu
, CPU_INTERRUPT_HARD
);
378 void apic_poll_irq(DeviceState
*dev
)
380 APICCommonState
*s
= APIC(dev
);
382 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
386 static void apic_set_irq(APICCommonState
*s
, int vector_num
, int trigger_mode
)
388 apic_report_irq_delivered(!apic_get_bit(s
->irr
, vector_num
));
390 apic_set_bit(s
->irr
, vector_num
);
392 apic_set_bit(s
->tmr
, vector_num
);
394 apic_reset_bit(s
->tmr
, vector_num
);
395 if (s
->vapic_paddr
) {
396 apic_sync_vapic(s
, SYNC_ISR_IRR_TO_VAPIC
);
398 * The vcpu thread needs to see the new IRR before we pull its current
399 * TPR value. That way, if we miss a lowering of the TRP, the guest
400 * has the chance to notice the new IRR and poll for IRQs on its own.
403 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
408 static void apic_eoi(APICCommonState
*s
)
411 isrv
= get_highest_priority_int(s
->isr
);
414 apic_reset_bit(s
->isr
, isrv
);
415 if (!(s
->spurious_vec
& APIC_SV_DIRECTED_IO
) && apic_get_bit(s
->tmr
, isrv
)) {
416 ioapic_eoi_broadcast(isrv
);
418 apic_sync_vapic(s
, SYNC_FROM_VAPIC
| SYNC_TO_VAPIC
);
422 static int apic_find_dest(uint8_t dest
)
424 APICCommonState
*apic
= local_apics
[dest
];
427 if (apic
&& apic
->id
== dest
)
428 return dest
; /* shortcut in case apic->id == local_apics[dest]->id */
430 for (i
= 0; i
< MAX_APICS
; i
++) {
431 apic
= local_apics
[i
];
432 if (apic
&& apic
->id
== dest
)
441 static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask
,
442 uint8_t dest
, uint8_t dest_mode
)
444 APICCommonState
*apic_iter
;
447 if (dest_mode
== 0) {
449 memset(deliver_bitmask
, 0xff, MAX_APIC_WORDS
* sizeof(uint32_t));
451 int idx
= apic_find_dest(dest
);
452 memset(deliver_bitmask
, 0x00, MAX_APIC_WORDS
* sizeof(uint32_t));
454 apic_set_bit(deliver_bitmask
, idx
);
457 /* XXX: cluster mode */
458 memset(deliver_bitmask
, 0x00, MAX_APIC_WORDS
* sizeof(uint32_t));
459 for(i
= 0; i
< MAX_APICS
; i
++) {
460 apic_iter
= local_apics
[i
];
462 if (apic_iter
->dest_mode
== 0xf) {
463 if (dest
& apic_iter
->log_dest
)
464 apic_set_bit(deliver_bitmask
, i
);
465 } else if (apic_iter
->dest_mode
== 0x0) {
466 if ((dest
& 0xf0) == (apic_iter
->log_dest
& 0xf0) &&
467 (dest
& apic_iter
->log_dest
& 0x0f)) {
468 apic_set_bit(deliver_bitmask
, i
);
478 static void apic_startup(APICCommonState
*s
, int vector_num
)
480 s
->sipi_vector
= vector_num
;
481 cpu_interrupt(CPU(s
->cpu
), CPU_INTERRUPT_SIPI
);
484 void apic_sipi(DeviceState
*dev
)
486 APICCommonState
*s
= APIC(dev
);
488 cpu_reset_interrupt(CPU(s
->cpu
), CPU_INTERRUPT_SIPI
);
490 if (!s
->wait_for_sipi
)
492 cpu_x86_load_seg_cache_sipi(s
->cpu
, s
->sipi_vector
);
493 s
->wait_for_sipi
= 0;
496 static void apic_deliver(DeviceState
*dev
, uint8_t dest
, uint8_t dest_mode
,
497 uint8_t delivery_mode
, uint8_t vector_num
,
498 uint8_t trigger_mode
)
500 APICCommonState
*s
= APIC(dev
);
501 uint32_t deliver_bitmask
[MAX_APIC_WORDS
];
502 int dest_shorthand
= (s
->icr
[0] >> 18) & 3;
503 APICCommonState
*apic_iter
;
505 switch (dest_shorthand
) {
507 apic_get_delivery_bitmask(deliver_bitmask
, dest
, dest_mode
);
510 memset(deliver_bitmask
, 0x00, sizeof(deliver_bitmask
));
511 apic_set_bit(deliver_bitmask
, s
->id
);
514 memset(deliver_bitmask
, 0xff, sizeof(deliver_bitmask
));
517 memset(deliver_bitmask
, 0xff, sizeof(deliver_bitmask
));
518 apic_reset_bit(deliver_bitmask
, s
->id
);
522 switch (delivery_mode
) {
525 int trig_mode
= (s
->icr
[0] >> 15) & 1;
526 int level
= (s
->icr
[0] >> 14) & 1;
527 if (level
== 0 && trig_mode
== 1) {
528 foreach_apic(apic_iter
, deliver_bitmask
,
529 apic_iter
->arb_id
= apic_iter
->id
);
536 foreach_apic(apic_iter
, deliver_bitmask
,
537 apic_startup(apic_iter
, vector_num
) );
541 apic_bus_deliver(deliver_bitmask
, delivery_mode
, vector_num
, trigger_mode
);
544 static bool apic_check_pic(APICCommonState
*s
)
546 DeviceState
*dev
= (DeviceState
*)s
;
548 if (!apic_accept_pic_intr(dev
) || !pic_get_output(isa_pic
)) {
551 apic_deliver_pic_intr(dev
, 1);
555 int apic_get_interrupt(DeviceState
*dev
)
557 APICCommonState
*s
= APIC(dev
);
560 /* if the APIC is installed or enabled, we let the 8259 handle the
564 if (!(s
->spurious_vec
& APIC_SV_ENABLE
))
567 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
568 intno
= apic_irq_pending(s
);
570 /* if there is an interrupt from the 8259, let the caller handle
571 * that first since ExtINT interrupts ignore the priority.
573 if (intno
== 0 || apic_check_pic(s
)) {
574 apic_sync_vapic(s
, SYNC_TO_VAPIC
);
576 } else if (intno
< 0) {
577 apic_sync_vapic(s
, SYNC_TO_VAPIC
);
578 return s
->spurious_vec
& 0xff;
580 apic_reset_bit(s
->irr
, intno
);
581 apic_set_bit(s
->isr
, intno
);
582 apic_sync_vapic(s
, SYNC_TO_VAPIC
);
589 int apic_accept_pic_intr(DeviceState
*dev
)
591 APICCommonState
*s
= APIC(dev
);
597 lvt0
= s
->lvt
[APIC_LVT_LINT0
];
599 if ((s
->apicbase
& MSR_IA32_APICBASE_ENABLE
) == 0 ||
600 (lvt0
& APIC_LVT_MASKED
) == 0)
606 static uint32_t apic_get_current_count(APICCommonState
*s
)
610 d
= (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL
) - s
->initial_count_load_time
) >>
612 if (s
->lvt
[APIC_LVT_TIMER
] & APIC_LVT_TIMER_PERIODIC
) {
614 val
= s
->initial_count
- (d
% ((uint64_t)s
->initial_count
+ 1));
616 if (d
>= s
->initial_count
)
619 val
= s
->initial_count
- d
;
624 static void apic_timer_update(APICCommonState
*s
, int64_t current_time
)
626 if (apic_next_timer(s
, current_time
)) {
627 timer_mod(s
->timer
, s
->next_time
);
633 static void apic_timer(void *opaque
)
635 APICCommonState
*s
= opaque
;
637 apic_local_deliver(s
, APIC_LVT_TIMER
);
638 apic_timer_update(s
, s
->next_time
);
641 static uint32_t apic_mem_readb(void *opaque
, hwaddr addr
)
646 static uint32_t apic_mem_readw(void *opaque
, hwaddr addr
)
651 static void apic_mem_writeb(void *opaque
, hwaddr addr
, uint32_t val
)
655 static void apic_mem_writew(void *opaque
, hwaddr addr
, uint32_t val
)
659 static uint32_t apic_mem_readl(void *opaque
, hwaddr addr
)
666 dev
= cpu_get_current_apic();
672 index
= (addr
>> 4) & 0xff;
677 case 0x03: /* version */
678 val
= s
->version
| ((APIC_LVT_NB
- 1) << 16);
681 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
682 if (apic_report_tpr_access
) {
683 cpu_report_tpr_access(&s
->cpu
->env
, TPR_ACCESS_READ
);
688 val
= apic_get_arb_pri(s
);
692 val
= apic_get_ppr(s
);
698 val
= s
->log_dest
<< 24;
701 val
= (s
->dest_mode
<< 28) | 0xfffffff;
704 val
= s
->spurious_vec
;
707 val
= s
->isr
[index
& 7];
710 val
= s
->tmr
[index
& 7];
713 val
= s
->irr
[index
& 7];
720 val
= s
->icr
[index
& 1];
723 val
= s
->lvt
[index
- 0x32];
726 val
= s
->initial_count
;
729 val
= apic_get_current_count(s
);
732 val
= s
->divide_conf
;
735 s
->esr
|= APIC_ESR_ILLEGAL_ADDRESS
;
739 trace_apic_mem_readl(addr
, val
);
743 static void apic_send_msi(MSIMessage
*msi
)
745 uint64_t addr
= msi
->address
;
746 uint32_t data
= msi
->data
;
747 uint8_t dest
= (addr
& MSI_ADDR_DEST_ID_MASK
) >> MSI_ADDR_DEST_ID_SHIFT
;
748 uint8_t vector
= (data
& MSI_DATA_VECTOR_MASK
) >> MSI_DATA_VECTOR_SHIFT
;
749 uint8_t dest_mode
= (addr
>> MSI_ADDR_DEST_MODE_SHIFT
) & 0x1;
750 uint8_t trigger_mode
= (data
>> MSI_DATA_TRIGGER_SHIFT
) & 0x1;
751 uint8_t delivery
= (data
>> MSI_DATA_DELIVERY_MODE_SHIFT
) & 0x7;
752 /* XXX: Ignore redirection hint. */
753 apic_deliver_irq(dest
, dest_mode
, delivery
, vector
, trigger_mode
);
756 static void apic_mem_writel(void *opaque
, hwaddr addr
, uint32_t val
)
760 int index
= (addr
>> 4) & 0xff;
761 if (addr
> 0xfff || !index
) {
762 /* MSI and MMIO APIC are at the same memory location,
763 * but actually not on the global bus: MSI is on PCI bus
764 * APIC is connected directly to the CPU.
765 * Mapping them on the global bus happens to work because
766 * MSI registers are reserved in APIC MMIO and vice versa. */
767 MSIMessage msi
= { .address
= addr
, .data
= val
};
772 dev
= cpu_get_current_apic();
778 trace_apic_mem_writel(addr
, val
);
787 if (apic_report_tpr_access
) {
788 cpu_report_tpr_access(&s
->cpu
->env
, TPR_ACCESS_WRITE
);
791 apic_sync_vapic(s
, SYNC_TO_VAPIC
);
801 s
->log_dest
= val
>> 24;
804 s
->dest_mode
= val
>> 28;
807 s
->spurious_vec
= val
& 0x1ff;
817 apic_deliver(dev
, (s
->icr
[1] >> 24) & 0xff, (s
->icr
[0] >> 11) & 1,
818 (s
->icr
[0] >> 8) & 7, (s
->icr
[0] & 0xff),
819 (s
->icr
[0] >> 15) & 1);
826 int n
= index
- 0x32;
828 if (n
== APIC_LVT_TIMER
) {
829 apic_timer_update(s
, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL
));
830 } else if (n
== APIC_LVT_LINT0
&& apic_check_pic(s
)) {
836 s
->initial_count
= val
;
837 s
->initial_count_load_time
= qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL
);
838 apic_timer_update(s
, s
->initial_count_load_time
);
845 s
->divide_conf
= val
& 0xb;
846 v
= (s
->divide_conf
& 3) | ((s
->divide_conf
>> 1) & 4);
847 s
->count_shift
= (v
+ 1) & 7;
851 s
->esr
|= APIC_ESR_ILLEGAL_ADDRESS
;
856 static void apic_pre_save(APICCommonState
*s
)
858 apic_sync_vapic(s
, SYNC_FROM_VAPIC
);
861 static void apic_post_load(APICCommonState
*s
)
863 if (s
->timer_expiry
!= -1) {
864 timer_mod(s
->timer
, s
->timer_expiry
);
870 static const MemoryRegionOps apic_io_ops
= {
872 .read
= { apic_mem_readb
, apic_mem_readw
, apic_mem_readl
, },
873 .write
= { apic_mem_writeb
, apic_mem_writew
, apic_mem_writel
, },
875 .endianness
= DEVICE_NATIVE_ENDIAN
,
878 static void apic_realize(DeviceState
*dev
, Error
**errp
)
880 APICCommonState
*s
= APIC(dev
);
882 if (s
->id
>= MAX_APICS
) {
883 error_setg(errp
, "%s initialization failed. APIC ID %d is invalid",
884 object_get_typename(OBJECT(dev
)), s
->id
);
888 memory_region_init_io(&s
->io_memory
, OBJECT(s
), &apic_io_ops
, s
, "apic-msi",
891 s
->timer
= timer_new_ns(QEMU_CLOCK_VIRTUAL
, apic_timer
, s
);
892 local_apics
[s
->id
] = s
;
894 msi_nonbroken
= true;
897 static void apic_unrealize(DeviceState
*dev
, Error
**errp
)
899 APICCommonState
*s
= APIC(dev
);
902 timer_free(s
->timer
);
903 local_apics
[s
->id
] = NULL
;
906 static void apic_class_init(ObjectClass
*klass
, void *data
)
908 APICCommonClass
*k
= APIC_COMMON_CLASS(klass
);
910 k
->realize
= apic_realize
;
911 k
->unrealize
= apic_unrealize
;
912 k
->set_base
= apic_set_base
;
913 k
->set_tpr
= apic_set_tpr
;
914 k
->get_tpr
= apic_get_tpr
;
915 k
->vapic_base_update
= apic_vapic_base_update
;
916 k
->external_nmi
= apic_external_nmi
;
917 k
->pre_save
= apic_pre_save
;
918 k
->post_load
= apic_post_load
;
919 k
->send_msi
= apic_send_msi
;
922 static const TypeInfo apic_info
= {
924 .instance_size
= sizeof(APICCommonState
),
925 .parent
= TYPE_APIC_COMMON
,
926 .class_init
= apic_class_init
,
929 static void apic_register_types(void)
931 type_register_static(&apic_info
);
934 type_init(apic_register_types
)