From patchwork Thu Feb 11 16:48:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 61790 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp316163lbl; Thu, 11 Feb 2016 08:50:00 -0800 (PST) X-Received: by 10.66.142.200 with SMTP id ry8mr13884440pab.11.1455209398111; Thu, 11 Feb 2016 08:49:58 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id rd7si13559865pab.90.2016.02.11.08.49.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 08:49:58 -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 1aTuQQ-0001wI-0N; Thu, 11 Feb 2016 16:49:02 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTuPy-0001G0-N2 for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2016 16:48:36 +0000 Received: by mail-wm0-x236.google.com with SMTP id g62so77086711wme.0 for ; Thu, 11 Feb 2016 08:48:13 -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=FDnfdxV2cv2Xwi2MbcoKKBMRpOaDoVyRZtFG8LBd8Qk=; b=Ay8AKfLxPpZYSSyHeehPoEJczMhF2yjg4h2LZFjZuXdCr7xI6LbzdysHH9YIpgwpua kq/XsFwLXnM6awgaJ7HcWbJ58dxRwuDpVxhIyGiMS5Ilj2SFHlwPYJ8HRslXmQSa7rOv H7ZM6vwy51Gt4+5QdYOol31wvA7cBcaeIPlhc= 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=FDnfdxV2cv2Xwi2MbcoKKBMRpOaDoVyRZtFG8LBd8Qk=; b=ZMm8YNmR8T3926sRTIY3DXU1YXGBJxL45RQ+k8e8TLRKcpXBQxm/L3YLpzMvw8X6hZ zzVnCCen4+xVixEcGmg2T7wxlYwFCZhfKrMy1alndAaLjAVroNqjyFesGWNyIDHCN2B2 ku+vgqsuMe5msGFD73MxwmAILSeSfRBccULaz6FmpPJch/piHcbM01VEB3kFdtzXU3SG gBeCa1C1KkYjHEYJEE2ky1V1rJijX8vvBlelfelOiv6kKR7zUZJ6ZnK03gXgHyai59uW 83stR2sy571023X7K9DvQnlaD1kuz7iBUwZB0SOZUhHor+RO9bNhx3ZMzscjc7eJoqER qrJw== X-Gm-Message-State: AG10YOReHl7LFunn14u5QowPifGmpCG3Dx/sxgeB1aNXTht7eiuJnrjPGodAb7x9/dUCe5TX X-Received: by 10.194.250.39 with SMTP id yz7mr52859392wjc.92.1455209292292; Thu, 11 Feb 2016 08:48:12 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id g1sm3673798wmc.0.2016.02.11.08.48.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Feb 2016 08:48:11 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, mark.rutland@arm.com, laurentiu.tudor@nxp.com Subject: [PATCH v2 2/3] arm64: defer __va translation of initrd_start and initrd_end Date: Thu, 11 Feb 2016 17:48:01 +0100 Message-Id: <1455209282-9596-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455209282-9596-1-git-send-email-ard.biesheuvel@linaro.org> References: <1455209282-9596-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160211_084835_123116_A359228F X-CRM114-Status: GOOD ( 15.14 ) 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:236 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Commit 66f51676a095 ("arm64: allow kernel Image to be loaded anywhere in physical memory") defers the assignment of memstart_addr to the point 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. However, this results in __va() translations that have been performed up to this point to have been carried out with a preliminary, incorrect value of memstart_addr, and these values need to be fixed up. 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/mm/init.c | 19 +++++++++++++++---- 1 file changed, 15 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/mm/init.c b/arch/arm64/mm/init.c index 3a9fc46cbf80..eff4751f8761 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -61,12 +61,18 @@ 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; } early_param("initrd", early_initrd); + +void __early_init_dt_declare_initrd(unsigned long start, unsigned long end) +{ + initrd_start = start; + initrd_end = end; +} #endif /* @@ -213,8 +219,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();