From nobody Tue Apr 7 18:22:09 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; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773313605; cv=none; d=zohomail.com; s=zohoarc; b=Dr5+1ImUK4OaKWdEPWlBoQm3CeAl9GU1RapUcT275fXbEfkxelPV6NA50NEMAFS7p/eIuB9FNRQZfLtQInJmRGuXce4tcHziVtOjg+zrfgGeBcq6BUKqd3t/8dqhJUTm3Aoc/Ft5FeseixxJpvOBx2RUsTYuHX4OnnQbbXDylyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773313605; 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=RkW2dPyvciirUsDcqFbuxfFBef+xd1Q9oGk4wtKZV8w=; b=oCGQ3vKC+Cm6vt44UwnpUcd0RdNHIakddo5RyHzGH1NsCnGX63gqvASYCGhhoQHNo5I/QmHTxf0YES9Q67n7DTCzrcaFc8eGmzI6tzCmjJclJCJD8HtSF6nArANrVudnYjX4Oo/ymATax0zxZc7/G5TB8L994XTKY6CXqGRvmEI= 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 1773313604994759.5537700339759; Thu, 12 Mar 2026 04:06:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0drE-0003rt-Av; Thu, 12 Mar 2026 07:05: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 1w0dr0-0003lR-S6 for qemu-devel@nongnu.org; Thu, 12 Mar 2026 07:05:24 -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 1w0dqt-0000Qc-67 for qemu-devel@nongnu.org; Thu, 12 Mar 2026 07:05:18 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-0GkkFKAlOU6aZb-Vd-AbYw-1; Thu, 12 Mar 2026 07:05:12 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-439c794edd9so836670f8f.3 for ; Thu, 12 Mar 2026 04:05:12 -0700 (PDT) Received: from [192.168.10.48] ([151.95.144.138]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe20b544sm7784107f8f.20.2026.03.12.04.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 04:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773313513; 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=RkW2dPyvciirUsDcqFbuxfFBef+xd1Q9oGk4wtKZV8w=; b=KyvnUd6oEVaUSEld6HmmorVGDmZV5QVyDdOhOZUZLW3LPb+uPVRY2Px8IaY/XQL8izGODl dhASJ0lAkI8lGLT3UmvZ2jjV0ZKGKRuVb0ox/K85QymwSqK/qw4Ugr76y00VwpSR3iCxCb kcq7EMFBO3/ILca4B10Qqj0R8wCwCzs= X-MC-Unique: 0GkkFKAlOU6aZb-Vd-AbYw-1 X-Mimecast-MFC-AGG-ID: 0GkkFKAlOU6aZb-Vd-AbYw_1773313511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773313510; x=1773918310; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RkW2dPyvciirUsDcqFbuxfFBef+xd1Q9oGk4wtKZV8w=; b=qCIUNULSwUb6wp97KiqZKKlNTLBB1DfNdsbgPrJ6acw8InNhFPPggMBTj7tX0EgK5J /ZK8+eK/j9FittTAt9DgyPilJ18ZPwAa62z6pQsA2oaZ/4kagM5LxixiVbJ8tgHpL4ih cxnLd2HMW1chytUbKLmfQlmBrRXh6s8BTykNFCfUSqxRJDVgyS/Gs1xjSAAyVq7uonH/ tB5hCtaF4asbIkOqD/kjZDtFU64mW7466UcvxgavUZ6XrUL/6gli8Bt6aqoVm0k85LMQ Y81RH5WL/9bzacg5FogUfGzsy3WktUL/PvExcqPFl/X5PIMaQHfqi40MH08JhXg4R84Z DhQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773313510; x=1773918310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RkW2dPyvciirUsDcqFbuxfFBef+xd1Q9oGk4wtKZV8w=; b=YsfD2JLgQE8kVtqG8zZDUYC5viJ9fMfi3v3siwLxjNvC94BgdQ5S+nTVPxY+RgLddy k+dMHFrcu/4S4ndtWuWsAcDHZVnNCPHnhOVd52Q5m+eNIo74i/mc6b6OwhIt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 04:05:10 -0700 (PDT) X-Received: by 2002:a5d:5849:0:b0:439:be82:1fd9 with SMTP id ffacd0b85a97d-439f81bc52bmr11356835f8f.12.1773313509516; Thu, 12 Mar 2026 04:05:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu , Zhijun Zeng , Chao Peng Subject: [PULL 06/14] i386/cpu: Enable CPUID 0x1f & cache model for ClearwaterForest Date: Thu, 12 Mar 2026 12:04:38 +0100 Message-ID: <20260312110451.685161-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312110451.685161-1-pbonzini@redhat.com> References: <20260312110451.685161-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: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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: 1773313607640154100 Content-Type: text/plain; charset="utf-8" From: Zhao Liu ClearwaterForest has CPUID 0x1f by default, so force enabling this leaf for it (ClearwaterForect-v3). And add the cache model to ClearwaterForest (v3) to better emulate its environment. The cache model is based on ClearwaterForest-AP (Advanced Performance): --- cache 0 --- cache type =3D data cache (1) cache level =3D 0x1 (1) self-initializing cache level =3D true fully associative cache =3D false maximum IDs for CPUs sharing cache =3D 0x0 (0) maximum IDs for cores in pkg =3D 0x3f (63) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x8 (8) number of sets =3D 0x40 (64) WBINVD/INVD acts on lower caches =3D false inclusive to lower caches =3D false complex cache indexing =3D false number of sets (s) =3D 64 (size synth) =3D 32768 (32 KB) --- cache 1 --- cache type =3D instruction cache (2) cache level =3D 0x1 (1) self-initializing cache level =3D true fully associative cache =3D false maximum IDs for CPUs sharing cache =3D 0x0 (0) maximum IDs for cores in pkg =3D 0x3f (63) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x8 (8) number of sets =3D 0x80 (128) WBINVD/INVD acts on lower caches =3D false inclusive to lower caches =3D false complex cache indexing =3D false number of sets (s) =3D 128 (size synth) =3D 65536 (64 KB) --- cache 2 --- cache type =3D unified cache (3) cache level =3D 0x2 (2) self-initializing cache level =3D true fully associative cache =3D false maximum IDs for CPUs sharing cache =3D 0x7 (7) maximum IDs for cores in pkg =3D 0x3f (63) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x10 (16) number of sets =3D 0x1000 (4096) WBINVD/INVD acts on lower caches =3D false inclusive to lower caches =3D false complex cache indexing =3D false number of sets (s) =3D 4096 (size synth) =3D 4194304 (4 MB) --- cache 3 --- cache type =3D unified cache (3) cache level =3D 0x3 (3) self-initializing cache level =3D true fully associative cache =3D false maximum IDs for CPUs sharing cache =3D 0x3ff (1023) maximum IDs for cores in pkg =3D 0x3f (63) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x10 (16) number of sets =3D 0x84000 (540672) WBINVD/INVD acts on lower caches =3D false inclusive to lower caches =3D false complex cache indexing =3D true number of sets (s) =3D 540672 (size synth) =3D 553648128 (528 MB) --- cache 4 --- cache type =3D no more caches (0) Suggested-by: Zhijun Zeng Suggested-by: Chao Peng Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20260310140819.1563084-6-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cd44a624201..1debc0c61fc 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3318,6 +3318,97 @@ static const CPUCaches xeon_srf_cache_info =3D { }, }; =20 +static const CPUCaches xeon_cwf_cache_info =3D { + .l1d_cache =3D &(CPUCacheInfo) { + /* CPUID 0x4.0x0.EAX */ + .type =3D DATA_CACHE, + .level =3D 1, + .self_init =3D true, + + /* CPUID 0x4.0x0.EBX */ + .line_size =3D 64, + .partitions =3D 1, + .associativity =3D 8, + + /* CPUID 0x4.0x0.ECX */ + .sets =3D 64, + + /* CPUID 0x4.0x0.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D false, + .complex_indexing =3D false, + + .size =3D 32 * KiB, + .share_level =3D CPU_TOPOLOGY_LEVEL_CORE, + }, + .l1i_cache =3D &(CPUCacheInfo) { + /* CPUID 0x4.0x1.EAX */ + .type =3D INSTRUCTION_CACHE, + .level =3D 1, + .self_init =3D true, + + /* CPUID 0x4.0x1.EBX */ + .line_size =3D 64, + .partitions =3D 1, + .associativity =3D 8, + + /* CPUID 0x4.0x1.ECX */ + .sets =3D 128, + + /* CPUID 0x4.0x1.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D false, + .complex_indexing =3D false, + + .size =3D 64 * KiB, + .share_level =3D CPU_TOPOLOGY_LEVEL_CORE, + }, + .l2_cache =3D &(CPUCacheInfo) { + /* CPUID 0x4.0x2.EAX */ + .type =3D UNIFIED_CACHE, + .level =3D 2, + .self_init =3D true, + + /* CPUID 0x4.0x2.EBX */ + .line_size =3D 64, + .partitions =3D 1, + .associativity =3D 16, + + /* CPUID 0x4.0x2.ECX */ + .sets =3D 4096, + + /* CPUID 0x4.0x2.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D false, + .complex_indexing =3D false, + + .size =3D 4 * MiB, + .share_level =3D CPU_TOPOLOGY_LEVEL_MODULE, + }, + .l3_cache =3D &(CPUCacheInfo) { + /* CPUID 0x4.0x3.EAX */ + .type =3D UNIFIED_CACHE, + .level =3D 3, + .self_init =3D true, + + /* CPUID 0x4.0x3.EBX */ + .line_size =3D 64, + .partitions =3D 1, + .associativity =3D 16, + + /* CPUID 0x4.0x3.ECX */ + .sets =3D 540672, + + /* CPUID 0x4.0x3.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D false, + .complex_indexing =3D true, + + .size =3D 528 * MiB, + .share_level =3D CPU_TOPOLOGY_LEVEL_SOCKET, + }, +}; + static const CPUCaches yongfeng_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { /* CPUID 0x4.0x0.EAX */ @@ -5963,9 +6054,11 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { }, { .version =3D 3, - .note =3D "with its-no", + .note =3D "with its-no, cwf-ap cache model and 0x1f leaf", + .cache_info =3D &xeon_cwf_cache_info, .props =3D (PropValue[]) { { "its-no", "on" }, + { "x-force-cpuid-0x1f", "on" }, { /* end of list */ }, } }, --=20 2.53.0