{"id":2175503,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2175503/?format=json","project":{"id":67,"url":"http://patchwork.ozlabs.org/api/1.0/projects/67/?format=json","name":"OpenSBI development","link_name":"opensbi","list_id":"opensbi.lists.infradead.org","list_email":"opensbi@lists.infradead.org","web_url":"https://github.com/riscv/opensbi","scm_url":"","webscm_url":""},"msgid":"<20251218104243.562667-1-ganboing@gmail.com>","date":"2025-12-18T10:42:36","name":"[v6,0/7] Initial ESWIN/EIC7700 and Hifive P550 support","submitter":{"id":86401,"url":"http://patchwork.ozlabs.org/api/1.0/people/86401/?format=json","name":"Bo Gan","email":"ganboing@gmail.com"},"series":[{"id":485819,"url":"http://patchwork.ozlabs.org/api/1.0/series/485819/?format=json","date":"2025-12-18T10:42:37","name":"Initial ESWIN/EIC7700 and Hifive P550 support","version":6,"mbox":"http://patchwork.ozlabs.org/series/485819/mbox/"}],"headers":{"Return-Path":"\n <opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Md7Ggxn/;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=WglvQ9S5;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dX6kJ1s9hz1y3k\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 21:44:56 +1100 (AEDT)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vWBUy-00000008Fg5-18wz;\n\tThu, 18 Dec 2025 10:44:44 +0000","from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vWBUv-00000008Fei-3bV5\n\tfor opensbi@lists.infradead.org;\n\tThu, 18 Dec 2025 10:44:43 +0000","by mail-pf1-x42b.google.com with SMTP id\n d2e1a72fcca58-7bb710d1d1dso878098b3a.1\n        for <opensbi@lists.infradead.org>;\n Thu, 18 Dec 2025 02:44:41 -0800 (PST)","from m91p.airy.home ([172.92.174.155])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-7fe11d3e004sm2264795b3a.15.2025.12.18.02.44.38\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Thu, 18 Dec 2025 02:44:39 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc\n\t:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:\n\tList-Owner; bh=PmvRfYRKoF3rCmLX09LCPgP+APEiAgkKzCAuvEJIB18=; b=Md7Ggxn/Z9EEBR\n\tybxbwR2VYZLpnJABA/a5vcRzeDMP6w8EO+mOnUB+20SK0uaWTXCwiGUCBrcFuN4gf/nL98kFvGXCj\n\tI5McIpmnyus1+Do3U5EKGclgMP9s0bilLfzKF7R0bt+Wx/0V5nMSy/sYaC121pW/wUEQUy75KMUlw\n\t+U0lGvIh5TfjeCrGmzDcge4/CQ5oTH20ofjpjmO4ZuXZuSZj681GLjSOZzsloUYBAoEa/JEAznDCO\n\tll5lz8Wjo0N7yWI81f4VoAu7EN26xAlHN+itA5Q+rWq73akK081P0aXfO/rWB3UKS+ez/gfgRK1S8\n\t35s8uHKiAr7ZqulGcNzg==;","v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20230601; t=1766054680; x=1766659480;\n darn=lists.infradead.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=d4VqOP/SYUCx3OYhGsyqOsjnuVB6Ilh37MKOZhLWWFI=;\n        b=WglvQ9S51W5J27/4TA9T9VAIAQm7qIUC+edH7wMkpiYHnjEVmfJiHVhLm5fDVocYQg\n         6pAv7vLcqSVMyPn3+vtPl+4WXzPK5HcRgDtq0JR7P168HJdFXOfRHczjfm8GP2ghK1TZ\n         PCsccTho43RyqvZxDr6Rjs6ZqRurJB1qxiuG0bIZRxSprunWxnmyKvjZHCWPV5imRWYr\n         UofmWe+ivE7StxERZqibGo+qZ57Yfk61+pAZGrv6OvCWyFplggJTiJeGvTpTnCDs6sN0\n         xOhIW2WzJnuZJKxDmlmnzaIcqVrukg1OUsZf+j/efxTRe0haSaGqYvv/TAh4QA0qthk7\n         MV3Q=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20230601; t=1766054680; x=1766659480;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=d4VqOP/SYUCx3OYhGsyqOsjnuVB6Ilh37MKOZhLWWFI=;\n        b=vd2nyXXfRX6icTUbWwaKKjfeeo36iNfGJkqVwJex1RF733HqpTYmM/jXVEbTNnV07R\n         V8bPmxjk9SZVoIbPsTHroCdj2BD8ruv/8jsMpQPirbaU+3v6QGiE8Gvzg6fKwa9IQqVn\n         sGo3MaYISKQn2T/VJGLyex1vjMab0yZqw2icqoEoFKt/EVtpts9u0N0TMDtTzKRf8R0A\n         mlez81m6hZF3KDFAHQ3AaLIjxOf5LYMHgBX8lyRHuIpKr7zoPdwveC+ZB4brGaHGlVK/\n         dEwX1jX0YQnLB4mtDrqTHWfge66Z9hkHipNU19rppA9rNZg4Z/+3ww31NRoOLn++bM0X\n         gEVg==","X-Gm-Message-State":"AOJu0YzHcVKsxC/PXSHBITI90GPJ8WRRB2/QEM31aVZihVZ1TtxhDmFm\n\tQFYylL2j7oACN7sDPC0zw0pgzeqxKSLhg/+H+M+XH+jsdoJwErWxDROfuiB0BA==","X-Gm-Gg":"AY/fxX4N0buiKovRGIIL0qVjecO8b7ljWwu+YiRqsDgyyhgzn8I1XPGlD5UfrXmELK8\n\tLjZre82ImcDL/IotGkJ1Vuz6iL6Ne3ej8UFh5jmV21LLDWxF24XMCseGgkN9BxtzUSLWCYQRKTj\n\trMdbKaqiRYMmAw43tYj+EWqHbTtpvLQ3vb4zKaIg27yUXYGD3uc4sT1WUArItrl3OZa7OdDKNRP\n\tOKVcX0eE42K/WG1gCcR+hXQkFsQm8QDEmou11/kAo9KPiUBxC9dECooxChNeD2u6lWPCj+9Usjb\n\trkABOg0MsH2xvlg1afPPBGCfbLIX93PK4Qfh1z4d5VJt0o4skFAQ566zF/DbGmPP/M6JpWyOcM1\n\t1Qf+ZeNUfakcC/2kzaaVpk0veXdvmkY++sVdiIbhnzBkUMrrE3TBMQReSsjJ6BSK4uUo/KX/rTz\n\txThu99P0cWXGhn","X-Google-Smtp-Source":"\n AGHT+IEAG9Hip3CLUWQQwUXHJFp/hP7domf82pLUgozl6YXVgVrrGLPYwJOG53v79EF583Yl66KcDA==","X-Received":"by 2002:a05:6a00:4c13:b0:7e8:450c:61a6 with SMTP id\n d2e1a72fcca58-7f669c8af30mr20153862b3a.61.1766054679764;\n        Thu, 18 Dec 2025 02:44:39 -0800 (PST)","From":"Bo Gan <ganboing@gmail.com>","To":"opensbi@lists.infradead.org","Cc":"linmin@eswincomputing.com,\n\tpinkesh.vaghela@einfochips.com,\n\tgaohan@iscas.ac.cn,\n\tsamuel@sholland.org,\n\twangxiang@iscas.ac.cn","Subject":"[PATCH v6 0/7] Initial ESWIN/EIC7700 and Hifive P550 support","Date":"Thu, 18 Dec 2025 02:42:36 -0800","Message-Id":"<20251218104243.562667-1-ganboing@gmail.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20251218_024441_904635_7B7154EB ","X-CRM114-Status":"GOOD (  18.44  )","X-Spam-Score":"-2.1 (--)","X-Spam-Report":"Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  EIC7700 is the SoC used in HiFive P550 and Milk-V Megrez.\n   This SoC is currently one of the only off-the-shelf board/chips that\n support\n    H extension, although it's v0.6.1. It also supports pre-ratified [...]\n Content analysis details:   (-2.1 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/, no\n                             trust\n                             [2607:f8b0:4864:20:0:0:0:42b listed in]\n                             [list.dnswl.org]\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail\n provider\n                             [ganboing(at)gmail.com]","X-BeenThere":"opensbi@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"<opensbi.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/opensbi/>","List-Post":"<mailto:opensbi@lists.infradead.org>","List-Help":"<mailto:opensbi-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"opensbi\" <opensbi-bounces@lists.infradead.org>","Errors-To":"opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"EIC7700 is the SoC used in HiFive P550 and Milk-V Megrez. This SoC is\ncurrently one of the only off-the-shelf board/chips that support H\nextension, although it's v0.6.1. It also supports pre-ratified N-trace.\nAdd support for it so people can benefit from latest OpenSBI features.\n\nThe device-tree of HiFive P550 has been upstreamed to Linux:\nhttps://lore.kernel.org/all/20250825132427.1618089-1-pinkesh.vaghela@einfochips.com/\nHowever U-boot is not, and there are bugs in vendor U-boot device-tree,\nand also inconsistencies between the two. Thus, this patch is coded with\nthe upstreamed device-tree as the reference, but tested with the patched\nvendor U-boot device tree as `FW_FDT_PATH`. The patched vendor U-boot is\nhosted here: https://github.com/ganboing/u-boot-eic7x/tree/eic7x-dt-fix\nRefer to the last PATCH for the instructions on building the firmware\nblob and launch it through UART boot.\n\nThe major complication of this chip is that it requires certain memory\nregions to be blocked with PMP entries to prevent speculative execution\nor HW prefetcher from touching the data-cacheable regions within to\navoid bus errors. Due to the fact that this SoC handles cache incoherent\nDMA by mapping memory twice, one as cached, and the other as uncached,\nwe also need an extra PMP to protect the OpenSBI in the uncached portion\nin address space. The PMP handling is tricky, so I documented it very\nextensively for people to reason about it. I managed to get it done with\nonly NAPOT PMP entries and still got 1 free PMP for root harts for die 0\n(No free PMP for die 1 root harts). This even permits a udomain/tdomain\nlike partitioning, so we can even try out TEEs. Sample boot log:\n\nOpenSBI v1.7-95-g68b64d77\nBuild time: 2025-12-17 05:08:58 -0800\nBuild compiler: gcc version 13.2.0 (gc891d8dc23e-dirty)\n   ____                    _____ ____ _____\n  / __ \\                  / ____|  _ \\_   _|\n | |  | |_ __   ___ _ __ | (___ | |_) || |\n | |  | | '_ \\ / _ \\ '_ \\ \\___ \\|  _ < | |\n | |__| | |_) |  __/ | | |____) | |_) || |_\n  \\____/| .__/ \\___|_| |_|_____/|____/_____|\n        | |\n        |_|\n\nPlatform Name               : SiFive HiFive Premier P550\nPlatform Features           : medeleg\nPlatform HART Count         : 4\nPlatform HART Protection    : eic7700_pmp\nPlatform IPI Device         : aclint-mswi\nPlatform Timer Device       : aclint-mtimer @ 1000000Hz\nPlatform Console Device     : uart8250\nPlatform HSM Device         : ---\nPlatform PMU Device         : ---\nPlatform Reboot Device      : hfp_reset\nPlatform Shutdown Device    : hfp_reset\nPlatform Suspend Device     : ---\nPlatform CPPC Device        : ---\nFirmware Base               : 0x80000000\nFirmware Size               : 357 KB\nFirmware RW Offset          : 0x40000\nFirmware RW Size            : 101 KB\nFirmware Heap Offset        : 0x4d000\nFirmware Heap Size          : 49 KB (total), 0 KB (reserved), 13 KB (used), 35 KB (free)\nFirmware Scratch Size       : 4096 B (total), 424 B (used), 3672 B (free)\nRuntime SBI Version         : 3.0\nStandard SBI Extensions     : time,rfnc,ipi,base,hsm,srst,pmu,dbcn,fwft,legacy,dbtr,sse\nExperimental SBI Extensions : none\n\nDomain0 Name                : root\nDomain0 Boot HART           : 3\nDomain0 HARTs               : 0*,1*,2*,3*\nDomain0 Region00            : 0x0000000080000000-0x000000008007ffff M: (F,R,W,X) S/U: ()\nDomain0 Region01            : 0x000000c000000000-0x000000c00007ffff M: (I,F,R,W,X) S/U: ()\nDomain0 Region02            : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()\nDomain0 Region03            : 0x0000000000000000-0x000000007fffffff M: (I,R,W) S/U: (R,W)\nDomain0 Region04            : 0x0000000000000000-0x0000000fffffffff M: (R,W) S/U: (R,W,X)\nDomain0 Region05            : 0x0000000000000000-0x0000007fffffffff M: (I) S/U: ()\nDomain0 Region06            : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X)\nDomain0 Next Address        : 0x0000000080200000\nDomain0 Next Arg1           : 0x00000000f8000000\nDomain0 Next Mode           : S-mode\nDomain0 SysReset            : yes\nDomain0 SysSuspend          : yes\n\nBoot HART ID                : 3\nBoot HART Domain            : root\nBoot HART Priv Version      : v1.11\nBoot HART Base ISA          : rv64imafdchx\nBoot HART ISA Extensions    : sscofpmf,zihpm,sdtrig\nBoot HART PMP Count         : 8\nBoot HART PMP Granularity   : 12 bits\nBoot HART PMP Address Bits  : 39\nBoot HART MHPM Info         : 4 (0x00000078)\nBoot HART Debug Triggers    : 4 triggers\nBoot HART MIDELEG           : 0x0000000000002666\nBoot HART MEDELEG           : 0x0000000000f0b509\n\nSigned-off-by: Bo Gan <ganboing@gmail.com>\n---\nChanges in v6:\n- Fix CPU_DIE_MASK macro\n- Make eic770x build on rv64 only to fix rv32 build error.\n- I'm still waiting for ESWIN's reply on the reset memory corruption\n  issue, but I stress tested the P550 board warm reset overnight,\n  and can confirm the extra sbi_printf indeed mitigated the problem.\n\nChanges in v5:\n- Add Hifive P550 shutdown/reboot support.\n- Add a sbi_printf() just before SoC reset to workaround flaky\n  memory corruption issue after reset. This issue has been reported\n  to ESWIN, and it's been reproduced with their vendor OpenSBI code.\n  ESWIN's actively investigating it.\n\nChanges in v4:\n- Adapt to the hart protection abstraction.\n  Also make use of sbi_hart_pmp_fence for correctness.\n- Specify MMIO flag for the uncached mapping of OpenSBI.\n  It'll avoid adding an extraneous reserved memory region in FDT for S mode.\n\nChanges in v3:\n- Figure out the cause behind bus error, and document it properly\n- Drop the consolidation logic and let the lib/memregion logic to\n  optimize out unnecessary regions -- simplifies many things.\n- Better and more comprehensive comments in source code.\n- Support tdomain/udomain like use cases on die 0.\n\nChanges in v2:\n- Major enhancement of PMP consolidation logic. Also fixed a Linux\n  Panic bug due to the mismatch between PMP settings and reserved\n  memory regions passed to Linux via FDT.\n- Also protects the OpenSBI firmware in uncached memory portion of\n  address space.\n- More detailed documentation on EIC770X/P550\n\n---\nBo Gan (7):\n  lib: sbi_hart_pmp: make sbi_hart_pmp_fence public\n  lib: sbi_domain: add sbi_domain_get_oldpmp_flags\n  lib: sbi_domain: make is_region_subset public\n  lib: sbi: give platform choice of using single memregion to cover\n    OpenSBI\n  platform: generic: eswin: add EIC7700\n  lib: utils/serial: Support multiple UART8250 devices\n  platform: generic: eswin: Add shutdown/reboot support for Hifive\n    Premier P550\n\n include/sbi/sbi_domain.h                 |  29 ++\n include/sbi/sbi_hart_pmp.h               |   1 +\n include/sbi/sbi_platform.h               |  21 ++\n include/sbi_utils/serial/uart8250.h      |  16 +\n lib/sbi/sbi_domain.c                     |  81 +++--\n lib/sbi/sbi_hart_pmp.c                   |  19 +-\n lib/utils/serial/uart8250.c              | 104 +++---\n platform/generic/Kconfig                 |   5 +\n platform/generic/configs/defconfig       |   1 +\n platform/generic/eswin/Kconfig           |  29 ++\n platform/generic/eswin/eic770x.c         | 405 +++++++++++++++++++++++\n platform/generic/eswin/hfp.c             | 118 +++++++\n platform/generic/eswin/objects.mk        |  11 +\n platform/generic/include/eswin/eic770x.h | 101 ++++++\n platform/generic/include/eswin/hfp.h     |  64 ++++\n 15 files changed, 911 insertions(+), 94 deletions(-)\n create mode 100644 platform/generic/eswin/Kconfig\n create mode 100644 platform/generic/eswin/eic770x.c\n create mode 100644 platform/generic/eswin/hfp.c\n create mode 100644 platform/generic/eswin/objects.mk\n create mode 100644 platform/generic/include/eswin/eic770x.h\n create mode 100644 platform/generic/include/eswin/hfp.h"}