[PATCH 2/4] irqchip/gic-v3: make distributor priorities variables

Mark Rutland mark.rutland at arm.com
Mon Jun 17 03:39:48 PDT 2024


On Wed, May 29, 2024 at 06:21:14PM +0100, Mark Rutland wrote:
> In subsequent patches the GICv3 driver will choose the regular interrupt
> priority at boot time.
> 
> In preparation for using dynamic priorities, place the priorities in
> variables and update the code to pass these as parameters. Users of
> GICD_INT_DEF_PRI_X4 are modified to replicate the priority byte using
> REPEAT_BYTE().
> 
> There should be no functional change as a result of this patch.

[...]

> -		writel_relaxed(GICD_INT_DEF_PRI_X4, base + GIC_DIST_PRI + i);
> +		writel_relaxed((u32)REPEAT_BYTE(priority),
> +			       base + GIC_DIST_PRI + i);

Sparse is unhappy that this throws away the upper 32 bits, and begins
producing warnings of the form:

  cast truncates bits from constant value (a0a0a0a0a0a0a0a0 becomes a0a0a0a0)

I can fix this with:

	 writel_relaxed(lower_32_bits(REPEAT_BYTE(priority)),
	 		base + GIC_DIST_PRI + i);

... but that gets a bit verbose, so I'm going to add a
REPEAT_BYTE_U32() to <linux/wordpart.h> and use that here and
elsewhere.

Mark.



More information about the linux-arm-kernel mailing list