Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp785210pxa; Sat, 1 Aug 2020 06:08:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZdX6k8wH8kfIm1FwyBGM9nDYLzZ1tpdfFhfLEAyXm+VmBsUJ88AugGJuxjYz/6KKrzo2v X-Received: by 2002:a17:906:d217:: with SMTP id w23mr8897973ejz.292.1596287319931; Sat, 01 Aug 2020 06:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596287319; cv=none; d=google.com; s=arc-20160816; b=l29t+BP71Nbrkq3ibqf0e9/hPUvHeB2y6sUTpa0xrWev9Xz8z8kNV8aTXtsCsiawEm B6o+useXJpNvBoMU8dRejRNV1dTaYImdx9rd747qPFLgu+DDECkA6UVskk7T7TnawZKi EIUdnL7kwXivEBWE7Fr1NB6dlIBPkn8X2tiD5duQfUKF6fTZbKXcN48uPDNVzXyX/sH2 ZI+xgEzrjrXTKPmOvlwEfEWxpbTxoK1L1f3OZDcnRHyqncIleYmvKDH62/t29e/2XFNi uQoNi7xYUaohh2P1ESEEb4e6XUp9tNX3kxLB05zrq4qzQ/X+V+CitR30XNTGT2JhsEIs cfkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NFAN72yeQsmgBNpbJ6vaw3gj5Gs4TwJ7NtADu4yBO7I=; b=zGAIY0qw1QY0NQUXGvQXtkEZu3Pej/+C6nNQs3LEU9Ru2KYdDseDsP3vMsA93jq0vM /OZ8TEbcSfXVdIJHqo1GBOKGT3JhrCo0yPztuMlr6vOqFTWHuHewu4laq/lcacH9ffWW GPuWPwQAS9rrwgf6abszmISIFPSQWjZbrN90JoTlgruiRIsG9c68GbXBsfZbx3zwaRGN 9rWVtsRqgoXSwfbtagTYQ2S8gVjfPyx+b8xcZzojGZXYKWyAzmLtsMAvShZMtiUy6vgF YCnQ2f1iM9i+ODggRderpWR5mmhpkvIdPW8m2uhjYS+VDB6BfU8P+d9OV7lynO4KGKt/ 6pFA== 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 u24si7007306ejx.88.2020.08.01.06.08.17; Sat, 01 Aug 2020 06:08:39 -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 S1726883AbgHANGK (ORCPT + 99 others); Sat, 1 Aug 2020 09:06:10 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8746 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725778AbgHANGJ (ORCPT ); Sat, 1 Aug 2020 09:06:09 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4E1FAB1F11033AFD53E9; Sat, 1 Aug 2020 21:06:05 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Sat, 1 Aug 2020 21:05:57 +0800 From: Chen Zhou To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v11 1/5] arm64: kdump: add macro CRASH_ALIGN and CRASH_ADDR_LOW_MAX Date: Sat, 1 Aug 2020 21:08:52 +0800 Message-ID: <20200801130856.86625-2-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200801130856.86625-1-chenzhou10@huawei.com> References: <20200801130856.86625-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Expose variable arm64_dma32_phys_limit for followup, and add macro CRASH_ALIGN for alignment, macro CRASH_ADDR_LOW_MAX for upper bound of low crash memory. Use macros instead. Signed-off-by: Chen Zhou --- arch/arm64/include/asm/kexec.h | 5 +++++ arch/arm64/include/asm/processor.h | 1 + arch/arm64/mm/init.c | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index d24b527e8c00..1a2f27f12794 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -25,6 +25,11 @@ #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 + #ifndef __ASSEMBLY__ /** diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 240fe5e5b720..af71063f352c 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -95,6 +95,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 1e93cfc7c47a..a3d0193f6a0a 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -67,7 +67,7 @@ EXPORT_SYMBOL(vmemmap); * 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 /* @@ -92,8 +92,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(0, CRASH_ADDR_LOW_MAX, + crash_size, CRASH_ALIGN); if (crash_base == 0) { pr_warn("cannot allocate crashkernel (size:0x%llx)\n", crash_size); @@ -111,7 +111,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