Message ID | 20230605113749.230696-11-apatel@ventanamicro.com |
---|---|
State | Accepted |
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=HESuQ1Ow; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=UTJwwBsd; 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=UYdU+bPg; 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 4QZYCk4jcFz20Q8 for <incoming@patchwork.ozlabs.org>; Mon, 5 Jun 2023 22:42:26 +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=5vHLrwmz4KnwLK6sLUt82VYbYIBJd51q6agVg3ku/gk=; b=HESuQ1OwAf7DdG CZc3ue/19CUMLNU3NJAf6attx3GLglRygusVzN3ZtAcLcp0qwLkRJqdJk7IB00z0TcAAj0LAlCda2 adL0/IDoOTP6Ezp/9GKGSafUlCvGa3PKQXc/yNac4OWib0jivv5JFLJoeAa3Oj9xxrtDz7AbnaEWI diQsdInmYCV7v6RA9OqT5RtKZYKyo1nDybsvbRsVP4tIXRiEiKt43tbRTavKOp9gz4lh3MBKzlp/7 TUmqBLonRFrnY+/Ua5TPcL48w0FQG9YrG35Xi8IYWM+Iiii+saItfar45DhBkN9FESZ1BnEPgM05R /XrMsxwu1x6T8MUlcZOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q69XE-00FU7N-2t; Mon, 05 Jun 2023 12:42:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q69XC-00FU6t-2q for opensbi@bombadil.infradead.org; Mon, 05 Jun 2023 12:42:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Azqc1KMJ5SvZN8VhG/lSFj02nJr0mmisYChETitCcj8=; b=UTJwwBsdZOXsX/zG7+naFovtKc fJ9+f09e8+WvybukUUEAkdPAscjfOOYn1YeiHdLF9Z13DoBe0HM87KNNqoG3ydkrT4losr8KAyTKl sBjBM+yP+KLxdEhE2Hoa1j6URAH7tJ557iek0qowsy34pFHLXoLF6Qvc55IfcVNagCSeIOPPl8hK1 YATjWjM+Bi9D8tT1/gKNBm3BCQQmbG1SOVCdjt7/lLaf0hJJc7c00hfVusUbey3OKzMm79b+xrf7G dwWA+KvxMLZDWXWM4hhMb9IKcc3kY/EiyCFqGrj6NCrdPjkWdboZC3XBroDM4turBJ9bzfl+ZzZ22 /+Z5FJVw==; Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q68Xk-003LT3-02 for opensbi@lists.infradead.org; Mon, 05 Jun 2023 11:38:38 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-39ab96e6aefso895921b6e.1 for <opensbi@lists.infradead.org>; Mon, 05 Jun 2023 04:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1685965112; x=1688557112; 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=Azqc1KMJ5SvZN8VhG/lSFj02nJr0mmisYChETitCcj8=; b=UYdU+bPgQUZ6UR9u6NfXD8cSMHACCzSsfYEqzAZBrSL+MtYXoQ0dfNu7DVlDNsuwGM Np4gNw5k09WL8Hb7Gr+Ui8hCS+bQIh/OrnwyjkLYYP7OXEO0sKMz24v/lLmnG+iwiMbo WRYIsP2pmRRv6QS8KmnIETLKqD+McUGomqXKD3FbeeL8+AKqyaxgdEDIe6l9bi22wf4V roRvAZ/sqXmInrU/nbYP+usZ7VEFt6LdpRsb1gDU4iso6J/QlXZ1MEEaa/XrobMC3TxT BRtK4CDNImmzCPkMLXbAsmyqgbV5VXOsk4ImOyap5m42WlBUkMWA4W9KmwqVp5szuub4 lOPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685965112; x=1688557112; 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=Azqc1KMJ5SvZN8VhG/lSFj02nJr0mmisYChETitCcj8=; b=hx+QFFHrT6Ih1SKX7/zEqSO+72PWhelknMO2qH8Vfo5Bfg8pNA6OyxM2Dcq9bibylf AaLLrKzZntloyRKPrxT8Y0s36kULrZ2UhcnO/bOI0/OT2/aNINBW/0zY3gw65oUcXSAf 7gGO7xYzwd1RDA2Ef+5+jm/fre8lfokZu9hD3Bmjfy80vHAaCRdZybMlVFMrVEsl4GpA DzyJ3SRS6TepSjqi0O4QwvzPhtDg5s1HuECWJq2IKqTxDW1YwWYA4chkG/ELBR82sOMX 6iAundN8AEdL3ECBvW3cwdJkPVmMJuCJsqaDFuzc0lThQJCy+yoFnNVJoiBk7AAH9UhR EAKw== X-Gm-Message-State: AC+VfDyZRd4wbh19NbHC/EaAaDo2jAdjxVjlh69CPUUoDvgyU9i4As4h Y+pLoetb3HieNdaAuRyduUInMw== X-Google-Smtp-Source: ACHHUZ6S3qSpH0ak1Djub7RAUvTofLU2BvrTGRm24WhHRO+OyDT0NAccIj6dJrtF4KmWxifcdOze1Q== X-Received: by 2002:aca:903:0:b0:396:1f76:b5be with SMTP id 3-20020aca0903000000b003961f76b5bemr8002815oij.14.1685965112115; Mon, 05 Jun 2023 04:38:32 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id p10-20020a54460a000000b00396324838e7sm3155301oip.10.2023.06.05.04.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 04:38:31 -0700 (PDT) From: Anup Patel <apatel@ventanamicro.com> To: Atish Patra <atishp@atishpatra.org>, Alistair Francis <Alistair.Francis@wdc.com> Cc: Anup Patel <anup@brainfault.org>, opensbi@lists.infradead.org, Anup Patel <apatel@ventanamicro.com>, Andrew Jones <ajones@ventanamicro.com> Subject: [PATCH v2 10/18] lib: utils/ipi: Use heap in ACLINT MSWI driver Date: Mon, 5 Jun 2023 17:07:41 +0530 Message-Id: <20230605113749.230696-11-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605113749.230696-1-apatel@ventanamicro.com> References: <20230605113749.230696-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230605_123836_212936_BE026EAE X-CRM114-Status: GOOD ( 11.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: Let's use heap allocation in ACLINT MSWI driver instead of using a fixed size global array. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> --- lib/utils/ipi/fdt_ipi_mswi.c | 21 ++++++++++ 1 file changed, 10 insertions(+), 11 [...] 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 [2607:f8b0:4864:20:0:0:0:231 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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 |
Introduce and use simple heap allocator
|
expand
|
diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c index 4dc91f2..e3a6378 100644 --- a/lib/utils/ipi/fdt_ipi_mswi.c +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -8,15 +8,11 @@ */ #include <sbi/sbi_error.h> +#include <sbi/sbi_heap.h> #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/ipi/fdt_ipi.h> #include <sbi_utils/ipi/aclint_mswi.h> -#define MSWI_MAX_NR 16 - -static unsigned long mswi_count = 0; -static struct aclint_mswi_data mswi[MSWI_MAX_NR]; - static int ipi_mswi_cold_init(void *fdt, int nodeoff, const struct fdt_match *match) { @@ -24,15 +20,17 @@ static int ipi_mswi_cold_init(void *fdt, int nodeoff, unsigned long offset; struct aclint_mswi_data *ms; - if (MSWI_MAX_NR <= mswi_count) - return SBI_ENOSPC; - ms = &mswi[mswi_count]; + ms = sbi_zalloc(sizeof(*ms)); + if (!ms) + return SBI_ENOMEM; rc = fdt_parse_aclint_node(fdt, nodeoff, false, &ms->addr, &ms->size, NULL, NULL, &ms->first_hartid, &ms->hart_count); - if (rc) + if (rc) { + sbi_free(ms); return rc; + } if (match->data) { /* Adjust MSWI address and size for CLINT device */ @@ -44,10 +42,11 @@ static int ipi_mswi_cold_init(void *fdt, int nodeoff, } rc = aclint_mswi_cold_init(ms); - if (rc) + if (rc) { + sbi_free(ms); return rc; + } - mswi_count++; return 0; }