From mboxrd@z Thu Jan 1 00:00:00 1970 From: mark.rutland@arm.com (Mark Rutland) Date: Wed, 13 Jan 2016 11:11:53 +0000 Subject: [PATCH v3 07/21] arm64: move kernel image to base of vmalloc area In-Reply-To: References: <1452518355-4606-1-git-send-email-ard.biesheuvel@linaro.org> <1452518355-4606-8-git-send-email-ard.biesheuvel@linaro.org> <20160112181336.GF4858@leverpostej> Message-ID: <20160113111152.GB23370@leverpostej> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Jan 13, 2016 at 10:58:55AM +0100, Ard Biesheuvel wrote: > On 13 January 2016 at 09:39, Ard Biesheuvel wrote: > > On 12 January 2016 at 19:14, Mark Rutland wrote: > >> On Mon, Jan 11, 2016 at 02:19:00PM +0100, Ard Biesheuvel wrote: > >>> @@ -438,12 +442,29 @@ static void __init map_kernel(pgd_t *pgd) > >>> map_kernel_chunk(pgd, __init_begin, __init_end, PAGE_KERNEL_EXEC); > >>> map_kernel_chunk(pgd, _data, _end, PAGE_KERNEL); > >>> > >>> - /* > >>> - * The fixmap falls in a separate pgd to the kernel, and doesn't live > >>> - * in the carveout for the swapper_pg_dir. We can simply re-use the > >>> - * existing dir for the fixmap. > >>> - */ > >>> - set_pgd(pgd_offset_raw(pgd, FIXADDR_START), *pgd_offset_k(FIXADDR_START)); > >>> + if (pgd_index(FIXADDR_START) != pgd_index((u64)_end)) { > >> > >> To match the style of early_fixmap_init, and given we already mapped the > >> kernel image, this could be: > >> > >> if (pgd_none(pgd_offset_raw(pgd, FIXADDR_START))) { > >> > >> Which also serves as a run-time check that the pgd entry really was > >> clear. > >> > > > > Yes, that looks better. I will steal that :-) > > > > OK, that doesn't work. pgd_none() is hardcoded to 'false' when running > with fewer than 4 pgtable levels, and so we always hit the BUG() here. Ah, sorry. We could also check CONFIG_PGTABLE_LEVELS > 3 check, as with fixmap_init, perhaps? Thanks, Mark.