Message ID | 20240830031610.32730-1-zong.li@sifive.com |
---|---|
State | New |
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; 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=ZWprWA/Y; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=cisoZhax; 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 4Ww3GD4X9tz1ydy for <incoming@patchwork.ozlabs.org>; Fri, 30 Aug 2024 13:16:36 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=gSGF+0LQREOgvJtuqNASQE0cXb1PkWByvKYLUvDJPiE=; b=ZWprWA/YcOZjyN jlVxLTsWLXEjDVppQL5sWBmCMQ+PisecilpWWI9JCl5rvNnzmdY8ILZir9sM/W8b/3MgsyR9KETyG 8nFBQgx2dDjk2G2RDHzEznEjkcrDA8a5IkhhHOd72e3KNbKfSO/i42BCjrEcRoVY8IXzaw2gxnz3h HBylDEGLTjWRoHyEy8pg0/RAKZLv7cUNJpLuBAD/p18AL0keOQrcCkcwF02+5OWNnxPxwpK6VhO6F OBRoR3+LCrvFpZo3EVNuQ9VvAgzU77EDQkhvk99F9OsYquT3ui9ROFf7UA2Tp41hRCMya1LHDTNNU Rg11PKF16TRZRxl0n2lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjs7g-00000004UJB-1Xh6; Fri, 30 Aug 2024 03:16:28 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjs7c-00000004UGz-2vCh for opensbi@lists.infradead.org; Fri, 30 Aug 2024 03:16:26 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-715e64ea7d1so1103090b3a.0 for <opensbi@lists.infradead.org>; Thu, 29 Aug 2024 20:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1724987783; x=1725592583; darn=lists.infradead.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SqBQG6+qgIxz1jB0hWI1fk760wMkoGZbOJVSoGlGNfk=; b=cisoZhaxXp0yyF/gic1Pu3ebPwoBrByVFKqgObBz/SXaccQUmPliwMpmX+Xk5CHXQH ejcnidH0O86TczMk6k8hK69d9bKYBSmyYxSv/hx3nfo9z/FgP5xKvtBtb1qx5YWV6XHU iA6LSYs9SY2jMk20i01Q+n2n4pgo/5voERDHAuhcFtpHgndCo4IOVhMNIQ/NWeC9pWZ8 xMxAvDu4XbsvfeW54A7++3AXrKTq56IhZwPGLqJzIlPJJoYivxrMZoQC5oGbYWnbM14f cAUGBaPHToSR3V+S+c8KcVmMgFYNNWAcDkL41VxgVbLlOZZylvvpZyHVIqcyf7UQ0u2l Khqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724987783; x=1725592583; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SqBQG6+qgIxz1jB0hWI1fk760wMkoGZbOJVSoGlGNfk=; b=ed4gbu6THhNVlhPfvv30ytLo+p1YJGp9yKaxDKzbvvAL3ODNcO0ZVoEy2L+zh30HZf 043DG04EkxVGQZOv5GzuEfTcdpr3O0ODC8G29Xt49vAVFzNmw99IkFcRnifyUP3JQ9in Cer8MUP0Io65EIzZC/PcxVYO49rzpxbi7IkloHuq285BKDhE4fbZ485KIDtO7Awx2avZ MEEBBg2ZVVxTHxDpgrDn6lJbpZOyMl3whUSmFLdQvgatiWXV+fjJEfPHnBHIlh49v8G1 K0+U/dldMfAmrCl8g1b6TF88XFvBBJPES4kT49JahCKxfH8HDkP2CjYCr3yOwwuDeKM4 rk1Q== X-Gm-Message-State: AOJu0YxdG7b7y3GzwpJ1UpoOzqDgZJ3JBCY3dxBPKUuv6CYnuOdWKTFq h6h/O1q4lgNtb27hc1mLGSeavkd6FYPEITXO6XiRmLw9mKlTi1b9W5Eb1V8FTnhSYLHxH9eap1f PoJhu/s2utqD0r0W4ocDLTIrhugiOq1qQz0ezfsvs8SDCYkhVKy0JCeUObGcn88XMuGXfdnQaG8 T+kLDD4VQsGUnuTgaWxVWumyrWv6cSN5BCOqBUZeDtFxkF X-Google-Smtp-Source: AGHT+IGgb3/fOuScqHa/eNu48CoSguBa7L8ruty8LAPwjkAh+4xWJDBUTal9MIO9BdFAb6IDBHOmSw== X-Received: by 2002:a05:6a20:2d29:b0:1cc:dedd:d8e8 with SMTP id adf61e73a8af0-1cce10057b7mr5402841637.9.1724987782643; Thu, 29 Aug 2024 20:16:22 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d85b39d0b8sm2524542a91.35.2024.08.29.20.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 20:16:22 -0700 (PDT) From: Zong Li <zong.li@sifive.com> To: opensbi@lists.infradead.org Cc: Zong Li <zong.li@sifive.com> Subject: [PATCH] include: sbi_bitops: add ULL version for BIT and GENMASK Date: Fri, 30 Aug 2024 11:16:10 +0800 Message-Id: <20240830031610.32730-1-zong.li@sifive.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_201625_057624_1C9196F7 X-CRM114-Status: UNSURE ( 7.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) 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: Add BIT_ULL and GENMASK_ULL for dealing with 64-bits data on 32-bits CPU, then we don't need to separate the operation to low part and high part. For instance, the MMIO register is 64 bits wide. Signed-off-by: Zong Li <zong.li@sifive.com> --- include/sbi/sbi_bitops.h | 6 ++++++ 1 file changed, 6 insertions(+) Content analysis details: (-2.1 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:42b 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 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 -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 T_SCC_BODY_TEXT_LINE No description available. 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> MIME-Version: 1.0 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 |
include: sbi_bitops: add ULL version for BIT and GENMASK
|
expand
|
diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index 7d90334..3ddac77 100644 --- a/include/sbi/sbi_bitops.h +++ b/include/sbi/sbi_bitops.h @@ -14,6 +14,8 @@ #define BITS_PER_LONG (8 * __SIZEOF_LONG__) +#define BITS_PER_LONG_LONG 64 + #define EXTRACT_FIELD(val, which) \ (((val) & (which)) / ((which) & ~((which)-1))) #define INSERT_FIELD(val, which, fieldval) \ @@ -28,9 +30,13 @@ #define BIT_WORD_OFFSET(bit) ((bit) & (BITS_PER_LONG - 1)) #define BIT_ALIGN(bit, align) (((bit) + ((align) - 1)) & ~((align) - 1)) +#define BIT_ULL(nr) (1ULL << (nr)) + #define GENMASK(h, l) \ (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK_ULL(h, l) \ + (((~0ULL) - (1ULL << (l)) + 1) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) /** * sbi_ffs - find first (less-significant) set bit in a long word. * @word: The word to search
Add BIT_ULL and GENMASK_ULL for dealing with 64-bits data on 32-bits CPU, then we don't need to separate the operation to low part and high part. For instance, the MMIO register is 64 bits wide. Signed-off-by: Zong Li <zong.li@sifive.com> --- include/sbi/sbi_bitops.h | 6 ++++++ 1 file changed, 6 insertions(+)