aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-05-05 08:51:47 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-05-07 10:05:34 -0400
commita520996ae2e2792e1f90b74e67c974120c8a3b83 (patch)
treef853e587a26c19707e797e967a8003a24fe544a5 /arch
parent7f1fc268c47491fd5e63548f6415fc8604e13003 (diff)
xen/vcpu: Document the xen_vcpu_info and xen_vcpu
They are important structures and it is not clear at first look what they are for. The xen_vcpu is a pointer. By default it points to the shared_info structure (at the CPU offset location). However if the VCPUOP_register_vcpu_info hypercall is implemented we can make the xen_vcpu pointer point to a per-CPU location. Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> [v1: Added comments from Ian Campbell] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/enlighten.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 94a81f41e8a2..a2babdb13a26 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -85,7 +85,29 @@
85 85
86EXPORT_SYMBOL_GPL(hypercall_page); 86EXPORT_SYMBOL_GPL(hypercall_page);
87 87
88/*
89 * Pointer to the xen_vcpu_info structure or
90 * &HYPERVISOR_shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
91 * and xen_vcpu_setup for details. By default it points to share_info->vcpu_info
92 * but if the hypervisor supports VCPUOP_register_vcpu_info then it can point
93 * to xen_vcpu_info. The pointer is used in __xen_evtchn_do_upcall to
94 * acknowledge pending events.
95 * Also more subtly it is used by the patched version of irq enable/disable
96 * e.g. xen_irq_enable_direct and xen_iret in PV mode.
97 *
98 * The desire to be able to do those mask/unmask operations as a single
99 * instruction by using the per-cpu offset held in %gs is the real reason
100 * vcpu info is in a per-cpu pointer and the original reason for this
101 * hypercall.
102 *
103 */
88DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); 104DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
105
106/*
107 * Per CPU pages used if hypervisor supports VCPUOP_register_vcpu_info
108 * hypercall. This can be used both in PV and PVHVM mode. The structure
109 * overrides the default per_cpu(xen_vcpu, cpu) value.
110 */
89DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); 111DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
90 112
91enum xen_domain_type xen_domain_type = XEN_NATIVE; 113enum xen_domain_type xen_domain_type = XEN_NATIVE;
@@ -187,7 +209,12 @@ static void xen_vcpu_setup(int cpu)
187 209
188 /* Check to see if the hypervisor will put the vcpu_info 210 /* Check to see if the hypervisor will put the vcpu_info
189 structure where we want it, which allows direct access via 211 structure where we want it, which allows direct access via
190 a percpu-variable. */ 212 a percpu-variable.
213 N.B. This hypercall can _only_ be called once per CPU. Subsequent
214 calls will error out with -EINVAL. This is due to the fact that
215 hypervisor has no unregister variant and this hypercall does not
216 allow to over-write info.mfn and info.offset.
217 */
191 err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info); 218 err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
192 219
193 if (err) { 220 if (err) {