Re: [PATCH v8] riscv: errata: Add C-SKY ERRATA WRITE_ONCE fixup
From: Guo Ren
Date: Thu Dec 03 2026 - 21:26:46 EST
On Mon, Nov 30, 2026 at 11:27 AM Drew Fustini <fustini@xxxxxxxxxx> wrote:
>
> On Mon, Nov 30, 2026 at 01:58:35AM +0000, GUO Ren (XuanTie) wrote:
> > The early version of C-SKY C910 core has a store merge buffer
>
> It is confusing to me that this now says C-SKY. If it is going to be
> changed from the previous revision, then I think there needs to be an
> explanation. It is not clear what the difference is between T-HEAD and
> C-SKY.
>
> > delay problem. The store merge buffer could improve the store queue
> > performance by merging multi-store requests, but when there are not
> > continued store requests, the prior single store request would be
> > waiting in the store queue for a long time. That would cause
> > significant problems for communication between multi-cores. This
> > problem was found on sg2042 platform with the qspinlock lock torture
> > test.
> >
> > So appending a fence w.o could immediately flush the store merge
> > buffer and let other cores see the write result.
> >
> > This will apply the WRITE_ONCE errata to handle the non-standard
> > behavior via appending a fence w.o instruction for WRITE_ONCE().
> >
> > This problem is only observed on the sg2042 hardware platform: it
> > takes hours of locktorture stress testing to trigger the livelock
> > once, and an interrupt can break the livelock. No user space
> > application has been observed to hit this problem, so there is no
> > need to modify user space WRITE_ONCE(). The vDSO code runs in user
> > space context as well, so its WRITE_ONCE() does not need the errata
> > fence either.
> >
> > Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
> > Reviewed-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
> > Reviewed-by: Leonardo Bras <leobras@xxxxxxxxxx>
> > Reviewed-by: Inochi Amaoto <inochiama@xxxxxxxxx>
> > Tested-by: Han Gao <gaohan@xxxxxxxxxxx>
> > Tested-by: Yao Zi <me@xxxxxxxx>
> > Cc: Chen Wang <unicorn_wang@xxxxxxxxxxx>
> > Cc: Xiaoguang Xing <xiaoguang.xing@xxxxxxxxxx>
> > Cc: Paul Walmsley <pjw@xxxxxxxxxx>
> > Cc: Drew Fustini <fustini@xxxxxxxxxx>
> > Co-developed-by: Han Gao <gaohan@xxxxxxxxxxx>
> > Signed-off-by: Han Gao <gaohan@xxxxxxxxxxx>
> > Reviewed-by: Drew Fustini <fustini@xxxxxxxxxx>
> > Signed-off-by: GUO Ren (XuanTie) <guoren@xxxxxxxxxx>
> [..]
> > diff --git a/arch/riscv/Kconfig.errata b/arch/riscv/Kconfig.errata
> > index 4f77b3c6d7fd..dfa99f1cfd4e 100644
> > --- a/arch/riscv/Kconfig.errata
> > +++ b/arch/riscv/Kconfig.errata
> > @@ -179,4 +179,22 @@ config ERRATA_THEAD_GHOSTWRITE
> >
> > If you don't know what to do here, say "Y".
> >
> > +config ERRATA_THEAD_WRITE_ONCE
> > + bool "Apply C-SKY WRITE_ONCE errata"
>
> Also, here it is ERRATA_THEAD_WRITE_ONCE but "C-SKY WRITE_ONCE"
Thanks, Drew, for the feedback.
To clarify the naming change: XuanTie is the RISC-V processor brand.
The early C910 (and related C9xx) cores were developed as part of the
C-SKY lineage. After Alibaba acquired C-SKY Microsystems in 2018 and
formed T-Head, the brand transitioned, but for these early silicon
revisions the vendor identification remains tied to C-SKY. This is a
legacy naming issue rather than a recent rebranding. Specifically:
- XuanTie is the RISC-V processor brand of C-SKY Microsystems Co., Ltd.
- JEDEC JEP106AB lists C-SKY Microsystems Co., Ltd. as the
manufacturer associated with ID 0x5b7.
That is why the commit message and Kconfig help text now say “C-SKY”.
The Kconfig symbol itself stays ERRATA_THEAD_WRITE_ONCE for
consistency with the existing T-Head errata infrastructure (e.g.
ERRATA_THEAD_GHOSTWRITE). I’ll update the commit log with this brief
historical note and tighten the Kconfig description to make the
C-SKY/XuanTie relationship explicit.
References:
[1] https://www.xrvm.com/product/xuantie/C930
[2] https://www.xrvm.com/declaration
[3] https://www.jedec.org/standards-documents/docs/jep-106ab
--
Best Regards
GUO Ren