From nobody Wed Sep 17 19:22:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ED86C3DA71 for ; Thu, 15 Dec 2022 18:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiLOSX5 (ORCPT ); Thu, 15 Dec 2022 13:23:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiLOSXu (ORCPT ); Thu, 15 Dec 2022 13:23:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB5046675 for ; Thu, 15 Dec 2022 10:23:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BE20BB81C37 for ; Thu, 15 Dec 2022 18:23:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50AA7C433D2; Thu, 15 Dec 2022 18:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671128626; bh=b2movO2QDbJENwvsGD8QiYwsUZPp0zsJc8kXD8M/tfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpSboetvljJzT63/IrlGiNOoqueazi0K6h+vUaIhfAanjtpjBAkBTKVgJJG/2RWQc hiLxABCFF8bWCWPfpJPqwLg7hb258NlP2t951bgnQWjs5C5EtyGqiIoJKdq6glnQjO aoyTTVFxNQdiMpaXRYuoMGBlBxcDDoKsqxmKXrWrPRnXy7PCGYffORUVHfCo/GrueN 5yDYYcD1RPbhUTVekdJBe/9+c4aCtRDItoFN8EjGv/xz8kt9V61Tsqy38PVNfj4JXk l7xuVmhzhHHkm86E8wFqTwgZSMt4n9paAa/oivBrIw/6P6MKOj9IxhYINqy9n/KysN P87CCcvHMoE8A== From: Bjorn Helgaas To: Eric Biederman Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load() Date: Thu, 15 Dec 2022 12:23:38 -0600 Message-Id: <20221215182339.129803-2-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215182339.129803-1-helgaas@kernel.org> References: <20221215182339.129803-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Helgaas The x86 implementation of arch_kexec_kernel_image_load() is functionally identical to the generic arch_kexec_kernel_image_load(). Remove it and use the generic arch_kexec_kernel_image_load(). No functional change intended. Signed-off-by: Bjorn Helgaas Acked-by: Baoquan He --- arch/x86/include/asm/kexec.h | 3 --- arch/x86/kernel/machine_kexec_64.c | 11 ----------- include/linux/kexec.h | 2 -- 3 files changed, 16 deletions(-) diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index a3760ca796aa..5b77bbc28f96 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -200,9 +200,6 @@ int arch_kexec_apply_relocations_add(struct purgatory_i= nfo *pi, const Elf_Shdr *symtab); #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add =20 -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_clea= nup #endif diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_k= exec_64.c index 0611fd83858e..1a3e2c05a8a5 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -374,17 +374,6 @@ void machine_kexec(struct kimage *image) /* arch-dependent functionality related to kexec file-based syscall */ =20 #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. * diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 5dd4343c1bbe..c08d5d52223a 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -207,12 +207,10 @@ static inline int arch_kimage_file_post_load_cleanup(= struct kimage *image) } #endif =20 -#ifndef arch_kexec_kernel_image_load static inline void *arch_kexec_kernel_image_load(struct kimage *image) { return kexec_image_load_default(image); } -#endif =20 #ifdef CONFIG_KEXEC_SIG #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION --=20 2.25.1 From nobody Wed Sep 17 19:22:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 963F5C25B04 for ; Thu, 15 Dec 2022 18:24:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbiLOSX7 (ORCPT ); Thu, 15 Dec 2022 13:23:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbiLOSXu (ORCPT ); Thu, 15 Dec 2022 13:23:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 546B94731C for ; Thu, 15 Dec 2022 10:23:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3F0461EA7 for ; Thu, 15 Dec 2022 18:23:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0C2C433EF; Thu, 15 Dec 2022 18:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671128628; bh=EzpeGu7n5zTSaE1MJ3GyQVMhUoUmeNkelZBjZU+Lqgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4jObftwCzhu9BbVq2qRzfBiVdRpA1YZBwORx0UiCJXPN4LlDTw3G3ccC6W8rrSpx N//3en4df78W/YWsp/VLnlfLBn4VdD3V9IEdxM/C0myOxIYlQ0c0bkSYXrerfwq19z tiyAKB4Hs7zgfe2Tw5nrGWrkVpYSqFkYlziL9SHoWVXJMq1rPwjnJeV8wfXPFMAKn0 mNoK4WfcHKWoFPG03j5SjAxu3s6q8KO/c6qgdQgWAWxDRLkWUpRu+ZQ/isN949U7gO FY2x1wxoZEiUlx5ygL5wQxnoLf4+IYH7cvOaMPDZj7qaRVFtj39Fet5BFhRCefAAdo Hz+niQwNZaDkA== From: Bjorn Helgaas To: Eric Biederman Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/2] kexec: Remove unnecessary arch_kexec_kernel_image_load() Date: Thu, 15 Dec 2022 12:23:39 -0600 Message-Id: <20221215182339.129803-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215182339.129803-1-helgaas@kernel.org> References: <20221215182339.129803-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Helgaas arch_kexec_kernel_image_load() only calls kexec_image_load_default(), and there are no arch-specific implementations. Remove the unnecessary arch_kexec_kernel_image_load() and make kexec_image_load_default() static . No functional change intended. Signed-off-by: Bjorn Helgaas kexec: make static Signed-off-by: Bjorn Helgaas Acked-by: Baoquan He --- include/linux/kexec.h | 6 ------ kernel/kexec_file.c | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index c08d5d52223a..8844e7debfa4 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -190,7 +190,6 @@ int kexec_purgatory_get_set_symbol(struct kimage *image= , const char *name, void *buf, unsigned int size, bool get_value); void *kexec_purgatory_get_symbol_addr(struct kimage *image, const char *na= me); -void *kexec_image_load_default(struct kimage *image); =20 #ifndef arch_kexec_kernel_image_probe static inline int @@ -207,11 +206,6 @@ static inline int arch_kimage_file_post_load_cleanup(s= truct kimage *image) } #endif =20 -static inline void *arch_kexec_kernel_image_load(struct kimage *image) -{ - return kexec_image_load_default(image); -} - #ifdef CONFIG_KEXEC_SIG #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_le= n); diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index dd5983010b7b..39ddf09ab573 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -65,7 +65,7 @@ int kexec_image_probe_default(struct kimage *image, void = *buf, return ret; } =20 -void *kexec_image_load_default(struct kimage *image) +static void *kexec_image_load_default(struct kimage *image) { if (!image->fops || !image->fops->load) return ERR_PTR(-ENOEXEC); @@ -249,8 +249,8 @@ kimage_file_prepare_segments(struct kimage *image, int = kernel_fd, int initrd_fd, /* IMA needs to pass the measurement list to the next kernel. */ ima_add_kexec_buffer(image); =20 - /* Call arch image load handlers */ - ldata =3D arch_kexec_kernel_image_load(image); + /* Call image load handler */ + ldata =3D kexec_image_load_default(image); =20 if (IS_ERR(ldata)) { ret =3D PTR_ERR(ldata); --=20 2.25.1