On 12.06.2025 12:51, Roger Pau Monné wrote: > On Thu, Jun 12, 2025 at 10:36:36AM +0200, Jan Beulich wrote: >> On 11.06.2025 19:16, Roger Pau Monne wrote: >>> @@ -80,6 +81,39 @@ unsigned long get_max_pfn(unsigned long top_pfn) >>> return pdx_to_pfn(pdx - 1) + 1; >>> } >>> >>> +#ifndef CONFIG_PDX_NONE >>> + >>> +#ifdef CONFIG_X86 >>> +# include <asm/e820.h> >>> +# define MAX_PFN_RANGES E820MAX >>> +#elif defined(CONFIG_HAS_DEVICE_TREE) >>> +# include <xen/bootfdt.h> >>> +# define MAX_PFN_RANGES NR_MEM_BANKS >>> +#else >>> +# error "Missing architecture maximum number of RAM ranges" >>> +#endif >>> + >>> +/* Generic PFN compression helpers. */ >>> +static struct pfn_range { >>> + unsigned long base, size; >>> +} ranges[MAX_PFN_RANGES] __initdata; >>> +static unsigned int __initdata nr; >> >> One other remark / nit: For my taste, "nr" isn't a suitable name for a >> static. >> It's too short, and hence the risk is too high that some function would add a >> local aliasing this one. > > Is nr_ranges enough to avoid aliasing?
Yes, at least as far as I'm concerned. Jan