From patchwork Mon Apr 26 17:59:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 50989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 26488B7D5B for ; Tue, 27 Apr 2010 04:17:03 +1000 (EST) Received: from localhost ([127.0.0.1]:58308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6SrP-0007HQ-MG for incoming@patchwork.ozlabs.org; Mon, 26 Apr 2010 14:16:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6Sbz-0006JB-DG for qemu-devel@nongnu.org; Mon, 26 Apr 2010 14:00:51 -0400 Received: from [140.186.70.92] (port=49311 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6Sbv-0006CY-QH for qemu-devel@nongnu.org; Mon, 26 Apr 2010 14:00:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6Sbj-0006xD-Jg for qemu-devel@nongnu.org; Mon, 26 Apr 2010 14:00:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34926) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6Sbj-0006wb-9A for qemu-devel@nongnu.org; Mon, 26 Apr 2010 14:00:35 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0XGv003338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Apr 2010 14:00:33 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0WFj026595; Mon, 26 Apr 2010 14:00:32 -0400 Received: from amt.cnet (vpn-8-113.rdu.redhat.com [10.11.8.113]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o3QI0U83006740; Mon, 26 Apr 2010 14:00:31 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id CF39F65606C; Mon, 26 Apr 2010 15:00:06 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o3QI03cx023714; Mon, 26 Apr 2010 15:00:03 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 26 Apr 2010 14:59:00 -0300 Message-Id: <204204308b011d5fe494970255b318ec444d1d45.1272304746.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Avi Kivity , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Sheng Yang Subject: [Qemu-devel] [PATCH 04/10] kvm: allow qemu to set EPT identity mapping address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Sheng Yang 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 Signed-off-by: Avi Kivity --- target-i386/kvm.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index bb6dafa..f73b47b 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)