From patchwork Fri Feb 12 14:57:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 61865 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp873059lbl; Fri, 12 Feb 2016 06:59:20 -0800 (PST) X-Received: by 10.66.62.161 with SMTP id z1mr2795601par.108.1455289160483; Fri, 12 Feb 2016 06:59:20 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id m80si20422853pfi.252.2016.02.12.06.59.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Feb 2016 06:59:20 -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 1aUFAu-00034z-On; Fri, 12 Feb 2016 14:58:24 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUFAW-0002s5-JI for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2016 14:58:02 +0000 Received: by mail-wm0-x229.google.com with SMTP id g62so65853221wme.0 for ; Fri, 12 Feb 2016 06:57:40 -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=yvXPTGaJolKZD5SqM1SCDehH5uyEPS1ivHXv5MZ/9oo=; b=BHScFUDJZg8JD59gGfovCQy6T7JeRid1VKStQ1BhLAc572skUz2tKYp1RCHK30qVlI y4FKl9Jy9QqKkf0jpf1AOGwowe2P8jpV9vM4WDrSGdPrdvs8VOcGKybogaNv5IWqD6PF kayPiix9BXu2RU8a1V/E1gzacNqTHmk3aVIBk= 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=yvXPTGaJolKZD5SqM1SCDehH5uyEPS1ivHXv5MZ/9oo=; b=RJYYWVSbEPiBxk095Kp/Rv8kKBXzSxdi7nh3wHptN1eEiXAKTtS0ZZW6rqMJHZXfFL nen+loM2+z2kl421G6jwkZfQizy8dG/WSc6fALFlzzatTFfpkQ1BGBg/8Yl5XVusXHB7 /1Z8B9/CWgQ2faf1r6/Nqi+O7LHh4cckG83z9siblAMCvrBOW5fY6JQo2+SrR080vZfv JLsHee17DjXsSnCQnlZOEbxqDGusM9odDG0GBZ3DnfRxDzpe0cFanmvf/Yrb4srujxF4 9ImGfxVxNaO9R81D7lHYWs4a+F6XlbY4ZKB4UNaX9LxrEr9lDgyWfDaTsOEPHhzO/09C /P2g== X-Gm-Message-State: AG10YOSnQi/bNLurSzeW/5SOPtPNbreDh/frYBIUDQeby/vqQ+bm6AXm9/IsiJY4SyOJdb9x X-Received: by 10.194.22.41 with SMTP id a9mr1115261wjf.68.1455289058963; Fri, 12 Feb 2016 06:57:38 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id e9sm12412008wja.25.2016.02.12.06.57.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 06:57:38 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, arnd@arndb.de Subject: [PATCH v3 2/4] arm64: defer __va translation of initrd_start and initrd_end Date: Fri, 12 Feb 2016 15:57:24 +0100 Message-Id: <1455289046-21321-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455289046-21321-1-git-send-email-ard.biesheuvel@linaro.org> References: <1455289046-21321-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160212_065800_953491_E45C0007 X-CRM114-Status: GOOD ( 14.68 ) 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:229 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: dave.martin@arm.com, 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/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 083361531a61..c900883a3119 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 3a9fc46cbf80..ed85778b32e5 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -61,8 +61,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; } @@ -213,8 +213,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();