From: "Min Lin" <linmin@eswincomputing.com>
To: "Bo Gan" <ganboing@gmail.com>
Cc: opensbi@lists.infradead.org, nick.hu@sifive.com,
gaohan@iscas.ac.cn, me@ziyao.cc
Subject: Re: [PATCH v2 2/2] platform: generic: eswin: Add eic770x_hsm and fix warm reset issues
Date: Mon, 15 Jun 2026 10:10:56 +0800 (GMT+08:00) [thread overview]
Message-ID: <6033f09d.751a.19ec90bd390.Coremail.linmin@eswincomputing.com> (raw)
In-Reply-To: <20260605075708.96-3-ganboing@gmail.com>
> -----Original Messages-----
> From: "Bo Gan" <ganboing@gmail.com>
> Send time:Friday, 05/06/2026 15:57:08
> To: opensbi@lists.infradead.org
> Cc: nick.hu@sifive.com, linmin@eswincomputing.com, gaohan@iscas.ac.cn, me@ziyao.cc
> Subject: [PATCH v2 2/2] platform: generic: eswin: Add eic770x_hsm and fix warm reset issues
>
> During warm reset, my EIC770X/Hifive Premier P550 can sometimes
> encounter memory corruption issue crashing Linux boot. Currently the
> issue is mitigated by having a sbi_printf before writing to the reset
> register. I analyzed the issue further since then. From the SoC
> datasheet[1], it's recommended to implement power-down flow as:
>
> a. Designate a primary core, and let it broadcast requests to other
> cores to execute a CEASE insn. Primary core also notifies an
> "Externel Agent" to start monitoring.
> b. Primary core waits for other cores to CEASE before it CEASEs.
> c. "External Agent" waits for primary core to CEASE before resets
> the Core Complex.
>
> It's possible that EIC770X can trigger undefined behavior if the core
> complex is reset while the harts are actively running. The sbi_printf
> in the reset handler effectively hides the problem by delaying the
> reset -- by the time sbi_printf finishes, all other harts will have
> already landed in the loop in sbi_hsm_hart_wait(), which parks the hart.
> Without the sbi_printf, I confirmed that other harts haven't reached
> sbi_hsm_hart_wait yet before current hart resets the SoC. (by debugging)
>
> To safely reset, and inspired by the datasheet, the warm reset logic
> in eic770x.c now use the current hart as both primary core and the
> "External Agent", and other harts as secondary cores. It leverages
> the HSM framework and a new eic770x_hsm device to CEASE other harts,
> and wait for them to CEASE before resets the SoC. with the sbi_printf
> before reset removed, and this logic in place, stress test shows that
> the memory corruption issue no longer occurs.
>
> The new eic770x_hsm device is only used for the reset-CEASE logic at
> the moment, and may be extended to a fully functional HSM device in
> the future.
>
> [1] https://github.com/eswincomputing/EIC7700X-SoC-Technical-Reference-Manual
>
> Fixes: e5797e0688c1 ("platform: generic: eswin: add EIC7700")
> Signed-off-by: Bo Gan <ganboing@gmail.com>
> ---
> platform/generic/eswin/eic770x.c | 118 +++++++++++++++++++++--
> platform/generic/eswin/hfp.c | 4 +-
> platform/generic/include/eswin/eic770x.h | 20 +++-
> 3 files changed, 126 insertions(+), 16 deletions(-)
>
> diff --git a/platform/generic/eswin/eic770x.c b/platform/generic/eswin/eic770x.c
> index 7330df9f..b5c128c6 100644
> --- a/platform/generic/eswin/eic770x.c
> +++ b/platform/generic/eswin/eic770x.c
> @@ -10,14 +10,109 @@
> #include <sbi/sbi_console.h>
> #include <sbi/sbi_system.h>
> #include <sbi/sbi_math.h>
> +#include <sbi/sbi_hsm.h>
> +#include <sbi/sbi_ipi.h>
> #include <sbi/sbi_hart_pmp.h>
> #include <sbi/sbi_hart_protection.h>
> +#include <sbi_utils/hsm/fdt_hsm_sifive_inst.h>
> #include <eswin/eic770x.h>
> #include <eswin/hfp.h>
[snip...]
>
> /* Memory Ports */
> #define EIC770X_MEMPORT_BASE 0x0080000000UL // 2G
> @@ -98,4 +105,7 @@ struct eic770x_board_override {
> divisor > 2 ? divisor : 2; \
> })
>
> +/* Reset definitions */
> +#define EIC770X_SYSRST_VAL 0x1AC0FFE6UL
> +
> #endif
> --
> 2.34.1
I had discussions with the SiFive hardware team. When resetting individual
CPU cores, it is indeed necessary to follow the power-down sequence
recommended in the SoC datasheet. However, writing 0x1AC0FFE6 to the
EIC770X_SYSCRG_SYSRST register resets the entire chip — including
CPU cores, DDR controller, NoC, etc.
Therefore, the issue described here should not occur.
In our local environment, we removed the sbi_printf function before reset,
but failed to reproduce the problem that Bo Gan encountered.
That said, regardless of this, I believe we should still follow the power-down
sequence described in the datasheet to ensure a safe reset.
This patch series looks good to me.
Regards,
Lin Min
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-06-15 2:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 7:57 [PATCH v2 0/2] Fix eic770x warm reset Bo Gan
2026-06-05 7:57 ` [PATCH v2 1/2] include: utils/hsm: Add __noreturn attribute for sifive_cease Bo Gan
2026-06-05 7:57 ` [PATCH v2 2/2] platform: generic: eswin: Add eic770x_hsm and fix warm reset issues Bo Gan
2026-06-15 2:10 ` Min Lin [this message]
2026-06-15 5:10 ` [PATCH v2 0/2] Fix eic770x warm reset Anup Patel
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=6033f09d.751a.19ec90bd390.Coremail.linmin@eswincomputing.com \
--to=linmin@eswincomputing.com \
--cc=ganboing@gmail.com \
--cc=gaohan@iscas.ac.cn \
--cc=me@ziyao.cc \
--cc=nick.hu@sifive.com \
--cc=opensbi@lists.infradead.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