All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] bitfield: tidy up bitfield.h
@ 2025-12-08 22:42 david.laight.linux
  2025-12-08 22:42 ` [PATCH 1/9] nfp: Call FIELD_PREP() in NFP_ETH_SET_BIT_CONFIG() wrapper david.laight.linux
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: david.laight.linux @ 2025-12-08 22:42 UTC (permalink / raw)
  To: Yury Norov, Rasmus Villemoes, linux-kernel, linux-usb,
	Geert Uytterhoeven
  Cc: David Laight, Alexandre Belloni, Jonathan Cameron, Crt Mori,
	Richard Genoud, Andy Shevchenko, Luo Jie, Peter Zijlstra,
	Jakub Kicinski, netdev, David S . Miller, Simon Horman,
	Mika Westerberg, Andreas Noever, Yehezkel Bernat

From: David Laight <david.laight.linux@gmail.com>

I noticed some very long (18KB) error messages from the compiler.
Turned out they were errors on lines that passed GENMASK() to FIELD_PREP().
Since most of the #defines are already statement functions the values
can be copied to locals so the actual parameters only get expanded once.

The 'bloat' is reduced further by using a simple test to ensure 'reg'
is large enough, slightly simplifying the test for constant 'val' and
only checking 'reg' and 'val' when the parameters are present.

The first two patches are slightly problematic.

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c manages to use
a #define that should be an internal to bitfield.h, the changed file
is actually more similar to the previous version.

drivers/thunderbolt/tb.h passes a bifield to FIELD_GET(), these can't
be used with sizeof or __auto_type. The usual solution is to add zero,
but that can't be done in FIELD_GET() because it doesn't want the value
promoted to 'int' (no idea how _Generic() treated it.)
The fix is just to add zero at the call site.
(The bitfield seems to be in a structure rad from hardware - no idea
how that works on BE (or any LE that uses an unusual order for bitfields.)

Both changes may need to to through the same tree as the header file changes.

The changes are based on 'next' and contain the addition of field_prep()
and field_get() for non-constant values.

I also know it is the merge window.
I expect to be generating a v2 in the new year (someone always has a comment).

David Laight (9):
  nfp: Call FIELD_PREP() in NFP_ETH_SET_BIT_CONFIG() wrapper
  thunderblot: Don't pass a bitfield to FIELD_GET
  bitmap: Use FIELD_PREP() in expansion of FIELD_PREP_WM16()
  bitfield: Copy #define parameters to locals
  bitfield: FIELD_MODIFY: Only do a single read/write on the target
  bitfield: Update sanity checks
  bitfield: Reduce indentation
  bitfield: Add comment block for the host/fixed endian functions
  bitfield: Update comments for le/be functions

 .../netronome/nfp/nfpcore/nfp_nsp_eth.c       |  16 +-
 drivers/thunderbolt/tb.h                      |   2 +-
 include/linux/bitfield.h                      | 278 ++++++++++--------
 include/linux/hw_bitfield.h                   |  17 +-
 4 files changed, 166 insertions(+), 147 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH 0/9] bitfield: tidy up bitfield.h
@ 2025-12-09 10:03 david.laight.linux
  2025-12-09 10:03 ` [PATCH 6/9] bitfield: Update sanity checks david.laight.linux
  0 siblings, 1 reply; 22+ messages in thread
From: david.laight.linux @ 2025-12-09 10:03 UTC (permalink / raw)
  To: Yury Norov, Rasmus Villemoes, linux-kernel, linux-usb,
	Geert Uytterhoeven, Alexandre Belloni, Jonathan Cameron, Crt Mori,
	Richard Genoud, Andy Shevchenko, Luo Jie, Peter Zijlstra,
	Jakub Kicinski, netdev, David S . Miller, Simon Horman,
	Mika Westerberg, Andreas Noever, Yehezkel Bernat,
	Nicolas Frattaroli
  Cc: David Laight

From: David Laight <david.laight.linux@gmail.com>

Re-send with patches going to everyone.
(I'd forgotten I'd set 'ccCover = 0'.)

I noticed some very long (18KB) error messages from the compiler.
Turned out they were errors on lines that passed GENMASK() to FIELD_PREP().
Since most of the #defines are already statement functions the values
can be copied to locals so the actual parameters only get expanded once.

The 'bloat' is reduced further by using a simple test to ensure 'reg'
is large enough, slightly simplifying the test for constant 'val' and
only checking 'reg' and 'val' when the parameters are present.

The first two patches are slightly problematic.

drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c manages to use
a #define that should be an internal to bitfield.h, the changed file
is actually more similar to the previous version.

drivers/thunderbolt/tb.h passes a bifield to FIELD_GET(), these can't
be used with sizeof or __auto_type. The usual solution is to add zero,
but that can't be done in FIELD_GET() because it doesn't want the value
promoted to 'int' (no idea how _Generic() treated it.)
The fix is just to add zero at the call site.
(The bitfield seems to be in a structure rad from hardware - no idea
how that works on BE (or any LE that uses an unusual order for bitfields.)

Both changes may need to to through the same tree as the header file changes.

The changes are based on 'next' and contain the addition of field_prep()
and field_get() for non-constant values.

I also know it is the merge window.
I expect to be generating a v2 in the new year (someone always has a comment).

David Laight (9):
  nfp: Call FIELD_PREP() in NFP_ETH_SET_BIT_CONFIG() wrapper
  thunderblot: Don't pass a bitfield to FIELD_GET
  bitmap: Use FIELD_PREP() in expansion of FIELD_PREP_WM16()
  bitfield: Copy #define parameters to locals
  bitfield: FIELD_MODIFY: Only do a single read/write on the target
  bitfield: Update sanity checks
  bitfield: Reduce indentation
  bitfield: Add comment block for the host/fixed endian functions
  bitfield: Update comments for le/be functions

 .../netronome/nfp/nfpcore/nfp_nsp_eth.c       |  16 +-
 drivers/thunderbolt/tb.h                      |   2 +-
 include/linux/bitfield.h                      | 278 ++++++++++--------
 include/linux/hw_bitfield.h                   |  17 +-
 4 files changed, 166 insertions(+), 147 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH 6/9] bitfield: Update sanity checks
@ 2025-12-11 14:03 kernel test robot
  0 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2025-12-11 14:03 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: __auto_type on self-init var"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20251209100313.2867-7-david.laight.linux@gmail.com>
