Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp198392lqo; Tue, 7 May 2024 17:45:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/b6PgSGiR3rNRG5t2bAEVv5skvSCsLyUq7t1aYPvtjwEFo01TEC0DDluQlRHB/Be5feUB5Nxv3FSH6ophM89CRYhJwVFUM4n6WE1Xww== X-Google-Smtp-Source: AGHT+IHbqV9FQpqLIvJg1nculcnye3gMwTd7abFOxhFBG9zRjtQj2kocda5EcsJez+XIkEFNjLt8 X-Received: by 2002:a50:ab56:0:b0:568:b622:f225 with SMTP id 4fb4d7f45d1cf-5731da64b11mr739822a12.30.1715129109474; Tue, 07 May 2024 17:45:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715129109; cv=pass; d=google.com; s=arc-20160816; b=j+uekGiF92lmkrF94U+BjS5OLbpMoZo6PTIxTfNnxEab3LSad+HWTbruDy2ZTwEUhD TOlJ8PCNGpzwD4K/dH6uozS8nF773wlTFIgKCVrlVLlS0HC6F139ro09j0Jj49TOM5hH tvCX+lNsQZnMo6h2m+zj0cbPPsp0Qzq0ECpgRALObRD5rEuci73LtYHx9mv7wcfhm/hI X0/sETgespMuvMQMJHtsbUaTYnr8kh28yp4Qkriigb3sTIAsBxhOiHXqPgcjaaLjXx1j 1NJBHSlVYBmwQn8eKYgkLM32fYgxVC0RAyZ3AEOl2eMDXmuuxS6+l/CR6G5zEwVOvH/c ProQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=FqVP35gx/D7V7P1YGee+2asNziZXwXIBi1Qlp5/HwBc=; fh=CzVga147v2C013A8lGo+wMwvpcYnq+rTBS/c/NBozhg=; b=xtv28XMV0xu2lMlXCVoc3TpNS+pgCWzh3yvbKPAp+M/kJG7fPTW4RKKGFWTQJNh2Yt rJ2vdvy4f+Bo6WqHtIthOepaSaqmOOcq2PIMl5MqKq/zjvAFBjZnbs8zyUT/HtTePYeP lamP3amJu3BT5vGHlRZVxT4wS84bscunAKU5HwvCoj1ws6SqovtllOXlR921PR12RbkO vFLC5PBF0KTncln3zqXAOzFBU/gzpd62YbpP0C0PVVaBVmDA7AoDzIVS1iB3GTlEIbGK XsAwkfCfa+my1vwyKb+GbsNKi6H4Dz6F0YlDF7mNjHKpGvKcRx6x4dXICm0zeZDidd60 Q+sQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-172570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172570-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o21-20020a056402039500b00572b1d9ae42si6309297edv.16.2024.05.07.17.45.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 17:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-172570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172570-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 39A181F233F7 for ; Wed, 8 May 2024 00:45:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1499F63E; Wed, 8 May 2024 00:45:03 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A23838F for ; Wed, 8 May 2024 00:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715129102; cv=none; b=HfAZ6zR48NlpouosjexPPDlnQxbZu27vOozfwj9GLCzhlNHR+irEUziikCGPthRDIpcCsNt7573+cNzD+ES0CcsqNG7FYAy1CmXYgFCgOSu77LlxBKJVzm8Q2FIFueBR9pjSOrRGexL7Dwh7t/AeMbU5kLDvyjgqe7rs2FTfhg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715129102; c=relaxed/simple; bh=yfQw/3vqdF4+42mil5aRcLojxuwgAsyxYBx/zV3endY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TC85D2ovgNz7dO7mu+QvlsK+RZsak44YRY6s700/sW4huMv1k5Pn9QacXxqOzNy1FK/83uRWyrm+CQno17/I/TiE/BPyH58VrGtblOqeKMRy9ue2bMD5P8FKZqweHncs3hvbN3gqUjDoY/qkfyewu9zKzz6vFO4HTZj1ebkjogg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 706b27a40cd311ef9305a59a3cc225df-20240508 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:e66522b2-69bb-40e4-8a42-b1c626a2eeff,IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.37,REQID:e66522b2-69bb-40e4-8a42-b1c626a2eeff,IP:15,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:ed6f28bb4c424293f5dd8bc025c82a57,BulkI D:240508083935XHS2JZ5I,BulkQuantity:0,Recheck:0,SF:44|64|66|38|24|17|19|10 2,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC: nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 706b27a40cd311ef9305a59a3cc225df-20240508 X-User: lijun01@kylinos.cn Received: from [172.30.60.202] [(39.156.73.13)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1605079120; Wed, 08 May 2024 08:39:33 +0800 Message-ID: <9af195f9-c47c-a323-dcc8-9b0bb6926d7e@kylinos.cn> Date: Wed, 8 May 2024 08:39:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2] LoongArch: Update the flush cache policy Content-Language: en-US To: 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 References: <20240507074357.2156083-1-lijun01@kylinos.cn> From: lijun In-Reply-To: <20240507074357.2156083-1-lijun01@kylinos.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Superseded. 在 2024/5/7 15:43, Li Jun 写道: > fix when LoongArch s3 resume, Can't find image information > > Signed-off-by: Li Jun > Signed-off-by: Baoqi Zhang > Signed-off-by: Jianmin Lv > Signed-off-by: Biao Dong > --- > arch/loongarch/mm/cache.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/arch/loongarch/mm/cache.c b/arch/loongarch/mm/cache.c > index 6be04d36ca07..89eeb9a97dd5 100644 > --- a/arch/loongarch/mm/cache.c > +++ b/arch/loongarch/mm/cache.c > @@ -63,6 +63,27 @@ 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; > + struct cache_desc *cdesc = current_cpu_data.cache_leaves + leaf; > + > + nr_nodes = loongson_sysconf.nr_nodes; > + > + addr = CSR_DMW1_BASE; > + iocsr_write32(0x1, 0x280); > + do { > + for (i = 0; i < (cdesc->ways * 3); i++) { > + for (j = 0; j < (cdesc->sets); j++) { > + *(volatile u32 *)addr; > + addr += cdesc->linesz; > + } > + } > + addr += 0x100000000000; > + } while (--nr_nodes > 0); > +} > + > asmlinkage __visible void __flush_cache_all(void) > { > int leaf; > @@ -71,7 +92,7 @@ asmlinkage __visible void __flush_cache_all(void) > > leaf = cache_present - 1; > if (cache_inclusive(cdesc + leaf)) { > - flush_cache_leaf(leaf); > + flush_cache_last_level(leaf); > return; > } >