From nobody Tue Feb 10 06:27:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1763719083; cv=pass; d=zohomail.com; s=zohoarc; b=nrtoMRgLEUw/RoSy6lrO+zauKLXDovpAyOi/YuoC2Nel4Xy8RISvYKPT0Q3gNWWnSwsMbNzMUd5w1GBoFerAodNmKzLFzzmyYtFICTEjv+4nS0Uhu3JFOU74j6KVvPmGba6DoAzKealfIKSZcj1ue2U+wuKJjc57w+vZuxsP+iI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763719083; h=Content-Type: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=G51lSEc6VqjRlnMr8fMP+FY47sjitLjNoVRPZrLeTQQ=; b=dbrR+I9UXEszPBOMh+9/tA468s36AbG9x3bQYWlGcVIjdgvxXsSY2rQGEUZ8uh0LmYrVdDehHuYtr/TND+rnOae3PwEkQ2XkWtF33p53z2AJZrZkY1lWNE4kLKlp/mA1JGrMI4tTeVOfzWfarr4yLDHBeDPeeDPYa5Tf/Piszlw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1763719083032379.73419784175246; Fri, 21 Nov 2025 01:58:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vMNtS-0008KI-IQ; Fri, 21 Nov 2025 04:57:30 -0500 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 1vMMdo-00057M-TL for qemu-devel@nongnu.org; Fri, 21 Nov 2025 03:37:16 -0500 Received: from mail-southcentralusazlp170120001.outbound.protection.outlook.com ([2a01:111:f403:c10d::1] helo=SN4PR2101CU001.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vMMdm-0000LB-TR for qemu-devel@nongnu.org; Fri, 21 Nov 2025 03:37:16 -0500 Received: from BL1PR13CA0069.namprd13.prod.outlook.com (2603:10b6:208:2b8::14) by PH8PR12MB7230.namprd12.prod.outlook.com (2603:10b6:510:226::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.11; Fri, 21 Nov 2025 08:37:07 +0000 Received: from BN2PEPF000044AB.namprd04.prod.outlook.com (2603:10b6:208:2b8:cafe::1d) by BL1PR13CA0069.outlook.office365.com (2603:10b6:208:2b8::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9343.10 via Frontend Transport; Fri, 21 Nov 2025 08:37:07 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BN2PEPF000044AB.mail.protection.outlook.com (10.167.243.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.9 via Frontend Transport; Fri, 21 Nov 2025 08:37:06 +0000 Received: from purico-abeahost.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Fri, 21 Nov 2025 00:37:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rBOpUIQEOunXbH94WaamwHBsAknGT2LGR+5KbIHC2TL0nojayCZxYzqqmBZQn007/OeHd6EBalyFuT5BwQDKohGxfZ6DRxNnT8QiupwsbW7eHglKJa/OE/MT9gtifW5A4E2cR45vB76hdzBPoa6enk+Ncinq8pDudP1hCUM2chm0yVPr9Y8N1oZ1dBvNrCFjD71+vYUN8xh2ZeJYCsrn0gS30NH64zH4pvpMr7R+AS07fPa/yT+nTNfAG4zLudbMaPUuj9b62ycmzRpsOBGuKM52XEXtVb42j8FgF/dgLE7Y8OZAQSsspJbRicwJ5a568V10oJOuWKOGbgF8Aa/WBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G51lSEc6VqjRlnMr8fMP+FY47sjitLjNoVRPZrLeTQQ=; b=LWGjiUOBx/Iwe+caIyVO+89YCkwgpdmz8YODCSmHlrEUGsAMAslsbzi70lGlLzrXsMrc++kKdjCWKPnJ9Y3Af8xWZBzm2EQeIwJ5DqvNWSxk3gJU+KqbBIGWkDL+SelCq/IMR6jUOWjOwRBrT+N+9Iq9YqTZbk5yn6sPY0pjg/+1zSF/Zc7Hz/U+TNlCuv2tPk/b+aZ2ChkYb6Q5pjxJG7zZPq5y3i4dvchKDq9tVWG/cONsFDa/w481UNzxsfZKd9Mkuuxxin8QXN6TW+owtLT1KjfyCjwCvYbcDfmsHN5ZsgylIIuzXPimvbF49OyEiMB/8upehqpTFo/C7kfhLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G51lSEc6VqjRlnMr8fMP+FY47sjitLjNoVRPZrLeTQQ=; b=SJ2qbBgpPlqI1pz5sMajRsM24JMrwM/zMPeeiQGC1tgQ5wz5k/5YFH5pMw/iJGupheXAaSylrFfBozj7Enb2Gw7sL59FzAaTPsgXYgffGshRqrFiRPSlHiv8Nc5A/2JYUuz/yxIBPNU3mhlBNfxtOirt2bI3aFkLZ0J9tP3CFYk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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 (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Shivansh Dhiman To: , , , CC: , , , , , , Subject: [PATCH 2/5] i386: Add CPU property x-force-cpuid-0x80000026 Date: Fri, 21 Nov 2025 08:34:49 +0000 Message-ID: <20251121083452.429261-3-shivansh.dhiman@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121083452.429261-1-shivansh.dhiman@amd.com> References: <20251121083452.429261-1-shivansh.dhiman@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044AB:EE_|PH8PR12MB7230:EE_ X-MS-Office365-Filtering-Correlation-Id: 92efa55c-068c-4459-5124-08de28d9278f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/hQN5uhv20Ybqs1GXCS0B4Zx+epvnn56av0BeFTAA7Zmv11Mig+1e0M5bAAX?= =?us-ascii?Q?LhMB1MMw5YiRmrpTFiFo+lzf3snbhfGJslRrK6mNPhnCtxfxXoQixhQtQ39m?= =?us-ascii?Q?3pdrRASVRjGpCPO7PvnrDFA2/irZY7DkZcqtA94ZBPz4MdzXbiZGIMFCw5st?= =?us-ascii?Q?mFPGkS4am+S4uQkxstvMGSqby76GqcmPaqmGWKwE14UhvDJbIYxvtwn80jxc?= =?us-ascii?Q?wGFawI19iJo+pG9hpK39GZSss3/LkLexHcIqy5vDdyyHU7RUdWrRDqYCh1Cv?= =?us-ascii?Q?m7oWQ8ru52U6MW3j33/a/nYLXFwDVnSnr0su+QhEgQt8ONKcv6QkFn6VW/Lt?= =?us-ascii?Q?gw+eK1JigTinNwGv1B8+CTFyTfN00W3eHDyRUEdO0InHF30pEw4/bsIXeQoa?= =?us-ascii?Q?eXzVFfqlh7Ra5eSl6/8qRgbjKLeCKLUm4x3mCTaFiyDqstZiIvrBBbW38YuQ?= =?us-ascii?Q?5cK+w4G5yoIJnXY2gJpkqJfyS1bs7Kc3k70iEX+iw9U/Q5gMtwdK6srsQDZL?= =?us-ascii?Q?4MR6Mn4NeMh5Px4F0IRvWcq3F3zCe8lOkXWYdCiMvvgroZwFSybr3vM2TCtB?= =?us-ascii?Q?2YyF22mDxZG77r5wEXDDj8WkQJhGP7KhtZFy3HcHDqL6AfeG02yRmCGdIilp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z+ho8eRymgpKMkbXwgBmdyKOVe16Rf61Jmj3uJp+1?= =?us-ascii?Q?XiWkrqOIKC02Fn4DO0U=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2025 08:37:06.9471 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92efa55c-068c-4459-5124-08de28d9278f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000044AB.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7230 Received-SPF: permerror client-ip=2a01:111:f403:c10d::1; envelope-from=Shivansh.Dhiman@amd.com; helo=SN4PR2101CU001.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 21 Nov 2025 04:57:26 -0500 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 @amd.com) X-ZM-MESSAGEID: 1763719085914018900 Content-Type: text/plain; charset="utf-8" Introduce new CPU property x-force-cpuid-0x80000026 using which the CPUID 0x80000026 is enabled. It defaults to false. If a vCPU's model is host, then CPUID is enabled based on CPU family/model. Implement x86_is_amd_zen4_or_above() helper to detect Zen4+ CPUs using family/model. Signed-off-by: Shivansh Dhiman --- target/i386/cpu.c | 8 ++++++++ target/i386/cpu.h | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b7827e448aa5..01c4da7cf134 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -9158,6 +9158,12 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **er= rp) if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_SGX) { x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x12); } + + /* Enable CPUID[0x80000026] for AMD Genoa models and above */ + if (cpu->force_cpuid_0x80000026 || + (!xcc->model && x86_is_amd_zen4_or_above(cpu))) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x80000026); + } } =20 /* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set = */ @@ -10133,6 +10139,8 @@ static const Property x86_cpu_properties[] =3D { arch_cap_always_on, false), DEFINE_PROP_BOOL("x-pdcm-on-even-without-pmu", X86CPU, pdcm_on_even_without_pmu, false), + DEFINE_PROP_BOOL("x-force-cpuid-0x80000026", X86CPU, force_cpuid_0x800= 00026, + false), }; =20 #ifndef CONFIG_USER_ONLY diff --git a/target/i386/cpu.h b/target/i386/cpu.h index cee1f692a1c3..0fecca26dc4a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2292,6 +2292,9 @@ struct ArchCPU { /* Force to enable cpuid 0x1f */ bool force_cpuid_0x1f; =20 + /* Force to enable cpuid 0x80000026 */ + bool force_cpuid_0x80000026; + /* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level; =20 @@ -2879,6 +2882,21 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf,= uint32_t buflen); uint32_t xsave_area_size(uint64_t mask, bool compacted); void x86_update_hflags(CPUX86State* env); =20 +static inline bool x86_is_amd_zen4_or_above(X86CPU *cpu) +{ + uint32_t family =3D x86_cpu_family(cpu->env.cpuid_version); + uint32_t model =3D x86_cpu_model(cpu->env.cpuid_version); + + if (!IS_AMD_CPU(&cpu->env) || family < 0x19) { + return false; + } + if (family > 0x19) { + return true; + } + return (model >=3D 0x10 && model <=3D 0x1f) || + (model >=3D 0x60 && model <=3D 0xaf); +} + static inline bool hyperv_feat_enabled(X86CPU *cpu, int feat) { return !!(cpu->hyperv_features & BIT(feat)); --=20 2.43.0