x86/kexec: remove unnecessary arch_kexec_kernel_image_load()
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Mar 2023 22:44:15 +0000 (16:44 -0600)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 8 Apr 2023 20:45:38 +0000 (13:45 -0700)
Patch series "kexec: Remove unnecessary arch hook", v2.

There are no arch-specific things in arch_kexec_kernel_image_load(), so
remove it and just use the generic version.

This patch (of 2):

The x86 implementation of arch_kexec_kernel_image_load() is functionally
identical to the generic arch_kexec_kernel_image_load():

  arch_kexec_kernel_image_load                # x86
    if (!image->fops || !image->fops->load)
      return ERR_PTR(-ENOEXEC);
    return image->fops->load(image, image->kernel_buf, ...)

  arch_kexec_kernel_image_load                # generic
    kexec_image_load_default
      if (!image->fops || !image->fops->load)
return ERR_PTR(-ENOEXEC);
      return image->fops->load(image, image->kernel_buf, ...)

Remove the x86-specific version and use the generic
arch_kexec_kernel_image_load().  No functional change intended.

Link: https://lkml.kernel.org/r/20230307224416.907040-1-helgaas@kernel.org
Link: https://lkml.kernel.org/r/20230307224416.907040-2-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/include/asm/kexec.h
arch/x86/kernel/machine_kexec_64.c
include/linux/kexec.h

index a3760ca796aa24c6976231fc1485ceb31d3c5185..5b77bbc28f9693622d7bcf1c4a4c8cc6be6aeb98 100644 (file)
@@ -200,9 +200,6 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
                                     const Elf_Shdr *symtab);
 #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
 
-void *arch_kexec_kernel_image_load(struct kimage *image);
-#define arch_kexec_kernel_image_load arch_kexec_kernel_image_load
-
 int arch_kimage_file_post_load_cleanup(struct kimage *image);
 #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
 #endif
index 0611fd83858e6404da8c9124d15a09a72016b97e..1a3e2c05a8a5b6dad9d29f00fd41fc3b2a3df80b 100644 (file)
@@ -374,17 +374,6 @@ void machine_kexec(struct kimage *image)
 /* arch-dependent functionality related to kexec file-based syscall */
 
 #ifdef CONFIG_KEXEC_FILE
-void *arch_kexec_kernel_image_load(struct kimage *image)
-{
-       if (!image->fops || !image->fops->load)
-               return ERR_PTR(-ENOEXEC);
-
-       return image->fops->load(image, image->kernel_buf,
-                                image->kernel_buf_len, image->initrd_buf,
-                                image->initrd_buf_len, image->cmdline_buf,
-                                image->cmdline_buf_len);
-}
-
 /*
  * Apply purgatory relocations.
  *
index 6883c592270152adc229dacc3fd0df47750b56e4..4746bc9d39c9493332979ae09bf8afb92d4b4c04 100644 (file)
@@ -207,12 +207,10 @@ static inline int arch_kimage_file_post_load_cleanup(struct kimage *image)
 }
 #endif
 
-#ifndef arch_kexec_kernel_image_load
 static inline void *arch_kexec_kernel_image_load(struct kimage *image)
 {
        return kexec_image_load_default(image);
 }
-#endif
 
 #ifdef CONFIG_KEXEC_SIG
 #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION