From nobody Sat Nov 15 12:47:36 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=1752493929; cv=none; d=zohomail.com; s=zohoarc; b=i6UYfkgnt3JxavgZJqiRrgO29u4uEkiV3fLEWb5r+wCitE4gUnByfPGpvlKcGDMwuYRKecHUNWo9TCqReGzbnk8gQY8s4f6GDAXPvqMTNB0kw298gaFbuLnRwLqNBYZ7joDBRZfXbahGB7/41s6SOys53yvJH1+Oe2OTL7WxLsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752493929; 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=oOKJ7k5EUKjWP5vYqwIlq0vfh3oRU4VVY5lSk531NFs=; b=WYme3xWVXpbfKV5B/tYyRvdkeftgdWbjRHISWrsPKgDcgPiitHjH6ry8XFzJuYLPZDh/ohggbAVKjXDDxDIpBo/TIErG6bTfaEsefish789C0nkGVz+3ayCb9ur+HmRB0dtmdbqUZIDjirkbbCyS1WNFHJb1N/PH4Dji+pToixw= 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 175249392944173.63214468565138; Mon, 14 Jul 2025 04:52:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ubHYd-00019d-DS; Mon, 14 Jul 2025 07:41:19 -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 1ubH1P-0001uO-2i for qemu-devel@nongnu.org; Mon, 14 Jul 2025 07:07:09 -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 1ubH1I-0002BD-Kc for qemu-devel@nongnu.org; Mon, 14 Jul 2025 07:06:54 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-qzVnPUrdMsGGRBEFTP7dKg-1; Mon, 14 Jul 2025 07:06:48 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-451d2037f1eso27403585e9.0 for ; Mon, 14 Jul 2025 04:06:48 -0700 (PDT) Received: from [192.168.10.48] ([151.49.73.155]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-455f2d3a1b5sm86609585e9.30.2025.07.14.04.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 04:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752491211; 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=oOKJ7k5EUKjWP5vYqwIlq0vfh3oRU4VVY5lSk531NFs=; b=eUvP5iOGh37E0nCxF8sTq4PYNddrV16x425fjS79n/FjG8P9BHwQbOXKnhWn93dQFwmuX3 E/pdJztcYvXOgXGh6/JLbjXbm78Cpwn60oTKnyacFVMT82qsLI2qixdPuzWD7TUoxNsg+Z hli/iieqG9EMqei7UKQ1kom40svMs84= X-MC-Unique: qzVnPUrdMsGGRBEFTP7dKg-1 X-Mimecast-MFC-AGG-ID: qzVnPUrdMsGGRBEFTP7dKg_1752491207 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752491206; x=1753096006; 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=oOKJ7k5EUKjWP5vYqwIlq0vfh3oRU4VVY5lSk531NFs=; b=BjoV8+LasCelEF85ucRs9TNd9bMK7JYlJNrGZnVdy113M7An5RzO3v6TkdztJVlGLf tF1E4TOy+NLSl9o4a+ZFGeRGfk2EGuN8vN1fP2ZHViHjCtdFH88TZWcb2CeXuf5PNktR iZzKkuA9UvlJiEu+TV87jZ8KDjUlkwHHp6uhyssvQCDLU0tQV844JVSxgNR6mhG20r+X AysjMJ/r8JKLbTNLuUwv3yLI2n2srTs0JByxt041l0sI9AIjeCnKDKnUTi8QqpAdfxiV 6RJfROXvnw8bh2yVWe5+4SMsJQVDId+2tfPhocy9RGmNkWGq5qxKXpeqUQhX0r+XAcQI YNnA== X-Gm-Message-State: AOJu0Yzg2GsAaGiza0+lXngjcXYGcGLH28w9kZBf8CsKnDt8/ssDprWy pDiRXi3yqrL8LNJ8L4QASdCZX77sVeu2TkZgukUt6pZpK2SMb/9xL5gAQVgeNl8bTSSv5JEtIxv EuJB4tKYlHsI+kONN9grr5lyga7cvQx3PNUojO5wGB2pUJhZhRxujl4VDEBXd9sAj21kWkaGZPA cxmZUvSpT2xWx7WN41TcyuYq4JYeUPkSgLkM0/Lv5k X-Gm-Gg: ASbGncuxe4zY6tZxwZGv9lsOsdt8+EPRTHBPRXxxcBZ5aLHYCDgUgxP2WtbUNLZ4oqP 7uVXCmHcdWCOnYyXIbY+ZgGcbuDdmBfXlPTbU94VeFO66nBGVdPDRPtZPINw+PY4ynBoSxt8jI2 gXwupLCOBirgbXeZMs4uSs/Df1hXNqIOTMyplY5gxwHhzQL6d4x+bmOn0BYI2VsS1j4vAhLgvYz qa0MePbk+mOIlT4jKsNTuWNDrjrN+TZTXjz2WfOBPwP+/1SV2yYiT3KE38AxjwMZfcs+Ln2H0DH paxj304B1go5QO6OEdpMjt3sy0mWv4rVGjgfGHJlh+I= X-Received: by 2002:a05:6000:1a87:b0:3a5:3930:f57 with SMTP id ffacd0b85a97d-3b5f2e3722amr9638637f8f.51.1752491205992; Mon, 14 Jul 2025 04:06:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpN4ER/MVc3ocntOVAK91nIlJUFPtS9McML9XrvTW/0Wli85ksa13lGcv/9TPQLO7TYEPjVQ== X-Received: by 2002:a05:6000:1a87:b0:3a5:3930:f57 with SMTP id ffacd0b85a97d-3b5f2e3722amr9638596f8f.51.1752491205405; Mon, 14 Jul 2025 04:06:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Ewan Hai , Yi Lai , Zhao Liu Subject: [PULL 61/77] i386/cpu: Introduce cache model for YongFeng Date: Mon, 14 Jul 2025 13:03:50 +0200 Message-ID: <20250714110406.117772-62-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: 1752493931369116600 Content-Type: text/plain; charset="utf-8" From: Ewan Hai Add the cache model to YongFeng (v3) to better emulate its environment. Note, although YongFeng v2 was added after v10.0, it was also back ported to v10.0.2. Therefore, the new version (v3) is needed to avoid conflict. The cache model is as follows: --- 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 0x0 (0) 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 0x0 (0) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x10 (16) 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 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 0x0 (0) maximum IDs for cores in pkg =3D 0x0 (0) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x8 (8) number of sets =3D 0x200 (512) WBINVD/INVD acts on lower caches =3D false inclusive to lower caches =3D true complex cache indexing =3D false number of sets (s) =3D 512 (size synth) =3D 262144 (256 KB) --- 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 0x0 (0) maximum IDs for cores in pkg =3D 0x0 (0) system coherency line size =3D 0x40 (64) physical line partitions =3D 0x1 (1) ways of associativity =3D 0x10 (16) number of sets =3D 0x2000 (8192) WBINVD/INVD acts on lower caches =3D true inclusive to lower caches =3D true complex cache indexing =3D false number of sets (s) =3D 8192 (size synth) =3D 8388608 (8 MB) --- cache 4 --- cache type =3D no more caches (0) Tested-by: Yi Lai Signed-off-by: Ewan Hai Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250711104603.1634832-5-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b3b29f69666..40f3b5eac88 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3156,6 +3156,105 @@ static const CPUCaches xeon_srf_cache_info =3D { }, }; =20 +static const CPUCaches yongfeng_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, + + /* CPUID 0x80000005.ECX */ + .lines_per_tag =3D 1, + .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 16, + + /* CPUID 0x4.0x1.ECX */ + .sets =3D 64, + + /* CPUID 0x4.0x1.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D false, + .complex_indexing =3D false, + + /* CPUID 0x80000005.EDX */ + .lines_per_tag =3D 1, + .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 8, + + /* CPUID 0x4.0x2.ECX */ + .sets =3D 512, + + /* CPUID 0x4.0x2.EDX */ + .no_invd_sharing =3D false, + .inclusive =3D true, + .complex_indexing =3D false, + + /* CPUID 0x80000006.ECX */ + .size =3D 256 * KiB, + + .share_level =3D CPU_TOPOLOGY_LEVEL_CORE, + }, + .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 8192, + + /* CPUID 0x4.0x3.EDX */ + .no_invd_sharing =3D true, + .inclusive =3D true, + .complex_indexing =3D false, + + .size =3D 8 * MiB, + .share_level =3D CPU_TOPOLOGY_LEVEL_DIE, + }, +}; + /* The following VMX features are not supported by KVM and are left out in= the * CPU definitions: * @@ -6435,6 +6534,11 @@ static const X86CPUDefinition builtin_x86_defs[] =3D= { { /* end of list */ } } }, + { + .version =3D 3, + .note =3D "with the cache model", + .cache_info =3D &yongfeng_cache_info, + }, { /* end of list */ } } }, --=20 2.50.0