From nobody Sat Nov 15 12:47:47 2025 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; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1752492970; cv=none; d=zohomail.com; s=zohoarc; b=FNZ7PzOnXmnnsks895N1dZ3UglJB6W2nL51Lyjfy1yowbZREtK1gXWbNe6gkM5x7prTyz7g/ut1UfCjvLNHlzkG1vZNs0NsRd9lb2gnPXxw2PUobA2pzbmdeKmLyF+JailDajttxa3FW2Iqq3kVcARTHw6fxkPA6EcalSeMs43Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752492970; 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=AjgJDMASZjcGOJV/vJO6lV99FBfJmaAIl4fEb4Kczgs=; b=QMq9XrnSocXe/8FLnPTw2j6O3ouhY0uyg2NJqFCJF+JshBrCudrPCX9apzEEo4vvEzQlDGiZ8RkeGQU2bRlnFLq319sVCOVB88Z7P7UZyJ11BbwkOWcsfdhradJv0YNHv5tcKXVVWJ0t8X2o82WP6FRBUct/MjHPoRsrddK3H08= ARC-Authentication-Results: i=1; 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; 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 1752492970389594.2024892806412; Mon, 14 Jul 2025 04:36:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ubHDd-0006Bx-UU; Mon, 14 Jul 2025 07:19:40 -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 1ubH0i-0001bL-Mv for qemu-devel@nongnu.org; Mon, 14 Jul 2025 07:06:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubH0f-000253-Iz for qemu-devel@nongnu.org; Mon, 14 Jul 2025 07:06:15 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-IVI1lenZMVi3dLRHIu8TdQ-1; Mon, 14 Jul 2025 07:06:11 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a4eec544c6so1838672f8f.0 for ; Mon, 14 Jul 2025 04:06:11 -0700 (PDT) Received: from [192.168.10.48] ([151.49.73.155]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b5e8e0dc3esm11976967f8f.47.2025.07.14.04.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 04:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752491172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AjgJDMASZjcGOJV/vJO6lV99FBfJmaAIl4fEb4Kczgs=; b=IydOuFEQ2a0EriszpFzOE6lMKCK/6RkyNhcSn4aHqoRBeoUx3CiyDHqdi9o+/dlD80CZ5k KI/aCIRTNlQII2IaVw+XBtjnM2bxNvLGIDzVU2QjWwRz9D93RxUCELlEvydoKtE4KZf2Kq VzgwqVPZEgeYj0YFqqEkjezeLCA9LWE= X-MC-Unique: IVI1lenZMVi3dLRHIu8TdQ-1 X-Mimecast-MFC-AGG-ID: IVI1lenZMVi3dLRHIu8TdQ_1752491170 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752491170; x=1753095970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AjgJDMASZjcGOJV/vJO6lV99FBfJmaAIl4fEb4Kczgs=; b=ucGkBbU+b9yTW9p8+ydWWrWWfG3IlNw9ZmWiGplmdGCEc8Zn6eZUI6YRJ52lw8D6W8 FYSV9cRAZwiD4u9r8C+68GJ9izMivxc7a9XWksfs/VVO1IhojsMc3veOekdcIttwVxlm 3B1BgSFunWM+Wtg7vSH8H/L5QfAx0IlnThhQgubHuFiLB2TTC4T7TIdZN8q3mCKULwLs iot/yk1v8sw/n5baB6kWB0pQ6g6ZakvwiYXzvUtQVs8WrGTMPl2u/+rbeqJBqmZdF/HS d5y9nd16RHepdqu0bhd6IPrRwEzNtXGfPphked/ZF4teOcYshE9zy2y6kELpNpYdXw4a /pGA== X-Gm-Message-State: AOJu0YycxFqBroBHL7NeBXzjLkJhdhMl3M7d8kSaxt+Q3TycUgra0QYM QkVRt+LwF89vAvncwXVI2HjnB9NtRgibGwF58tI2jFGtSDd5OMKHfWZWqDuQxArUH4TU3gzQAe6 y3o1l58IyzWBZACydttkfxTsSXg1bO8YzlAdC1FKQC9Qt90u3ebc87iZHh5EXZR+wk5ewTlNwtc vI7kYp70LnA6bvyGptQQGQ7FSOkx1qlVqa4WoPGPx8 X-Gm-Gg: ASbGncu+thPv870XslM9nBza0H0DPyk479py2Q6g76n37zo2eoJqtpdpYfjXcAcpWuL Gv3Mf8QC9PxkC+Yxbc8/xhMg+QOVcDOGXoKJioi6Gzx30Mc7Q7f0QquBLEnUOlpNQAVBAfKdjMZ 0IXB0Pq57g/lXnohHzQhBLEyKW8f9wqjnG1Gov6CgYhdBftk3KVhvTETjvSeb1AwQmDaUf4uSCf xL2FPxhg8v1IxM+H97E6mv1mTflse9KYg+7EjaJ12h2S1KeiIFFwZ+5bV3f1Qcp/0OGDuTfq8We JFfUxmrv0EngCHif/0BrRB9eBzdD7zhQ4t9x+OvY4Jg= X-Received: by 2002:a05:6000:2004:b0:3a5:1cc5:aa6f with SMTP id ffacd0b85a97d-3b5f18b3ecbmr11074738f8f.34.1752491169560; Mon, 14 Jul 2025 04:06:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI3avFznPtpSpEwF0WHFReGm7r1UBfMpshWt9tcKw+6HMy39a/n0KxsP61s9DC6iNSWxv4Tg== X-Received: by 2002:a05:6000:2004:b0:3a5:1cc5:aa6f with SMTP id ffacd0b85a97d-3b5f18b3ecbmr11074705f8f.34.1752491168878; Mon, 14 Jul 2025 04:06:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu , Yi Lai Subject: [PULL 46/77] i386/cpu: Add x-vendor-cpuid-only-v2 option for compatibility Date: Mon, 14 Jul 2025 13:03:35 +0200 Message-ID: <20250714110406.117772-47-pbonzini@redhat.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250714110406.117772-1-pbonzini@redhat.com> References: <20250714110406.117772-1-pbonzini@redhat.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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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 @redhat.com) X-ZM-MESSAGEID: 1752492971137116600 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Add a compat property "x-vendor-cpuid-only-v2" (for PC machine v10.0 and older) to keep the original behavior. This property will be used to adjust vendor specific CPUID fields. Make x-vendor-cpuid-only-v2 depend on x-vendor-cpuid-only. Although x-vendor-cpuid-only and v2 should be initernal only, QEMU doesn't support "internal" property. To avoid any other unexpected issues, check the dependency. Tested-by: Yi Lai Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250711102143.1622339-8-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 11 ++++++++++- hw/i386/pc.c | 1 + target/i386/cpu.c | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index d3f7c53e301..d88481ba8ec 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2282,9 +2282,18 @@ struct ArchCPU { /* Enable auto level-increase for all CPUID leaves */ bool full_cpuid_auto_level; =20 - /* Only advertise CPUID leaves defined by the vendor */ + /* + * Compatibility bits for old machine types (PC machine v6.0 and older= ). + * Only advertise CPUID leaves defined by the vendor. + */ bool vendor_cpuid_only; =20 + /* + * Compatibility bits for old machine types (PC machine v10.0 and olde= r). + * Only advertise CPUID leaves defined by the vendor. + */ + bool vendor_cpuid_only_v2; + /* Only advertise TOPOEXT features that AMD defines */ bool amd_topoext_features_only; =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a6fa7923688..7cfa61c9ee6 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -83,6 +83,7 @@ =20 GlobalProperty pc_compat_10_0[] =3D { { TYPE_X86_CPU, "x-consistent-cache", "false" }, + { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" }, }; const size_t pc_compat_10_0_len =3D G_N_ELEMENTS(pc_compat_10_0); =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ac22548f47d..630a40d72be 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8749,6 +8749,16 @@ static void x86_cpu_realizefn(DeviceState *dev, Erro= r **errp) tcg_cflags_set(cs, CF_PCREL); #endif =20 + /* + * x-vendor-cpuid-only and v2 should be initernal only. But + * QEMU doesn't support "internal" property. + */ + if (!cpu->vendor_cpuid_only && cpu->vendor_cpuid_only_v2) { + error_setg(errp, "x-vendor-cpuid-only-v2 property " + "depends on x-vendor-cpuid-only"); + return; + } + if (cpu->apic_id =3D=3D UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; --=20 2.50.0