[PATCH v2 0/5] Initial ESWIN/EIC7700 support

Bo Gan
2025-11-17T05:50:42Z

EIC7700 is the SoC used in HiFive P550 and Milk-V Megrez. This SoC is
currently one of the only off-the-shelf board/chips that support H
extension, although it's v0.6.1. It also supports pre-ratified N-trace.
Add support for it so people can benefit from latest OpenSBI features.

The device-tree of HiFive P550 has been upstreamed to Linux:
https://lore.kernel.org/all/20250825132427.1618089-1-pinkesh.vaghela@einfochips.com/
However U-boot is not, and there are bugs in vendor U-boot device-tree,
and also inconsistencies between the two. Thus, this patch is coded with
the upstreamed device-tree as the reference, but tested with the patched
vendor U-boot device tree as `FW_FDT_PATH`. The patched vendor U-boot is
hosted here: https://github.com/ganboing/u-boot-eic7x/tree/eic7x-dt-fix
Refer to PATCH 5/5 for the instructions on building the firmware blob
and launch it through UART boot.

The major complication of this chip is that it requires certain memory
regions to be blocked with PMP entries to prevent speculative execution
or HW prefetcher from touching them to avoid bus errors. Also due to the
fact that this SoC handles cache incoherent DMA by mapping memory twice,
one as cached, and the other as uncached, we also need an extra PMP to
protect the OpenSBI in the uncached portion in address space. Following
changes are made to lib/ and firmware/ to make it possible:

- Allow platform to override pmp_(un)configure
- Add helper function for settings PMP TOR
- Add helper function to check if memregions are disjoint
- Introduce FIRMWARE_PACKED_RXRW for disabling power-of-2 RW split

The defconfig of EIC770X is separated out, because it has to require
CONFIG_FIRMWARE_PACKED_RXRW to not run out of PMP entries. It'll
change the layout of firmware sections to not power-of-2 align the
RW sections, so do not by default enable this for other platforms.

Signed-off-by: Bo Gan <ganboing@gmail.com>
---
Changes in v2:
- Major enhancement of PMP consolidation logic. Also fixed a Linux
Panic bug due to the mismatch between PMP settings and reserved
memory regions passed to Linux via FDT.
- Also protects the OpenSBI firmware in uncached memory portion of
address space.
- More detailed documentation on EIC770X/P550

---
Bo Gan (5):
lib: sbi: allow platform to override PMP configuration
lib: sbi: Add __pmp_set_tor for setting TOR regions
firmware: add CONFIG_FIRMWARE_PACKED_RXRW
include: sbi: Add helpers for sbi_domain_memregion
platform: generic: eswin: add EIC7700

firmware/Kconfig | 11 +
firmware/fw_base.ldS | 14 +-
include/sbi/riscv_asm.h | 7 +
include/sbi/sbi_domain.h | 23 ++
include/sbi/sbi_hart.h | 9 +
include/sbi/sbi_platform.h | 53 +++
lib/sbi/riscv_asm.c | 75 ++++-
lib/sbi/sbi_domain.c | 11 +
lib/sbi/sbi_domain_context.c | 11 +-
lib/sbi/sbi_hart.c | 97 ++++--
platform/generic/Kconfig | 6 +
platform/generic/configs/eic770x_defconfig | 28 ++
platform/generic/eswin/Kconfig | 29 ++
platform/generic/eswin/eic770x.c | 361 +++++++++++++++++++++
platform/generic/eswin/objects.mk | 11 +
platform/generic/include/eswin/eic770x.h | 66 ++++
16 files changed, 752 insertions(+), 60 deletions(-)
create mode 100644 platform/generic/configs/eic770x_defconfig
create mode 100644 platform/generic/eswin/Kconfig
create mode 100644 platform/generic/eswin/eic770x.c
create mode 100644 platform/generic/eswin/objects.mk
create mode 100644 platform/generic/include/eswin/eic770x.h