All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 3/3] kvm: allow qemu to set EPT identity mapping address
Date: Mon, 08 Mar 2010 22:53:46 -0300	[thread overview]
Message-ID: <20100309015644.272624611@redhat.com> (raw)
In-Reply-To: 20100309015343.901738854@redhat.com

[-- Attachment #1: identity-map --]
[-- Type: text/plain, Size: 1449 bytes --]

From: Sheng Yang <sheng@linux.intel.com>

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>

Index: qemu-kvm/target-i386/kvm.c
===================================================================
--- qemu-kvm.orig/target-i386/kvm.c
+++ qemu-kvm/target-i386/kvm.c
@@ -341,6 +341,24 @@ static int kvm_has_msr_star(CPUState *en
     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;
@@ -368,7 +386,11 @@ int kvm_arch_init(KVMState *s, int smp_c
         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)



WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: [Qemu-devel] [patch 3/3] kvm: allow qemu to set EPT identity mapping address
Date: Mon, 08 Mar 2010 22:53:46 -0300	[thread overview]
Message-ID: <20100309015644.272624611@redhat.com> (raw)
In-Reply-To: 20100309015343.901738854@redhat.com

[-- Attachment #1: identity-map --]
[-- Type: text/plain, Size: 1447 bytes --]

From: Sheng Yang <sheng@linux.intel.com>

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>

Index: qemu-kvm/target-i386/kvm.c
===================================================================
--- qemu-kvm.orig/target-i386/kvm.c
+++ qemu-kvm/target-i386/kvm.c
@@ -341,6 +341,24 @@ static int kvm_has_msr_star(CPUState *en
     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;
@@ -368,7 +386,11 @@ int kvm_arch_init(KVMState *s, int smp_c
         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)

  parent reply	other threads:[~2010-03-09  1:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09  1:53 [patch 0/3] misc uq/master updates Marcelo Tosatti
2010-03-09  1:53 ` [Qemu-devel] " Marcelo Tosatti
2010-03-09  1:53 ` [patch 1/3] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
2010-03-09  1:53   ` [Qemu-devel] " Marcelo Tosatti
2010-03-11  8:35   ` Avi Kivity
2010-03-11  8:35     ` [Qemu-devel] " Avi Kivity
2010-03-11 18:53     ` Marcelo Tosatti
2010-03-11 18:53       ` [Qemu-devel] " Marcelo Tosatti
2010-03-14  7:36       ` Avi Kivity
2010-03-14  7:36         ` [Qemu-devel] " Avi Kivity
2010-03-09  1:53 ` [patch 2/3] kvm: handle internal error Marcelo Tosatti
2010-03-09  1:53   ` [Qemu-devel] " Marcelo Tosatti
2010-03-11  8:42   ` Avi Kivity
2010-03-11  8:42     ` [Qemu-devel] " Avi Kivity
2010-03-09  1:53 ` Marcelo Tosatti [this message]
2010-03-09  1:53   ` [Qemu-devel] [patch 3/3] kvm: allow qemu to set EPT identity mapping address Marcelo Tosatti
2010-03-11  8:42   ` Avi Kivity
2010-03-11  8:42     ` [Qemu-devel] " Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100309015644.272624611@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.