public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v3 00/11] Enable setexpr command to print cpu-list like bitmaps
@ 2024-01-10  9:10 lukas.funke-oss
  2024-01-10  9:10 ` [PATCH v3 01/11] sandbox: add generic find_next_zero_bit implementation lukas.funke-oss
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: lukas.funke-oss @ 2024-01-10  9:10 UTC (permalink / raw)
  To: u-boot
  Cc: Simon Glass, Heinrich Schuchardt, Lukas Funke, Bin Meng,
	Evgeny Bachinin, Ilias Apalodimas, Marek Vasut,
	Mattijs Korpershoek, Roland Gaudig, Siddharth Vadapalli,
	Łukasz Stelmach

From: Lukas Funke <lukas.funke@weidmueller.com>


This series enables the 'setexpr' command to print "cpu list"-like
bitmaps based on the printk format specifier [1].

One use-case is to pass cpu list [2] based kernel parameter like
'isolcpu', 'nohz_full', irq affinity or RCU related CPU parameter to
the kernel via a separate firmware variable without exposing the
'bootargs' variable to directly.

Example:

=> env set value 0xdeadbeef
=> setexpr a fmt isolcpus=%32pbl $value
=> echo $a
isolcpus=0-3,5-7,9-13,15-16,18-19,21,23,25-28,30-31

[1] https://www.kernel.org/doc/Documentation/printk-formats.txt
[2] https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html


Changes in v3:
- Use generic find_next_zero_bit() from arch/arm/include/asm/bitops.h
- Redirect sandbox ffz() implementation to generic __ffs() impl
- Remove '%bp' from documentation
- Give an example output in the documentation
- Remove bitmap_string() conversion function since the same function
  can be achieved using other format specifier
- Dereference pointer argument (i.e. *value) in the
  'setexpr name fmt <format> value' case. This is currently only
  supported in the 'setexptr <name> [*]<value>' and
  'setexptr <name> [*]<value> <op> [*]<value2>' case

Changes in v2:
- Add bitmap format specifier to documentation

Lukas Funke (11):
  sandbox: add generic find_next_zero_bit implementation
  linux: bitmap.h: add 'for_each_set_bitrange' iteration macro
  test: cmd: setexpr: Add tests for bitmap string format
  doc: printf() codes: Add bitmap format specifier
  cmd: printf: Correctly handle field width
  lib: Add hextobarray() function
  lib: vsprintf: enable '%pbl' format specifier
  setexpr: rename 'get_arg()' to 'setexpr_get_arg()'
  setexpr: Promote 'setexpr_get_arg()' to a public function
  setexptr: Extend setexpr_get_arg() to handle pointer to memory
  cmd: printf: forward '%p' format string specifier

 arch/sandbox/include/asm/bitops.h | 60 +++++++++++++++++++------------
 cmd/printf.c                      | 53 ++++++++++++++++++++++++++-
 cmd/setexpr.c                     | 48 +++++++++++++++----------
 doc/develop/printf.rst            |  4 +++
 include/command.h                 | 27 ++++++++++++++
 include/linux/bitmap.h            |  7 ++++
 include/vsprintf.h                |  7 ++++
 lib/strto.c                       | 35 ++++++++++++++++++
 lib/vsprintf.c                    | 42 ++++++++++++++++++++++
 test/cmd/setexpr.c                | 22 ++++++++++++
 10 files changed, 263 insertions(+), 42 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-01-24  1:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10  9:10 [PATCH v3 00/11] Enable setexpr command to print cpu-list like bitmaps lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 01/11] sandbox: add generic find_next_zero_bit implementation lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 02/11] linux: bitmap.h: add 'for_each_set_bitrange' iteration macro lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 03/11] test: cmd: setexpr: Add tests for bitmap string format lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 04/11] doc: printf() codes: Add bitmap format specifier lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 05/11] cmd: printf: Correctly handle field width lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 06/11] lib: Add hextobarray() function lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 07/11] lib: vsprintf: enable '%pbl' format specifier lukas.funke-oss
2024-01-18 20:22   ` Tom Rini
2024-01-23 14:48     ` Lukas Funke
2024-01-24  1:32       ` Tom Rini
2024-01-10  9:10 ` [PATCH v3 08/11] setexpr: rename 'get_arg()' to 'setexpr_get_arg()' lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 09/11] setexpr: Promote 'setexpr_get_arg()' to a public function lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 10/11] setexptr: Extend setexpr_get_arg() to handle pointer to memory lukas.funke-oss
2024-01-10  9:10 ` [PATCH v3 11/11] cmd: printf: forward '%p' format string specifier lukas.funke-oss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox