From patchwork Tue Mar 7 22:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 65942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp9338wrd; Tue, 7 Mar 2023 15:01:56 -0800 (PST) X-Google-Smtp-Source: AK7set93UjOa8cFfQCn0gW11aFsPsQcW+cNxEAOou8xRww4Ix0RNKrp4tyKF5BwNAENvZYna/jRn X-Received: by 2002:aa7:d296:0:b0:4bd:6b93:1286 with SMTP id w22-20020aa7d296000000b004bd6b931286mr16799244edq.25.1678230116573; Tue, 07 Mar 2023 15:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230116; cv=none; d=google.com; s=arc-20160816; b=QhIzSg88Al/URgycUNm/6WYG0eq56E0h/KgTvMwsmps1loo/sHzYN00Pw0PwLHjZIi 3dq6bZIVtyY7zm/c18t6a9PRJLvf2KB6CdWXogxyHv6wMaHaDlw2pTpeoyEATfGnZzdS Rj5mrsxQ50pbzz64hZ+QcMvwSCK9pzYMcmTnfmM8J3Ew320S8ccfNcq2IYRAYd/u30nk LuvAk0wC7jbP5OlpQ7H+Np3rCxD7goFGC2d/64SUcRLlmZrVVVfjmLMfCy91TAxVKmdI ck8my0aB1CacLrmbIoirVwBaad/JpLVwO3hIIVU11kEpKVia7pT/0wXWADmPvK31jaIr ateg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lDNnBPxpQ2CGH7r5AqAdnb9YIoTd7tP+hqI8h67Wzfo=; b=uSsZ/A1A6TfdwUTqhWbNfEImGNWmFUdXpnTVNh4whISPqd+C4oCYgxznZubH8Qs8kz qUXkn1folDTNoH9fN4uiZ36HJfEinb79Do292RbLZoZMLUUWt8HtXvkPjls9Ltiqah+K ZvHK5Cl5TZxMYt8paofHs/IYxxbdBa1UDPSqN99R3ytCNgXL8431y6wq5hWO25f4Tvkg /zPXfHodXB9J1W1ZXGAi3L5fML7T6QnL9BS+CUo+NvO3siqlWrVVJ0ZBECVIIrY/AnRg M2BwAP7mWUCWgwK3u8WVJT0/kBkGoJAUilGAx2ocOXlnVOaMfqR02VWgN7cjKDJ53tq8 Ufew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OGh3xeI8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a056402181400b004ad4c17aa75si786202edy.425.2023.03.07.15.01.21; Tue, 07 Mar 2023 15:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OGh3xeI8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231339AbjCGWp2 (ORCPT + 99 others); Tue, 7 Mar 2023 17:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbjCGWpF (ORCPT ); Tue, 7 Mar 2023 17:45:05 -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 69C6B93C8 for ; Tue, 7 Mar 2023 14:44:46 -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 24C03B81AC8 for ; Tue, 7 Mar 2023 22:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 911EAC433EF; Tue, 7 Mar 2023 22:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678229083; bh=Sgx5i2lNaUlucKD5NKA2BLD/U0/3cRA/AXWf2ibpr9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OGh3xeI87gXT1hHLaVnvQondnXYfVRlajcTagX08FAmNdHpngQjDpurlwrdhu7iEN yhTTsHog1FtnJf6/IyXhcYYm4xGWqchKwTw+P9IDV5I8I48beHwhhdcNZhKhM2MriK Xz0GEj4Sh9H6mqf5g29G6NLMwFaJcAlYZKU6JQHk+cePybMk8IDJxHs5jS93TLJO7a aYdEMAWHyAq/67lU9NtCv+XXZX1RlmarIz+PJwe3wmRhWjWcwEM1M+qq5uJm2WZaoX C/dUva5LbQWzC7Rg/Q7zqgxDgC7UpfNdfAdXCh1boc/5/Hp03T13bW8gxzJ+F5XM6K uMQVeq7vbIgyg== From: Bjorn Helgaas To: Eric Biederman , Dave Hansen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Baoquan He , x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH v2 1/2] x86/kexec: Remove unnecessary arch_kexec_kernel_image_load() Date: Tue, 7 Mar 2023 16:44:15 -0600 Message-Id: <20230307224416.907040-2-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307224416.907040-1-helgaas@kernel.org> References: <20230307224416.907040-1-helgaas@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751822871290391?= X-GMAIL-MSGID: =?utf-8?q?1759751822871290391?= From: Bjorn Helgaas 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. Signed-off-by: Bjorn Helgaas Reviewed-by: Simon Horman --- 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_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 diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_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 */ #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 6883c5922701..4746bc9d39c9 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 -#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