From patchwork Fri Jun 28 08:24:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-Chien Peter Lin X-Patchwork-Id: 1953834 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=YyHYtyec; 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 4W9T5T4j5Qz20Xf for ; Fri, 28 Jun 2024 18:25:17 +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: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:In-Reply-To:References: List-Owner; bh=li+DBAb97tU+LW/FBgBLNa9rMbWb5dFNepmXdRRXy0U=; b=YyHYtyecG0+X+/ iqcpkrONUE45N0LCM1qmTFHz3Yv1k5+miHbAcjr724OF9BcGYPbUOQdKy0LYaQnxUjsBhdSjfulc3 OpAMUVrxRFcjXqHTJcN8WQfsWa7pXM7yNezs/ZkLop3i1I94NrK3Bs/lk1T5LMlxIJ0kb2yufrZTn wlBdVsE3DPIGgmFbLkNPjoVm2awUdHfU7NcO1w4tmQ9go3cxx4mLVE0ha1lyFH+cuejlkobIKz6qW yB7jCVF0E5zeAUFPr04iP7zonRXjDy592ZWGkz25sPerLmlyW9wsporyGizCSThXt20Tn9i/WY5NI UCqabu0Gi2rHFsNoMoqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sN6ur-0000000D3tE-2YwU; Fri, 28 Jun 2024 08:25:09 +0000 Received: from 60-248-80-70.hinet-ip.hinet.net ([60.248.80.70] helo=Atcsqr.andestech.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sN6uo-0000000D3sJ-24Nx for opensbi@lists.infradead.org; Fri, 28 Jun 2024 08:25:08 +0000 Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTP id 45S8Olsv015762; Fri, 28 Jun 2024 16:24:47 +0800 (+08) (envelope-from peterlin@andestech.com) Received: from swlinux02.andestech.com (10.0.15.183) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 28 Jun 2024 16:24:48 +0800 From: Yu Chien Peter Lin To: CC: , , , "Yu Chien Peter Lin" , Alvin Chang Subject: [RFC PATCH] lib: utils: fdt_domain: Use consistent device-tree address when next-arg1 is missing Date: Fri, 28 Jun 2024 16:24:39 +0800 Message-ID: <20240628082439.2873497-1-peterlin@andestech.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.0.15.183] X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 45S8Olsv015762 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_012506_832809_0FC79669 X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: 0.4 (/) 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: The diagram shows the boot-flow involving OP-TEE OS initialization: (1)+ | U-Boot SPL | ++ | v (2)+ | OpenSBI (fw_dynamic) | | (4)+ | | | optee dispatcher driv [...] Content analysis details: (0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 TVD_RCVD_IP Message was received from an IP address 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 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 The diagram shows the boot-flow involving OP-TEE OS initialization: (1)-----------+ | U-Boot SPL | +------------+ | v (2)-------------------------------------------------------------+ | OpenSBI (fw_dynamic) | | (4)------------------------+ | | | optee dispatcher driver | | +-----------------+-------^---------|-------+------------------+ M-mode | (coldboot domain) | | ---------+--(trusted domain)---+----+----+-(untrusted domain)-------- S-mode | | | | v | | v (3)---------------------------+ |(5)----------------------------+ | OP-TEE OS | | | U-Boot | +----------------------------+ | +-----------------------------+ | | | v |(6)----------------------------+ | | Linux | | +-----------------------------+ As OP-TEE OS has device-tree node fixups that need to be passed through the next boot stages, such as reserved memory node shown below: reserved-memory { #address-cells = <0x00000002>; #size-cells = <0x00000002>; ranges; optee_core@f1000000 { no-map; reg = <0x00000000 0xf1000000 // OP-TEE OS base address 0x00000000 0x01000000>; }; <...> }; Instead of using 0x0 as default value, allow identical next-arg1 to be used by non-coldboot domain (i.e., untrusted domain), when the next-arg1 is not provided. Also, update the document about next-arg1 of domain instance. Signed-off-by: Yu Chien Peter Lin Reviewed-by: Alvin Chang Reviewed-by: Anup Patel --- docs/domain_support.md | 4 +--- lib/utils/fdt/fdt_domain.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/domain_support.md b/docs/domain_support.md index b34e43a..1a40068 100644 --- a/docs/domain_support.md +++ b/docs/domain_support.md @@ -180,9 +180,7 @@ The DT properties of a domain instance DT node are as follows: boot HART of the domain instance. * **next-arg1** (Optional) - The 64 bit next booting stage arg1 for the domain instance. If this DT property is not available and coldboot HART - is not assigned to the domain instance then **0x0** is used as default - value. If this DT property is not available and coldboot HART is assigned - to the domain instance then **next booting stage arg1 of coldboot HART** + is not assigned to the domain instance then **next booting stage arg1 of coldboot HART** is used as default value. * **next-addr** (Optional) - The 64 bit next booting stage address for the domain instance. If this DT property is not available and coldboot HART diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index fa1c357..a13daa6 100644 --- a/lib/utils/fdt/fdt_domain.c +++ b/lib/utils/fdt/fdt_domain.c @@ -395,8 +395,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) val64 = fdt32_to_cpu(val[0]); val64 = (val64 << 32) | fdt32_to_cpu(val[1]); } else { - if (domain_offset == *cold_domain_offset) - val64 = sbi_scratch_thishart_ptr()->next_arg1; + val64 = sbi_scratch_thishart_ptr()->next_arg1; } dom->next_arg1 = val64;