All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yao Zi <me@ziyao.cc>
To: Yixun Lan <dlan@gentoo.org>, 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 10:38:33 +0000	[thread overview]
Message-ID: <aq-3qRad3KYZgH_x@pie> (raw)
In-Reply-To: <20260920005609-GYA322162@gentoo.org>

On Sun, Sep 20, 2026 at 12:56:09AM +0000, Yixun Lan wrote:
> 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?

Whether the USB driver needs a flush or only invalidation or not, the
current thead_cmo.c only cleans the cacheline in flush_dcache_range(),
which is wrong.

But out of curiosity, I have a look at DWC3, and found at least the call
in dwc3_ep0_start_trans() requires dwc3_flush_dcache(), which is a
wrapper over flush_dcache_range(), to really clean the cache, otherwise
the DMA data and TRB might not be visible to an incoherent DWC3.

> > Signed-off-by: Han Gao <gaohan@iscas.ac.cn>

Regards,
Yao Zi

  reply	other threads:[~2026-09-20 10:39 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
2026-09-20 10:38   ` Yao Zi [this message]
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=aq-3qRad3KYZgH_x@pie \
    --to=me@ziyao.cc \
    --cc=dlan@gentoo.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=leo.liang@sifive.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.