summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86.c
diff options
context:
space:
mode:
authorCarsten Otte2007-10-29 16:09:10 +0100
committerAvi Kivity2008-01-30 16:52:58 +0100
commit6866b83ed7240bf4a7c50836ee10f61c8534503f (patch)
treeca4ca86b554537998ff0ee7c78d00ea723c3f537 /drivers/kvm/x86.c
parentKVM: Portability: Move memory segmentation to x86.c (diff)
downloadkernel-qcow2-linux-6866b83ed7240bf4a7c50836ee10f61c8534503f.tar.gz
kernel-qcow2-linux-6866b83ed7240bf4a7c50836ee10f61c8534503f.tar.xz
kernel-qcow2-linux-6866b83ed7240bf4a7c50836ee10f61c8534503f.zip
KVM: Portability: move get/set_apic_base to x86.c
This patch moves the implementation of get_apic_base and set_apic_base from kvm_main.c to x86.c Signed-off-by: Carsten Otte <cotte@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86.c')
-rw-r--r--drivers/kvm/x86.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 5a959220410a..c26e3715bee8 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -59,6 +59,25 @@ unsigned long segment_base(u16 selector)
}
EXPORT_SYMBOL_GPL(segment_base);
+u64 kvm_get_apic_base(struct kvm_vcpu *vcpu)
+{
+ if (irqchip_in_kernel(vcpu->kvm))
+ return vcpu->apic_base;
+ else
+ return vcpu->apic_base;
+}
+EXPORT_SYMBOL_GPL(kvm_get_apic_base);
+
+void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data)
+{
+ /* TODO: reserve bits check */
+ if (irqchip_in_kernel(vcpu->kvm))
+ kvm_lapic_set_base(vcpu, data);
+ else
+ vcpu->apic_base = data;
+}
+EXPORT_SYMBOL_GPL(kvm_set_apic_base);
+
/*
* List of msr numbers which we expose to userspace through KVM_GET_MSRS
* and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.