aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2010-03-23 13:37:12 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2010-04-26 11:28:35 -0300
commit204204308b011d5fe494970255b318ec444d1d45 (patch)
tree04364fcb52887821dd5416188e61de2d7527b570 /target-i386
parent7c80eef899ff0feb1ab6730d4dd3bc3aee046093 (diff)
kvm: allow qemu to set EPT identity mapping address
If we use larger BIOS image than current 256KB, we would need move reserved TSS and EPT identity mapping pages. Currently TSS support this, but not EPT. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/kvm.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index bb6dafab33..f73b47b97c 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -326,6 +326,25 @@ static int kvm_has_msr_star(CPUState *env)
return 0;
}
+static int kvm_init_identity_map_page(KVMState *s)
+{
+#ifdef KVM_CAP_SET_IDENTITY_MAP_ADDR
+ int ret;
+ uint64_t addr = 0xfffbc000;
+
+ if (!kvm_check_extension(s, KVM_CAP_SET_IDENTITY_MAP_ADDR)) {
+ return 0;
+ }
+
+ ret = kvm_vm_ioctl(s, KVM_SET_IDENTITY_MAP_ADDR, &addr);
+ if (ret < 0) {
+ fprintf(stderr, "kvm_set_identity_map_addr: %s\n", strerror(ret));
+ return ret;
+ }
+#endif
+ return 0;
+}
+
int kvm_arch_init(KVMState *s, int smp_cpus)
{
int ret;
@@ -353,7 +372,12 @@ int kvm_arch_init(KVMState *s, int smp_cpus)
perror("e820_add_entry() table is full");
exit(1);
}
- return kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);
+ ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);
+ if (ret < 0) {
+ return ret;
+ }
+
+ return kvm_init_identity_map_page(s);
}
static void set_v8086_seg(struct kvm_segment *lhs, const SegmentCache *rhs)