mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lijun <lijun01@kylinos.cn>
To: Xi Ruoyao <xry111@xry111.site>,
	chenhuacai@kernel.org, kernel@xen0n.name, lvjianmin@loongson.cn,
	dongbiao@loongson.cn, zhangbaoqi@loongson.cn
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LoongArch: Update the flush cache policy
Date: Mon, 6 May 2024 18:08:10 +0800	[thread overview]
Message-ID: <cbb24599-8b40-cd27-6ce7-215476c0ddf4@kylinos.cn> (raw)
In-Reply-To: <8a8135eb0f1dc724cfbb4402dc6daf08db5b0bc7.camel@xry111.site>

volatile prevents compiler optimization by allowing the compiler

  to reread the address value of addr every time

在 2024/5/6 17:28, Xi Ruoyao 写道:
> On Mon, 2024-05-06 at 17:24 +0800, Li Jun wrote:
>> fix when LoongArch s3 resume, Can't find image information
>>
>> Signed-off-by: Li Jun <lijun01@kylinos.cn>
>> Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
>> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn>
>> Signed-off-by: Biao Dong <dongbiao@loongson.cn>
>> ---
>>   arch/loongarch/mm/cache.c | 24 +++++++++++++++++++++++-
>>   1 file changed, 23 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/loongarch/mm/cache.c b/arch/loongarch/mm/cache.c
>> index 6be04d36ca07..52872fa0e5d8 100644
>> --- a/arch/loongarch/mm/cache.c
>> +++ b/arch/loongarch/mm/cache.c
>> @@ -63,6 +63,28 @@ static void flush_cache_leaf(unsigned int leaf)
>>   	} while (--nr_nodes > 0);
>>   }
>>   
>> +static void flush_cache_last_level(unsigned int leaf)
>> +{
>> +	u64 addr;
>> +	int i, j, nr_nodes, way_size;
>> +	struct cache_desc *cdesc = current_cpu_data.cache_leaves +
>> leaf;
>> +
>> +	nr_nodes = loongson_sysconf.nr_nodes;
>> +
>> +	addr = CSR_DMW1_BASE;
>> +	iocsr_write32(0x1, 0x280);
>> +	way_size = cdesc->sets * cdesc->linesz;
>> +	do {
>> +		for (i = 0; i < (cdesc->ways * 3); i++) {
>> +			for (j = 0; j < (cdesc->sets); j++) {
>> +				*(volatile u32 *)addr;
> ??? what does this line do?
>

  reply	other threads:[~2024-05-06 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06  9:24 Li Jun
2024-05-06  9:28 ` Xi Ruoyao
2024-05-06 10:08   ` lijun [this message]
2024-05-06 10:17     ` Xi Ruoyao
2024-05-07  0:53       ` lijun
2024-05-07  3:55         ` Xi Ruoyao
2024-05-07  6:38           ` lijun
2024-05-07  7:48             ` Xi Ruoyao
2024-05-07  6:06 ` kernel test robot

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=cbb24599-8b40-cd27-6ce7-215476c0ddf4@kylinos.cn \
    --to=lijun01@kylinos.cn \
    --cc=chenhuacai@kernel.org \
    --cc=dongbiao@loongson.cn \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lvjianmin@loongson.cn \
    --cc=xry111@xry111.site \
    --cc=zhangbaoqi@loongson.cn \
    /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

all inboxes | Powered by JetHome®