Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10252170pxu; Tue, 29 Dec 2020 19:42:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJynRD+1a+lciR79dM9qxVxrVtCqb4fFAoLZkXqmEI3IgVFM8/EG4Y8epnD1xprLgMHYwf6W X-Received: by 2002:a17:906:a04e:: with SMTP id bg14mr6479356ejb.149.1609299763493; Tue, 29 Dec 2020 19:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609299763; cv=none; d=google.com; s=arc-20160816; b=eslZX41SBro+m/IPxBeSsStiEFRVikWrSAhr5nRNYQ+7WBCRpYpSK4xEtXdCKMuT4Z RgMwN0JTcej0tABsrtUJpgT5zHHEy3mJ+vLJpmnXMDhUL4GR17b+++uXZFDtDuwEAcfe OMGmXIM8Ko+6+JTYMQQTde8WGOIbbq1ohM6t+VN0pqSacu6KN7xPGSo0KPdUfEfaNI3T 3WSIo0nV7LCAb4SeNnzPuIUb/V+UeTzZyrKCN4cvaqcuoQ2JN6Nqhq7pxXSERnXn3saG +dbsUNDTm7aOfPidZJzkOkx5aE8AIU2iUTvI4E0JNXVM4mvak46lc86wJNAuSDaRWhKx UHJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=AAVrpDmMadjqROimwI2b/EOt+HkVq5eqBpwwbJ/SxYY=; b=Z1blKvxJ5eeqB33ja7K0OUb9wdAVqDAf3ezX6XZtmWcadV9wqhBueccDHcok5RmxDK fSp0b3wzOzFNZIwFY5Zhz0D7A9qIFYJ15uhEUOKBighzkbOTzTfakvZgBCgzaXoZmGQA ManDtUFtQ2sHpvTCGcZ4it+Wpy0Tr2KneBrLD0JwbnKZDAT98ph8ppbz1H4mWnlPxjh4 d56+enOX68tGiXVUSzOp9b2yuq6kXAD/pCsSpzaUzIPCO4Dph1ntUDM19mcl6RVYIxcj DOfjbuUZVfAtzabt5Tq8CCrfcl9GwRwjP36LZ6JG4XXv5hIWG4oSLHPL3Fc6kSNX/m5R mI8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=oJdCeTqG; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=M+KbwuUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si19109987edt.265.2020.12.29.19.42.21; Tue, 29 Dec 2020 19:42:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=oJdCeTqG; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=M+KbwuUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbgL3Dk6 (ORCPT + 99 others); Tue, 29 Dec 2020 22:40:58 -0500 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:54533 "EHLO wnew2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbgL3Dk6 (ORCPT ); Tue, 29 Dec 2020 22:40:58 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 33412700; Tue, 29 Dec 2020 22:40:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 29 Dec 2020 22:40:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=AAVrpDmMadjqROimwI2b/EOt+H kVq5eqBpwwbJ/SxYY=; b=oJdCeTqGIbkQ9Qhy12tH6UsyFVh88nphmBbq+6AuE0 mtBvrx3T7lMv/HQ5G66/+AWd2ql6cUmd1Trel4ariZZMqZqvkX27BY3CCQ2enA3i LkpAVr2APzGeAGakScV9c4GmnCxb1pXr5Ays7wkHJ/KBo+XnS3TgaNdFVqsa3wda /03MJmJbb/yNejWvgexw3vFbxKLZPv04xANk0bgFF6u/CBmxjrVgj5nxCgJ/UnlK rpg58YK14gNLPnQ6vU2CXLIpzptwLRom8yEL6tV/MZ2q+6mJR/30v/mDEYbMncc5 8e0UL+MylDkzgY06up+0sc5x4EyQ5ZWl7aGDft2odK5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=AAVrpDmMadjqROimw I2b/EOt+HkVq5eqBpwwbJ/SxYY=; b=M+KbwuUcnsjIZW5OxTypyR6qkPm1+cYGe 3PHhC63bbffUdn7kMpF5M0KsmogzgXkxliYLQ28+8jsear+8paze0ixpa2kyKrYY HxO0uGCm83YHiKAIIxq2BEpzJ1bM63nHeBFwEJgL/NwEP7Eu0IxHvoY6kJhsem+S 9dYrnuM3Ovoa0k/O9wNlU8QO9inAxUsW1/YiA/okpGwJmBdIPbVMgoCOrZ269elW lovbV8Xl0lRzFBw87I4Dduad0GTiyMQM+a6vBxtaHF74ErC2se2JP/iTPNQM94TD xazSlZl7MAi6otFDRNhJq9NnLxuaR4pJMGPlUNjUQQVp1IqUBpkEA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddvvddgiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeflihgrgihunhcu jggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecuggftrf grthhtvghrnhephfejtdektdeuhedtieefteekveffteejteefgeekveegffetvddugfel iefhtddunecukfhppeeitddrudejjedrudekledrudejudenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhih ghhorghtrdgtohhm X-ME-Proxy: Received: from strike.202.net.flygoat.com (unknown [60.177.189.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 9F90124005A; Tue, 29 Dec 2020 22:40:05 -0500 (EST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Tiezhu Yang , Thomas Bogendoerfer , Huacai Chen , linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/2] MIPS: cacheinfo: Add missing VCache Date: Wed, 30 Dec 2020 11:39:48 +0800 Message-Id: <20201230033950.13839-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Victim Cache is defined by Loongson as per-core unified private Cache. Add this into cacheinfo and make cache levels selfincrement instead of hardcode levels. Signed-off-by: Jiaxun Yang Reviewed-by: Tiezhu Yang Tested-by: Tiezhu Yang --- arch/mips/kernel/cacheinfo.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/arch/mips/kernel/cacheinfo.c b/arch/mips/kernel/cacheinfo.c index 47312c529410..83548331ee94 100644 --- a/arch/mips/kernel/cacheinfo.c +++ b/arch/mips/kernel/cacheinfo.c @@ -35,6 +35,11 @@ static int __init_cache_level(unsigned int cpu) leaves += (c->icache.waysize) ? 2 : 1; + if (c->vcache.waysize) { + levels++; + leaves++; + } + if (c->scache.waysize) { levels++; leaves++; @@ -74,25 +79,38 @@ static int __populate_cache_leaves(unsigned int cpu) struct cpuinfo_mips *c = ¤t_cpu_data; struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); struct cacheinfo *this_leaf = this_cpu_ci->info_list; + int level = 1; if (c->icache.waysize) { - /* L1 caches are per core */ + /* D/I caches are per core */ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); - populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA); + populate_cache(dcache, this_leaf, level, CACHE_TYPE_DATA); fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); - populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST); + populate_cache(icache, this_leaf, level, CACHE_TYPE_INST); + level++; } else { - populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED); + populate_cache(dcache, this_leaf, level, CACHE_TYPE_UNIFIED); + level++; + } + + if (c->vcache.waysize) { + /* Vcache is per core as well */ + fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); + populate_cache(vcache, this_leaf, level, CACHE_TYPE_UNIFIED); + level++; } if (c->scache.waysize) { - /* L2 cache is per cluster */ + /* Scache is per cluster */ fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map); - populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED); + populate_cache(scache, this_leaf, level, CACHE_TYPE_UNIFIED); + level++; } - if (c->tcache.waysize) - populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED); + if (c->tcache.waysize) { + populate_cache(tcache, this_leaf, level, CACHE_TYPE_UNIFIED); + level++; + } this_cpu_ci->cpu_map_populated = true; -- 2.30.0