From patchwork Mon Mar 19 11:19:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10292163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BB6E60385 for ; Mon, 19 Mar 2018 11:22:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECEA12832B for ; Mon, 19 Mar 2018 11:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0F7728448; Mon, 19 Mar 2018 11:22:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5779E2832B for ; Mon, 19 Mar 2018 11:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HyMs7GJb6equCPEo1WegGQWP1dP7Bdcbao9VOXPmNOA=; b=oRO6vJYql5ruD4tgc2K3sVfrWs P5etgH81l+dYZAM3UbnxA/kQyiQha18076gD9jOGaznHl1tab2bKs6mUH27kaNepVXgo0BPeVR0Xk 0VNmb57Ip77FCcCMtOqZMCnlbG69lT1Iq9wT8xF0Cy6FL++sfz9DOnhrPzNjnDoCXIJkr//tneiDh RJ7ZdV2gn66opZgirTGc0/rKt0b8aCb+mJtsEShm3ZeBDMWZYzXXe58/IE0T+kglXzWNNo181bMQN C4dU7EpjUZ3lgn9m/Wfaol1sqlA8dmPdSYhfS0HV5RD+2U9VaRLr0lTiyVyIrV1M/2dHS4+2iF94F ufWMtn1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1exss4-0001Qe-Va; Mon, 19 Mar 2018 11:22:33 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1exspx-00005Q-HO for linux-arm-kernel@lists.infradead.org; Mon, 19 Mar 2018 11:20:24 +0000 Received: by mail-pl0-x244.google.com with SMTP id b7-v6so5927669plr.8 for ; Mon, 19 Mar 2018 04:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UQ6VyxXHFVUAzDkjYhbbe5Vb0WfG88IX/TXnx1oDzuQ=; b=ZqZ2SNW7ANoWPx7l1jGwWE51VOl4m++pJ5yww+YnoMVMpSVP5EwAmkuXVjHRsVNryn JpLHbmQVmGyAsOPPcJhBbVpgnsa6QkltQPqwJZ5r9qLykdHAdvdDDbBTo55oXlCcQ2Jj MrU+TSvPVfaQZqiRxvWGhFgD/J9LC7OnYYHyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UQ6VyxXHFVUAzDkjYhbbe5Vb0WfG88IX/TXnx1oDzuQ=; b=uEiSz+HPFVHiYN4r9rqsvfJD83T7Iz/NNTPniQoFeSIgED5oPHmn8M/2GRuRqBp+u0 t9fHlT25+Jfx0k1Xi1eCjVv1Q66tHMxxoVKJNpLBaIADCu8ZoDIzyH+m8FM+jrJjdhXy Qvh7XqiY99pAQoUZeR837emNKXrsCOom1bl7YZwndIE/duc9ZpppkgdQ4iHtbOA9Fy+2 2B+Ornknl5vrBbR5zUos91bInwIDUF+lXO6rwIh25NSWGmdnG2dSdi/8yNFrFgmnp+QO KfbUM1coQQOAF911kNBAW01opujRD/aUAnW7yFnsqIknLRvZZ1DlaJfB/axIBu12Ax6V TL/g== X-Gm-Message-State: AElRT7Hd4kmwv7KNr24ARKg/teMTsfgN9IhrGiApAHwhZAuS7dbtawrS RngE21wQpcZrmZOQK0M+nLqxYDklw1A= X-Google-Smtp-Source: AG47ELuiRgTElzJjrplQ9As4H4oJ2IhAA/zy18HE7tY1WQn/25GjCmYaCR/xMfUcqq4Es1K5kGJiVA== X-Received: by 2002:a17:902:bd46:: with SMTP id b6-v6mr11903573plx.38.1521458409760; Mon, 19 Mar 2018 04:20:09 -0700 (PDT) Received: from localhost.localdomain ([218.255.99.6]) by smtp.gmail.com with ESMTPSA id g67sm23172968pgc.60.2018.03.19.04.20.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 04:20:09 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 1/6] arm64/mm: add explicit physical address argument to map_kernel_segment Date: Mon, 19 Mar 2018 19:19:53 +0800 Message-Id: <20180319111958.4171-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180319111958.4171-1-ard.biesheuvel@linaro.org> References: <20180319111958.4171-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180319_042021_673334_8A655569 X-CRM114-Status: GOOD ( 13.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Ard Biesheuvel , will.deacon@arm.com, marc.zyngier@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation of mapping a physically non-adjacent memory region as backing for the vmlinux segment covering the trampoline and primary level swapper_pg_dir regions, make the physical address an explicit argument of map_kernel_segment(). Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/mmu.c | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 8c704f1e53c2..007b2e32ca71 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -507,10 +507,10 @@ void mark_rodata_ro(void) } static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end, - pgprot_t prot, struct vm_struct *vma, - int flags, unsigned long vm_flags) + phys_addr_t pa_start, pgprot_t prot, + struct vm_struct *vma, int flags, + unsigned long vm_flags) { - phys_addr_t pa_start = __pa_symbol(va_start); unsigned long size = va_end - va_start; BUG_ON(!PAGE_ALIGNED(pa_start)); @@ -585,15 +585,19 @@ static void __init map_kernel(pgd_t *pgdp) * Only rodata will be remapped with different permissions later on, * all other segments are allowed to use contiguous mappings. */ - map_kernel_segment(pgdp, _text, _etext, text_prot, &vmlinux_text, 0, - VM_NO_GUARD); - map_kernel_segment(pgdp, __start_rodata, __inittext_begin, PAGE_KERNEL, + map_kernel_segment(pgdp, _text, _etext, __pa_symbol(_text), text_prot, + &vmlinux_text, 0, VM_NO_GUARD); + map_kernel_segment(pgdp, __start_rodata, __inittext_begin, + __pa_symbol(__start_rodata), PAGE_KERNEL, &vmlinux_rodata, NO_CONT_MAPPINGS, VM_NO_GUARD); - map_kernel_segment(pgdp, __inittext_begin, __inittext_end, text_prot, + map_kernel_segment(pgdp, __inittext_begin, __inittext_end, + __pa_symbol(__inittext_begin), text_prot, &vmlinux_inittext, 0, VM_NO_GUARD); - map_kernel_segment(pgdp, __initdata_begin, __initdata_end, PAGE_KERNEL, + map_kernel_segment(pgdp, __initdata_begin, __initdata_end, + __pa_symbol(__initdata_begin), PAGE_KERNEL, &vmlinux_initdata, 0, VM_NO_GUARD); - map_kernel_segment(pgdp, _data, _end, PAGE_KERNEL, &vmlinux_data, 0, 0); + map_kernel_segment(pgdp, _data, _end, __pa_symbol(_data), PAGE_KERNEL, + &vmlinux_data, 0, 0); if (!READ_ONCE(pgd_val(*pgd_offset_raw(pgdp, FIXADDR_START)))) { /*