From patchwork Tue Feb 16 12:52:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62018 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1646809lbl; Tue, 16 Feb 2016 04:58:13 -0800 (PST) X-Received: by 10.98.8.80 with SMTP id c77mr30559549pfd.42.1455627493533; Tue, 16 Feb 2016 04:58:13 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id fn1si51132455pad.82.2016.02.16.04.58.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Feb 2016 04:58:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVfBg-0003HZ-Td; Tue, 16 Feb 2016 12:57:04 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVf8S-00086A-TK for linux-arm-kernel@lists.infradead.org; Tue, 16 Feb 2016 12:53:46 +0000 Received: by mail-wm0-x231.google.com with SMTP id g62so190229023wme.0 for ; Tue, 16 Feb 2016 04:53:24 -0800 (PST) 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=3M81tL5hEjQhYY5376vOzwXWwI3agm53Dr7uMY8TBhI=; b=PWgXw/RCBkImexi8M0Djt3U24fCK4hqVmqtw62wxJ1p5g/6Sdd5oI3FWR5pUhZRlSQ cNvTXm1caBcVs9pe+RgkJv6gEsKb3nkn3l9y+TO4k7fYittUNicoEcoDfyjA/TpbMJfb uTVIHch+0P6ofh+uN76dE7f8UHIovdPMCIkKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3M81tL5hEjQhYY5376vOzwXWwI3agm53Dr7uMY8TBhI=; b=Feh1WW+335WWphwAvmphOOsIP7k1ykB3LnnkyV4cgPWjoRajbY0YkhdTwMP7Q0T8DN oETDZqzSIXBt3PYjMOdGab2kA+LzHJ2MVT6sZndrRgBrAL6+3MjzhYQrnWRUdCUgzdT9 dkyNwnzs+SqS5Qm6BwVYSbMsDKOOC9yJWLdwyTGMeFpWvkdDlJWURr7STs7DvYdpZEED yvTFQ9u/be029opy+UocYeChaYOhTO7QG8agxSI+HftK71kOBlH/f4SW8br7zqlcgMm9 a4i/qriJieOXWC5rL9bEZT2ODZ/fvS9MNdi83nj3kM0pHvysqSoMDPLJpI05uomkYDZt sE+w== X-Gm-Message-State: AG10YOTblfd/U12W57sMDBVgOt11+qz1X747096YetwDcJwUvoFyjT2v+7/ZJQvBxpOEqvfo X-Received: by 10.28.156.199 with SMTP id f190mr18294531wme.83.1455627203284; Tue, 16 Feb 2016 04:53:23 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id x66sm20454816wmb.20.2016.02.16.04.53.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Feb 2016 04:53:22 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, mark.rutland@arm.com, keescook@chromium.org Subject: [PATCH v6sub1 10/11] arm64: defer __va translation of initrd_start and initrd_end Date: Tue, 16 Feb 2016 13:52:41 +0100 Message-Id: <1455627162-31600-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455627162-31600-1-git-send-email-ard.biesheuvel@linaro.org> References: <1455627162-31600-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160216_045345_316351_C43CB785 X-CRM114-Status: GOOD ( 15.45 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:231 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marc.zyngier@arm.com, Ard Biesheuvel , james.morse@arm.com, laurentiu.tudor@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Before deferring the assignment of memstart_addr in a subsequent patch, to the moment where all memory has been discovered and possibly clipped based on the size of the linear region and the presence of a mem= command line parameter, we need to ensure that memstart_addr is not used to perform __va translations before it is assigned. One such use is in the generic early DT discovery of the initrd location, which is recorded as a virtual address in the globals initrd_start and initrd_end. So wire up the generic support to declare the initrd addresses, and implement it without __va() translations, and perform the translation after memstart_addr has been assigned. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 8 ++++++++ arch/arm64/mm/init.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 4388651d1f0d..18b7e77c7495 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -121,6 +121,14 @@ #define IOREMAP_MAX_ORDER (PMD_SHIFT) #endif +#ifdef CONFIG_BLK_DEV_INITRD +#define __early_init_dt_declare_initrd(__start, __end) \ + do { \ + initrd_start = (__start); \ + initrd_end = (__end); \ + } while (0) +#endif + #ifndef __ASSEMBLY__ extern phys_addr_t memstart_addr; diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 1d627cd8121c..52d1fc465885 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -59,8 +59,8 @@ static int __init early_initrd(char *p) if (*endp == ',') { size = memparse(endp + 1, NULL); - initrd_start = (unsigned long)__va(start); - initrd_end = (unsigned long)__va(start + size); + initrd_start = start; + initrd_end = start + size; } return 0; } @@ -168,8 +168,13 @@ void __init arm64_memblock_init(void) */ memblock_reserve(__pa(_text), _end - _text); #ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) - memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); + if (initrd_start) { + memblock_reserve(initrd_start, initrd_end - initrd_start); + + /* the generic initrd code expects virtual addresses */ + initrd_start = __phys_to_virt(initrd_start); + initrd_end = __phys_to_virt(initrd_end); + } #endif early_init_fdt_scan_reserved_mem();