From nobody Mon Feb 9 13:21:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1750995056; cv=none; d=zohomail.com; s=zohoarc; b=lA1cRE5V3/CXfJqRjGXfyySE9o+efCMGMsHs3aRGcw4l5bD4Ptq/9HfUWExBnvAk+411vpGGIosWRTyrLxcWeqlRe3hTS6B+1hwve/0Wxi6p1qNbvH5ir6Mhcl41IxtFcj8qUM9APEpLQDqaY7c1uo1lBX+AItmBoSMeBWxhM5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750995056; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ok0lXr/PjP8h0VI0YZnOxmy2AeOAO7wDKJKAvv0wyf8=; b=UJdbZd3UFnCHR4j3uOKkOHh66BAoz0+IaPpoQMGdjfhaaB3rCrUuBKLa4Y+90rRsICHiRl9wz+zqcXaeTIaAZiQVfO5YkkGTadJGMhPhncXkxdVFaNRqlpU7OGZS3ACk+SYPjQMHGpG97JM8oIs1Z5rVn+uWPpoMLHotLR5g5RA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750995056829112.87589247563972; Thu, 26 Jun 2025 20:30:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUznB-0002gl-EY; Thu, 26 Jun 2025 23:30:21 -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 1uUzn8-0002g3-Pv for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:18 -0400 Received: from mgamail.intel.com ([192.198.163.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUzn6-0007SZ-OU for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:18 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 20:30:15 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 26 Jun 2025 20:30:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750995017; x=1782531017; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aVTkAGWI/2ZaKLWpgm+xpYMqxlxfusnFITw89gyWokU=; b=RR1tVGNvklHe4lZRwtXMeAkdNeROlIdehCJmIyBqrSdJ4Pw9mlahN9sQ chi5mxEbc9DlCsiyS4ZHEbv2vpYfYrxbA7hgFuJ/yMDbzFEHdgG0Z2+N1 THbpo5ZJ6IYRKhIB1ntXSvt1cfuK+ddF/fwR5WNmwSDH6XpRxdZ2kOC1N /C5kXlbWlalNin2iUxsraEzHCyRn6OGugWHlBSO0S9U39Ms36OmtTXMp0 CBS9jTDyW+r2p/lVbcSqglH4jH9yHiUnZrVUwU9C6cFCAB8KLFEhGQwUo ZsX1oOn9X2ApCLQ1sChkUFPkeAjoDEBouV+ZO5OB5FkbvWK/dpXnd+c1S w==; X-CSE-ConnectionGUID: 6HbzFv/oQd6lAIRWzhq8fw== X-CSE-MsgGUID: 7ZJ/u1uuR8+zJCDuvXLpiA== X-IronPort-AV: E=McAfee;i="6800,10657,11476"; a="53247135" X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="53247135" X-CSE-ConnectionGUID: tmkYkKvMSgSoCJlVrioU+w== X-CSE-MsgGUID: WFO+GGajRPGIvOEnNJPuiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="157084629" From: Zhao Liu To: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Igor Mammedov Cc: Ewan Hai , Xiaoyao Li , Tao Su , Yi Lai , Dapeng Mi , qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 1/4] i386/cpu: Mark EBX/ECX/EDX in CPUID 0x80000000 leaf as reserved for Intel Date: Fri, 27 Jun 2025 11:51:26 +0800 Message-Id: <20250627035129.2755537-2-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250627035129.2755537-1-zhao1.liu@intel.com> References: <20250627035129.2755537-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.17; envelope-from=zhao1.liu@intel.com; helo=mgamail.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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1750995057313116600 Content-Type: text/plain; charset="utf-8" Per SDM, 80000000H EAX Maximum Input Value for Extended Function CPUID Information. EBX Reserved. ECX Reserved. EDX Reserved. EBX/ECX/EDX in CPUID 0x80000000 leaf are reserved. Intel is using 0x0 leaf to encode vendor. Signed-off-by: Zhao Liu Reviewed-by: Tao Su --- target/i386/cpu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c7f157a0f71c..867e08236540 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8280,9 +8280,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, break; case 0x80000000: *eax =3D env->cpuid_xlevel; - *ebx =3D env->cpuid_vendor1; - *edx =3D env->cpuid_vendor2; - *ecx =3D env->cpuid_vendor3; + + if (cpu->vendor_cpuid_only_v2 && IS_INTEL_CPU(env)) { + *ebx =3D *ecx =3D *edx =3D 0; + } else { + *ebx =3D env->cpuid_vendor1; + *edx =3D env->cpuid_vendor2; + *ecx =3D env->cpuid_vendor3; + } break; case 0x80000001: *eax =3D env->cpuid_version; --=20 2.34.1 From nobody Mon Feb 9 13:21:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1750995056; cv=none; d=zohomail.com; s=zohoarc; b=OuVMBpuPo1q4JQGofbQ/IIhQwCpN1wKYeNEvtg3le2SyvVacvXQmKOYI0ag5XmcBJSo+0dadZkFAe/+7Ev+cI8IPsf4SQ9gzo2P99sMwnEiKD00lNoS47b7hRqV10BNPPVxlHMvTkpum9Gt4k3PwTfHXtsqzqwsxVTizRzOvXBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750995056; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Hv82Y/31Qwmutx9ims8gDjD5vthSXm1H/1zSgGVKSkA=; b=Vnyu8AmVlq222W0AME5A50pROSoRQycNRJ7UZrmik0U1I1HCXnPQhnfx+TdA0Tfopg9VbhIQO7YwhFZyAPQTAZpkEcw5J2qSeSNAEDLRH6Wd88jozKwuh45xH80iXAslix4i9FtCdF7ILVIwG6VhCv5qwey3VnYes/e333QrdfM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750995056523492.9883199450435; Thu, 26 Jun 2025 20:30:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUznC-0002hA-VB; Thu, 26 Jun 2025 23:30:22 -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 1uUznB-0002gj-5K for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:21 -0400 Received: from mgamail.intel.com ([192.198.163.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUzn9-0007Kq-Iu for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:20 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 20:30:18 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 26 Jun 2025 20:30:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750995020; x=1782531020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vqumn9WyfeJIP89iUmDECJNuxthMp5H2k50wGBtggFg=; b=AHQeCeOywG82sbcFnruN5quMpi03ekoVHDoVLMVh05KgdHdAOdRw8btV ra2TnGlbOBLKs+UmOESX4m+/XxxfIniFXP6BlCx8vhCWv2rbKoYvy8Zoc EyMy6pSIoczkqsyFFamH59QD8ZJLS1+gH26ptk9xj1g3LdSBlmjASKjSQ Imk61rgHQXOOY6mzsO4yj/hrvSxJs/dG9wRFpCTvOcPoxD8TNr2QziHjs lkvmAUYQzn14J7pjyGcGg/l9iETLBqe0r7efxGBj8w7WaP/owGYMfu2bz SEZFBfWlS9WZCPKnVP6I8cb2X/P4jh0JiMU8vNxSVqIS03/9RLVYQI6o7 w==; X-CSE-ConnectionGUID: +Ns6FmY7REu31GF+sdq+Rg== X-CSE-MsgGUID: jTLAGG3aQkGGZV2ldaXY2w== X-IronPort-AV: E=McAfee;i="6800,10657,11476"; a="53247139" X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="53247139" X-CSE-ConnectionGUID: qt+G+2++SoChamGiwrMUhg== X-CSE-MsgGUID: bRaS3BYaSi2tHxhCpuRb7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="157084643" From: Zhao Liu To: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Igor Mammedov Cc: Ewan Hai , Xiaoyao Li , Tao Su , Yi Lai , Dapeng Mi , qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 2/4] i386/cpu: Mark CPUID 0x80000007[EBX] as reserved for Intel Date: Fri, 27 Jun 2025 11:51:27 +0800 Message-Id: <20250627035129.2755537-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250627035129.2755537-1-zhao1.liu@intel.com> References: <20250627035129.2755537-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.17; envelope-from=zhao1.liu@intel.com; helo=mgamail.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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1750995057336116600 Content-Type: text/plain; charset="utf-8" Per SDM, 80000007H EAX Reserved =3D 0. EBX Reserved =3D 0. ECX Reserved =3D 0. EDX Bits 07-00: Reserved =3D 0. Bit 08: Invariant TSC available if 1. Bits 31-09: Reserved =3D 0. EAX/EBX/ECX in CPUID 0x80000007 leaf are reserved for Intel. At present, EAX is reserved for AMD, too. And AMD hasn't used ECX in QEMU. So these 2 registers are both left as 0. Therefore, only fix the EBX and excode it as 0 for Intel. Signed-off-by: Zhao Liu Reviewed-by: Tao Su --- target/i386/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 867e08236540..6d590a9af389 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8374,7 +8374,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, } case 0x80000007: *eax =3D 0; - *ebx =3D env->features[FEAT_8000_0007_EBX]; + if (cpu->vendor_cpuid_only_v2 && IS_INTEL_CPU(env)) { + *ebx =3D 0; + } else { + *ebx =3D env->features[FEAT_8000_0007_EBX]; + } *ecx =3D 0; *edx =3D env->features[FEAT_8000_0007_EDX]; break; --=20 2.34.1 From nobody Mon Feb 9 13:21:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1750995049; cv=none; d=zohomail.com; s=zohoarc; b=kue+d8BZqqIIFrWl0LeMR/IeAAm+F2BEOE7/5z1Oh2JWMvhByIa60gZk9GRqUSoDoh6MSMEHDvJ5bgIvgmnTN8120TxIOGuhaaX9td4alBnjK8rQ31Y2/1cJYjV1YLCiDMMfvMD9r1iGADvSONcuh9yNchJU+aC5wH4vCmHXdIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750995049; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BmvKAErxXiTeANoMCAVCdHWDFU30N4YXC9mrsH3ctdk=; b=DaGr+t95A7wFrxfE+xFPq/exRPtxNQXlGQ13if8AT54as2qccb1PMuGeJSNxo1p1g62TBSYlRoOSE6kjH7I8mVgShYWsYGBg7JU8L8txLPaKa/sy3ASe3W9koY793DkLEzWtN7IFFYtOrhz5QancFj17HTRpOuLh5j5nW1OkZhk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750995049118434.3186288732725; Thu, 26 Jun 2025 20:30:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUznF-0002hf-3G; Thu, 26 Jun 2025 23:30:25 -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 1uUznD-0002hB-1L for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:23 -0400 Received: from mgamail.intel.com ([192.198.163.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUznB-0007SZ-7o for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:22 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 20:30:21 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 26 Jun 2025 20:30:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750995021; x=1782531021; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HFjv+JYT/dQV1XqLt+l9iUih2+5JEcR33IkcBKX4acQ=; b=BF7lq/qZXzyU8GmK9dI/FLLAEXcim/R1S6Pex9as6O0ZL/3yZdiZ+0rJ 9DC04lGTDxjNOhgT0jxD25i+Ts+1PqZy4gJbgBjF6OgXQpLIUEYNgNa1B FUviBYUGtMk2HTbCKXt7TMRrKBZizOfreM7RFayJR8USYKcXatY/0PPZ3 W6HkMu9OXSXdPLYX1iihg5cuU4r+H2lK/RGW44XRL4FFiA3fyXzp3p5z4 UE4CP17rZ83IB+jYywdbagdzGPsbHL+4UdUJlJ7Iq2qedpsZYrtUZWYeV NZTWgUSgDmj8bJ1qkoUsBThxSH32d89oq24Z7DCtS219YSjeXZ6KPjhSz g==; X-CSE-ConnectionGUID: gH0QzRaGT2yrFBAq5+2HVA== X-CSE-MsgGUID: 8L5b7MmMTOqUHbMQ6y+hhQ== X-IronPort-AV: E=McAfee;i="6800,10657,11476"; a="53247143" X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="53247143" X-CSE-ConnectionGUID: xvXrYM/tS2iJq06RpI25mQ== X-CSE-MsgGUID: RwRoOmpVT8SdbUuU6eQtYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="157084653" From: Zhao Liu To: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Igor Mammedov Cc: Ewan Hai , Xiaoyao Li , Tao Su , Yi Lai , Dapeng Mi , qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 3/4] i386/cpu: Mark ECX/EDX in CPUID 0x80000008 leaf as reserved for Intel Date: Fri, 27 Jun 2025 11:51:28 +0800 Message-Id: <20250627035129.2755537-4-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250627035129.2755537-1-zhao1.liu@intel.com> References: <20250627035129.2755537-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.17; envelope-from=zhao1.liu@intel.com; helo=mgamail.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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1750995052409116600 Content-Type: text/plain; charset="utf-8" Per SDM, 80000008H EAX Linear/Physical Address size. Bits 07-00: #Physical Address Bits*. Bits 15-08: #Linear Address Bits. Bits 31-16: Reserved =3D 0. EBX Bits 08-00: Reserved =3D 0. Bit 09: WBNOINVD is available if 1. Bits 31-10: Reserved =3D 0. ECX Reserved =3D 0. EDX Reserved =3D 0. ECX/EDX in CPUID 0x80000008 leaf are reserved. Encode these 2 registers as 0 for Intel. Signed-off-by: Zhao Liu Reviewed-by: Tao Su --- target/i386/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6d590a9af389..5d5a227d4c8a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8391,6 +8391,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, *eax |=3D (cpu->guest_phys_bits << 16); } *ebx =3D env->features[FEAT_8000_0008_EBX]; + + if (cpu->vendor_cpuid_only_v2 && IS_INTEL_CPU(env)) { + *ecx =3D *edx =3D 0; + break; + } + if (threads_per_pkg > 1) { /* * Bits 15:12 is "The number of bits in the initial --=20 2.34.1 From nobody Mon Feb 9 13:21:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1750995085; cv=none; d=zohomail.com; s=zohoarc; b=icoEr03mCQ7Cnpo4ieU1J+n2xJCbFLpcC9CKkz0wBE9rBZER8JM6pOjH56ic6A45NFfnwE/bg7BZlDdN+Rn48621OfJZ6FARYvBa2HXMw1DTjhwOJ5EXiQKDt/gpb1cF5Q6OGznYshUvFs7vxzSvaDCUnhe0jRxsVvIVfE/YCGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750995085; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QAMRbSVovkDjSvQDhwE8vYGm5j25Dmoe9XmW6NXcY0c=; b=ZqzqZUs3ny65mdDeKIA4IR9UgW3kb/jN0A/rIOCR+TZuRrOQ6eP3qkAdtm0n4Glal8y9epbTgm3UEDDC/sxwnXoiU7Cx1vM+/3tO+JTTvmNXzZYUvGuKa2Jsu2yOLPe1HcuyGvyFgUY0rPMTlxbUhyHYY+8/Tg0N44ZH2nUXoAM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750995085895325.6009045887055; Thu, 26 Jun 2025 20:31:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUznK-0002ii-3G; Thu, 26 Jun 2025 23:30:30 -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 1uUznG-0002i3-Pq for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:26 -0400 Received: from mgamail.intel.com ([192.198.163.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUznE-0007Uq-Nt for qemu-devel@nongnu.org; Thu, 26 Jun 2025 23:30:26 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 20:30:23 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 26 Jun 2025 20:30:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750995025; x=1782531025; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HOHLAI5RhOkZcHb0DpFGdSaVgH4ihzFmplldEQusHAo=; b=M3vIkiCx6D0U5iGlROuBCWvc7Zn428ECWB21idyrBxFXss1+eIphRa6w UEjB25b7pXSywFNG5oW/mqq1qcew/KgRSXYSQCknzz5ZRpS3bFCc4FveT QtTxzgirieUEZ8MEoPhDe7S7A+Xn6HayvwJYqlYoHxNuUhqWqvsha6wyN id8FsFIf1faFI/1Q41eZDLXFEKU9SUMK4FRZtYcEKZ7/fZMFswCFz5yoN jN7sb0OiHerIWChMt1Bh8mmC7ax0zyHATDn4rc4YZQDHHzw2V/Sq2BRGU ZIG8oHQzPKppSlAExWz9KFaUnVH/IyBPiEDDXCiLFfejbEwIPfwx8/UCG g==; X-CSE-ConnectionGUID: APqy9T7nSO61pZwZKDRHxA== X-CSE-MsgGUID: NCzrYM8vRlKx3ELTPSAmKQ== X-IronPort-AV: E=McAfee;i="6800,10657,11476"; a="53247146" X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="53247146" X-CSE-ConnectionGUID: ygSOAq+HS/mOg7y5gPINfA== X-CSE-MsgGUID: 1YPQI+KvS/+bdvb046Yuwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,269,1744095600"; d="scan'208";a="157084660" From: Zhao Liu To: Paolo Bonzini , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Igor Mammedov Cc: Ewan Hai , Xiaoyao Li , Tao Su , Yi Lai , Dapeng Mi , qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 4/4] i386/cpu: Reorder CPUID leaves in cpu_x86_cpuid() Date: Fri, 27 Jun 2025 11:51:29 +0800 Message-Id: <20250627035129.2755537-5-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250627035129.2755537-1-zhao1.liu@intel.com> References: <20250627035129.2755537-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.17; envelope-from=zhao1.liu@intel.com; helo=mgamail.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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1750995087596116600 Content-Type: text/plain; charset="utf-8" Sort the CPUID leaves strictly by index to facilitate checking and changing. Signed-off-by: Zhao Liu Reviewed-by: Tao Su --- target/i386/cpu.c | 60 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5d5a227d4c8a..18bb0e9cf9f6 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8052,21 +8052,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, assert(!(*eax & ~0x1f)); *ebx &=3D 0xffff; /* The count doesn't need to be reliable. */ break; - case 0x1C: - if (cpu->enable_pmu && (env->features[FEAT_7_0_EDX] & CPUID_7_0_ED= X_ARCH_LBR)) { - x86_cpu_get_supported_cpuid(0x1C, 0, eax, ebx, ecx, edx); - *edx =3D 0; - } - break; - case 0x1F: - /* V2 Extended Topology Enumeration Leaf */ - if (!x86_has_cpuid_0x1f(cpu)) { - *eax =3D *ebx =3D *ecx =3D *edx =3D 0; - break; - } - - encode_topo_cpuid1f(env, count, topo_info, eax, ebx, ecx, edx); - break; case 0xD: { /* Processor Extended State */ *eax =3D 0; @@ -8207,6 +8192,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, } break; } + case 0x1C: + if (cpu->enable_pmu && (env->features[FEAT_7_0_EDX] & CPUID_7_0_ED= X_ARCH_LBR)) { + x86_cpu_get_supported_cpuid(0x1C, 0, eax, ebx, ecx, edx); + *edx =3D 0; + } + break; case 0x1D: { /* AMX TILE, for now hardcoded for Sapphire Rapids*/ *eax =3D 0; @@ -8244,6 +8235,15 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, } break; } + case 0x1F: + /* V2 Extended Topology Enumeration Leaf */ + if (!x86_has_cpuid_0x1f(cpu)) { + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + break; + } + + encode_topo_cpuid1f(env, count, topo_info, eax, ebx, ecx, edx); + break; case 0x24: { *eax =3D 0; *ebx =3D 0; @@ -8465,6 +8465,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, *edx =3D 0; } break; + case 0x8000001F: + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + if (sev_enabled()) { + *eax =3D 0x2; + *eax |=3D sev_es_enabled() ? 0x8 : 0; + *eax |=3D sev_snp_enabled() ? 0x10 : 0; + *ebx =3D sev_get_cbit_position() & 0x3f; /* EBX[5:0] */ + *ebx |=3D (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11= :6] */ + } + break; + case 0x80000021: + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + *eax =3D env->features[FEAT_8000_0021_EAX]; + *ebx =3D env->features[FEAT_8000_0021_EBX]; + break; case 0x80000022: *eax =3D *ebx =3D *ecx =3D *edx =3D 0; /* AMD Extended Performance Monitoring and Debug */ @@ -8497,21 +8512,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,= uint32_t count, *ecx =3D 0; *edx =3D 0; break; - case 0x8000001F: - *eax =3D *ebx =3D *ecx =3D *edx =3D 0; - if (sev_enabled()) { - *eax =3D 0x2; - *eax |=3D sev_es_enabled() ? 0x8 : 0; - *eax |=3D sev_snp_enabled() ? 0x10 : 0; - *ebx =3D sev_get_cbit_position() & 0x3f; /* EBX[5:0] */ - *ebx |=3D (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11= :6] */ - } - break; - case 0x80000021: - *eax =3D *ebx =3D *ecx =3D *edx =3D 0; - *eax =3D env->features[FEAT_8000_0021_EAX]; - *ebx =3D env->features[FEAT_8000_0021_EBX]; - break; default: /* reserved values: zero */ *eax =3D 0; --=20 2.34.1