Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp400556pxa; Fri, 21 Aug 2020 10:06:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMrKSOsGvPeFYU3Tl0oj+gcANzps2OlBBbsYAhrSsVsGy2plGojzxCdf5r9DzBBA9fVs34 X-Received: by 2002:a17:906:7f0e:: with SMTP id d14mr3846673ejr.400.1598029600673; Fri, 21 Aug 2020 10:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598029600; cv=none; d=google.com; s=arc-20160816; b=nVL1ujmLDUqJc8v+AABD4ymHzG9bnhQPsgIoKdBbzXmKQrvUvRdASYZ8e1Rlly+B4Y eKPgd5ItPq4xlc5wdnZx4JDoApeftFACRQcAKqE+/WB1fzk+YE7BWrN3O3+URT6dsVhs blkLf15tKNUH5zWOd6murh9Yrx6q7iCl6lqJOlJMcnHQDacIArLGmjox+zjFip8ab6Nh vF+gv7rXdfR2xWjUNXZRwjwbQ7LkSqisE/R2Oh3wGiBk5OLIWiFs+SPIY99Ll0vRQfYJ Fsx/riSdSo9GlB3Z//FxSeryFqrFY1hC8RapRljoq9l/dLeZhE9WTXFC7JJuzlXykXC5 ZSqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=DGBpfIr2v8Y0BgIFgYHnudo+o8nIepKJMgfBdkGINmQ=; b=D2/4qX8e/KeA7kcsM327etkQz2QttI6y+jORTD4FatkwgVmD7paMMmL6AlCXhrqoYf f3koQ4oqZRUskpaANhYuIJX7N6f74lZBG4aGfCuiE94lWUpIK89U4FrAT2Ha8rE9egKm dNlXWlqzhT0ltybHYNTM+T++oMIcYyLlqM5+loHhW0oTEPKGaTplAbMh72arn69TAA5i PbBqQM22upVcCiVM51K0hotI0H6Kn7YhL7z2tMSEQ6AKS7aeuqsVjX6ic0zgZWkpwrDX ptDg4RKrsbTN+/7fKketpHImeLC8QgrHa9L2cO4A5U48kVQk9pIb+dYDsyBB54Q9dJT0 EciQ== ARC-Authentication-Results: i=1; mx.google.com; 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 i19si1464781ejh.715.2020.08.21.10.06.16; Fri, 21 Aug 2020 10:06:40 -0700 (PDT) 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; 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 S1727973AbgHURC5 (ORCPT + 99 others); Fri, 21 Aug 2020 13:02:57 -0400 Received: from elvis.franken.de ([193.175.24.41]:54990 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbgHUQ5m (ORCPT ); Fri, 21 Aug 2020 12:57:42 -0400 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1k9AME-0003dt-00; Fri, 21 Aug 2020 18:57:38 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 79A5CC0D8F; Fri, 21 Aug 2020 18:55:39 +0200 (CEST) Date: Fri, 21 Aug 2020 18:55:39 +0200 From: Thomas Bogendoerfer To: Jiaxun Yang Cc: linux-mips@vger.kernel.org, Huacai Chen , Vladimir Kondratiev , Paul Burton , linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND 1/2] MIPS: cacheinfo: Add missing VCache Message-ID: <20200821165539.GA15948@alpha.franken.de> References: <20200820004253.3418-1-jiaxun.yang@flygoat.com> <20200820004253.3418-2-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200820004253.3418-2-jiaxun.yang@flygoat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 20, 2020 at 08:42:49AM +0800, Jiaxun Yang wrote: > 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 > --- > 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) { why can't we insert vcache as level 4 and leave the rest of the file alone ? Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]