Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2402828pxb; Sat, 30 Jan 2021 01:16:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXKztagPxjk/7LzkUeAV8nryvBTKwtiF0DCpjs2Sbk1ntzbnA5VM2S87hYemLGB2616YFM X-Received: by 2002:a17:906:168e:: with SMTP id s14mr66698ejd.515.1611998188524; Sat, 30 Jan 2021 01:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611998188; cv=none; d=google.com; s=arc-20160816; b=Jua9D8Yhk/UmUYvg+a65TQrPUMq5ea4Ri6kefkLnKORUYnIkzd+s4spcNoOZrxBkPH ABzj+8GvYhhgZY2riEFvZYU/AnymXTrkiHHPj9CJ2TuB3gmX5gH6vw5HqC7YGQTyEpb+ Xinva5i+X3B1MOnrkNpxnO8lZXzY1YO+SrFYFLEM3qZA5xJmVXGcjdU9W0FRHxpwPEKN xF4xiS9/mGPmd7v6jc9HpiNpZ8k+fwqEzeekSyR5s95QoljyPKqJMiAYW1A2/S43O7JF EjlnM/d9wQ5qiTHh2Sv9cSRn2bHFVEaH+t+rvhLdaCdvLnNoS0wlUSCJaXTq95Jbeuuy ccAA== 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; bh=+ztfO0oa2hN6SXGCSHozXaTcuOjzlHk8soEjCpJ5RHw=; b=WsJQOv8Tcnu8tGvW8w6MQr7K79xYbxtJ49/EpvdlZrkxSjEVMItGzRtadDWzrOs2jA F3ZOCrHi145VGEvGEOWbGAcaWpSvoEgtze7V2q+vBrVOpjzojEN3crNocAl6MItKYXII AIYGd0b29QwENOdxzg4lOVpw3SYCaJ0URKCED5M1kefcrAywiyaTpF2yezlJFtmh7GNJ iQ/SzkqPM+kh0i0DtMGrdl/0cMKAz8Qu68aaxp/0wJ3U0JBbYplfwRrNWwLDarTVXOuc Ecg1F8UkbanMWHnd5W9KPBq3ZiIhc4ZKAbvvUbVBnD0Z/LczxncUAcqc8Ud4J8kuRYm2 ZDGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx2si5913060ejb.526.2021.01.30.01.16.04; Sat, 30 Jan 2021 01:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbhA3JNS (ORCPT + 99 others); Sat, 30 Jan 2021 04:13:18 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:11947 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbhA3JM7 (ORCPT ); Sat, 30 Jan 2021 04:12:59 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DSQFk09sbzjFJ9; Sat, 30 Jan 2021 15:05:14 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Sat, 30 Jan 2021 15:06:05 +0800 From: Chen Zhou To: , , , , , , , , , , , CC: , , , , , , , , , , , , , John Donnelly Subject: [PATCH v14 04/11] x86: kdump: move xen_pv_domain() check and insert_resource() to setup_arch() Date: Sat, 30 Jan 2021 15:10:18 +0800 Message-ID: <20210130071025.65258-5-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210130071025.65258-1-chenzhou10@huawei.com> References: <20210130071025.65258-1-chenzhou10@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will make the functions reserve_crashkernel() as generic, the xen_pv_domain() check in reserve_crashkernel() is relevant only to x86, the same as insert_resource() in reserve_crashkernel[_low](). So move xen_pv_domain() check and insert_resource() to setup_arch() to keep them in x86. Suggested-by: Mike Rapoport Signed-off-by: Chen Zhou Tested-by: John Donnelly --- arch/x86/kernel/setup.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 086a04235be4..5d676efc32f6 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -454,7 +454,6 @@ static int __init reserve_crashkernel_low(void) crashk_low_res.start = low_base; crashk_low_res.end = low_base + low_size - 1; - insert_resource(&iomem_resource, &crashk_low_res); #endif return 0; } @@ -478,11 +477,6 @@ static void __init reserve_crashkernel(void) high = true; } - if (xen_pv_domain()) { - pr_info("Ignoring crashkernel for a Xen PV domain\n"); - return; - } - /* 0 means: find the address automatically */ if (!crash_base) { /* @@ -529,7 +523,6 @@ static void __init reserve_crashkernel(void) crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; - insert_resource(&iomem_resource, &crashk_res); } #else static void __init reserve_crashkernel(void) @@ -1151,7 +1144,17 @@ void __init setup_arch(char **cmdline_p) * Reserve memory for crash kernel after SRAT is parsed so that it * won't consume hotpluggable memory. */ - reserve_crashkernel(); + if (xen_pv_domain()) + pr_info("Ignoring crashkernel for a Xen PV domain\n"); + else { + reserve_crashkernel(); +#ifdef CONFIG_KEXEC_CORE + if (crashk_res.end > crashk_res.start) + insert_resource(&iomem_resource, &crashk_res); + if (crashk_low_res.end > crashk_low_res.start) + insert_resource(&iomem_resource, &crashk_low_res); +#endif + } memblock_find_dma_reserve(); -- 2.20.1