References: <20251209100313.2867-7-david.laight.linux@gmail.com>
TO: david.laight.linux@gmail.com
TO: Yury Norov <yury.norov@gmail.com>
TO: Rasmus Villemoes <linux@rasmusvillemoes.dk>
TO: linux-kernel@vger.kernel.org
TO: linux-usb@vger.kernel.org
TO: Geert Uytterhoeven <geert+renesas@glider.be>
TO: Alexandre Belloni <alexandre.belloni@bootlin.com>
TO: Jonathan Cameron <Jonathan.Cameron@huawei.com>
TO: Crt Mori <cmo@melexis.com>
TO: Richard Genoud <richard.genoud@bootlin.com>
TO: Andy Shevchenko <andriy.shevchenko@intel.com>
TO: Luo Jie <quic_luoj@quicinc.com>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Jakub Kicinski <kuba@kernel.org>
TO: netdev@vger.kernel.org
TO: "David S . Miller" <davem@davemloft.net>
TO: Simon Horman <simon.horman@netronome.com>
TO: Mika Westerberg <mika.westerberg@linux.intel.com>
TO: Andreas Noever <andreas.noever@gmail.com>
TO: Yehezkel Bernat <YehezkelShB@gmail.com>
TO: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
CC: David Laight <david.laight.linux@gmail.com>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20251211]
[cannot apply to westeri-thunderbolt/next v6.18]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/david-laight-linux-gmail-com/nfp-Call-FIELD_PREP-in-NFP_ETH_SET_BIT_CONFIG-wrapper/20251209-181248
base:   linus/master
patch link:    https://lore.kernel.org/r/20251209100313.2867-7-david.laight.linux%40gmail.com
patch subject: [PATCH 6/9] bitfield: Update sanity checks
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: nios2-randconfig-r133-20251211 (https://download.01.org/0day-ci/archive/20251211/202512112136.QAv8Vduf-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251211/202512112136.QAv8Vduf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202512112136.QAv8Vduf-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: __auto_type on self-init var
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse: sparse: __auto_type on self-init var
   drivers/mmc/host/dw_mmc-rockchip.c:595:1: sparse: sparse: bad integer constant expression
   drivers/mmc/host/dw_mmc-rockchip.c:595:1: sparse: sparse: static assertion failed: "MODULE_INFO(author, ...) contains embedded NUL byte"
   drivers/mmc/host/dw_mmc-rockchip.c:596:1: sparse: sparse: bad integer constant expression
   drivers/mmc/host/dw_mmc-rockchip.c:596:1: sparse: sparse: static assertion failed: "MODULE_INFO(description, ...) contains embedded NUL byte"
   drivers/mmc/host/dw_mmc-rockchip.c:597:1: sparse: sparse: bad integer constant expression
   drivers/mmc/host/dw_mmc-rockchip.c:597:1: sparse: sparse: static assertion failed: "MODULE_INFO(alias, ...) contains embedded NUL byte"
   drivers/mmc/host/dw_mmc-rockchip.c:598:1: sparse: sparse: bad integer constant expression
   drivers/mmc/host/dw_mmc-rockchip.c:598:1: sparse: sparse: static assertion failed: "MODULE_INFO(file, ...) contains embedded NUL byte"
   drivers/mmc/host/dw_mmc-rockchip.c:598:1: sparse: sparse: bad integer constant expression
   drivers/mmc/host/dw_mmc-rockchip.c:598:1: sparse: sparse: static assertion failed: "MODULE_INFO(license, ...) contains embedded NUL byte"
>> drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: incompatible types in conditional expression (different base types):
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    unsigned int
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    bad type
>> drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: incompatible type for operation (-):
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    bad type _mask
>> drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: incompatible types for operation (>>):
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    bad type _mask
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    int
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse: sparse: incompatible types for operation (<<):
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    bad type _val
   drivers/mmc/host/dw_mmc-rockchip.c:152:17: sparse:    int
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse: sparse: incompatible types in conditional expression (different base types):
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    unsigned int
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    bad type
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse: sparse: incompatible type for operation (-):
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    bad type _mask
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse: sparse: incompatible types for operation (>>):
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    bad type _mask
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    int
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse: sparse: incompatible types for operation (<<):
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    bad type _val
   drivers/mmc/host/dw_mmc-rockchip.c:155:17: sparse:    int

vim +152 drivers/mmc/host/dw_mmc-rockchip.c

59903441f5e49d Shawn Lin          2024-08-28   87  
59903441f5e49d Shawn Lin          2024-08-28   88  static int rockchip_mmc_set_internal_phase(struct dw_mci *host, bool sample, int degrees)
59903441f5e49d Shawn Lin          2024-08-28   89  {
739f04f4a46237 Shawn Lin          2025-11-04   90  	unsigned long rate = clk_get_rate(host->ciu_clk) / RK3288_CLKGEN_DIV;
59903441f5e49d Shawn Lin          2024-08-28   91  	u8 nineties, remainder;
59903441f5e49d Shawn Lin          2024-08-28   92  	u8 delay_num;
59903441f5e49d Shawn Lin          2024-08-28   93  	u32 raw_value;
59903441f5e49d Shawn Lin          2024-08-28   94  	u32 delay;
59903441f5e49d Shawn Lin          2024-08-28   95  
59903441f5e49d Shawn Lin          2024-08-28   96  	/*
59903441f5e49d Shawn Lin          2024-08-28   97  	 * The below calculation is based on the output clock from
59903441f5e49d Shawn Lin          2024-08-28   98  	 * MMC host to the card, which expects the phase clock inherits
59903441f5e49d Shawn Lin          2024-08-28   99  	 * the clock rate from its parent, namely the output clock
59903441f5e49d Shawn Lin          2024-08-28  100  	 * provider of MMC host. However, things may go wrong if
59903441f5e49d Shawn Lin          2024-08-28  101  	 * (1) It is orphan.
59903441f5e49d Shawn Lin          2024-08-28  102  	 * (2) It is assigned to the wrong parent.
59903441f5e49d Shawn Lin          2024-08-28  103  	 *
59903441f5e49d Shawn Lin          2024-08-28  104  	 * This check help debug the case (1), which seems to be the
59903441f5e49d Shawn Lin          2024-08-28  105  	 * most likely problem we often face and which makes it difficult
59903441f5e49d Shawn Lin          2024-08-28  106  	 * for people to debug unstable mmc tuning results.
59903441f5e49d Shawn Lin          2024-08-28  107  	 */
59903441f5e49d Shawn Lin          2024-08-28  108  	if (!rate) {
59903441f5e49d Shawn Lin          2024-08-28  109  		dev_err(host->dev, "%s: invalid clk rate\n", __func__);
59903441f5e49d Shawn Lin          2024-08-28  110  		return -EINVAL;
59903441f5e49d Shawn Lin          2024-08-28  111  	}
59903441f5e49d Shawn Lin          2024-08-28  112  
59903441f5e49d Shawn Lin          2024-08-28  113  	nineties = degrees / 90;
59903441f5e49d Shawn Lin          2024-08-28  114  	remainder = (degrees % 90);
59903441f5e49d Shawn Lin          2024-08-28  115  
59903441f5e49d Shawn Lin          2024-08-28  116  	/*
59903441f5e49d Shawn Lin          2024-08-28  117  	 * Due to the inexact nature of the "fine" delay, we might
59903441f5e49d Shawn Lin          2024-08-28  118  	 * actually go non-monotonic.  We don't go _too_ monotonic
59903441f5e49d Shawn Lin          2024-08-28  119  	 * though, so we should be OK.  Here are options of how we may
59903441f5e49d Shawn Lin          2024-08-28  120  	 * work:
59903441f5e49d Shawn Lin          2024-08-28  121  	 *
59903441f5e49d Shawn Lin          2024-08-28  122  	 * Ideally we end up with:
59903441f5e49d Shawn Lin          2024-08-28  123  	 *   1.0, 2.0, ..., 69.0, 70.0, ...,  89.0, 90.0
59903441f5e49d Shawn Lin          2024-08-28  124  	 *
59903441f5e49d Shawn Lin          2024-08-28  125  	 * On one extreme (if delay is actually 44ps):
59903441f5e49d Shawn Lin          2024-08-28  126  	 *   .73, 1.5, ..., 50.6, 51.3, ...,  65.3, 90.0
59903441f5e49d Shawn Lin          2024-08-28  127  	 * The other (if delay is actually 77ps):
59903441f5e49d Shawn Lin          2024-08-28  128  	 *   1.3, 2.6, ..., 88.6. 89.8, ..., 114.0, 90
59903441f5e49d Shawn Lin          2024-08-28  129  	 *
59903441f5e49d Shawn Lin          2024-08-28  130  	 * It's possible we might make a delay that is up to 25
59903441f5e49d Shawn Lin          2024-08-28  131  	 * degrees off from what we think we're making.  That's OK
59903441f5e49d Shawn Lin          2024-08-28  132  	 * though because we should be REALLY far from any bad range.
59903441f5e49d Shawn Lin          2024-08-28  133  	 */
59903441f5e49d Shawn Lin          2024-08-28  134  
59903441f5e49d Shawn Lin          2024-08-28  135  	/*
59903441f5e49d Shawn Lin          2024-08-28  136  	 * Convert to delay; do a little extra work to make sure we
59903441f5e49d Shawn Lin          2024-08-28  137  	 * don't overflow 32-bit / 64-bit numbers.
59903441f5e49d Shawn Lin          2024-08-28  138  	 */
59903441f5e49d Shawn Lin          2024-08-28  139  	delay = 10000000; /* PSECS_PER_SEC / 10000 / 10 */
59903441f5e49d Shawn Lin          2024-08-28  140  	delay *= remainder;
59903441f5e49d Shawn Lin          2024-08-28  141  	delay = DIV_ROUND_CLOSEST(delay,
59903441f5e49d Shawn Lin          2024-08-28  142  			(rate / 1000) * 36 *
59903441f5e49d Shawn Lin          2024-08-28  143  				(ROCKCHIP_MMC_DELAY_ELEMENT_PSEC / 10));
59903441f5e49d Shawn Lin          2024-08-28  144  
59903441f5e49d Shawn Lin          2024-08-28  145  	delay_num = (u8) min_t(u32, delay, 255);
59903441f5e49d Shawn Lin          2024-08-28  146  
59903441f5e49d Shawn Lin          2024-08-28  147  	raw_value = delay_num ? ROCKCHIP_MMC_DELAY_SEL : 0;
59903441f5e49d Shawn Lin          2024-08-28  148  	raw_value |= delay_num << ROCKCHIP_MMC_DELAYNUM_OFFSET;
59903441f5e49d Shawn Lin          2024-08-28  149  	raw_value |= nineties;
59903441f5e49d Shawn Lin          2024-08-28  150  
59903441f5e49d Shawn Lin          2024-08-28  151  	if (sample)
47975a878c0669 Nicolas Frattaroli 2025-08-25 @152  		mci_writel(host, TIMING_CON1,
47975a878c0669 Nicolas Frattaroli 2025-08-25  153  			   FIELD_PREP_WM16(GENMASK(11, 1), raw_value));
59903441f5e49d Shawn Lin          2024-08-28  154  	else
47975a878c0669 Nicolas Frattaroli 2025-08-25  155  		mci_writel(host, TIMING_CON0,
47975a878c0669 Nicolas Frattaroli 2025-08-25  156  			   FIELD_PREP_WM16(GENMASK(11, 1), raw_value));
59903441f5e49d Shawn Lin          2024-08-28  157  
59903441f5e49d Shawn Lin          2024-08-28  158  	dev_dbg(host->dev, "set %s_phase(%d) delay_nums=%u actual_degrees=%d\n",
59903441f5e49d Shawn Lin          2024-08-28  159  		sample ? "sample" : "drv", degrees, delay_num,
59903441f5e49d Shawn Lin          2024-08-28  160  		rockchip_mmc_get_phase(host, sample)
59903441f5e49d Shawn Lin          2024-08-28  161  	);
59903441f5e49d Shawn Lin          2024-08-28  162  
59903441f5e49d Shawn Lin          2024-08-28  163  	return 0;
59903441f5e49d Shawn Lin          2024-08-28  164  }
59903441f5e49d Shawn Lin          2024-08-28  165  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH 6/9] bitfield: Update sanity checks
@ 2025-12-12  4:48 kernel test robot
  0 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2025-12-12  4:48 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: __auto_type on self-init var"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20251209100313.2867-7-david.laight.linux@gmail.com>
