From patchwork Wed Jan 24 05:12:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13528634 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE668C48260 for ; Wed, 24 Jan 2024 06:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5Nx2+T4FtVkXPVy02w1xDQFMWZp+bDpQiO6Yj8fYOkY=; b=ZIoQLiK5KSgxI4 dMVVlTq+BE8xS2ksihw1GQ9kbU7j0g3jDr4NRp2LcOk0hfxri+a1b3EgdPL7HGpzz1YSajul3iri9 cOsQ/K8Bqm9KyBXKt4jEMu+/n0pf7IkeWAU5/Qbdc7gAX9wS2kfKEU3VvSy+dYXB8j8mB37ok+wZ9 CJUdMdbrlOm+zqvlLQY4LorLY0lErmyc6fHLGVKiRbCPw/ZmX8JvMEk21d0fN0+9ZcMMFVcozDMie 2mSjpHja0QUkYneG4ZhDN9c0w9IDgFjq++hJXObWPx3T6SfkyVtcFkKDygsTU66JVDqjDbNF3A2JL Wu8vDWUU72ERarNNHVtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSWXx-001hdf-2l; Wed, 24 Jan 2024 06:15:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSVah-001X9I-09 for linux-arm-kernel@bombadil.infradead.org; Wed, 24 Jan 2024 05:14:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=1ELQbTPNyx4L6Rjica+79k486cYCM/jEDd+jz77hDLU=; b=Hc7FNPiKDDWlndxEu4UX9s+Gzb c6TwlICbjPMcLZyeOa8BCjIi2S6y00rA+svVLg/KFWPcgafwL3BxNQcCjqCvMN3NMm9e2Ebb34vwE uOvZ8g9bqH4wT4qjq+pGxEGRbs1iLhfjxu/Nlm4o2GFprpPE6plv6gFvDevWG2/654h9jG65JgFgg Z/7soFv0DqNWymGL6muxeJ5FIs4dcnZMq5o7RyqLnSgxaMHn2E/juxwhyuyRFzQDyPNY9gMDx/T1H xMKmYNbWc4Zpnd/fqWeinz4Bq87gh0VFQGmHTNKyEVbR/GPhzN+ZHUoFBsPDPZ7oVniQc+qVhearK pz2gNdTg==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rSVaZ-00000004FLZ-2PLo for linux-arm-kernel@lists.infradead.org; Wed, 24 Jan 2024 05:14:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706073253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ELQbTPNyx4L6Rjica+79k486cYCM/jEDd+jz77hDLU=; b=F6KXeUPhxGXNdo8MoQC3b8JVQXnm8Xf8VCbsslfAH6glvr8X4H69WoLFA3sGVgLLPWECtS fSsrTPH/iWLg6z8FQpoMgvvJ5fVXubGRrIx/1rB/RW58WejR+Os8j8v2bwVitoLWQALmTu cn5JTpoGb8LImyj7HkGgZv+w6pEJimg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706073254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ELQbTPNyx4L6Rjica+79k486cYCM/jEDd+jz77hDLU=; b=LMJhaxAEAfqCEGgK2Inuy0LUOvjtDr56mIq9etSYh5vqtTGchOnSxDyqxtFpSgrmag7kZQ aVNIVmt7+Dn6mS2evVsXRsbkhTx7xE7M7a7sc5ZNfeATr+vkJIBQAX4jKbQbebn2xgkeWQ UAqkLSC15IYhF4ghViLESNZgnRcFfaA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-6y3KZd9xNXOZOuwb7FQaow-1; Wed, 24 Jan 2024 00:14:08 -0500 X-MC-Unique: 6y3KZd9xNXOZOuwb7FQaow-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 764E885A58A; Wed, 24 Jan 2024 05:14:07 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 719011C060AF; Wed, 24 Jan 2024 05:14:01 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, akpm@linux-foundation.org, ebiederm@xmission.com, hbathini@linux.ibm.com, piliu@redhat.com, viro@zeniv.linux.org.uk, Baoquan He Subject: [PATCH linux-next v3 09/14] s390, crash: wrap crash dumping code into crash related ifdefs Date: Wed, 24 Jan 2024 13:12:49 +0800 Message-ID: <20240124051254.67105-10-bhe@redhat.com> In-Reply-To: <20240124051254.67105-1-bhe@redhat.com> References: <20240124051254.67105-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240124_051418_179652_2593DF8D X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now crash codes under kernel/ folder has been split out from kexec code, crash dumping can be separated from kexec reboot in config items on s390 with some adjustments. Here wrap up crash dumping codes with CONFIG_CRASH_DUMP ifdeffery. Signed-off-by: Baoquan He --- arch/s390/kernel/kexec_elf.c | 2 ++ arch/s390/kernel/kexec_image.c | 2 ++ arch/s390/kernel/machine_kexec_file.c | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c index 9da6fa30c447..4d364de43799 100644 --- a/arch/s390/kernel/kexec_elf.c +++ b/arch/s390/kernel/kexec_elf.c @@ -40,8 +40,10 @@ static int kexec_file_add_kernel_elf(struct kimage *image, buf.bufsz = phdr->p_filesz; buf.mem = ALIGN(phdr->p_paddr, phdr->p_align); +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) buf.mem += crashk_res.start; +#endif buf.memsz = phdr->p_memsz; data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz; diff --git a/arch/s390/kernel/kexec_image.c b/arch/s390/kernel/kexec_image.c index af23eff5774d..a32ce8bea745 100644 --- a/arch/s390/kernel/kexec_image.c +++ b/arch/s390/kernel/kexec_image.c @@ -24,8 +24,10 @@ static int kexec_file_add_kernel_image(struct kimage *image, buf.bufsz = image->kernel_buf_len; buf.mem = 0; +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) buf.mem += crashk_res.start; +#endif buf.memsz = buf.bufsz; data->kernel_buf = image->kernel_buf; diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c index 8d207b82d9fe..c2bac14dd668 100644 --- a/arch/s390/kernel/machine_kexec_file.c +++ b/arch/s390/kernel/machine_kexec_file.c @@ -105,6 +105,7 @@ static int kexec_file_update_purgatory(struct kimage *image, if (ret) return ret; +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) { u64 crash_size; @@ -121,6 +122,7 @@ static int kexec_file_update_purgatory(struct kimage *image, sizeof(crash_size), false); } +#endif return ret; } @@ -134,8 +136,10 @@ static int kexec_file_add_purgatory(struct kimage *image, data->memsz = ALIGN(data->memsz, PAGE_SIZE); buf.mem = data->memsz; +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) buf.mem += crashk_res.start; +#endif ret = kexec_load_purgatory(image, &buf); if (ret) @@ -158,8 +162,10 @@ static int kexec_file_add_initrd(struct kimage *image, data->memsz = ALIGN(data->memsz, PAGE_SIZE); buf.mem = data->memsz; +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) buf.mem += crashk_res.start; +#endif buf.memsz = buf.bufsz; data->parm->initrd_start = data->memsz; @@ -223,8 +229,10 @@ static int kexec_file_add_ipl_report(struct kimage *image, data->kernel_buf + offsetof(struct lowcore, ipl_parmblock_ptr); *lc_ipl_parmblock_ptr = (__u32)buf.mem; +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) buf.mem += crashk_res.start; +#endif ret = kexec_add_buffer(&buf); out: @@ -268,10 +276,12 @@ void *kexec_file_add_components(struct kimage *image, memcpy(data.parm->command_line, image->cmdline_buf, image->cmdline_buf_len); +#ifdef CONFIG_CRASH_DUMP if (image->type == KEXEC_TYPE_CRASH) { data.parm->oldmem_base = crashk_res.start; data.parm->oldmem_size = crashk_res.end - crashk_res.start + 1; } +#endif if (image->initrd_buf) { ret = kexec_file_add_initrd(image, &data);