On 4/29/25 08:53, Mike Rapoport wrote: > On Mon, Apr 28, 2025 at 03:05:55PM -0700, Dave Hansen wrote: >> On 4/10/25 22:37, Changyuan Lyu wrote: >>> From: Alexander Graf <g...@amazon.com> >>> >>> +#ifdef CONFIG_KEXEC_HANDOVER >>> +static bool process_kho_entries(unsigned long minimum, unsigned long >>> image_size) >>> +{ >>> + struct kho_scratch *kho_scratch; >>> + struct setup_data *ptr; >>> + int i, nr_areas = 0; >> >> Do these really need actual #ifdefs or will a nice IS_ENABLED() check >> work instead? >> >>> + ptr = (struct setup_data *)(unsigned >>> long)boot_params_ptr->hdr.setup_data; >> >> What's with the double cast? > > The double cast is required for this to be compiled on 32 bits (just like > in mem_avoid_overlap). The setup_data is all u64 and to cast it to a > pointer on 32 bit it has to go via unsigned long.
Let's just make KHO depend on 64BIT, at least on x86. >>> diff --git a/arch/x86/kernel/kexec-bzimage64.c >>> b/arch/x86/kernel/kexec-bzimage64.c >>> index 68530fad05f74..518635cc0876c 100644 >>> --- a/arch/x86/kernel/kexec-bzimage64.c >>> +++ b/arch/x86/kernel/kexec-bzimage64.c >>> @@ -233,6 +233,31 @@ setup_ima_state(const struct kimage *image, struct >>> boot_params *params, >>> #endif /* CONFIG_IMA_KEXEC */ >>> } >>> >>> +static void setup_kho(const struct kimage *image, struct boot_params >>> *params, >>> + unsigned long params_load_addr, >>> + unsigned int setup_data_offset) >>> +{ >>> +#ifdef CONFIG_KEXEC_HANDOVER >> >> Can this #ifdef be replaced with IS_ENABLED()? > > The KHO structures in kexec image are under #ifdef, so it won't compile > with IS_ENABLED(). They shouldn't be. Define them unconditionally, please. ... >> Please axe the #ifdef in the .c file if at all possible, just like the >> others. > > This one follows IMA, but it's easy to make it IS_ENABLED(). It's really up > to x86 folks preference. Last I checked, I'm listed under the big M: for "X86 ARCHITECTURE". ;)