From patchwork Tue Jun 13 13:19:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 13278733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B74F4C7EE29 for ; Tue, 13 Jun 2023 13:21:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q93wQ-0000er-JR; Tue, 13 Jun 2023 09:20:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q93wK-0000c2-Jy for qemu-devel@nongnu.org; Tue, 13 Jun 2023 09:20:05 -0400 Received: from mga03.intel.com ([134.134.136.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q93wJ-0006qJ-1w for qemu-devel@nongnu.org; Tue, 13 Jun 2023 09:20:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686662403; x=1718198403; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B5kXUdZwwuuOfUtptKN/wWx9SMd2e3OQhNjQfBpYiqM=; b=Ch73WpI5DmhlWQon3TzUynZL49ltbFjLl6t4cb3YAQObrHpZbpuXapwA eiSbsm6Mm7n1znRbt7EuZ3blThU3fId9rhUizrn4p99AGCXx0kc1ptfMk S3SbeJWGkpmxJYcRdMUj/YVh2sDo23xeuyKmnLc/MVDz6vAbD4Kza32aU vKwihihFANeYFTXcjSuUkIcGzhD2YpwXy/hesjtLfWVaZ4VEbU7ckl5L2 H6hAF3cjmJgjbxImuJSGdy4DJUt6kyds94D5YUEDr+UhFD3nqiIIzkLwN Nim0EYE0i46qg71Ap43Xce9ktelInok2+swBiKLJMOz2ylFk/48Ia03eH w==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="361696825" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="361696825" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 06:19:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="744680355" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="744680355" Received: from lxy-clx-4s.sh.intel.com ([10.239.48.46]) by orsmga001.jf.intel.com with ESMTP; 13 Jun 2023 06:19:55 -0700 From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH v2 3/3] i386/cpuid: Move leaf 7 to correct group Date: Tue, 13 Jun 2023 09:19:29 -0400 Message-Id: <20230613131929.720453-4-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613131929.720453-1-xiaoyao.li@intel.com> References: <20230613131929.720453-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=134.134.136.65; envelope-from=xiaoyao.li@intel.com; helo=mga03.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org CPUID leaf 7 was grouped together with SGX leaf 0x12 by commit b9edbadefb9e ("i386: Propagate SGX CPUID sub-leafs to KVM") by mistake. SGX leaf 0x12 has its specific logic to check if subleaf (starting from 2) is valid or not by checking the bit 0:3 of corresponding EAX is 1 or not. Leaf 7 follows the logic that EAX of subleaf 0 enumerates the maximum valid subleaf. Fixes: b9edbadefb9e ("i386: Propagate SGX CPUID sub-leafs to KVM") Signed-off-by: Xiaoyao Li Reviewed-by:Yang Weijiang --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index d7e235ce35a6..86aab9ca4ba2 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1993,7 +1993,6 @@ int kvm_arch_init_vcpu(CPUState *cs) c = &cpuid_data.entries[cpuid_i++]; } break; - case 0x7: case 0x12: for (j = 0; ; j++) { c->function = i; @@ -2013,6 +2012,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c = &cpuid_data.entries[cpuid_i++]; } break; + case 0x7: case 0x14: case 0x1d: case 0x1e: {