diff options
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/events.h | 7 | ||||
-rw-r--r-- | include/xen/grant_table.h | 4 | ||||
-rw-r--r-- | include/xen/hvm.h | 30 | ||||
-rw-r--r-- | include/xen/interface/features.h | 6 | ||||
-rw-r--r-- | include/xen/interface/grant_table.h | 1 | ||||
-rw-r--r-- | include/xen/interface/hvm/hvm_op.h | 46 | ||||
-rw-r--r-- | include/xen/interface/hvm/params.h | 95 | ||||
-rw-r--r-- | include/xen/platform_pci.h | 49 | ||||
-rw-r--r-- | include/xen/xen-ops.h | 3 |
9 files changed, 241 insertions, 0 deletions
diff --git a/include/xen/events.h b/include/xen/events.h index e68d59a90ca8..a15d93262e30 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -56,4 +56,11 @@ void xen_poll_irq(int irq); | |||
56 | /* Determine the IRQ which is bound to an event channel */ | 56 | /* Determine the IRQ which is bound to an event channel */ |
57 | unsigned irq_from_evtchn(unsigned int evtchn); | 57 | unsigned irq_from_evtchn(unsigned int evtchn); |
58 | 58 | ||
59 | /* Xen HVM evtchn vector callback */ | ||
60 | extern void xen_hvm_callback_vector(void); | ||
61 | extern int xen_have_vector_callback; | ||
62 | int xen_set_callback_via(uint64_t via); | ||
63 | void xen_evtchn_do_upcall(struct pt_regs *regs); | ||
64 | void xen_hvm_evtchn_do_upcall(void); | ||
65 | |||
59 | #endif /* _XEN_EVENTS_H */ | 66 | #endif /* _XEN_EVENTS_H */ |
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index a40f1cd91be1..9a731706a016 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h | |||
@@ -51,6 +51,7 @@ struct gnttab_free_callback { | |||
51 | u16 count; | 51 | u16 count; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | int gnttab_init(void); | ||
54 | int gnttab_suspend(void); | 55 | int gnttab_suspend(void); |
55 | int gnttab_resume(void); | 56 | int gnttab_resume(void); |
56 | 57 | ||
@@ -112,6 +113,9 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | |||
112 | void arch_gnttab_unmap_shared(struct grant_entry *shared, | 113 | void arch_gnttab_unmap_shared(struct grant_entry *shared, |
113 | unsigned long nr_gframes); | 114 | unsigned long nr_gframes); |
114 | 115 | ||
116 | extern unsigned long xen_hvm_resume_frames; | ||
117 | unsigned int gnttab_max_grant_frames(void); | ||
118 | |||
115 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) | 119 | #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) |
116 | 120 | ||
117 | #endif /* __ASM_GNTTAB_H__ */ | 121 | #endif /* __ASM_GNTTAB_H__ */ |
diff --git a/include/xen/hvm.h b/include/xen/hvm.h new file mode 100644 index 000000000000..b193fa2f9fdd --- /dev/null +++ b/include/xen/hvm.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* Simple wrappers around HVM functions */ | ||
2 | #ifndef XEN_HVM_H__ | ||
3 | #define XEN_HVM_H__ | ||
4 | |||
5 | #include <xen/interface/hvm/params.h> | ||
6 | #include <asm/xen/hypercall.h> | ||
7 | |||
8 | static inline int hvm_get_parameter(int idx, uint64_t *value) | ||
9 | { | ||
10 | struct xen_hvm_param xhv; | ||
11 | int r; | ||
12 | |||
13 | xhv.domid = DOMID_SELF; | ||
14 | xhv.index = idx; | ||
15 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); | ||
16 | if (r < 0) { | ||
17 | printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n", | ||
18 | idx, r); | ||
19 | return r; | ||
20 | } | ||
21 | *value = xhv.value; | ||
22 | return r; | ||
23 | } | ||
24 | |||
25 | #define HVM_CALLBACK_VIA_TYPE_VECTOR 0x2 | ||
26 | #define HVM_CALLBACK_VIA_TYPE_SHIFT 56 | ||
27 | #define HVM_CALLBACK_VECTOR(x) (((uint64_t)HVM_CALLBACK_VIA_TYPE_VECTOR)<<\ | ||
28 | HVM_CALLBACK_VIA_TYPE_SHIFT | (x)) | ||
29 | |||
30 | #endif /* XEN_HVM_H__ */ | ||
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index f51b6413b054..70d2563ab166 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h | |||
@@ -41,6 +41,12 @@ | |||
41 | /* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ | 41 | /* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ |
42 | #define XENFEAT_mmu_pt_update_preserve_ad 5 | 42 | #define XENFEAT_mmu_pt_update_preserve_ad 5 |
43 | 43 | ||
44 | /* x86: Does this Xen host support the HVM callback vector type? */ | ||
45 | #define XENFEAT_hvm_callback_vector 8 | ||
46 | |||
47 | /* x86: pvclock algorithm is safe to use on HVM */ | ||
48 | #define XENFEAT_hvm_safe_pvclock 9 | ||
49 | |||
44 | #define XENFEAT_NR_SUBMAPS 1 | 50 | #define XENFEAT_NR_SUBMAPS 1 |
45 | 51 | ||
46 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ | 52 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ |
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h index 39da93c21de0..39e571796e32 100644 --- a/include/xen/interface/grant_table.h +++ b/include/xen/interface/grant_table.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #ifndef __XEN_PUBLIC_GRANT_TABLE_H__ | 28 | #ifndef __XEN_PUBLIC_GRANT_TABLE_H__ |
29 | #define __XEN_PUBLIC_GRANT_TABLE_H__ | 29 | #define __XEN_PUBLIC_GRANT_TABLE_H__ |
30 | 30 | ||
31 | #include <xen/interface/xen.h> | ||
31 | 32 | ||
32 | /*********************************** | 33 | /*********************************** |
33 | * GRANT TABLE REPRESENTATION | 34 | * GRANT TABLE REPRESENTATION |
diff --git a/include/xen/interface/hvm/hvm_op.h b/include/xen/interface/hvm/hvm_op.h new file mode 100644 index 000000000000..a4827f46ee97 --- /dev/null +++ b/include/xen/interface/hvm/hvm_op.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
3 | * of this software and associated documentation files (the "Software"), to | ||
4 | * deal in the Software without restriction, including without limitation the | ||
5 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
6 | * sell copies of the Software, and to permit persons to whom the Software is | ||
7 | * furnished to do so, subject to the following conditions: | ||
8 | * | ||
9 | * The above copyright notice and this permission notice shall be included in | ||
10 | * all copies or substantial portions of the Software. | ||
11 | * | ||
12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
13 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
15 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
18 | * DEALINGS IN THE SOFTWARE. | ||
19 | */ | ||
20 | |||
21 | #ifndef __XEN_PUBLIC_HVM_HVM_OP_H__ | ||
22 | #define __XEN_PUBLIC_HVM_HVM_OP_H__ | ||
23 | |||
24 | /* Get/set subcommands: the second argument of the hypercall is a | ||
25 | * pointer to a xen_hvm_param struct. */ | ||
26 | #define HVMOP_set_param 0 | ||
27 | #define HVMOP_get_param 1 | ||
28 | struct xen_hvm_param { | ||
29 | domid_t domid; /* IN */ | ||
30 | uint32_t index; /* IN */ | ||
31 | uint64_t value; /* IN/OUT */ | ||
32 | }; | ||
33 | DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_param); | ||
34 | |||
35 | /* Hint from PV drivers for pagetable destruction. */ | ||
36 | #define HVMOP_pagetable_dying 9 | ||
37 | struct xen_hvm_pagetable_dying { | ||
38 | /* Domain with a pagetable about to be destroyed. */ | ||
39 | domid_t domid; | ||
40 | /* guest physical address of the toplevel pagetable dying */ | ||
41 | aligned_u64 gpa; | ||
42 | }; | ||
43 | typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t; | ||
44 | DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_pagetable_dying_t); | ||
45 | |||
46 | #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ | ||
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h new file mode 100644 index 000000000000..1888d8c157e6 --- /dev/null +++ b/include/xen/interface/hvm/params.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
3 | * of this software and associated documentation files (the "Software"), to | ||
4 | * deal in the Software without restriction, including without limitation the | ||
5 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
6 | * sell copies of the Software, and to permit persons to whom the Software is | ||
7 | * furnished to do so, subject to the following conditions: | ||
8 | * | ||
9 | * The above copyright notice and this permission notice shall be included in | ||
10 | * all copies or substantial portions of the Software. | ||
11 | * | ||
12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
13 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
15 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
18 | * DEALINGS IN THE SOFTWARE. | ||
19 | */ | ||
20 | |||
21 | #ifndef __XEN_PUBLIC_HVM_PARAMS_H__ | ||
22 | #define __XEN_PUBLIC_HVM_PARAMS_H__ | ||
23 | |||
24 | #include "hvm_op.h" | ||
25 | |||
26 | /* | ||
27 | * Parameter space for HVMOP_{set,get}_param. | ||
28 | */ | ||
29 | |||
30 | /* | ||
31 | * How should CPU0 event-channel notifications be delivered? | ||
32 | * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt). | ||
33 | * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows: | ||
34 | * Domain = val[47:32], Bus = val[31:16], | ||
35 | * DevFn = val[15: 8], IntX = val[ 1: 0] | ||
36 | * val[63:56] == 2: val[7:0] is a vector number. | ||
37 | * If val == 0 then CPU0 event-channel notifications are not delivered. | ||
38 | */ | ||
39 | #define HVM_PARAM_CALLBACK_IRQ 0 | ||
40 | |||
41 | #define HVM_PARAM_STORE_PFN 1 | ||
42 | #define HVM_PARAM_STORE_EVTCHN 2 | ||
43 | |||
44 | #define HVM_PARAM_PAE_ENABLED 4 | ||
45 | |||
46 | #define HVM_PARAM_IOREQ_PFN 5 | ||
47 | |||
48 | #define HVM_PARAM_BUFIOREQ_PFN 6 | ||
49 | |||
50 | /* | ||
51 | * Set mode for virtual timers (currently x86 only): | ||
52 | * delay_for_missed_ticks (default): | ||
53 | * Do not advance a vcpu's time beyond the correct delivery time for | ||
54 | * interrupts that have been missed due to preemption. Deliver missed | ||
55 | * interrupts when the vcpu is rescheduled and advance the vcpu's virtual | ||
56 | * time stepwise for each one. | ||
57 | * no_delay_for_missed_ticks: | ||
58 | * As above, missed interrupts are delivered, but guest time always tracks | ||
59 | * wallclock (i.e., real) time while doing so. | ||
60 | * no_missed_ticks_pending: | ||
61 | * No missed interrupts are held pending. Instead, to ensure ticks are | ||
62 | * delivered at some non-zero rate, if we detect missed ticks then the | ||
63 | * internal tick alarm is not disabled if the VCPU is preempted during the | ||
64 | * next tick period. | ||
65 | * one_missed_tick_pending: | ||
66 | * Missed interrupts are collapsed together and delivered as one 'late tick'. | ||
67 | * Guest time always tracks wallclock (i.e., real) time. | ||
68 | */ | ||
69 | #define HVM_PARAM_TIMER_MODE 10 | ||
70 | #define HVMPTM_delay_for_missed_ticks 0 | ||
71 | #define HVMPTM_no_delay_for_missed_ticks 1 | ||
72 | #define HVMPTM_no_missed_ticks_pending 2 | ||
73 | #define HVMPTM_one_missed_tick_pending 3 | ||
74 | |||
75 | /* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */ | ||
76 | #define HVM_PARAM_HPET_ENABLED 11 | ||
77 | |||
78 | /* Identity-map page directory used by Intel EPT when CR0.PG=0. */ | ||
79 | #define HVM_PARAM_IDENT_PT 12 | ||
80 | |||
81 | /* Device Model domain, defaults to 0. */ | ||
82 | #define HVM_PARAM_DM_DOMAIN 13 | ||
83 | |||
84 | /* ACPI S state: currently support S0 and S3 on x86. */ | ||
85 | #define HVM_PARAM_ACPI_S_STATE 14 | ||
86 | |||
87 | /* TSS used on Intel when CR0.PE=0. */ | ||
88 | #define HVM_PARAM_VM86_TSS 15 | ||
89 | |||
90 | /* Boolean: Enable aligning all periodic vpts to reduce interrupts */ | ||
91 | #define HVM_PARAM_VPT_ALIGN 16 | ||
92 | |||
93 | #define HVM_NR_PARAMS 17 | ||
94 | |||
95 | #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ | ||
diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h new file mode 100644 index 000000000000..ce9d671c636c --- /dev/null +++ b/include/xen/platform_pci.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _XEN_PLATFORM_PCI_H | ||
2 | #define _XEN_PLATFORM_PCI_H | ||
3 | |||
4 | #define XEN_IOPORT_MAGIC_VAL 0x49d2 | ||
5 | #define XEN_IOPORT_LINUX_PRODNUM 0x0003 | ||
6 | #define XEN_IOPORT_LINUX_DRVVER 0x0001 | ||
7 | |||
8 | #define XEN_IOPORT_BASE 0x10 | ||
9 | |||
10 | #define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */ | ||
11 | #define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0) /* 2 byte access (R) */ | ||
12 | #define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0) /* 2 byte access (W) */ | ||
13 | #define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0) /* 4 byte access (W) */ | ||
14 | |||
15 | #define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2) /* 1 byte access (W) */ | ||
16 | #define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2) /* 1 byte access (R) */ | ||
17 | #define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2) /* 2 byte access (W) */ | ||
18 | |||
19 | #define XEN_UNPLUG_ALL_IDE_DISKS 1 | ||
20 | #define XEN_UNPLUG_ALL_NICS 2 | ||
21 | #define XEN_UNPLUG_AUX_IDE_DISKS 4 | ||
22 | #define XEN_UNPLUG_ALL 7 | ||
23 | #define XEN_UNPLUG_IGNORE 8 | ||
24 | |||
25 | static inline int xen_must_unplug_nics(void) { | ||
26 | #if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \ | ||
27 | defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \ | ||
28 | (defined(CONFIG_XEN_PLATFORM_PCI) || \ | ||
29 | defined(CONFIG_XEN_PLATFORM_PCI_MODULE)) | ||
30 | return 1; | ||
31 | #else | ||
32 | return 0; | ||
33 | #endif | ||
34 | } | ||
35 | |||
36 | static inline int xen_must_unplug_disks(void) { | ||
37 | #if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \ | ||
38 | defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \ | ||
39 | (defined(CONFIG_XEN_PLATFORM_PCI) || \ | ||
40 | defined(CONFIG_XEN_PLATFORM_PCI_MODULE)) | ||
41 | return 1; | ||
42 | #else | ||
43 | return 0; | ||
44 | #endif | ||
45 | } | ||
46 | |||
47 | extern int xen_platform_pci_unplug; | ||
48 | |||
49 | #endif /* _XEN_PLATFORM_PCI_H */ | ||
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index d789c937c48a..351f4051f6d8 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
@@ -7,6 +7,7 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); | |||
7 | 7 | ||
8 | void xen_pre_suspend(void); | 8 | void xen_pre_suspend(void); |
9 | void xen_post_suspend(int suspend_cancelled); | 9 | void xen_post_suspend(int suspend_cancelled); |
10 | void xen_hvm_post_suspend(int suspend_cancelled); | ||
10 | 11 | ||
11 | void xen_mm_pin_all(void); | 12 | void xen_mm_pin_all(void); |
12 | void xen_mm_unpin_all(void); | 13 | void xen_mm_unpin_all(void); |
@@ -14,6 +15,8 @@ void xen_mm_unpin_all(void); | |||
14 | void xen_timer_resume(void); | 15 | void xen_timer_resume(void); |
15 | void xen_arch_resume(void); | 16 | void xen_arch_resume(void); |
16 | 17 | ||
18 | int xen_setup_shutdown_event(void); | ||
19 | |||
17 | extern unsigned long *xen_contiguous_bitmap; | 20 | extern unsigned long *xen_contiguous_bitmap; |
18 | int xen_create_contiguous_region(unsigned long vstart, unsigned int order, | 21 | int xen_create_contiguous_region(unsigned long vstart, unsigned int order, |
19 | unsigned int address_bits); | 22 | unsigned int address_bits); |