From patchwork Wed Jul 24 15:00:54 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: 1964289 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=MIGCpssP; 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 4WTcff0FR0z1ybY for ; Thu, 25 Jul 2024 01:01:27 +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=AEBpDmLn1W/MQyyrc5CXh9xPszkNLw+nolqY/J84hDI=; b=MIGCpssPdiGC4w n6Ze5/dpYG+qH37tHikGhnDtyrkg7HdX6sYWg7Xone58U7GYKgViLR0/t/Eb0Dyy49viI7eT25uaV T7m6fXCRpUhQnDK8Q1gYxKMfFe0PRRq+4j9U0eC4SjRzd/nqVrz3RGCDJaMnIwe29FnQ6KvDNfeDx /xCi4WePxP0VmyI5s169WyG5lNx9TIpv12XYf2L4qI1XS5duMDM3hKMbuEHqJENaiL2YYCEf1adqY gnpnth5+OYOgzEOVyRMjIAQ15zliYv9P7jCTPs03//oADVtT1Se4S4hdsBMQmlBwCk9NCTpm7W73U 9b9hHX8rWloakWgFB3Mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWdUS-0000000Fi8O-1Tap; Wed, 24 Jul 2024 15:01:16 +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 1sWdUP-0000000Fi7h-0JvU for opensbi@lists.infradead.org; Wed, 24 Jul 2024 15:01:15 +0000 Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTPS id 46OF0xe4040465 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 24 Jul 2024 23:00:59 +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; Wed, 24 Jul 2024 23:00:59 +0800 From: Yu Chien Peter Lin To: CC: , Yu Chien Peter Lin , "Alvin Chang" , Anup Patel Subject: [PATCH v2] lib: utils: fdt_domain: Use consistent device-tree address when next-arg1 is missing Date: Wed, 24 Jul 2024 23:00:54 +0800 Message-ID: <20240724150054.3052794-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 46OF0xe4040465 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_080113_424258_316B80BE X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: -0.9 (/) 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 shown below illustrates 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.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 TVD_RCVD_IP Message was received from an IP address 1.0 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 shown below illustrates the boot-flow involving OP-TEE OS initialization. (1)-----------+ | U-Boot SPL | +------------+ | v (2)-------------------------------------------------------------+ | OpenSBI (fw_dynamic) | | (4)------------------------+ | | | optee dispatcher driver | | +-----------------+-------^---------|-------+------------------+ M-mode | | | ---------+--[trusted domain]---+----.----+--[untrusted domain]------- S-mode | (coldboot domain) | | | 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 to the next boot stages, e.g. the reserved memory node: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; optee_core@f1000000 { no-map; reg = <0x0 0xf1000000 // OP-TEE OS base address 0x0 0x01000000>; }; <...> }; Instead of using 0x0 as the default value, allow identical next-arg1 to be used by non-coldboot domain (i.e., untrusted domain) when the property is not provided. Also, update the description of next-arg1 property in the document. Signed-off-by: Yu Chien Peter Lin Reviewed-by: Alvin Chang Reviewed-by: Anup Patel --- Changes v1 -> v2: - Improve commit message, no functional change --- 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;