From patchwork Wed Sep 15 17:13:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Arcangeli X-Patchwork-Id: 64852 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 B64E4B6EEF for ; Thu, 16 Sep 2010 03:16:21 +1000 (EST) Received: from localhost ([127.0.0.1]:44077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ovvak-0007LG-MI for incoming@patchwork.ozlabs.org; Wed, 15 Sep 2010 13:16:18 -0400 Received: from [140.186.70.92] (port=34064 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvvYC-0006R0-83 for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:13:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvvYA-0008Mx-Lg for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:13:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33115) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvvYA-0008Mp-Cu for qemu-devel@nongnu.org; Wed, 15 Sep 2010 13:13:38 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8FHDbiQ006296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Sep 2010 13:13:37 -0400 Received: from random.random (ovpn-113-70.phx2.redhat.com [10.3.113.70]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8FHDaqk013307; Wed, 15 Sep 2010 13:13:36 -0400 Date: Wed, 15 Sep 2010 19:13:35 +0200 From: Andrea Arcangeli To: qemu-devel@nongnu.org Message-ID: <20100915171335.GM5981@random.random> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH] allow more than 1T in KVM x86 guest 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 Subject: allow more than 1T in KVM x86 guest From: Andrea Arcangeli When host supports 48 bits of physical address reflect that in the guest cpuid to allow the guest to use more than 1TB of RAM. The migration code should probably be updated accordingly checking if the size of the guest ram is bigger than the migration target cpuid 0x80000008 limit and failing migration in that case. (not a real practical issue, I don't see many people migrating >1T guests yet :) The comment below refers to a 42 bit limit on exec.c, but I didn't identify what the comment refers to yet. At least now guest should be able to use 4TB. Signed-off-by: Andrea Arcangeli diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index d63fdcb..462e709 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -1189,6 +1189,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, /* 64 bit processor */ /* XXX: The physical address space is limited to 42 bits in exec.c. */ *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */ + if (kvm_enabled()) { + uint32_t _eax; + host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL); + if (_eax >= 0x80000008) + host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL); + } } else { if (env->cpuid_features & CPUID_PSE36) *eax = 0x00000024; /* 36 bits physical */