diff options
Diffstat (limited to 'arch/x86/xen/apic.c')
-rw-r--r-- | arch/x86/xen/apic.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c new file mode 100644 index 000000000000..ec57bd3818a4 --- /dev/null +++ b/arch/x86/xen/apic.c | |||
@@ -0,0 +1,33 @@ | |||
1 | #include <linux/init.h> | ||
2 | |||
3 | #include <asm/x86_init.h> | ||
4 | #include <asm/apic.h> | ||
5 | #include <asm/xen/hypercall.h> | ||
6 | |||
7 | #include <xen/xen.h> | ||
8 | #include <xen/interface/physdev.h> | ||
9 | |||
10 | unsigned int xen_io_apic_read(unsigned apic, unsigned reg) | ||
11 | { | ||
12 | struct physdev_apic apic_op; | ||
13 | int ret; | ||
14 | |||
15 | apic_op.apic_physbase = mpc_ioapic_addr(apic); | ||
16 | apic_op.reg = reg; | ||
17 | ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op); | ||
18 | if (!ret) | ||
19 | return apic_op.value; | ||
20 | |||
21 | /* fallback to return an emulated IO_APIC values */ | ||
22 | if (reg == 0x1) | ||
23 | return 0x00170020; | ||
24 | else if (reg == 0x0) | ||
25 | return apic << 24; | ||
26 | |||
27 | return 0xfd; | ||
28 | } | ||
29 | |||
30 | void __init xen_init_apic(void) | ||
31 | { | ||
32 | x86_io_apic_ops.read = xen_io_apic_read; | ||
33 | } | ||