Message ID | 20230511161104.115168-2-ajones@ventanamicro.com |
---|---|
State | Superseded |
Headers | show
Return-Path: <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; 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=<UNKNOWN>) 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=HljJHonq; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=Ig+AZiiv; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QHH2V2B5dz213w for <incoming@patchwork.ozlabs.org>; Fri, 12 May 2023 02:11:30 +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=Ln1rJAn+QQ6cWpDIe3PuA5eBEgqW5H1AcPgRBKSn0vM=; b=HljJHonqSowEmg ywvo/uw5fulRjpoWKN6BkvG7ybMBVu7mB+/V7FyYyR2+ZQbq1kGgIiBEbh7rZNyAH1I7gZkK0IyON Gyyzo4uiRKGtS0BV68NqDz5uZfLsasC3N0Uj8dYKVTU5+AmBx+JH27m0T450Vv9Glh22EJFhrbXGj JQJzBoNUgp8NbMwJ7O4UmjHXM1r1iXbYTeu1J+Fiy4UCzCUMgPhtZZ0hfoZD29UjjFqqFRz+P1CKx ERkGv6nGuE+CG5dJ60bn/AMcCslpQtuCOfjdRVfJNREuZedJf0riiWrecywW/TVMw2d5J+TENUEXM xHeXutlrn1ODK21ZhYwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1px8ss-009JUq-1S; Thu, 11 May 2023 16:11:14 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1px8so-009JTB-29 for opensbi@lists.infradead.org; Thu, 11 May 2023 16:11:11 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3075e802738so8000946f8f.1 for <opensbi@lists.infradead.org>; Thu, 11 May 2023 09:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1683821467; x=1686413467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OPl3+1pVbE2RSR4jYSoFSZA90AVSm7/qj4LGwPRitYk=; b=Ig+AZiivszF0/y9kJhX0I9hMEuYSguxoNEKd7k64q5rwrUr1AY4eu8w7K/05h8Vgk6 qXOtcdhlC/XtFpRnxBazQMj9bRo+iuZHoDmprlTZAzRqG702hEy8QtNFouNcb2M+4QE2 D4BMaVWtSMGOgMKo9G4bbrmPBLaLh3p/1S/eWw1E3Xth1KBcxt+92Wg9MALER8T6FMpH IMGZKrDD+mjj8ZxrPz0xArGFuW4/4HuXT0SVl57T/aGX3dqEtCGBODpXKSUrEq1ACqhP 19rx+zpMCiKlf/PJfDQ13eCypfWS6c9svkW+oBr6Pb4/lfDfIPu9cXvDAeT05qInLxeF EP3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683821467; x=1686413467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OPl3+1pVbE2RSR4jYSoFSZA90AVSm7/qj4LGwPRitYk=; b=kha6OeGPPrn20ffVqsvCsQt42brPINZWnjroqYSTSz3xW/+8ItjP3dn4RrhICS8rpA xbxVS5CrzoGFYYOkxxGKfEYeMtq6c1KIL+2fTtVBep4rbitoCOznxLX3HWBebkw+p5ii 2Lm6/lITzgaBhmqqFhG/KMINXG8WOpQYcPkkmT9XC+WELXt8LYuYkLPqDBhLFV3xOSAO vg2H2i30WSNGbzIWEtCKd12IJhU2zbnLs6Invpc2/kegaJ3KELiZz6XoIcV2Df1HC8ow zhKuy32kPJ4D0+WTzhtJZ3Ca3SM3atj9mz5TVswGzl5X0pOrQXRGmiG/DVJR4B7u5doL b+ag== X-Gm-Message-State: AC+VfDz8XcgSTNWYm6SJ6mHs3Wbtrx9vNxE4ANuWtixPNRw5Jh1n6AX0 k0xjCAQUrw3mdJp+D3IJjkGK3ghtWpfHZn0+Ids= X-Google-Smtp-Source: ACHHUZ7/QY9A/3gKuN1Tn+fOYRiU2dCopsPfVWJPLRX5XrZkKtgRU0p/gFYdeWs0udl3W9dIVVc8LA== X-Received: by 2002:adf:edc6:0:b0:306:337e:4b28 with SMTP id v6-20020adfedc6000000b00306337e4b28mr18024710wro.3.1683821467420; Thu, 11 May 2023 09:11:07 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id y18-20020a5d6212000000b0030796e103a1sm12570505wru.5.2023.05.11.09.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 09:11:07 -0700 (PDT) From: Andrew Jones <ajones@ventanamicro.com> To: opensbi@lists.infradead.org Cc: Xiang W <wxjstz@126.com>, Anup Patel <anup@brainfault.org> Subject: [PATCH v4 1/3] lib: sbi: Don't register unavailable single ID extensions Date: Thu, 11 May 2023 18:11:02 +0200 Message-Id: <20230511161104.115168-2-ajones@ventanamicro.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230511161104.115168-1-ajones@ventanamicro.com> References: <20230511161104.115168-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230511_091110_703703_BD5F55AA X-CRM114-Status: GOOD ( 11.79 ) 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: When an extension provides a probe callback we can check it at init time to see if we should register the extension at all. However, this is only possible for single ID extensions since attempting to [...] 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 [2a00:1450:4864:20:0:0:0:436 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_AU Message has a valid DKIM or DK signature from author's 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_EF Message has a valid DKIM or DK signature from envelope-from domain 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>, <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>, <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 |
Series |
lib: sbi: Ensure SBI extension is available
|
expand
|
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c index 76a1ae9ab733..5a301fb7d403 100644 --- a/lib/sbi/sbi_ecall.c +++ b/lib/sbi/sbi_ecall.c @@ -148,15 +148,18 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs) int sbi_ecall_init(void) { - int ret; struct sbi_ecall_extension *ext; - unsigned long i; + unsigned long out_val, i; + int ret; for (i = 0; i < sbi_ecall_exts_size; i++) { ext = sbi_ecall_exts[i]; - ret = sbi_ecall_register_extension(ext); - if (ret) - return ret; + if (ext->extid_start != ext->extid_end || !ext->probe || + (!ext->probe(ext->extid_end, &out_val) && out_val)) { + ret = sbi_ecall_register_extension(ext); + if (ret) + return ret; + } } return 0;
When an extension provides a probe callback we can check it at init time to see if we should register the extension at all. However, this is only possible for single ID extensions since attempting to probe all IDs of a potentially very large range doesn't make sense. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> --- lib/sbi/sbi_ecall.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)