From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 296B72D47E6 for ; Fri, 17 Apr 2026 18:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776451384; cv=none; b=ZkqZNn4/gHHljDreYG/IqnkTH748If5goOnXmjvaUkFGBoOJ4PrMu28JRCqVtQJbEKkPnD7JSQZ3KqHF/3RbzTNve1SwGX6weOk3SfdK8Ll/K/JGKJIe4JjtQQvsVVha5ooVtrBZW/wBGYeUg0MRP6BvGUVz42xQPbySOPXgiKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776451384; c=relaxed/simple; bh=GrhKsJNuO0xmf8KxXAirnEOwtCWdYT04Tcyy1D7elhA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H15pGTN7oLpchP2Mxye19qrGlDdN3yLV9WHUqnLO8PBOetA3KZ46JpYvLA/wcMG3dWtA689b8g4y2UB0uVS2I6xjb3QN0o9wdj7xfMUxiJnWI2doVAu5OlygognIrMYZ/VlgTZXoa6UKLAfEp7LxCvHQiRNHSnezokrvzSLPsPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qStLjIuW; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qStLjIuW" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-48896199cbaso10511825e9.1 for ; Fri, 17 Apr 2026 11:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776451381; x=1777056181; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Zrub1C4d7CDdCrR1P7BJnLdyF1FR8X46HxABz+9R31c=; b=qStLjIuWbzYThV4ib4VowIOzxGWuAun7qOAHFuyfwhCzTf3xGirAR9tLh50Nb06jD6 Tjhe8IpxmGAfS2K3xMK+v1n1RSp3yswFwDFtOnY73+R0RZEVn1OTAsd6aP/+irJz+6Xp r7xEO51IN9+4d2iMy0VEXMhiv69AP2WCwxlWqIyY9sqFeqSDe7ZEebkDgxrj3dPrcaHq nrelqKejsBu8JHHGvNHpseVvDu8qG6WkMClBMUQdr06cG9ZZjneVIWYnpDkU/spmy0oy 3vvYJnn29lvCKyPkM4nK8wNv7l56LFWyMecdDgLwznGHvgTG3UeVTMfTxJrD8zeeV84Y y4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776451381; x=1777056181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Zrub1C4d7CDdCrR1P7BJnLdyF1FR8X46HxABz+9R31c=; b=NyoepjlQ7KzC5SIl4CZ8RwJ1c2Od6BZglhF4TgLba/quzZ/gW4uaLQLC9HFZLZcLJP K2yOpLXoGCbGsJ9r1MSrZGYBEa2zmrYwcU86t6UFU8vJtpIRy405fYTA2KljR2JSe0Fd CjGkRDuws9XXHEyx6JsFwZzlgPyvLsiECTE19S89jq+Z0GZY2HTP4lQN7N99FNn6M051 r+ZpMdslWrvQ6LaA11GkVOn2jah6BIb14943oQ+poa+2QdzsfX9V61oOqv5cyRgh2Xfb YFbHLpevI9OrcvVhQiDBZ7IfzefsYPFJCdr9z4hJl38Ijw5YADVEVVkTfsEsRxnB/7Zb lEnA== X-Forwarded-Encrypted: i=1; AFNElJ99iuK0sPJXzOv2S6QYZckixI/x39Q7yiatmbA0ZjPf4RZLzsqnKau4AfV330V/7ce67fYKQcLjSUaBxf0=@vger.kernel.org X-Gm-Message-State: AOJu0YzKlYMtnvcyHQt15Bvc6cM83+K7le4lMkir+bIB/oEmK4AyPGtV hy5CJyQWDE9ta7y+zr2vRC64Oo4MgfKJrC+DKBIFWkqiohKoYVFIAgV8pvUoH4Nu X-Gm-Gg: AeBDievv9d8fMFlYtrADtQVUnTDaILKh75zZOf/9S3QkVQG0rjXk+D26FSqYCQ+r1ym gKhxIu8qN45la8IwOq844jPEjm4h+i/FwL5INWZ+0zjLbRuTMTVvYc5iKuDL+CfJDdMZb5nv1/u 062uDcSkwep+MKejrKXf1SA+NoQuAHPKnOkSGaLQMhoMsbJYgjK178AzfSUK0kL6jEdHn8x7MyI DmNEIK4vbie+mFm0rij6J9a9uLYgA9/Gl5N4wRl9BakEwJh0ylHSnBdS2gRmPcYi8AUOWRtfp7v /9ghV3zOaqAMi7A9Ln/TPArcHLt037suQat2uBvn/SgY6nJjyj6ZhoNeJRdnUJZuJdnKm21s23N 6j+lLQAiIY567+rhlbMhhTx0QIluHtPZWWXJp7RLFI6pr4noFXz2IBJA+N7fpgcjoIos+GwSqsO BAIPN700L8b2tL+8Shhykfhc3q1Hfc/vISHL5LZacrxuIJhn35zNh5STezy9H9rUM5LwCjRw51u vg= X-Received: by 2002:a05:600c:1554:b0:488:9bf8:7f17 with SMTP id 5b1f17b1804b1-488fb77810bmr61308135e9.14.1776451381317; Fri, 17 Apr 2026 11:43:01 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc1c01cfsm68401345e9.10.2026.04.17.11.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2026 11:43:00 -0700 (PDT) Date: Fri, 17 Apr 2026 19:42:59 +0100 From: David Laight To: Yury Norov Cc: Jinjie Ruan , pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, yury.norov@gmail.com, linux@rasmusvillemoes.dk, arnd@arndb.de, akpm@linux-foundation.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, nathan@kernel.org Subject: Re: [PATCH v3 0/2] arch/riscv: Add bitrev.h file to support rev8 and brev8 Message-ID: <20260417194259.0c48d7ef@pumpkin> In-Reply-To: References: <20260417093102.3812978-1-ruanjinjie@huawei.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 17 Apr 2026 12:09:03 -0400 Yury Norov wrote: > On Fri, Apr 17, 2026 at 05:31:00PM +0800, Jinjie Ruan wrote: > > Add bitrev.h file to support rev8 and brev8 for riscv. > > > > Tested functionally on riscv64 QEMU with: > > "-M virt,acpi=on,zbkb=true,zbb=true" > > > > Changes in v3: > > - Fix the build issue by remving the CONFIG_HAVE_ARCH_BITREVERSE macro > > for byte_rev_table. > > No arch needs byte_rev_table, except risc-v under a very certain > configuration. Please find a better approach that wouldn't bloat > random victims' .data section. Eh? x86 doesn't have a bit-reverse instruction. The only arch that 'select HAVE_ARCH_BITREVERSE' are arm64, arm32 (some cpu), loongarch and mips (for CPU_MIPSR6). I think you mean that no arch that sets CONFIG_HAVE_ARCH_BITREVERSE needs it except riscv. Could you globally have: select NEED_BYTE_REV_TABLE if !HAVE_ARCH_BITREVERSE and then riscv could also select it? (And isn't there a method of including files in the build based on kconfig options rather than unconditionally compiling it and getting cpp to throw the contents away?) David > > > - Update the riscv implementation as David suggested. > > - Add Reviwed-by. > > > > Changes in v2: > > - Define generic __bitrev8/16/32 for reuse in riscv. > > > > Jinjie Ruan (2): > > bitops: Define generic __bitrev8/16/32 for reuse > > arch/riscv: Add bitrev.h file to support rev8 and brev8 > > > > arch/riscv/Kconfig | 1 + > > arch/riscv/include/asm/bitrev.h | 55 +++++++++++++++++++++++++++ > > include/asm-generic/bitops/__bitrev.h | 22 +++++++++++ > > include/linux/bitrev.h | 20 ++-------- > > lib/bitrev.c | 3 -- > > 5 files changed, 82 insertions(+), 19 deletions(-) > > create mode 100644 arch/riscv/include/asm/bitrev.h > > create mode 100644 include/asm-generic/bitops/__bitrev.h > > > > -- > > 2.34.1