linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org, Huacai Chen <chenhc@lemote.com>,
	Vladimir Kondratiev <vladimir.kondratiev@intel.com>,
	Paul Burton <paulburton@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 1/2] MIPS: cacheinfo: Add missing VCache
Date: Fri, 21 Aug 2020 18:55:39 +0200	[thread overview]
Message-ID: <20200821165539.GA15948@alpha.franken.de> (raw)
In-Reply-To: <20200820004253.3418-2-jiaxun.yang@flygoat.com>

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 <jiaxun.yang@flygoat.com>
> ---
>  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 = &current_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 ]

  reply	other threads:[~2020-08-21 17:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20  0:42 [PATCH RESEND 0/2] Fix cacheinfo Jiaxun Yang
2020-08-20  0:42 ` [PATCH RESEND 1/2] MIPS: cacheinfo: Add missing VCache Jiaxun Yang
2020-08-21 16:55   ` Thomas Bogendoerfer [this message]
2020-11-03  5:40     ` Jiaxun Yang
2020-11-25  8:15       ` Tiezhu Yang
2020-08-21 16:57 ` [PATCH RESEND 0/2] Fix cacheinfo Thomas Bogendoerfer
2020-12-30  3:39 [PATCH RESEND 1/2] MIPS: cacheinfo: Add missing VCache Jiaxun Yang
2020-12-31  0:25 ` Huacai Chen
2021-01-04 10:42 ` Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200821165539.GA15948@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=chenhc@lemote.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=vladimir.kondratiev@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).