From patchwork Wed Jan 13 09:04:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang, Weijiang" X-Patchwork-Id: 12016117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00091C433DB for ; Wed, 13 Jan 2021 08:54:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 499A923370 for ; Wed, 13 Jan 2021 08:54:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 499A923370 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzbus-0003bC-1P for qemu-devel@archiver.kernel.org; Wed, 13 Jan 2021 03:54:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzbtv-00035b-DN for qemu-devel@nongnu.org; Wed, 13 Jan 2021 03:53:11 -0500 Received: from mga12.intel.com ([192.55.52.136]:53910) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzbtr-00018S-51 for qemu-devel@nongnu.org; Wed, 13 Jan 2021 03:53:10 -0500 IronPort-SDR: QwdA5+FA1KdXGtndSN5OtU4Cbu5NIgTUR9zFbgek6tJiPIDz55QKPUsv/NNN6ZRQd7OamIV1yH Aj1ntDQJHILA== X-IronPort-AV: E=McAfee;i="6000,8403,9862"; a="157354959" X-IronPort-AV: E=Sophos;i="5.79,343,1602572400"; d="scan'208";a="157354959" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2021 00:52:55 -0800 IronPort-SDR: Dil8UGQTUnmbJbsLCHCXj9VZV3/KuQEzPycjetEhIUr6DZ+m4aApgTG+myHysXkR6lQzYfAYwZ hICDGhBOJJNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,343,1602572400"; d="scan'208";a="381765972" Received: from local-michael-cet-test.sh.intel.com ([10.239.159.172]) by orsmga008.jf.intel.com with ESMTP; 13 Jan 2021 00:52:53 -0800 From: Yang Weijiang To: pbonzini@redhat.com, seanjc@google.com, qemu-devel@nongnu.org Subject: [Qemu-devel][PATCH] x86/cpu: Use max host physical address if -cpu max option is applied Date: Wed, 13 Jan 2021 17:04:30 +0800 Message-Id: <20210113090430.26394-1-weijiang.yang@intel.com> X-Mailer: git-send-email 2.17.2 Received-SPF: pass client-ip=192.55.52.136; envelope-from=weijiang.yang@intel.com; helo=mga12.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Weijiang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" QEMU option -cpu max(max_features) means "Enables all features supported by the accelerator in the current host", this looks true for all the features except guest max physical address width, so add this patch to enable it. Signed-off-by: Yang Weijiang Tested-by: Nathan Chancellor --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 35459a38bb..b5943406f7 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6673,7 +6673,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) warned = true; } - if (cpu->host_phys_bits) { + if (cpu->host_phys_bits || cpu->max_features) { /* The user asked for us to use the host physical bits */ cpu->phys_bits = host_phys_bits; if (cpu->host_phys_bits_limit &&