References: <20251209100313.2867-7-david.laight.linux@gmail.com>
TO: david.laight.linux@gmail.com
TO: Yury Norov <yury.norov@gmail.com>
TO: Rasmus Villemoes <linux@rasmusvillemoes.dk>
TO: linux-kernel@vger.kernel.org
TO: linux-usb@vger.kernel.org
TO: Geert Uytterhoeven <geert+renesas@glider.be>
TO: Alexandre Belloni <alexandre.belloni@bootlin.com>
TO: Jonathan Cameron <Jonathan.Cameron@huawei.com>
TO: Crt Mori <cmo@melexis.com>
TO: Richard Genoud <richard.genoud@bootlin.com>
TO: Andy Shevchenko <andriy.shevchenko@intel.com>
TO: Luo Jie <quic_luoj@quicinc.com>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Jakub Kicinski <kuba@kernel.org>
TO: netdev@vger.kernel.org
TO: "David S . Miller" <davem@davemloft.net>
TO: Simon Horman <simon.horman@netronome.com>
TO: Mika Westerberg <mika.westerberg@linux.intel.com>
TO: Andreas Noever <andreas.noever@gmail.com>
TO: Yehezkel Bernat <YehezkelShB@gmail.com>
TO: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
CC: David Laight <david.laight.linux@gmail.com>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20251212]
[cannot apply to westeri-thunderbolt/next v6.18]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/david-laight-linux-gmail-com/nfp-Call-FIELD_PREP-in-NFP_ETH_SET_BIT_CONFIG-wrapper/20251209-181248
base:   linus/master
patch link:    https://lore.kernel.org/r/20251209100313.2867-7-david.laight.linux%40gmail.com
patch subject: [PATCH 6/9] bitfield: Update sanity checks
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: um-randconfig-r132-20251212 (https://download.01.org/0day-ci/archive/20251212/202512121232.PvAIXM4T-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251212/202512121232.PvAIXM4T-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202512121232.PvAIXM4T-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: __auto_type on self-init var
>> drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: incompatible types in conditional expression (different base types):
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    unsigned int
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    bad type
>> drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: incompatible type for operation (-):
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    bad type _mask
>> drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: incompatible types for operation (>>):
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    bad type _mask
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    int
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse: sparse: incompatible types for operation (<<):
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    bad type _val
   drivers/pci/controller/pcie-rockchip.c:158:16: sparse:    int

vim +158 drivers/pci/controller/pcie-rockchip.c

9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  114  
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  115  int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  116  {
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  117  	struct device *dev = rockchip->dev;
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  118  	int err, i;
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  119  	u32 regs;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  120  
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  121  	err = reset_control_bulk_assert(ROCKCHIP_NUM_PM_RSTS,
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  122  					rockchip->pm_rsts);
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  123  	if (err)
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  124  		return dev_err_probe(dev, err, "Couldn't assert PM resets\n");
31a3a7b5b26f75 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-10  125  
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  126  	for (i = 0; i < MAX_LANE_NUM; i++) {
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  127  		err = phy_init(rockchip->phys[i]);
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  128  		if (err) {
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  129  			dev_err(dev, "init phy%d err %d\n", i, err);
8c595dd1fd97d8 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-23  130  			goto err_exit_phy;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  131  		}
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  132  	}
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  133  
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  134  	err = reset_control_bulk_assert(ROCKCHIP_NUM_CORE_RSTS,
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  135  					rockchip->core_rsts);
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  136  	if (err) {
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  137  		dev_err_probe(dev, err, "Couldn't assert Core resets\n");
8c595dd1fd97d8 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-23  138  		goto err_exit_phy;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  139  	}
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  140  
0722bdd2962a4a drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-24  141  	udelay(10);
0722bdd2962a4a drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-24  142  
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  143  	err = reset_control_bulk_deassert(ROCKCHIP_NUM_PM_RSTS,
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  144  					  rockchip->pm_rsts);
0722bdd2962a4a drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-24  145  	if (err) {
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  146  		dev_err(dev, "Couldn't deassert PM resets %d\n", err);
8c595dd1fd97d8 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-23  147  		goto err_exit_phy;
0722bdd2962a4a drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-24  148  	}
0722bdd2962a4a drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-11-24  149  
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  150  	if (rockchip->link_gen == 2)
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  151  		rockchip_pcie_write(rockchip, PCIE_CLIENT_GEN_SEL_2,
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  152  				    PCIE_CLIENT_CONFIG);
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  153  	else
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  154  		rockchip_pcie_write(rockchip, PCIE_CLIENT_GEN_SEL_1,
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  155  				    PCIE_CLIENT_CONFIG);
f2fb5b8f2a0cb6 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-12-07  156  
091022f5f94513 drivers/pci/controller/pcie-rockchip.c Damien Le Moal   2024-10-17  157  	regs = PCIE_CLIENT_ARI_ENABLE |
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09 @158  	       PCIE_CLIENT_CONF_LANE_NUM(rockchip->lanes);
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  159  
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  160  	if (rockchip->is_rc)
091022f5f94513 drivers/pci/controller/pcie-rockchip.c Damien Le Moal   2024-10-17  161  		regs |= PCIE_CLIENT_LINK_TRAIN_ENABLE |
091022f5f94513 drivers/pci/controller/pcie-rockchip.c Damien Le Moal   2024-10-17  162  			PCIE_CLIENT_CONF_ENABLE | PCIE_CLIENT_MODE_RC;
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  163  	else
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  164  		regs |= PCIE_CLIENT_CONF_DISABLE | PCIE_CLIENT_MODE_EP;
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  165  
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  166  	rockchip_pcie_write(rockchip, regs, PCIE_CLIENT_CONFIG);
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  167  
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  168  	for (i = 0; i < MAX_LANE_NUM; i++) {
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  169  		err = phy_power_on(rockchip->phys[i]);
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  170  		if (err) {
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  171  			dev_err(dev, "power on phy%d err %d\n", i, err);
8c595dd1fd97d8 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-23  172  			goto err_power_off_phy;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  173  		}
9e87240c460637 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-25  174  	}
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  175  
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  176  	err = readx_poll_timeout(rockchip_pcie_read_addr,
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  177  				 PCIE_CLIENT_SIDE_BAND_STATUS,
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  178  				 regs, !(regs & PCIE_CLIENT_PHY_ST),
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  179  				 RK_PHY_PLL_LOCK_SLEEP_US,
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  180  				 RK_PHY_PLL_LOCK_TIMEOUT_US);
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  181  	if (err) {
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  182  		dev_err(dev, "PHY PLLs could not lock, %d\n", err);
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  183  		goto err_power_off_phy;
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  184  	}
9dd3c7c4c8c3f7 drivers/pci/controller/pcie-rockchip.c Rick Wertenbroek 2023-04-18  185  
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  186  	err = reset_control_bulk_deassert(ROCKCHIP_NUM_CORE_RSTS,
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  187  					  rockchip->core_rsts);
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  188  	if (err) {
18715931a5c08d drivers/pci/controller/pcie-rockchip.c Anand Moon       2024-12-02  189  		dev_err(dev, "Couldn't deassert Core reset %d\n", err);
8c595dd1fd97d8 drivers/pci/host/pcie-rockchip.c       Shawn Lin        2017-08-23  190  		goto err_power_off_phy;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  191  	}
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  192  
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  193  	return 0;
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  194  err_power_off_phy:
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  195  	while (i--)
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  196  		phy_power_off(rockchip->phys[i]);
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  197  	i = MAX_LANE_NUM;
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  198  err_exit_phy:
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  199  	while (i--)
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  200  		phy_exit(rockchip->phys[i]);
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  201  	return err;
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  202  }
3593709f2651da drivers/pci/host/pcie-rockchip.c       Shawn Lin        2018-05-09  203  EXPORT_SYMBOL_GPL(rockchip_pcie_init_port);
e77f847df54c6b drivers/pci/host/pcie-rockchip.c       Shawn Lin        2016-09-03  204  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [PATCH 6/9] bitfield: Update sanity checks
@ 2025-12-12 20:28 kernel test robot
  0 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2025-12-12 20:28 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/iommu/riscv/iommu.c:1596:13: sparse: sparse: trying to concatenate 15816-character string (8191 bytes max)"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20251209100313.2867-7-david.laight.linux@gmail.com>
References: <20251209100313.2867-7-david.laight.linux@gmail.com>
TO: david.laight.linux@gmail.com
TO: Yury Norov <yury.norov@gmail.com>
TO: Rasmus Villemoes <linux@rasmusvillemoes.dk>
TO: linux-kernel@vger.kernel.org
TO: linux-usb@vger.kernel.org
TO: Geert Uytterhoeven <geert+renesas@glider.be>
TO: Alexandre Belloni <alexandre.belloni@bootlin.com>
TO: Jonathan Cameron <Jonathan.Cameron@huawei.com>
TO: Crt Mori <cmo@melexis.com>
TO: Richard Genoud <richard.genoud@bootlin.com>
TO: Andy Shevchenko <andriy.shevchenko@intel.com>
TO: Luo Jie <quic_luoj@quicinc.com>
TO: Peter Zijlstra <peterz@infradead.org>
TO: Jakub Kicinski <kuba@kernel.org>
TO: netdev@vger.kernel.org
TO: "David S . Miller" <davem@davemloft.net>
TO: Simon Horman <simon.horman@netronome.com>
TO: Mika Westerberg <mika.westerberg@linux.intel.com>
TO: Andreas Noever <andreas.noever@gmail.com>
TO: Yehezkel Bernat <YehezkelShB@gmail.com>
TO: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
CC: David Laight <david.laight.linux@gmail.com>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20251212]
[cannot apply to westeri-thunderbolt/next v6.18]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/david-laight-linux-gmail-com/nfp-Call-FIELD_PREP-in-NFP_ETH_SET_BIT_CONFIG-wrapper/20251209-181248
base:   linus/master
patch link:    https://lore.kernel.org/r/20251209100313.2867-7-david.laight.linux%40gmail.com
patch subject: [PATCH 6/9] bitfield: Update sanity checks
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: riscv-randconfig-r113-20251212 (https://download.01.org/0day-ci/archive/20251213/202512130436.cX0B0hF7-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251213/202512130436.cX0B0hF7-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202512130436.cX0B0hF7-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   WARNING: invalid argument to '-march': '_zacas_zabha'
>> drivers/iommu/riscv/iommu.c:1596:13: sparse: sparse: trying to concatenate 15816-character string (8191 bytes max)
   drivers/iommu/riscv/iommu.c:163:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *base @@     got void [noderef] __iomem * @@
   drivers/iommu/riscv/iommu.c:163:29: sparse:     expected void *base
   drivers/iommu/riscv/iommu.c:163:29: sparse:     got void [noderef] __iomem *
>> drivers/iommu/riscv/iommu.c:697:41: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [usertype] *ddt_root @@     got void [noderef] __iomem * @@
   drivers/iommu/riscv/iommu.c:697:41: sparse:     expected unsigned long long [usertype] *ddt_root
   drivers/iommu/riscv/iommu.c:697:41: sparse:     got void [noderef] __iomem *

vim +1596 drivers/iommu/riscv/iommu.c

822e8bc68505820 Tomasz Jeznach 2024-10-15  1550  
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1551  static int riscv_iommu_init_check(struct riscv_iommu_device *iommu)
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1552  {
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1553  	u64 ddtp;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1554  
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1555  	/*
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1556  	 * Make sure the IOMMU is switched off or in pass-through mode during
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1557  	 * regular boot flow and disable translation when we boot into a kexec
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1558  	 * kernel and the previous kernel left them enabled.
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1559  	 */
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1560  	ddtp = riscv_iommu_readq(iommu, RISCV_IOMMU_REG_DDTP);
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1561  	if (ddtp & RISCV_IOMMU_DDTP_BUSY)
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1562  		return -EBUSY;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1563  
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1564  	if (FIELD_GET(RISCV_IOMMU_DDTP_IOMMU_MODE, ddtp) >
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1565  	     RISCV_IOMMU_DDTP_IOMMU_MODE_BARE) {
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1566  		if (!is_kdump_kernel())
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1567  			return -EBUSY;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1568  		riscv_iommu_disable(iommu);
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1569  	}
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1570  
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1571  	/* Configure accesses to in-memory data structures for CPU-native byte order. */
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1572  	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) !=
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1573  	    !!(iommu->fctl & RISCV_IOMMU_FCTL_BE)) {
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1574  		if (!(iommu->caps & RISCV_IOMMU_CAPABILITIES_END))
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1575  			return -EINVAL;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1576  		riscv_iommu_writel(iommu, RISCV_IOMMU_REG_FCTL,
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1577  				   iommu->fctl ^ RISCV_IOMMU_FCTL_BE);
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1578  		iommu->fctl = riscv_iommu_readl(iommu, RISCV_IOMMU_REG_FCTL);
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1579  		if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) !=
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1580  		    !!(iommu->fctl & RISCV_IOMMU_FCTL_BE))
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1581  			return -EINVAL;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1582  	}
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1583  
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1584  	/*
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1585  	 * Distribute interrupt vectors, always use first vector for CIV.
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1586  	 * At least one interrupt is required. Read back and verify.
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1587  	 */
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1588  	if (!iommu->irqs_count)
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1589  		return -EINVAL;
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1590  
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1591  	iommu->icvec = FIELD_PREP(RISCV_IOMMU_ICVEC_FIV, 1 % iommu->irqs_count) |
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1592  		       FIELD_PREP(RISCV_IOMMU_ICVEC_PIV, 2 % iommu->irqs_count) |
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1593  		       FIELD_PREP(RISCV_IOMMU_ICVEC_PMIV, 3 % iommu->irqs_count);
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1594  	riscv_iommu_writeq(iommu, RISCV_IOMMU_REG_ICVEC, iommu->icvec);
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1595  	iommu->icvec = riscv_iommu_readq(iommu, RISCV_IOMMU_REG_ICVEC);
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15 @1596  	if (max(max(FIELD_GET(RISCV_IOMMU_ICVEC_CIV, iommu->icvec),
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1597  		    FIELD_GET(RISCV_IOMMU_ICVEC_FIV, iommu->icvec)),
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1598  		max(FIELD_GET(RISCV_IOMMU_ICVEC_PIV, iommu->icvec),
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1599  		    FIELD_GET(RISCV_IOMMU_ICVEC_PMIV, iommu->icvec))) >= iommu->irqs_count)
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1600  		return -EINVAL;
856c0cfe5c5f6a2 Tomasz Jeznach 2024-10-15  1601  
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1602  	return 0;
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1603  }
5c0ebbd3c6c6e00 Tomasz Jeznach 2024-10-15  1604  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2025-12-12 20:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 22:42 [PATCH 0/9] bitfield: tidy up bitfield.h david.laight.linux
2025-12-08 22:42 ` [PATCH 1/9] nfp: Call FIELD_PREP() in NFP_ETH_SET_BIT_CONFIG() wrapper david.laight.linux
2025-12-08 22:42 ` [PATCH 2/9] thunderblot: Don't pass a bitfield to FIELD_GET david.laight.linux
2025-12-08 22:56   ` Greg KH
2025-12-09 10:36     ` David Laight
2025-12-08 22:42 ` [PATCH 3/9] bitmap: Use FIELD_PREP() in expansion of FIELD_PREP_WM16() david.laight.linux
2025-12-09  0:54   ` Yury Norov
2025-12-09  9:56     ` David Laight
2025-12-11 18:53     ` David Laight
2025-12-08 22:42 ` [PATCH 4/9] bitfield: Copy #define parameters to locals david.laight.linux
2025-12-08 22:42 ` [PATCH 5/9] bitfield: FIELD_MODIFY: Only do a single read/write on the target david.laight.linux
2025-12-08 22:42 ` [PATCH 6/9] bitfield: Update sanity checks david.laight.linux
2025-12-08 22:42 ` [PATCH 7/9] bitfield: Reduce indentation david.laight.linux
2025-12-08 22:42 ` [PATCH 8/9] bitfield: Add comment block for the host/fixed endian functions david.laight.linux
2025-12-08 22:42 ` [PATCH 9/9] bitfield: Update comments for le/be functions david.laight.linux
2025-12-09  7:08 ` [PATCH 0/9] bitfield: tidy up bitfield.h Mika Westerberg
2025-12-09  7:49   ` Jakub Kicinski
2025-12-09  9:44   ` David Laight
  -- strict thread matches above, loose matches on Subject: below --
2025-12-09 10:03 david.laight.linux
2025-12-09 10:03 ` [PATCH 6/9] bitfield: Update sanity checks david.laight.linux
2025-12-11 14:03 kernel test robot
2025-12-12  4:48 kernel test robot
2025-12-12 20:28 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.