From patchwork Thu Jul 25 22:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Haas X-Patchwork-Id: 1964928 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=KkG2imxU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZyHRznC6; 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 4WVR3J2vdlz1yY5 for ; Fri, 26 Jul 2024 08:52:10 +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=hO5hPyiIJRKZ8HFCcCB6TyCpz6ORbgV1WFWYJGDOmr4=; b=KkG2imxUvo0ArF lma8KbrfPSfrPsCZVpCA8YHjj80xybWA+6osMibYZwvKy/XCwOEFO4k/Q3a9NXk2Y20Zs0I4xeXh1 Mk7xYMbAVXYEDaiuTLrd7VUVCRHL8pDb9pgOw4Vmnbea1dQE3ZM/yp1AYcA5GowvbSBHDHVy6YW9h 5XAZaw4hooiCb6/l/UTWLMcmZ3OtefU1ZfZqVnBaxzb6pyITrGNMHIVIO1s/m9QTevTxJn9Ks49hr NCSLNl/f9+4vXiA1JqVIPBfqi3dw2NfD3/U/EB4tKczoJTWO2Xs/LdN5lBzJx5KR6DOppmtIF8V8g A9W8e/3aSdc36tnG6VVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sX7JW-00000002Jkv-1w2B; Thu, 25 Jul 2024 22:51:58 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sX7JT-00000002JkB-3pTw for opensbi@lists.infradead.org; Thu, 25 Jul 2024 22:51:57 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1fd78c165eeso690405ad.2 for ; Thu, 25 Jul 2024 15:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721947914; x=1722552714; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=V95NQ8bl9F2BTAqv6WD3bVJgMwzbCiUv3G6XF38mZgs=; b=ZyHRznC6PjqmYfymQJIH86NXyffVoeXtfF3fxjF4e3FQExN5d81HZ+7NOIG+JNcSNq x8n+P2xn9G6CPPVnHv8/OYR7knc2Col9uOvbMBtei7BuDOCcF5XiNi/HpTKyUsq/keAA WEIfAYV4phujaZtAEc+jPi7jnuW9VdLdL5JMM/az0E/06PJQ1PvWWqruGQjfYHtMV6YH J5OGc8PG9NF3Nu9Zcw/KitO3Tj3hBeenKPqnUCptvXQwFxyrle1Kn5XRJdmwCj5DgXht kOnjepcYqniPgBxhwyFX7f+RykWb1U8Z+4xFw8TlOfM79tTcSdD4uMKZUxCVnL3tsCXG udMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721947914; x=1722552714; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V95NQ8bl9F2BTAqv6WD3bVJgMwzbCiUv3G6XF38mZgs=; b=hAZkF1rmL+mcn4tGWqMuayhMJgqmVW9aMYknrDZjzh4daa01rb1z0cQkDrKCxkBEtk HgsHDZQp4HtUMeqG2xjIwz6bRWJw2Fa3xs8T5IRnu2zTA10lJXNgJ6eFxtYhvLJkNvDj COC1rpc2p6hxLTemwxUqAdXYXQ2tnjMY+YqXF2pbdHXn6VY2fnfSCK+/MS7PINIFExDc lKoE+TYIwrjDTV+abDGYxcWipL7GMjNTfpq125D2sMCTxf/nj16ivAsMD6qAm0I8ZkA/ F8fnmoHw+ffi3HI4pdFBIutAIzL4UsRTyB7MowwwQhLEfBkENzCGR5p6C1j0HkHJbVAQ X8qw== X-Gm-Message-State: AOJu0YzbXTzqUPhcEagsG388guOeGX2+EoS5+8Ar9PxVkVpbVy/LGy+D ntMO4IlLAqWj4kzvhDxTTLo06Wc0PeQGB6vOVM016JPw8LCHDTsVPITg5A== X-Google-Smtp-Source: AGHT+IEnkTHimq1cRgzWsTh7jnYOLw+8lfejpXMg3n5bqhLgwaLnatNqW+DKxgw8m1bQsdq8iAHndw== X-Received: by 2002:a17:902:e74f:b0:1fd:73e6:83d1 with SMTP id d9443c01a7336-1fed91faa8emr48188245ad.21.1721947914281; Thu, 25 Jul 2024 15:51:54 -0700 (PDT) Received: from localhost ([205.175.106.198]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fed7d173a6sm19310855ad.102.2024.07.25.15.51.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jul 2024 15:51:53 -0700 (PDT) From: Gregor Haas To: opensbi@lists.infradead.org Cc: atishp@rivosinc.com, Gregor Haas Subject: [PATCH] lib: utils: fdt_domain: Make opensbi-domain optional in CPU specification Date: Thu, 25 Jul 2024 15:51:52 -0700 Message-ID: <20240725225152.1143010-1-gregorhaas1997@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240725_155155_978174_24884717 X-CRM114-Status: GOOD ( 15.17 ) X-Spam-Score: -1.8 (-) 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 domain_support.md documentation states that "the HART to domain instance assignment can be parsed from the device tree using *optional* DT property opensbi-domain in each CPU DT node". However, th [...] Content analysis details: (-1.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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.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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gregorhaas1997(at)gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [gregorhaas1997(at)gmail.com] 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 domain_support.md documentation states that "the HART to domain instance assignment can be parsed from the device tree using *optional* DT property opensbi-domain in each CPU DT node". However, the current implementation does not treat this parameter as optional when determining which HARTs to assign to a freshly discovered domain from the device tree, causing an effect where every HART in the system must be explicitly assigned to a domain only if a domain is specified in the device tree. Instead, this patch simply ignores CPUs that do not specify a domain, and does not attempt to assign them into the recently discovered domain. --- lib/utils/fdt/fdt_domain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index fa1c357..3623c6b 100644 --- a/lib/utils/fdt/fdt_domain.c +++ b/lib/utils/fdt/fdt_domain.c @@ -459,12 +459,12 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) if (!fdt_node_is_enabled(fdt, cpu_offset)) continue; + // This is an optional property for CPUs, so just continue if not present val = fdt_getprop(fdt, cpu_offset, "opensbi-domain", &len); - if (!val || len < 4) { - err = SBI_EINVAL; - goto fail_free_all; - } + if (!val || len < 4) + continue; + // However, if the tag exists, it should point to a valid domain instance doffset = fdt_node_offset_by_phandle(fdt, fdt32_to_cpu(*val)); if (doffset < 0) { err = doffset;