Message ID | 20230605113749.230696-2-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=NJ1t3U6I; 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=jgz1RpIo; 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 4QZWnk6bykz20QH for <incoming@patchwork.ozlabs.org>; Mon, 5 Jun 2023 21:38:18 +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=4kYvr1TTL17ix8HpfXhdgVfcxJrK6V1aU3GWW+njfZY=; b=NJ1t3U6I1FT1IM OTzrry8oly9Stl1OO5W/QAkB+zhJMqI2+mzpTzrLs5yVrlNn0zodo35x2gjSbc5KMbnv0Aq5Znx7h TwiT1kQYrPmNUA3mi8LzocFpf84EtTIfo84wIak5ePywb0YBpxMwC7fCbfB75jJVgctfcn0KhFTTi dn4nUQwvOUP3Q2qbCI1seQo/+n2rAHP8k+lMNNJ1N3c/EDRiuOIm6A6Bp4DkGhU2REbQ/5E4ygo22 ub4hLtkLNHOPbOTRT4NuXGJ3L2YCZDesVX8dZXolnjmeFlylN6UDxGWoL8529Sw3de0X4eH/EkGre LRsawyiBT5bdUb76owdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q68XF-00FIme-2z; Mon, 05 Jun 2023 11:38:05 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q68XD-00FIlU-1g for opensbi@lists.infradead.org; Mon, 05 Jun 2023 11:38:04 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-394c7ba4cb5so3223159b6e.1 for <opensbi@lists.infradead.org>; Mon, 05 Jun 2023 04:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1685965081; x=1688557081; 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=9yZxTSCXvOW3yQjILxmt9HNjfjxVzDnp9v/T4tNf1UY=; b=jgz1RpIo5qbq/g9+Y6EnQBUA/8Hpumfun1/wBWmLLdRZfZxJX2Ucz1JlMofzaJNmzy TYFzvB819bxqY+WmZX+wwvz4bOtVMc5h8VbDMUAF46zST4cAJlB2dwDq+Jc1xrXBL/7B RWdVaZq0F96wm6bPHj/AuINDqnx2Vl9hQlJZ9pKs4FEF4zgBZCcF132HXfGSPHwnsDVj seyRRBg9UQjhnoqlagqRl6x1v5mt5teC1eYEt1m+y1e0jdv+WczQ0U89rCOANNxdHL7Q f99VxGtpEV0CY05xJ7Q6jlS7qSNiuNoP3j+fmeEdt0TKTVY7dt8Pf/MkBUuFDZn25vJq VYXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685965081; x=1688557081; 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=9yZxTSCXvOW3yQjILxmt9HNjfjxVzDnp9v/T4tNf1UY=; b=NVaWe7Mr1txPwuGK7/m2yizYnekc6KyjVPauaaiVyIb13f83kgc0A27E23+XTM9dwk UHL5KBfU1q90OVF+rJyKHjfpG8ncDN2muLCzPuYyrveEDyKbcbPTk1JoG/SZeSlWn2Nk AC3F+mE30FsJ/2VhSpa5/ehkY/K+r48VZCRDISCN9ASc8vNA0JmePsF9y94dKt0LYWVB LYBZhihTW728GAF3fLH4ODUv0MD/6s1aDGG2eT1xJecI1nhIP9CA6uEu50jRFINooS7N cEIjVSml5wPPFL7lJbkvUnzaHclR2udw/VMBL/yu799VLGXr/Zs/pntlGMY4mBRY8UbY Mdkg== X-Gm-Message-State: AC+VfDxi78/FxCTgu/VtP8wAryvOGZMx3WoPEtvRfWogimhrtrhs/dTj jkE8GtybLUpW+/pf8GMjBoQJ+zn4Eloa4Rl76fLPWw== X-Google-Smtp-Source: ACHHUZ6sX9teDJtDaVlKRuZNzkBZTVMUPniPMs0tozmdYe1AOTTiZzE+Sgl6sWoRcKcGkOrfubgwEQ== X-Received: by 2002:a05:6808:2d2:b0:39a:a9e6:af3 with SMTP id a18-20020a05680802d200b0039aa9e60af3mr4410655oid.49.1685965081558; Mon, 05 Jun 2023 04:38:01 -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.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 04:38:01 -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> Subject: [PATCH v2 01/18] include: sbi_scratch: Add helper macros to access data type Date: Mon, 5 Jun 2023 17:07:32 +0530 Message-Id: <20230605113749.230696-2-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_043803_557605_945D384F X-CRM114-Status: UNSURE ( 8.13 ) X-CRM114-Notice: Please train this message. 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: Reading and writing a data type in scratch space is a very common use-case so let us add related helper macros in sbi_scratch.h. Signed-off-by: Anup Patel <apatel@ventanamicro.com> --- include/sbi/sbi_scratch.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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:235 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 |
Introduce and use simple heap allocator
|
expand
|
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h index 2966188..58f2d06 100644 --- a/include/sbi/sbi_scratch.h +++ b/include/sbi/sbi_scratch.h @@ -174,6 +174,23 @@ void sbi_scratch_free_offset(unsigned long offset); #define sbi_scratch_thishart_offset_ptr(offset) \ (void *)((char *)sbi_scratch_thishart_ptr() + (offset)) +/** Allocate offset for a data type in sbi_scratch */ +#define sbi_scratch_alloc_type_offset(__type) \ + sbi_scratch_alloc_offset(sizeof(__type)) + +/** Read a data type from sbi_scratch at given offset */ +#define sbi_scratch_read_type(__scratch, __type, __offset) \ +({ \ + *((__type *)sbi_scratch_offset_ptr((__scratch), (__offset))); \ +}) + +/** Write a data type to sbi_scratch at given offset */ +#define sbi_scratch_write_type(__scratch, __type, __offset, __ptr) \ +do { \ + *((__type *)sbi_scratch_offset_ptr((__scratch), (__offset))) \ + = (__type)(__ptr); \ +} while (0) + /** HART id to scratch table */ extern struct sbi_scratch *hartid_to_scratch_table[];
Reading and writing a data type in scratch space is a very common use-case so let us add related helper macros in sbi_scratch.h. Signed-off-by: Anup Patel <apatel@ventanamicro.com> --- include/sbi/sbi_scratch.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)