From nobody Sun Nov 24 08:20:35 2024 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=1723622703; cv=none; d=zohomail.com; s=zohoarc; b=VDJf/PBoA5UnrqPv3a/zV0YsuDdRjLOmBUT60BOD53WLJZSahNmgbmeRR5e69AYX35WwXBsPjbEAfeHJOrH5+Um90rpVwB/zf0qzhpz+77+BfPJdJGj5xs2Ero8nmF4NWXzcJueoolefhlyVZM8XKZ+yjkQ4mjM7EJnly/9wJl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622703; 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=abSW+ZK/k+jpA6nANLbhTRC7Abn/2XDG4qCt07k8M7I=; b=O1dS5vwrTdNh2ndygMUTAwEJQwrvOwNeVYtKMhBJ8EMyrcCgjLYMThV1da9eGg05fnPzPLvGQZs1WtaPDUOPv0jDi1auJIxKOmZ3bJcIYBxJXxL5uN02oqZ6rbqXRzziUNwD3EP1n5MlOCy9xjR2/IGuKs3RQd27XYTfHzQnY3k= 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 1723622703064263.6341385847161; Wed, 14 Aug 2024 01:05:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8xx-0002Jo-Ji; Wed, 14 Aug 2024 04:02:45 -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 1se8xu-0002Gu-Ge for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:02:42 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8xp-0007sc-EF for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:02:42 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:35 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622558; x=1755158558; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=95lVEX5CsBG7kTAIi2nQlw8g78ZvNp99dsAYOY0HpDo=; b=VIxXEF2dmN65l3Ift9jCWBlURN0XOtLWCb1bH0So7P9WxPoCdBWr7KvK rwgHNtvAiTWg7IeAYslnCRZHFVI3DJG9leIleQ3IoNsuvkYjZLAavMncV Z+otNFiu5zYonqyYZSiuBtfczO056hj/ZIGQ3r/KDXUKrpMilnyauXD6j MZwdfeNbkkHBPjtuVe+UfhSd03C6t+JX3TKXyT1E3fi3dMRk7JLssOwzu tBUJoOtKtV/WXKcGQHj55xDsGpAtjNIwKfPDRPmSM6tt+gwbZvVZ+ab9r Rijly0BVEGDSUs4/RRT7xYWivfIXd0azzXsAmta2HRV9F95AYbDGIxlBt Q==; X-CSE-ConnectionGUID: Ef9vSaLZTWKQc4921Oav3Q== X-CSE-MsgGUID: 95A1uGMvSz6TvzmPqpskag== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584456" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584456" X-CSE-ConnectionGUID: 8wOW06pLTcCnYg13vPkjNw== X-CSE-MsgGUID: NbBLo//tQNKuSM0CFGdwiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048943" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 1/9] i386/cpu: Don't construct a all-zero entry for CPUID[0xD 0x3f] Date: Wed, 14 Aug 2024 03:54:23 -0400 Message-Id: <20240814075431.339209-2-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622704293116600 Content-Type: text/plain; charset="utf-8" Currently, QEMU always constructs a all-zero CPUID entry for CPUID[0xD 0x3f]. It's meaningless to construct such a leaf as the end of leaf 0xD. Rework the logic of how subleaves of 0xD are constructed to get rid of such all-zero value of subleaf 0x3f. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 31f149c9902c..c168ff5691df 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1844,10 +1844,6 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *env, case 0xb: case 0xd: for (j =3D 0; ; j++) { - if (i =3D=3D 0xd && j =3D=3D 64) { - break; - } - c->function =3D i; c->flags =3D KVM_CPUID_FLAG_SIGNIFCANT_INDEX; c->index =3D j; @@ -1863,7 +1859,12 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *env, break; } if (i =3D=3D 0xd && c->eax =3D=3D 0) { - continue; + if (j < 63) { + continue; + } else { + cpuid_i--; + break; + } } if (cpuid_i =3D=3D KVM_MAX_CPUID_ENTRIES) { goto full; --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622650; cv=none; d=zohomail.com; s=zohoarc; b=jpt0obbrarypqzKK8DugvdKwav2iA40srK0/xCBDWxdaJvJJHEur4qpWJzKcLBEIXu571luORcwNGOVUnhVhqB9AJs4CRyJlRBvNLmdNURO/TSawgV38uCl9BMOQsSZ9sGsLGSQrw1q7mqFg3/zkXp0d1sI+A6CbUDCR3moNKZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622650; 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=9XT/R3x477uEMkxRGlZM1NwKmMjEG/BbxIH2A4FUr0w=; b=XID7kwieRQBFv5XBFLFDY1rOySgiLJYJUC0/v0WmbyxJFhRiLGd0qIWYMenp6e6lmlRsN1pWfyXxM+LvocO9+WhnGfLngWKsOn6aXZcv71O9/PtxPFudTtUMT81yID/9HpjXSUh5yIPANSD4Df3/72BZnniSMFMCSBTCv6S/gUI= 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 1723622650246787.7810810702125; Wed, 14 Aug 2024 01:04:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8xy-0002O6-Ss; Wed, 14 Aug 2024 04:02:46 -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 1se8xw-0002IR-1H for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:02:44 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8xq-0007sl-Ga for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:02:43 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:36 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622559; x=1755158559; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Cg5NURAi8EL/prAcQEbdCLOiFO5T+SW5x3k5dhQ2JYo=; b=YrW9Qk+HrYhr1beXXnTzb/ay5pcgEKslfmuuAuS64evROvHbosPeGhW/ Sz9Cx5STKjbKYMqMmEIeACystkfrkT0tSpc4vJHnbEW6HaAkaGePTa2Ab 3NwreCYKyzkfX+j3+D0Dmf0qM2Qd6x6v7BFACuc8Vwn7FF/nNrlaeL+8I IO0QYmiNLAMmUqSJUCI5/7CzkRmicqmOuGDQkYGDBbH9OvJQFmcsOzCmd u8G1TgoW8kd653F3TvFRS8TUDkHmOmNqeYLbxN8MMuNXsvLIHBqLVO1Lr 3bKuczDGYUzYe00ZtAFUldT6Or7fC5PqJ6xLElWvYVSlqjL6rVE2wz0GF g==; X-CSE-ConnectionGUID: NOtlfraCRcuM7cZBVF8zFw== X-CSE-MsgGUID: Er4RBYmiTom9WbQAK972qw== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584468" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584468" X-CSE-ConnectionGUID: MkQ/j6iMStqhvnomGk60Ew== X-CSE-MsgGUID: m4F72zKTRqiPog9YBMx+XQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048946" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 2/9] i386/cpu: Enable fdp-excptn-only and zero-fcs-fds Date: Wed, 14 Aug 2024 03:54:24 -0400 Message-Id: <20240814075431.339209-3-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622652107116600 Content-Type: text/plain; charset="utf-8" - CPUID.(EAX=3D07H,ECX=3D0H):EBX[bit 6]: x87 FPU Data Pointer updated only on x87 exceptions if 1. - CPUID.(EAX=3D07H,ECX=3D0H):EBX[bit 13]: Deprecates FPU CS and FPU DS values if 1. i.e., X87 FCS and FDS are always zero. Define names for them so that they can be exposed to guest with -cpu host. Also define the bit field MACROs so that named cpu models can add it as well in the future. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 85ef7452c04e..e60d9dd58b60 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1054,9 +1054,9 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { .type =3D CPUID_FEATURE_WORD, .feat_names =3D { "fsgsbase", "tsc-adjust", "sgx", "bmi1", - "hle", "avx2", NULL, "smep", + "hle", "avx2", "fdp-excptn-only", "smep", "bmi2", "erms", "invpcid", "rtm", - NULL, NULL, "mpx", NULL, + NULL, "zero-fcs-fds", "mpx", NULL, "avx512f", "avx512dq", "rdseed", "adx", "smap", "avx512ifma", "pcommit", "clflushopt", "clwb", "intel-pt", "avx512pf", "avx512er", diff --git a/target/i386/cpu.h b/target/i386/cpu.h index c6cc035df3d8..542512f65dec 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -826,6 +826,8 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu= , FeatureWord w); #define CPUID_7_0_EBX_HLE (1U << 4) /* Intel Advanced Vector Extensions 2 */ #define CPUID_7_0_EBX_AVX2 (1U << 5) +/* FPU data pointer updated only on x87 exceptions */ +#define CPUID_7_0_EBX_FDP_EXCPTN_ONLY (1u << 6) /* Supervisor-mode Execution Prevention */ #define CPUID_7_0_EBX_SMEP (1U << 7) /* 2nd Group of Advanced Bit Manipulation Extensions */ @@ -836,6 +838,8 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu= , FeatureWord w); #define CPUID_7_0_EBX_INVPCID (1U << 10) /* Restricted Transactional Memory */ #define CPUID_7_0_EBX_RTM (1U << 11) +/* Zero out FPU CS and FPU DS */ +#define CPUID_7_0_EBX_ZERO_FCS_FDS (1U << 13) /* Memory Protection Extension */ #define CPUID_7_0_EBX_MPX (1U << 14) /* AVX-512 Foundation */ --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622663; cv=none; d=zohomail.com; s=zohoarc; b=Dh9d5Cshw0OFgWWOxkl6Ns8ikIbYqxGym2rUG5wGDngupiyMlNWx6RTUCbWMfR2sJ35s0gLSlnoWr1522aHfLrIqTmKH4P5pO5k2GKXQQSVRzS6dGKrmSprTsG3mti6wHmZ1WHp6PS2uVJHpRz3uNlg4xK9YHuhd2X25czoHzJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622663; 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=jxgaIqmf9BUKVluE/glpPMNXH7jZp+OmWJCbl0UD+9Y=; b=K/JVoStKMy4w34swd671rYkq44Dj9Wq/NWfOQnwEcWFwdGe3ZC0hWBjJMTTAwTEmS/je6CjyEbWUSFUZintPhJcF/e/2kbjTr76Qm/3wGK+S+xcYpsQ68MzbVa2OVGOv8hfkpq0vH2CIRlm8jpicA4kczHco7uvbsHUY5j0LisQ= 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 1723622663102478.1330080794544; Wed, 14 Aug 2024 01:04:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yf-0003Ba-2V; Wed, 14 Aug 2024 04:03:29 -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 1se8yI-0002p1-OE for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:10 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8xu-0007sc-RW for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:06 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:38 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622562; x=1755158562; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uep5VC7g3XliyLn1znJEV29ajVLkzpBFUeE1+TBL7QA=; b=WnpbLIjNdu033H9aIxt+Xah/0ElmgUSOa/cRIXKcD9VrFSNPJ0+zJWg/ McT9s0uy/f98HppICdQg/nDxBfsS5KJEDSjpoKZg18tnPaC5SDpE+Crii IEt2LganZ9Jpo6Ns8DzDAaoxZEihaWHzY2eqwthyBNCpwJJfnj7q/8Gg+ 0QHuHQVmkSyeX5GQ+Bq9QTcObNnrdA5WY0zeQ1iaL4DyMEjL6VS529rs5 DeZvG+f4EjFCvK3riN3t8nkIn0E08ux7PNOy3Q7CTcHngFC476LosdFyk lFFRm98xjd7b8mk96Y/qUG517NDHEoI/0CqQ5gKiG40+g9pPHAHJQbm6S g==; X-CSE-ConnectionGUID: voy0BJzWTWiJG8XrC/PE8g== X-CSE-MsgGUID: oB5mx0dsQD+pE2UWfqetDA== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584474" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584474" X-CSE-ConnectionGUID: o7p3KkbsTfO1NtbxCirgxw== X-CSE-MsgGUID: kqlP9rAJTr688NY7cbVQBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048949" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 3/9] i386/cpu: Add support for bits in CPUID.7_2.EDX Date: Wed, 14 Aug 2024 03:54:25 -0400 Message-Id: <20240814075431.339209-4-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622664211116601 Content-Type: text/plain; charset="utf-8" KVM started to report the support of bit 0-5 since commit eefe5e668209 ("Advertise CPUID.(EAX=3D7,ECX=3D2):EDX[5:0] to userspace") Allow them to be exposed to guest in QEMU. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e60d9dd58b60..03376ccf3e75 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1148,8 +1148,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { [FEAT_7_2_EDX] =3D { .type =3D CPUID_FEATURE_WORD, .feat_names =3D { - NULL, NULL, NULL, NULL, - NULL, "mcdt-no", NULL, NULL, + "psfd", "ipred-ctrl", "rrsba-ctrl", "ddpd-u", + "bhi-ctrl", "mcdt-no", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622663; cv=none; d=zohomail.com; s=zohoarc; b=feFponwrTkB7cQGYHvOWTCipz5PEd+lA4Z2QaHedQ6QLy70hpD4AxNfo7li8nd1N1CmKUc2k+ofr+nUv/Ffn5bwspfcUB/wlQ8x5kHwmCPjQBCwbvCgsiXuC3xL9HQAQ0hgYFTtYf1Ljdmrwx6kOtxqY1e9fjA//FIWml4ocJ1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622663; 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=ynP17wV9Lz1bwFxkqo0kUMfyNZoeoS4HJQNq9p/lKtQ=; b=Ao51k8o9cx4QItYRbt1T9fK7AQ052whs0clqpb+oE57JJqvbggOdcrXs0D4nPngvqosF7atlHZR3FGr7ZnhPcAMRAtAjBsZ7ZAsUVApwwl8yWBluvQ9FIO6PWJlXyAikevJjGdYHSSUDcX0ySkom0ISCpBsYw7eDjrV0+5RVb9I= 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 1723622663041248.03447995228828; Wed, 14 Aug 2024 01:04:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yr-0003wu-HF; Wed, 14 Aug 2024 04:03:41 -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 1se8yK-0002pS-Sl for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:17 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8xv-0007rt-Qz for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:08 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:39 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622563; x=1755158563; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X3na6+L70Cfx64EUlxwZzmPxVDrsGV+622+OsmsswRI=; b=HW4H3ZAB1VCB86q2h+4iU+YAzXgoBS1ExjizY5WpL+5VhkfeZjnkLgyb 3DquqIM4xbnCOQroa7IL3vDNDNeJrZUOAwIWunNUYI4IDx8XnrM3FZ4kX gcoNMN9NBwnzipE58h5a822+jk9doedXZWzxotrUMiiY3+11LL4XaXU4g Lm4rIzUnNO/4CMwEXV0c0hzrspUd4MkptvCPT1oN27IWmfp89t4PQILIF sdCve7WXRwtlgZ52YUHqItdGrbnxUhPkMECNFRMkuSgJkiUquAXh04HVT mHF9s5pwpPT3krIZ20ZQKxl8fcSOEeT+x/zD7kgxI46LILN9er1i+gcwU Q==; X-CSE-ConnectionGUID: ZIlyPCHkQpmHZF/PSiBTSg== X-CSE-MsgGUID: rK9YP794S8uAbpYltJXILg== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584478" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584478" X-CSE-ConnectionGUID: BUEn6TXQQ9G9BU38uK4/2g== X-CSE-MsgGUID: sSJofb4dTDqskubB5/BOIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048952" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 4/9] i386/cpu: Construct valid CPUID leaf 5 iff CPUID_EXT_MONITOR Date: Wed, 14 Aug 2024 03:54:26 -0400 Message-Id: <20240814075431.339209-5-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622664211116600 Content-Type: text/plain; charset="utf-8" When CPUID_EXT_MONITOR is not set, it means no support of MONITOR/MWAIT leaf, i.e., CPUID leaf 5. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 03376ccf3e75..5bee84333089 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6553,10 +6553,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index= , uint32_t count, break; case 5: /* MONITOR/MWAIT Leaf */ - *eax =3D cpu->mwait.eax; /* Smallest monitor-line size in bytes */ - *ebx =3D cpu->mwait.ebx; /* Largest monitor-line size in bytes */ - *ecx =3D cpu->mwait.ecx; /* flags */ - *edx =3D cpu->mwait.edx; /* mwait substates */ + if (env->features[FEAT_1_ECX] & CPUID_EXT_MONITOR) { + *eax =3D cpu->mwait.eax; /* Smallest monitor-line size in byte= s */ + *ebx =3D cpu->mwait.ebx; /* Largest monitor-line size in bytes= */ + *ecx =3D cpu->mwait.ecx; /* flags */ + *edx =3D cpu->mwait.edx; /* mwait substates */ + } else { + *eax =3D *ebx =3D *ecx =3D *edx =3D 0; + } break; case 6: /* Thermal and Power Leaf */ --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622650; cv=none; d=zohomail.com; s=zohoarc; b=FjGlUlMTpbqOsk8zGi8NKiqqCUBPlbJQ5pTZtxRDDtMmmgRlqi2JvJTqzHFFM5iW3a6zAMW7tUhhJ22GWrirjfcrzYsOAoGm6qZeuJakZBIkhwiTiGAyLnYNlHsXsc/I4CuYHm5F/Yx76pjCuhAuW86/KVp09yH8bghXJqtli5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622650; 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=0jlEXxnKPa1s2g6xbf814Bqp3SOlVlJQEIrnnss/Yp4=; b=JeQNSJcbyVe/JibSQHIJk7NZtXI1Y0ETmNyUOibJXsbmZ56JbBW0eR6Ax72c2yeNX/QJp6DRZlqOidQaN6NYWGxqMgxyn1mxV7uascwm04i0VisfV6UrOYivD7pxbrmXN+nDaO6asA3Id7mePioNdjqVfk3bwjGe3SvquYkkp3g= 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 1723622650434147.54598668922142; Wed, 14 Aug 2024 01:04:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yp-0003lo-Q4; Wed, 14 Aug 2024 04:03:39 -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 1se8yK-0002pR-Pw for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:17 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8xw-0007sl-Cs for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:08 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:41 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622564; x=1755158564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l9ibDxi4pjx2BEry03rv9wc5np14WZq/dpLp+/IOpk4=; b=gY1BDT+ACDS1TcuZpq3P1DZ6wou0wTPcX1dRBhRQ9J6X/MXmCmbZwYdQ 7Db86exWx3C+C9s2ItrkDflzObbMQRrMorF3tUCQvqNXNQEqsOawCuB4A CA2ds9zWjevLiMm+F70RqQOHoiElnIrONol7JORz/w0LlMSn1yzAOERWd Vyy6mytZaJHccBSN8tkMHufvZY/qmow6NInhtDVAKn/N64NhWcg0U+TUq u5u9FOBGDEkmKAs2PT84I2VZufAKiea6OdtpURtmBLML4npBqrhCpTqBN R9UbSoi368nu2e+LJADQXzalNeayDXh7PRbgwV7u2TwklyculDtiS1uEJ w==; X-CSE-ConnectionGUID: wmIs9s2kQVy6s7ujJjR4PQ== X-CSE-MsgGUID: GBZSj6Z4QjW5CvCE5X1xHg== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584481" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584481" X-CSE-ConnectionGUID: w+NWm/qsQEObMRIL6k8yPQ== X-CSE-MsgGUID: SZlHgF/pR8av3GAvF8+zDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048955" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 5/9] i386/cpu: Construct CPUID 2 as stateful iff times > 1 Date: Wed, 14 Aug 2024 03:54:27 -0400 Message-Id: <20240814075431.339209-6-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622652099116600 Content-Type: text/plain; charset="utf-8" When times =3D=3D 1, the CPUID leaf 2 is not stateful. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index c168ff5691df..6618259f265c 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1818,10 +1818,12 @@ static uint32_t kvm_x86_build_cpuid(CPUX86State *en= v, int times; =20 c->function =3D i; - c->flags =3D KVM_CPUID_FLAG_STATEFUL_FUNC | - KVM_CPUID_FLAG_STATE_READ_NEXT; cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx); times =3D c->eax & 0xff; + if (times > 1) { + c->flags =3D KVM_CPUID_FLAG_STATEFUL_FUNC | + KVM_CPUID_FLAG_STATE_READ_NEXT; + } =20 for (j =3D 1; j < times; ++j) { if (cpuid_i =3D=3D KVM_MAX_CPUID_ENTRIES) { --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622695; cv=none; d=zohomail.com; s=zohoarc; b=HkDbhy+60awc1/ZCSQuwvlfs9BH5ThcSGLLFLPKN2JWNSaUYKkOiz+CGWWn15Gh90DlJxMAvHIJeTr+Wsn1fXnUpqyYEK9NU3dLCNBE0rEGumIttYI5i34Ae2MxTchiTyrszomhOsEogSHXbRYxokmMRganS//asDIPuKS2pX6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622695; 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=am+xyqh2qptEs9UyKUPj7FD3acx+4pceyUgVlS4/qEM=; b=S+ac+ln8rImfQBxmA+RJbbdZ54vqxIg+ajh3qKdcN8XFaH768IIGQNYVLko5jyzEbend59yw76bRZkmhj7dZIZQ1otmCd2DrhG1YOioSwTSaX0iDy8oiHZrUN3xWZ6d4vD7MgQK59mi/VjFp+mTnJ2Hwz5FYly9jVHzM6OLkwtg= 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 1723622695814399.885200636125; Wed, 14 Aug 2024 01:04:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8ys-00040A-3K; Wed, 14 Aug 2024 04:03:42 -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 1se8yT-0002tK-1H for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:23 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8yJ-0007sc-4T for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:15 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:41 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622587; x=1755158587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y3Zdg2gkuvf92qw6n0gEjAnA5h7Gl2EFlz23K8pA8v4=; b=KGe73R7DX4BnQUffUvnNcOxkBUWOjTD6Mq7+41oQuyL9qYX+5cSS/up0 B7ybgXIAT30okQj7We8muph8ao3hCrjCZXckmwexhCfVzqVBSEjPVykxP G6hy5f3q2IrF1v4R0pBWCnEk1/uw3wp6bqQhrQzRHZS0E+MZ4LdF+nOew tX9hM6w9+UYxquVuc9OmzZnssrAC5cK/ztqB1kzVbFf9he2a8GNSZfivG EoOTPzOs295eC/W4ZBvZEb9ZC0HysUZkhAgNi2nbTssntqaXTSqkGjOsG yRvabzv5OTVaq39MaUe9FSirJAUHSxcjFAav5aEJwUhgNWHWgm9WGhYgz A==; X-CSE-ConnectionGUID: GwpXFdTARb6RHq0SMBPuuw== X-CSE-MsgGUID: mHGtlY0rRVqiR+tTU+5u9g== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584490" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584490" X-CSE-ConnectionGUID: sbz+iBpqTWSIEzia/8Shwg== X-CSE-MsgGUID: X6d4oiFnSamnUzsFLavRKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048958" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 6/9] i386/cpu: Set topology info in 0x80000008.ECX only for AMD CPUs Date: Wed, 14 Aug 2024 03:54:28 -0400 Message-Id: <20240814075431.339209-7-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622696250116600 Content-Type: text/plain; charset="utf-8" The whole ECX of CPUID 0x80000008 is reserved for Intel. Signed-off-by: Xiaoyao Li --- 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 5bee84333089..7a4835289760 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6944,7 +6944,7 @@ 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 (threads_per_pkg > 1) { + if (threads_per_pkg > 1 && IS_AMD_CPU(env)) { /* * Bits 15:12 is "The number of bits in the initial * Core::X86::Apic::ApicId[ApicId] value that indicate --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622649; cv=none; d=zohomail.com; s=zohoarc; b=GY9Dyx7B617p3C8VDk8FXEhjLUAZL1b474TBvvZB7eTY8XhVlJfvJFTaId1MGl8lNESpOKzvAmnXgX0RixygUKWrQM86++Ndqf2S5XE0ULLySZcj0Me0pLvU95SkNZ3cQhQHQS/Ng7IxHU6aT5DOWxdKLL6DyiCg6ayRVK3guPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622649; 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=RdskTWB/2cPhbo5K1pGmzV7Y13jiXhq7IXOigUmZosQ=; b=S6MrwDK3MywIb2QHpdQoh54LebAj9TqD2rXisVpgGlAEbBVW8mMykLbi537XkZQ1JAba81cz+QRxcqOuBiSgvxmPDVxkps75lp07yHplxetvxN4pNvDmD522rkEUF4xKxQdmHea6ZATWTv742xntpFyrzjhYeXsozjG35y1Tt+8= 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 1723622649980190.33805954060756; Wed, 14 Aug 2024 01:04:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yh-0003IY-Bj; Wed, 14 Aug 2024 04:03:31 -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 1se8yT-0002tJ-1N for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:23 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8yL-0007rt-9N for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:15 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:43 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622589; x=1755158589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+1CShJKpDmVBjOQNUIrC3GWrHShE0+pF4rvqTJMJim8=; b=B1OVSrxgfqxn6/VYAbhQpQd/vRDDXI2iB5P+7PnDzydv/2RLfNkYJd7z WAgHVIIImGfg4c8UflJxf6wLO1Zw7udzh4ZRevg7NZQxBK+txyGQhC6dZ sIxxkTQJ8Tdm+WgfpNVKuyx8bP1TWsq1qQb8yMOj5DJuVXq2qmdTP+nMg 0qt515Sy6mwADjF/9gOx2F21rbd02BpS5JrRHA/guwN509a22wLyL0h3O xWStRds2h7U1PvC5n4FOxpSU5XS2DYB2RQMGS79+4Be5cbwwc2hs8RJck wlRClMxcvuePTsyWUva82qZ+DaaA43N/ZBu7bBtTIkpyrBLaCfBbvl/8h w==; X-CSE-ConnectionGUID: ph3zYcS0RiymqV8OAZl5Lw== X-CSE-MsgGUID: tQJf5YMTSUmHh1LLbBTr8w== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584500" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584500" X-CSE-ConnectionGUID: KEfZ5W48QYaoJauvCfm6gQ== X-CSE-MsgGUID: 0Haszx6eSjqibH/f847CBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048963" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 7/9] i386/cpu: Suppress CPUID values not defined by Intel Date: Wed, 14 Aug 2024 03:54:29 -0400 Message-Id: <20240814075431.339209-8-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622652106116600 Content-Type: text/plain; charset="utf-8" Some CPUID leaves are defined by AMD while it also gets exposed to Intel VMs by QEMU. It causes no issue with current VMs however it will not work with Intel TDX because these CPUID leaves are enforced by TDX module as reserved. Stop to advertise them to Intel VMs when vendor_cpuid_only is true. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7a4835289760..fed805e04aeb 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6863,12 +6863,16 @@ 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 && 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; + *eax =3D (cpu->vendor_cpuid_only && IS_INTEL_CPU(env)) ? 0 : env->= cpuid_version; *ebx =3D 0; *ecx =3D env->features[FEAT_8000_0001_ECX]; *edx =3D env->features[FEAT_8000_0001_EDX]; --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622677; cv=none; d=zohomail.com; s=zohoarc; b=IJkEKdOmHESh48oFqXVu0w3dwl6pOKegLCjaXbV2swJSKzMtxa3uYIX15fy2dvhVTsZPVTXATCaYMPOs5r9jD6k8rseZOPbqG7Y5QV8YuokRZ+JqFW5duz393cvwWA412Q0pHQdbz83k1mHPRzdHmNuzx3EaPUDcW3blGwefuSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622677; 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=GIJZIoFo+vL3VqbjpTgSs5/uEkpxgUagsRVoRx/0IZ0=; b=b+3TSGMlXQn5UAUhM+brCHyC9qMQ/ztaCFdL+dIdZ1rRjHN1NR3ZZWZmVoIoTTRMlGrMqhF7uQn97YMbWPBVQUQ+qBBMPlzfBOaInR5pAsba1jv9XCsWLbfN82Eny3rT+ghBRSMDwaWhX1PFWf41sO8ct2e8pxAp44QP5jnUOlY= 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 1723622677346371.7849240192097; Wed, 14 Aug 2024 01:04:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yt-00044v-1d; Wed, 14 Aug 2024 04:03:43 -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 1se8yT-0002tI-0z for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:24 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8yL-0007sl-4D for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:15 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:44 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622589; x=1755158589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YQXU1V8cjOIRfFnAkE3ZUsJxcIpDFj6x85Y7iJEOblI=; b=TYzM23AsAf9p6dfW+88Q1nlM0rzvVhU0YDmNH1Hne1q4QMzEl9q8xkSW EP0sZBvx8fzYSS+fNcWcSglxvhrYHeD7yS74zZo8sWNDLAZJN2CJsGJW5 6BjiWKGqSFmckC/DpGmIl48ObTJ0uST0npySw9K0BDL5QjolgpJA0dMVX P/m9xU0EZOhu6fvCROJjZSZtAFTiWQ6xmoKrZ5CoYTYLhBWR/Qy2U81k3 OvmQo4WZsn4TlV761vrMDMKYB3NGIencFkj80DRLj4GtqFTH0o45UOGKU 5wMhdZqScdy0q6Dz78MUunUvpLOtNunTExY5R7D7RoOK6NPUsXF5gDXJ0 w==; X-CSE-ConnectionGUID: PFdy1yh/TbuBFS/wW4Py9w== X-CSE-MsgGUID: 7Nar7dGnTsOZQAsaKeafYA== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584506" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584506" X-CSE-ConnectionGUID: aHkv1BIkToCVIdaFFa7Yyg== X-CSE-MsgGUID: t1AZl/TdSAq9Ftp1CBFuKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048966" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 8/9] i386/cpu: Drop AMD alias bits in FEAT_8000_0001_EDX for non-AMD guests Date: Wed, 14 Aug 2024 03:54:30 -0400 Message-Id: <20240814075431.339209-9-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622678128116600 Content-Type: text/plain; charset="utf-8" The AMD alias bits are reserved for Intel. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fed805e04aeb..85ce405ece80 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6118,6 +6118,11 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *= cpu, FeatureWord w) #endif break; =20 + case FEAT_8000_0001_EDX: + if (cpu && !IS_AMD_CPU(&cpu->env)) { + unavail =3D CPUID_EXT2_AMD_ALIASES; + } + break; default: break; } --=20 2.34.1 From nobody Sun Nov 24 08:20:35 2024 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=1723622682; cv=none; d=zohomail.com; s=zohoarc; b=QbZpuq/dND1WNd+AKBLWTQTh2NKtNcSiHpKg5Lzk0HI0+Oa7q7OAl5O1vilY6IMzA5t//ryB9nPwvVjD145B0+ZJb67ybDs9TmOyem4tvRB+1aCRL0WDUWXzOavagBgbOCN59/ARf1ir7NZZceu87nBUNXJNkHfEc2+9kVjSHnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723622682; 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=TtZWoI9FXfBFi5NDZ+KPcr4RKEm3/AYDk1aslM30AtI=; b=BY06+HTs2Wm+s/0WPI9hsQ2FWlLajcrLdcXQ2cNMpxrLRobpCHJ6fRWNbBSSoWYjO9UBan0FwGNPn4919/Q4Z/5ZtZZFpt+muTy1ZyxoYDbNm22CHiJwR7CmKgSMzgj7IoTgwd9x+0zN7J7bfPp3QuayFHk4y+wPh2ZuuyYZf4Q= 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 1723622682534507.6774041960788; Wed, 14 Aug 2024 01:04:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1se8yn-0003YB-Rh; Wed, 14 Aug 2024 04:03:38 -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 1se8ya-0002zY-RL for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:25 -0400 Received: from mgamail.intel.com ([198.175.65.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se8yU-0007sc-Cc for qemu-devel@nongnu.org; Wed, 14 Aug 2024 04:03:24 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2024 01:02:46 -0700 Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by fmviesa010.fm.intel.com with ESMTP; 14 Aug 2024 01:02:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723622598; x=1755158598; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CS43UzH48cjlmpX92LFl+4C3u5GSWZlxQ4JoVqNlFE8=; b=QTcBRXfyGu4ISDitLQ+pGe2MhuyWUq2NhdiMkAzEVz3DAlhJ3GnAMw2g Cdl9JCiYVnN2Hcg7i8BpSqUuDtO6cNrAqLvJeVgc2Xvh8pZXDa70HCWRW uiM7q/UR+AqMMU1NEKiF+PBqXiFFVfFlNXisJ9xfbre3PYoc54sk/Tlzf 693zxw10hZd7eeVR558fwoY3bQhmq5MWtBz9OCuLhoO1US+gtUTAuBde/ hDg9RuV/1Sl+iwUL52cHflJ0shu7gM0htmWWT5GnIXsI3Bx0DkTUuDS5q Xp1FJmtUX4L/NVi6yP3qmQrAkUWjZpbse0bh0PEpMpNZiCHj5Gu0SthpZ Q==; X-CSE-ConnectionGUID: N3wz2giGRvu8A4G27wOWZA== X-CSE-MsgGUID: bmBPMeC7Ss6JWOUnJnxTQw== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="25584510" X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="25584510" X-CSE-ConnectionGUID: KgvttIVYRdeLtaOXm/+pdw== X-CSE-MsgGUID: prB1e/MfTna/Sx4+fuK1gg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,288,1716274800"; d="scan'208";a="59048969" From: Xiaoyao Li To: Paolo Bonzini , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com Subject: [PATCH 9/9] i386/cpu: Make invtsc migratable when user sets tsc-khz explicitly Date: Wed, 14 Aug 2024 03:54:31 -0400 Message-Id: <20240814075431.339209-10-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814075431.339209-1-xiaoyao.li@intel.com> References: <20240814075431.339209-1-xiaoyao.li@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=198.175.65.15; envelope-from=xiaoyao.li@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1723622684188116600 Content-Type: text/plain; charset="utf-8" When user sets tsc-frequency explicitly, the invtsc feature is actually migratable because the tsc-frequency is supposed to be fixed during the migration. See commit d99569d9d856 ("kvm: Allow invtsc migration if tsc-khz is set explicitly") for referrence. Signed-off-by: Xiaoyao Li --- target/i386/cpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 85ce405ece80..fb3519fc6836 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1865,9 +1865,10 @@ static inline uint64_t x86_cpu_xsave_xss_components(= X86CPU *cpu) * Returns the set of feature flags that are supported and migratable by * QEMU, for a given FeatureWord. */ -static uint64_t x86_cpu_get_migratable_flags(FeatureWord w) +static uint64_t x86_cpu_get_migratable_flags(X86CPU *cpu, FeatureWord w) { FeatureWordInfo *wi =3D &feature_word_info[w]; + CPUX86State *env =3D &cpu->env; uint64_t r =3D 0; int i; =20 @@ -1881,6 +1882,12 @@ static uint64_t x86_cpu_get_migratable_flags(Feature= Word w) r |=3D f; } } + + /* when tsc-khz is set explicitly, invtsc is migratable */ + if ((w =3D=3D FEAT_8000_0007_EDX) && env->user_tsc_khz) { + r |=3D CPUID_APM_INVTSC; + } + return r; } =20 @@ -6129,7 +6136,7 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *c= pu, FeatureWord w) =20 r &=3D ~unavail; if (cpu && cpu->migratable) { - r &=3D x86_cpu_get_migratable_flags(w); + r &=3D x86_cpu_get_migratable_flags(cpu, w); } return r; } --=20 2.34.1