Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1871996pxx; Sat, 31 Oct 2020 00:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVZjD9S5dHRotKOBTQ6GELyxTHMFaxJiiri/ImnlUJI/Hm/2bVMJLiz3u6x2KjgPZp5hl6 X-Received: by 2002:a05:6402:395:: with SMTP id o21mr6423416edv.2.1604130077022; Sat, 31 Oct 2020 00:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604130077; cv=none; d=google.com; s=arc-20160816; b=lFJ07Yhr3VkgUliM7cZ5s7LveAVThTTdwr7No6BMG9rB91S2aW4W0s2cw1u5w2FUEL j70LWFMJJ70WAuK5jAAffEWyhJhStY73Gukgb/Yz8QQUX/RSefCD85JmBb3C0m2uFbgn oW9SxgxMQk2ldfoDmOndYlAd1EmVm4xNUihk9Jmwpr6pxZNGJMpk1hWa4EmAPjNPhOLY W3+FbF/pJ4g6j7nO24A/tH8gMcRUtSCmchjHOyYDO9mHBRWokiwnxy/y91VSxjOZDPhH dAnIPmAMc1u9q6J0zCAJJ06cqhlkyxjYJjGdRmn9Defx56dGyLADwrfFGbJllFc23w76 MC6w== 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=+4rwEmBQczJew6PO2w6Gle/LYCxg2t3NI/TwENtOxuc=; b=vZnDUAlm5BL8MpMR1cpExoXCBk6EUQ0KKu9F/gDCy8XxSL8ywjUOyvZnOXT7yl3Yme OQn8LCkhx82oiVUgL2Ii6zji+vmrHudkgZO4vvt8sk1I91kkBwsFc5Frl1mTmP6jav4D uXObU5c9TtzsvBK5heWh1rrgUyT/+7Td6W9RaQfjqf0n7RwUkQsr7f+s3HD2mC2MEl7w eeENmZsmakntAVNVLSueo8X5dJPw/3ePE4ygSEsnH19293Tf7JiXvFc5veRV+U6C8y4M sdQBW7IA16SaH2IpkurxpjccxF2GbTn2Y6ubNkDj4i57Cwj7k1Beu9SpsdHJo51dRpt0 4s9A== 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 si11si149312ejb.722.2020.10.31.00.40.54; Sat, 31 Oct 2020 00:41:17 -0700 (PDT) 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 S1726443AbgJaHjZ (ORCPT + 99 others); Sat, 31 Oct 2020 03:39:25 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6713 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726391AbgJaHjO (ORCPT ); Sat, 31 Oct 2020 03:39:14 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CNWJs5BFlzkY6M; Sat, 31 Oct 2020 15:39:09 +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.487.0; Sat, 31 Oct 2020 15:39:03 +0800 From: Chen Zhou To: , , , , , , , , , CC: , , , , , , , , , , , , , , John Donnelly Subject: [PATCH v13 5/8] arm64: kdump: introduce some macroes for crash kernel reservation Date: Sat, 31 Oct 2020 15:44:34 +0800 Message-ID: <20201031074437.168008-6-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201031074437.168008-1-chenzhou10@huawei.com> References: <20201031074437.168008-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 Introduce macro CRASH_ALIGN for alignment, macro CRASH_ADDR_LOW_MAX for upper bound of low crash memory, macro CRASH_ADDR_HIGH_MAX for upper bound of high crash memory, use macroes instead. Besides, keep consistent with x86, use CRASH_ALIGN as the lower bound of crash kernel reservation. Signed-off-by: Chen Zhou Tested-by: John Donnelly --- arch/arm64/include/asm/kexec.h | 6 ++++++ arch/arm64/include/asm/processor.h | 1 + arch/arm64/mm/init.c | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index d24b527e8c00..402d208265a3 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -25,6 +25,12 @@ #define KEXEC_ARCH KEXEC_ARCH_AARCH64 +/* 2M alignment for crash kernel regions */ +#define CRASH_ALIGN SZ_2M + +#define CRASH_ADDR_LOW_MAX arm64_dma32_phys_limit +#define CRASH_ADDR_HIGH_MAX MEMBLOCK_ALLOC_ACCESSIBLE + #ifndef __ASSEMBLY__ /** diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index fce8cbecd6bc..12131655cab7 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -96,6 +96,7 @@ #endif /* CONFIG_ARM64_FORCE_52BIT */ extern phys_addr_t arm64_dma_phys_limit; +extern phys_addr_t arm64_dma32_phys_limit; #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) struct debug_info { diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 095540667f0f..a07fd8e1f926 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -60,7 +60,7 @@ EXPORT_SYMBOL(memstart_addr); * bit addressable memory area. */ phys_addr_t arm64_dma_phys_limit __ro_after_init; -static phys_addr_t arm64_dma32_phys_limit __ro_after_init; +phys_addr_t arm64_dma32_phys_limit __ro_after_init; #ifdef CONFIG_KEXEC_CORE /* @@ -85,8 +85,8 @@ static void __init reserve_crashkernel(void) if (crash_base == 0) { /* Current arm64 boot protocol requires 2MB alignment */ - crash_base = memblock_find_in_range(0, arm64_dma32_phys_limit, - crash_size, SZ_2M); + crash_base = memblock_find_in_range(CRASH_ALIGN, CRASH_ADDR_LOW_MAX, + crash_size, CRASH_ALIGN); if (crash_base == 0) { pr_warn("cannot allocate crashkernel (size:0x%llx)\n", crash_size); @@ -104,7 +104,7 @@ static void __init reserve_crashkernel(void) return; } - if (!IS_ALIGNED(crash_base, SZ_2M)) { + if (!IS_ALIGNED(crash_base, CRASH_ALIGN)) { pr_warn("cannot reserve crashkernel: base address is not 2MB aligned\n"); return; } -- 2.20.1