On 17.12.2025 00:13, Grygorii Strashko wrote:
> --- a/xen/arch/x86/include/asm/mm.h
> +++ b/xen/arch/x86/include/asm/mm.h
> @@ -619,8 +619,16 @@ void __iomem *ioremap_wc(paddr_t pa, size_t len);
>
> extern int memory_add(unsigned long spfn, unsigned long epfn, unsigned int
> pxm);
>
> -unsigned int domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits);
> -#define domain_clamp_alloc_bitsize(d, bits) domain_clamp_alloc_bitsize(d,
> bits)
> +#ifdef CONFIG_PV32
> +#define domain_clamp_alloc_bitsize(d, bits) ({
> \
> + struct domain *_d = (d);
> \
This imo wants to be pointer-to-const. Question is whether then I'm upsetting
you
again, Andrew?
> + ((_d &&
> \
> + _d->arch.physaddr_bitsize)
> \
> + ? min_t(unsigned int, _d->arch.physaddr_bitsize, bits)
> \
> + : bits);
> \
This imo wants to look more like
((_d && _d->arch.physaddr_bitsize) \
? min_t(unsigned int, _d->arch.physaddr_bitsize, bits) \
: (bits)); \
The parenthesization of the latter use of "bits" is a must.
With the adjustments (happy to carry out while committing, so long as there's
agreement):
Reviewed-by: Jan Beulich <[email protected]>
Albeit, as indicated before, I'm not quite happy with the use of min_t(). Maybe
another macro-local variable _bits should be introduced?
Jan