From patchwork Fri Nov 2 05:38:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hao, Xudong" X-Patchwork-Id: 196486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D304C2C035A for ; Fri, 2 Nov 2012 16:34:00 +1100 (EST) Received: from localhost ([::1]:37731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9tG-0003Bu-Ro for incoming@patchwork.ozlabs.org; Fri, 02 Nov 2012 01:33:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9t5-0003AX-TW for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU9t4-0003wE-Aw for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:47 -0400 Received: from mga09.intel.com ([134.134.136.24]:28144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU9t4-0003ub-5B for qemu-devel@nongnu.org; Fri, 02 Nov 2012 01:33:46 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 01 Nov 2012 22:33:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,696,1344236400"; d="scan'208";a="214290411" Received: from xhao-dev.sh.intel.com (HELO localhost.localdomain) ([10.239.48.48]) by orsmga001.jf.intel.com with ESMTP; 01 Nov 2012 22:33:42 -0700 From: Xudong Hao To: qemu-devel@nongnu.org Date: Fri, 2 Nov 2012 13:38:21 +0800 Message-Id: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> X-Mailer: git-send-email 1.5.5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Cc: Xudong Hao , avi@redhat.com, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 1/2] qemu-kvm/cpuid: fix a emulation of guest physical address space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For 64 bit processor, emulate 40 bits physical address if the host physical address space >= 40bits, else guest physical is same as host. Signed-off-by: Xudong Hao --- target-i386/cpu.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 423e009..3a78881 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1584,7 +1584,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, if (env->cpuid_ext2_features & CPUID_EXT2_LM) { /* 64 bit processor */ /* XXX: The physical address space is limited to 42 bits in exec.c. */ - *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */ +/* XXX: 40 bits physical if host physical address space >= 40 bits */ + uint32_t a, b, c, d; + host_cpuid(0x80000008, 0, &a, &b, &c, &d); + *eax = a < 0x00003028 ? a : 0x00003028; } else { if (env->cpuid_features & CPUID_PSE36) *eax = 0x00000024; /* 36 bits physical */