X-Received: by 2002:a17:90a:7f92:b0:1bc:f09:59 with SMTP id m18-20020a17090a7f9200b001bc0f090059mr10552515pjl.98.1645639089835; Wed, 23 Feb 2022 09:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645639089; cv=none; d=google.com; s=arc-20160816; b=mqlhHMjnfDvwtXK+hCNCzH3fhAq5G2NQ6UXQ+2tqB25Um8foeD0m2qFvfIH+1X19db JzU2+5m90HRvnYNx7R12YfffOXXB8VCoJXf8Ar9WMfM3/KdiQLllsu22Wt2qWBvQrXMB qW+AYrCwFG/8Xdywm1jLrOaAfrZXKJooeVgKnWH1ybD62BAJioIVnUT47xkgnBKaxhbZ 9NLFUpv1JcYq3i6r/034HY3TGBE+xJIsxROVVQFH4+1Mh3WYmE0BZDZ6nze2ep4QluP9 G614f42No0RulAc7vWR/JuxyzL9C/bduOnUDd3/A5u6qFc+/RCObNUqWQRZzw+p4V+YE s/jw== 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=hwQLMtEcBC3XALlAa6IT7v4zUNwzhN/4Kn6SmvYX9qs=; b=oFr/eYS7nF41I0cN/hje3h3UKxoRYoE/atB7DDwCCNllyba4Z7SrxlZLVPPnY34/1K urKWYn7NfrEW14gdjyLRy5n2aBK9eiM6wWz/ixNOIs3TSB92R//m6GbuWNxJloD/nzco L1qmSQxW/IRHcUufgDRijhyK1EAobjMSmIQqtX43MP5a98uC96i8UKyVkBZjaFr0jFxm bIGODz1RraNVfyr6EbDSC4RREe7yYPlyS0ObkpZfv79wMnlwJdboL6ATR/NZKwPKq9Vw z31zM4KVJeVFdwoGKW5ZbtGVvj1ZMhRYb6J6TjsBQ2xsHRQcJZNYnN4DArTz4pkUP0V0 oJIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c5NLgQmP; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1si238440pgm.782.2022.02.23.09.57.53; Wed, 23 Feb 2022 09:58:09 -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=@redhat.com header.s=mimecast20190719 header.b=c5NLgQmP; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239932AbiBWLdi (ORCPT + 99 others); Wed, 23 Feb 2022 06:33:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239912AbiBWLd1 (ORCPT ); Wed, 23 Feb 2022 06:33:27 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9C2D23E0CB for ; Wed, 23 Feb 2022 03:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645615978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hwQLMtEcBC3XALlAa6IT7v4zUNwzhN/4Kn6SmvYX9qs=; b=c5NLgQmPNdRGQucKYTADgMqoih27W97h46vAkSqsQX1kl1N9X/AmzgQlN95qvIw3kASaiE 32j72abbB12XaZ7QNSruyXEU+HngnV+fVwR8fztGA7ejO6LwYLkp9u+dif8AcHk6RLloF/ esEvsk9BAC/rHptNsyFA3A0eCUbvFFE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-fFlfqDnAPRC_m8p-UZVHVQ-1; Wed, 23 Feb 2022 06:32:55 -0500 X-MC-Unique: fFlfqDnAPRC_m8p-UZVHVQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6CFC41091DA0; Wed, 23 Feb 2022 11:32:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.smartont.net (ovpn-13-167.pek2.redhat.com [10.72.13.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id B00FA76C2B; Wed, 23 Feb 2022 11:32:51 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, dyoung@redhat.com, akpm@linux-foundation.org, bhe@redhat.com, x86@kernel.org, linux-mm@kvack.org Subject: [PATCH v2 2/2] kexec_file: clean up arch_kexec_kernel_image_load Date: Wed, 23 Feb 2022 19:32:25 +0800 Message-Id: <20220223113225.63106-3-bhe@redhat.com> In-Reply-To: <20220223113225.63106-1-bhe@redhat.com> References: <20220223113225.63106-1-bhe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Function arch_kexec_kernel_image_load() has a common weak version which is a wrapper of kexec_image_load_default() , and has only one arch dependent version in x86_64. Now the x86_64 dependent function is not needed any more. So clean it up. And also rename kexec_image_load_default() to kexec_kernel_image_load() for better reflecting its functionality. Signed-off-by: Baoquan He Acked-by: Dave Young --- arch/x86/kernel/machine_kexec_64.c | 11 ----------- include/linux/kexec.h | 1 - kernel/kexec_file.c | 9 ++------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 1f0eb0eed546..6b14d9274def 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -372,17 +372,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 0c994ae37729..47b70402c0a4 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -186,7 +186,6 @@ void *kexec_purgatory_get_symbol_addr(struct kimage *image, const char *name); /* Architectures may override the below functions */ int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, unsigned long buf_len); -void *arch_kexec_kernel_image_load(struct kimage *image); int arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section, const Elf_Shdr *relsec, diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 8347fc158d2b..b6a1347f546e 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -60,7 +60,7 @@ int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, return kexec_image_probe_default(image, buf, buf_len); } -static void *kexec_image_load_default(struct kimage *image) +static void *kexec_kernel_image_load(struct kimage *image) { if (!image->fops || !image->fops->load) return ERR_PTR(-ENOEXEC); @@ -71,11 +71,6 @@ static void *kexec_image_load_default(struct kimage *image) image->cmdline_buf_len); } -void * __weak arch_kexec_kernel_image_load(struct kimage *image) -{ - return kexec_image_load_default(image); -} - int kexec_image_post_load_cleanup_default(struct kimage *image) { if (!image->fops || !image->fops->cleanup) @@ -279,7 +274,7 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, ima_add_kexec_buffer(image); /* Call arch image load handlers */ - ldata = arch_kexec_kernel_image_load(image); + ldata = kexec_kernel_image_load(image); if (IS_ERR(ldata)) { ret = PTR_ERR(ldata); -- 2.31.1