Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752832AbaKQO5d (ORCPT ); Mon, 17 Nov 2014 09:57:33 -0500 Received: from mail-oi0-f52.google.com ([209.85.218.52]:58864 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752400AbaKQO5b (ORCPT ); Mon, 17 Nov 2014 09:57:31 -0500 MIME-Version: 1.0 Date: Mon, 17 Nov 2014 22:57:30 +0800 Message-ID: Subject: Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned? From: Min-Hua Chen To: Catalin Marinas , Will Deacon , Santosh Shilimkar Cc: "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I have a problem about kernel_x_start and kernel_x_end in map_lowmem. If the start address of DRAM is 0x20000000 and PHYS_OFFSET is 0x20100000 (1MB) and _start is 0xc0008000 and SECTION_SIZE is 0x200000 (2MB). Let's say the memory between 0x20000000 and 0x20100000 is used by some H/W, and not available for kernel. According to current implementation: unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); Than we'll get kernel_x_start = round_down(__pa(0xc0008000), SECTION_SIZE) = round_down(0x20008000, SECTION_SIZE) = 0x20000000 In this case, 0x20000000 is not available for kernel memory. Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned or we should get kernel_x_start by rounding down _start first then convert the virtual address to physical address. phys_addr_t kernel_x_start = __pa(round_down(_stext, SECTION_SIZE)); phys_addr_t kernel_x_end = __pa(round_up(__init_end, SECTION_SIZE)); get kernel_x_start = __pa(round_down(0xc0008000, SECTION_SIZE)) = __pa(round_down(0xc0008000, SECTION_SIZE)) = __pa(0xc0000000) = 0x20100000 thanks, Min-Hua -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/