U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@gentoo.org>
To: Han Gao <gaohan@iscas.ac.cn>
Cc: Yao Zi <me@ziyao.cc>,
	u-boot@lists.u-boot-project.org,
	Tim Ouyang <tim609@andestech.com>,
	Leo Liang <leo.liang@sifive.com>, Tom Rini <trini@konsulko.com>,
	Han Gao <rabenda.cn@gmail.com>
Subject: Re: [PATCH] riscv: thead: fix D-cache flushing
Date: Sun, 20 Sep 2026 00:56:09 +0000	[thread overview]
Message-ID: <20260920005609-GYA322162@gentoo.org> (raw)
In-Reply-To: <20260919-fixcmo-v1-1-0a9db1d0fa61@iscas.ac.cn>

Hi Han,


On 04:29 Sat 19 Sep     , Han Gao wrote:
> Use CIPA instead of CPA to clean and invalidate cache lines. This
> fixes stale DMA descriptors breaking USB enumeration on TH1520.
> 
I suspect this isn't a correct fix, there are separate functions for dcache
flush and invalidate - flush_dcache_range() vs invalidate_dcache_range()

Better to check the USB driver, where it actually need to flush or invalidate?

> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
> ---
>  arch/riscv/lib/thead_cmo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/lib/thead_cmo.c b/arch/riscv/lib/thead_cmo.c
> index b8051e29e02b..763ff799eddd 100644
> --- a/arch/riscv/lib/thead_cmo.c
> +++ b/arch/riscv/lib/thead_cmo.c
> @@ -40,6 +40,6 @@ void flush_dcache_range(unsigned long start, unsigned long end)
>  {
>  	register unsigned long i asm("a0") = start & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
>  	for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE)
> -		__asm__ __volatile__(DCACHE_CPA_A0);
> +		__asm__ __volatile__(DCACHE_CIPA_A0);
>  	__asm__ __volatile__(SYNC_S);
>  }
> 
> ---
> base-commit: 211de43d0f954a00a490220c1aac9db298287c40
> change-id: 20260919-fixcmo-cf56064fccd6
> 
> Best regards,
> --  
> Han Gao <gaohan@iscas.ac.cn>
> 

-- 
Yixun Lan (dlan)

  reply	other threads:[~2026-09-20 15:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 20:29 [PATCH] riscv: thead: fix D-cache flushing Han Gao
2026-09-20  0:56 ` Yixun Lan [this message]
2026-09-20 10:38   ` Yao Zi
2026-09-20 10:21 ` Yao Zi

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=20260920005609-GYA322162@gentoo.org \
    --to=dlan@gentoo.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=leo.liang@sifive.com \
    --cc=me@ziyao.cc \
    --cc=rabenda.cn@gmail.com \
    --cc=tim609@andestech.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /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