From patchwork Thu Jun 6 09:17:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1944516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=B+YivzaH; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ChByTVAf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvzJN6Nm0z20Q8 for ; Thu, 6 Jun 2024 19:17:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PMOCCaFKtaAJcsjgTSNEKhSBuecRYFmFDPUG74p5ilQ=; b=B+YivzaH3Eapj8 +jNwJ+E2u+o9e4XpA+GzafTchZ8U7ci5mqLGYv3GfBH756YACc8200FCEHqpVDy49z54vqAtImrkw xrJCyGngfqjpd8HOl/s8iCRLoi6yOFyk7ejpatUO4cpBVXWTMDzvF1t9epqjEpDYZOT7yOQurpWZi BFboEvkCbp6GwftGOEZzqoC181WneyOJSFzRQikNHu+zRGkXxSYSmXEsqjm+vZRDhOtEgo5L2RILF uIa6MEhxV+FOZcJ7mrzmJ7+VfWuKFAFEFtg9HIybPBkCHf2IioaH4id1hoLbOMNRQy0r5vMcV3DIE TwpYrDG8YglQWoLLGZIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fh-000000095IL-3Yda; Thu, 06 Jun 2024 09:17:45 +0000 Received: from m16.mail.126.com ([220.197.31.9]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fd-000000095E7-3hLP for opensbi@lists.infradead.org; Thu, 06 Jun 2024 09:17:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=o8v1b aw2UjkvobpA2VlWIRtSiyj4fJWyRsZeTl7LOEs=; b=ChByTVAflCi67wS92vnsb K+ME0F3GhG00J/10KJeDO1OOeRaM81kIgiwbj8YCfzApeLlrmPeIcWWTLJVREZjv BcvWoSAuiVmwncGWzzxk/H5UkRJUkNV7fwSLsf1b97SyCTS3cWtQCHkNDVCRBbxh X/xly1dgb0K/2VYKLMaDGo= Received: from T490.lan (unknown [112.83.182.153]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wDXX8KnfmFmYexZBA--.59331S3; Thu, 06 Jun 2024 17:17:31 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org Subject: [PATCH 1/4] include: sbi_utils: fixup fdt_get_address Date: Thu, 6 Jun 2024 17:17:13 +0800 Message-ID: <20240606091723.896477-2-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606091723.896477-1-wxjstz@126.com> References: <20240606091723.896477-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDXX8KnfmFmYexZBA--.59331S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZF13tryruFWxtF4DKrWDtwb_yoW3tFgEv3 Z7Ca1jgrsrursF93WxKw1DtrsagrWrAF18WrySga9rAr4UGFyUuwsrArn3Zrs8Kw10kry7 ursxXryxJay8WjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRM0PfJUUUUU== X-Originating-IP: [112.83.182.153] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiFw71OmW-PqUonAABsi X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_021742_323735_3F85478C X-CRM114-Status: UNSURE ( 7.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: root.next_arg1 will be NULL before sbi_domain_init, which will cause fdt address to be NULL before sbi_domain is initialized. This patch fixes this. Signed-off-by: Xiang W --- include/sbi_utils/fdt/fdt_helper.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.197.31.9 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz(at)126.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org root.next_arg1 will be NULL before sbi_domain_init, which will cause fdt address to be NULL before sbi_domain is initialized. This patch fixes this. Signed-off-by: Xiang W --- include/sbi_utils/fdt/fdt_helper.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h index ab4a80f..67e6dc7 100644 --- a/include/sbi_utils/fdt/fdt_helper.h +++ b/include/sbi_utils/fdt/fdt_helper.h @@ -116,7 +116,9 @@ int fdt_parse_compat_addr(void *fdt, uint64_t *addr, static inline void *fdt_get_address(void) { - return (void *)root.next_arg1; + if (root.next_arg1) + return (void *)root.next_arg1; + return sbi_scratch_thishart_arg1_ptr(); } #endif /* __FDT_HELPER_H__ */ From patchwork Thu Jun 6 09:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1944517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HPU5kQji; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=daD3adln; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvzJP1K0Sz20Tl for ; Thu, 6 Jun 2024 19:17:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n8UDTUm2nscYTLjXyHpWfgQvRhTEtyQnjuVp9LFfeDk=; b=HPU5kQjiT8PqT/ vf+L/fekUw7bQa5N6UgaT8T0wRXtvpdPIJC+3kc/xK6zhUd382OERMI3zLdNodi/aj+7JKsjB5lml HwZM3pfqtYVD1lMsEGwrJhX5rU+ydfVDqXD9am+3SJGDwQxQTA7HZJFqaPs2rjDn3jmKhgv3u0JOY oKIS1Fb/l7SVVsL65kEfHN6fktFDPneYpgu7VMMG7rBW+YhmCW9hA+igjg0ZkZoIdeTEdt36I6mwc vJ7vVspv56jtHBS00DFXnPe0Tmu01wuS/U5Zulpj9ZsOlvN3bHY1VzxRTpr5Wi3nFTog/whKzbue5 KJW/vsnMJ6v+V+AKESMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fk-000000095Kj-14Qn; Thu, 06 Jun 2024 09:17:48 +0000 Received: from m16.mail.126.com ([220.197.31.6]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fe-000000095ER-0evs for opensbi@lists.infradead.org; Thu, 06 Jun 2024 09:17:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=tIUU4 98Y1eTV9G+CxzEPkvN13YemXhOQn1Kzj8EudSs=; b=daD3adlnHZpEWCAcsnq1k hj1toInEFSR5tOLb6o1295RZidmC+2aCnEw2pvxPwxDqxq+tzMIDyE71cOcSfgTE hKCTanqhjbLCAZPbh+b8jiObQV5BcXuERvzLAI9Wy+KeZy83uIyTxhE/ZXwKqn1V CFHbuslxnPbLj0k8r8wzFQ= Received: from T490.lan (unknown [112.83.182.153]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wDXX8KnfmFmYexZBA--.59331S4; Thu, 06 Jun 2024 17:17:31 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org Subject: [PATCH 2/4] lib: sbi: Add domains_init to sbi_console_device Date: Thu, 6 Jun 2024 17:17:14 +0800 Message-ID: <20240606091723.896477-3-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606091723.896477-1-wxjstz@126.com> References: <20240606091723.896477-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDXX8KnfmFmYexZBA--.59331S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7WryfKFWUuF4UAF4rAFyDGFg_yoW8XFWxpF 1DJFsxJ3y0gr1Sv3s8Cw10qryrK3ykt3W2k3sxCw1Iv3Z7Ar4kuw1rXw15u3y3AF40y3Wj yFy7AF4DuF15XFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pE-tx-UUUUU= X-Originating-IP: [112.83.182.153] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiFw71OmW-PqUonAAAsj X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_021742_633543_E228362D X-CRM114-Status: GOOD ( 10.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: To initialize the console before the domain is initialized, an interface needs to be reserved for adding the mem region to the root domain after the console is initialized. Signed-off-by: Xiang W --- include/sbi/sbi_console.h | 3 +++ lib/sbi/sbi_domain.c | 10 ++++++++++ 2 files changed, 13 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.197.31.6 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz(at)126.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org To initialize the console before the domain is initialized, an interface needs to be reserved for adding the mem region to the root domain after the console is initialized. Signed-off-by: Xiang W --- include/sbi/sbi_console.h | 3 +++ lib/sbi/sbi_domain.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/sbi/sbi_console.h b/include/sbi/sbi_console.h index 0979765..5c7eae7 100644 --- a/include/sbi/sbi_console.h +++ b/include/sbi/sbi_console.h @@ -24,6 +24,9 @@ struct sbi_console_device { /** Read a character from the console input */ int (*console_getc)(void); + + /* This function is used to add memregion to the root domain. */ + int (*domains_init)(void); }; #define __printf(a, b) __attribute__((format(printf, a, b))) diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 374ac36..eb392b7 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -696,6 +696,16 @@ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid) struct sbi_domain *dom; const struct sbi_platform *plat = sbi_platform_ptr(scratch); + /* Initialize and populate domains for the console */ + if (sbi_console_get_device()->domains_init) { + rc = sbi_console_get_device()->domains_init(); + if (rc) { + sbi_printf("%s: console domains_init() failed (error %d)\n", + __func__, rc); + return rc; + } + } + /* Initialize and populate domains for the platform */ rc = sbi_platform_domains_init(plat); if (rc) { From patchwork Thu Jun 6 09:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1944518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RC3T1GFn; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=TwWnV3Y4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvzJQ2fVsz20Q5 for ; Thu, 6 Jun 2024 19:17:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wPqHEcslCdFair9/HYEoyGBBBl3sgHC9zmbEQM5n4R0=; b=RC3T1GFn9bCm9c J7DpHyydo2p6vXT7nCX+M9WRcfOl3cC3zlv8hph7khE3L3aiwBbIEdA/idC0fqXAuhny6ld98Mcqi gF+TjA9A3xS8druFPohjdN4Wy8TaKy4ySFK9O93xUK8bWZ8n6J5CfVWMbq5m/jJxsEtFmSd+mqyzP GP+2TdYVBYZYBqGEHOS4uEpjnNe2c1KelU/phAUgkcCANGcPzR1hZBMypDfKLvyGJHElFbMp8+pZZ x3UxYioZ0axParPIv2480/plnhZiZN3mBbVGCXv9gXJQXhAlTNfWJihET7D8MPp0MKoLBlG4scqkD z4k8+CzdJ22cMV/kAeiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fj-000000095Jh-2317; Thu, 06 Jun 2024 09:17:47 +0000 Received: from m16.mail.126.com ([220.197.31.7]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fe-000000095EP-2SBH for opensbi@lists.infradead.org; Thu, 06 Jun 2024 09:17:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=/SvNc wmaKEmYqi17GGITFsFMtVHHN7r/MTc2aWkxySs=; b=TwWnV3Y4FfXtC+dualyvj RTd+K+rtJGaD88Z4TszZ7apaU2s3Uh0oNFBfgKTrg6kpaFf5bvsUOBy9Ibx9JSiY DJYegOykNPAGM8Bb+o/XFZrfhmwyWi8zI/dIvVk2rXfuKG6YL3eIl5krayE/8Yw+ MJnEaSmIp7jzh25qUDIe+4= Received: from T490.lan (unknown [112.83.182.153]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wDXX8KnfmFmYexZBA--.59331S5; Thu, 06 Jun 2024 17:17:31 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org Subject: [PATCH 3/4] lib: utils/serial: add domains_init for 8250 Date: Thu, 6 Jun 2024 17:17:15 +0800 Message-ID: <20240606091723.896477-4-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606091723.896477-1-wxjstz@126.com> References: <20240606091723.896477-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDXX8KnfmFmYexZBA--.59331S5 X-Coremail-Antispam: 1Uf129KBjvJXoWxCFy5CFy3Aw17AryUGry3urg_yoW5Gr4rpF yDKFsxJFWUtFyxu3Z3Jr4vqr1rW3Z7uw1UKFnFkrsF9a1DZrWxXFW5J34Yyw4jq3yqyF43 ZFykJrWDA3W8Wr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zEt8n5UUUUU= X-Originating-IP: [112.83.182.153] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiIQ71OmVLaJOfGAAAsy X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_021743_012442_DFAC941F X-CRM114-Status: GOOD ( 10.21 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 8250 needs to add memregion to root_domain. Move this part of operation to sbi_console_device.domains_init Signed-off-by: Xiang W --- include/sbi_utils/serial/uart8250.h | 1 + lib/utils/serial/uart8250.c | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.197.31.7 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz(at)126.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 8250 needs to add memregion to root_domain. Move this part of operation to sbi_console_device.domains_init Signed-off-by: Xiang W --- include/sbi_utils/serial/uart8250.h | 1 + lib/utils/serial/uart8250.c | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/sbi_utils/serial/uart8250.h b/include/sbi_utils/serial/uart8250.h index be9483a..0949b96 100644 --- a/include/sbi_utils/serial/uart8250.h +++ b/include/sbi_utils/serial/uart8250.h @@ -18,6 +18,7 @@ struct uart8250_device { u32 baudrate; u32 reg_shift; u32 reg_width; + u32 reg_offset; }; void uart8250_putc(struct uart8250_device *dev, char ch); diff --git a/lib/utils/serial/uart8250.c b/lib/utils/serial/uart8250.c index db35ec3..754548f 100644 --- a/lib/utils/serial/uart8250.c +++ b/lib/utils/serial/uart8250.c @@ -92,10 +92,21 @@ static int uart8250_console_getc(void) return uart8250_getc(&console_dev); } +static int uart8250_domains_init(void) +{ + unsigned long base = (unsigned long)console_dev.base + - console_dev.reg_offset; + + return sbi_domain_root_add_memrange(base, PAGE_SIZE, PAGE_SIZE, + (SBI_DOMAIN_MEMREGION_MMIO | + SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW)); +} + static struct sbi_console_device uart8250_console = { .name = "uart8250", .console_putc = uart8250_console_putc, - .console_getc = uart8250_console_getc + .console_getc = uart8250_console_getc, + .domains_init = uart8250_domains_init }; int uart8250_init(struct uart8250_device * dev, unsigned long base, u32 in_freq, @@ -103,11 +114,12 @@ int uart8250_init(struct uart8250_device * dev, unsigned long base, u32 in_freq, { u16 bdiv = 0; - dev->base = (volatile char *)base + reg_offset; - dev->reg_shift = reg_shift; - dev->reg_width = reg_width; - dev->in_freq = in_freq; - dev->baudrate = baudrate; + dev->base = (volatile char *)base + reg_offset; + dev->reg_offset = reg_offset; + dev->reg_shift = reg_shift; + dev->reg_width = reg_width; + dev->in_freq = in_freq; + dev->baudrate = baudrate; if (baudrate) bdiv = (in_freq + 8 * baudrate) / (16 * baudrate); @@ -147,7 +159,5 @@ int uart8250_console_init(unsigned long base, u32 in_freq, u32 baudrate, u32 reg sbi_console_set_device(&uart8250_console); - return sbi_domain_root_add_memrange(base, PAGE_SIZE, PAGE_SIZE, - (SBI_DOMAIN_MEMREGION_MMIO | - SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW)); + return 0; } From patchwork Thu Jun 6 09:17:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1944515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xqLdSKgZ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=luqwJr7N; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvzJM4wWqz20Q5 for ; Thu, 6 Jun 2024 19:17:55 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VGvz8ONeOfDKUeBokbaU/cXlmgG78ruyV+8HMlZh2CM=; b=xqLdSKgZgEzv9s 5jTdYGBXTZFjF9EXg4IXfDksW8VN2B/jc3G4MePLcyfDBUjtKKNAQP/kUablnIiS0Ygdu1xjdEESz XXGHRI9Y/+YpyuSbMDR/vtoTI+4bkTTkuhWeaWHtVWNuve+w/qVYtgY/4iEPqg5YWpuqvRZmzCQpk ywJgGJOVGQilyN2cy9OaCZm47tTYFP+eiGDlx+u1vK1vSgMvpwPT+AcrJKyrlcaMkFyerC4hY/cgO L7UyBpuMaNQ72qYUBEEnDqk4gRVuPU/c3JzO5XZsjZEIGbzocaaNFLQAUc5hU4wmeQQB+YiEDDovl u1VJHjMjpYlEnTdYxN3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fi-000000095JM-3v9H; Thu, 06 Jun 2024 09:17:46 +0000 Received: from m16.mail.126.com ([220.197.31.6]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sF9Fd-000000095EG-3iXK for opensbi@lists.infradead.org; Thu, 06 Jun 2024 09:17:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=Ps3lI DwrurY4P23Jj7I/Mf0BnEIOwP0gZONp8/Ne0LY=; b=luqwJr7N5M9uQ0dka6iht cAM+Bz8+MwLqN/CUzjdt2dwj3KOWfQqzUR8A1njLrNf9eCyYC7pjWvniy/uub4EI SiFYFYAOJ+9h4iE6SGYf1jTrGbOx08q+J5ojws34aRjn6mZUR/rTeUE8MnMWfyU5 N8RYCmQ5ucsr27g/+XuZnk= Received: from T490.lan (unknown [112.83.182.153]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wDXX8KnfmFmYexZBA--.59331S6; Thu, 06 Jun 2024 17:17:32 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org Subject: [PATCH 4/4] lib: sbi: Initialize the console as early as possible Date: Thu, 6 Jun 2024 17:17:16 +0800 Message-ID: <20240606091723.896477-5-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240606091723.896477-1-wxjstz@126.com> References: <20240606091723.896477-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wDXX8KnfmFmYexZBA--.59331S6 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr1fAFW7tF4rtw17Gw1xZrb_yoWDuwb_Zr ykuwnFg39xWr4kX3Wjkr45JrW09rs3ta18XF12qFs8Aw1xCrWUJFyUtr9I93W8WrW0yFW7 WanrZrWxAr1YgjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRNvtC7UUUUU== X-Originating-IP: [112.83.182.153] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiFxD1OmW-PqUovgAAsf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_021742_345057_C8D50DD3 X-CRM114-Status: UNSURE ( 7.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Move console initialization to the front of init_coldboot so that more information can be output Signed-off-by: Xiang W --- lib/sbi/sbi_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.197.31.6 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz(at)126.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Move console initialization to the front of init_coldboot so that more information can be output Signed-off-by: Xiang W --- lib/sbi/sbi_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 389172a..b14cd03 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -214,6 +214,10 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) unsigned long *count; const struct sbi_platform *plat = sbi_platform_ptr(scratch); + rc = sbi_console_init(scratch); + if (rc) + sbi_hart_hang(); + /* Note: This has to be first thing in coldboot init sequence */ rc = sbi_scratch_init(scratch); if (rc) @@ -260,10 +264,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) if (rc) sbi_hart_hang(); - rc = sbi_console_init(scratch); - if (rc) - sbi_hart_hang(); - rc = sbi_sse_init(scratch, true); if (rc) { sbi_printf("%s: sse init failed (error %d)\n", __func__, rc);