From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5977AC433E0 for ; Wed, 30 Dec 2020 03:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E00222209 for ; Wed, 30 Dec 2020 03:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726244AbgL3Dk6 (ORCPT ); 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