[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250820-riscv-altn-helper-wip-v1-0-c3c626c1f7e6@iscas.ac.cn>
Date: Wed, 20 Aug 2025 21:44:44 +0800
From: Vivian Wang <wangruikang@...as.ac.cn>
To: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>, Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Vivian Wang <wangruikang@...as.ac.cn>, Vivian Wang <uwu@...m.page>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
Aydın Mercan <aydin@...can.dev>
Subject: [PATCH 0/6] riscv: Add helpers use_alternative_{likely,unlikely}
There are about a dozen uses of asm goto in arch/riscv just to select
between two code paths with the alternative mechanism. Introduce helpers
similar to arm64's alternative_has_cap_{likely,unlikely} for this, and
convert the existing code to use it.
I did not use the name alternative_has_cap_{likely,unlikely} since riscv
alternatives are not all CPU capabilities.
In each case, I have tried to preserve the existing logic while picking
between "likely" and "unlikely".
These patches are also available at:
https://github.com/dramforever/linux/tree/riscv/altn-helper/v1
---
Vivian Wang (6):
riscv: Introduce use_alternative_{likely,unlikely}
riscv: pgtable: Convert to use_alternative_unlikely
riscv: checksum: Convert to use_alternative_likely
riscv: hweight: Convert to use_alternative_likely
riscv: bitops: Convert to use_alternative_likely
riscv: cmpxchg: Convert to use_alternative_likely
arch/riscv/include/asm/alternative-macros.h | 73 ++++++++++++++++
arch/riscv/include/asm/arch_hweight.h | 42 ++++------
arch/riscv/include/asm/bitops.h | 112 +++++++++++--------------
arch/riscv/include/asm/checksum.h | 13 +--
arch/riscv/include/asm/cmpxchg.h | 125 ++++++++++++++--------------
arch/riscv/include/asm/pgtable.h | 15 ++--
arch/riscv/lib/csum.c | 65 ++++++---------
arch/riscv/mm/pgtable.c | 22 +++--
8 files changed, 247 insertions(+), 220 deletions(-)
---
base-commit: 062b3e4a1f880f104a8d4b90b767788786aa7b78
change-id: 20250820-riscv-altn-helper-wip-00af3a552c37
Best regards,
--
Vivian "dramforever" Wang
Powered by blists - more mailing lists