From patchwork Fri May 22 05:43:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 6461211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 179AC9F399 for ; Fri, 22 May 2015 05:47:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46EEA20412 for ; Fri, 22 May 2015 05:47:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D95720295 for ; Fri, 22 May 2015 05:47:31 +0000 (UTC) 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 1YvfmA-00078D-QW; Fri, 22 May 2015 05:45:42 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yvfm4-0006tu-Ob for linux-arm-kernel@lists.infradead.org; Fri, 22 May 2015 05:45:38 +0000 Received: by pacwv17 with SMTP id wv17so10669338pac.2 for ; Thu, 21 May 2015 22:45:13 -0700 (PDT) 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=y6cP7uuCKJcjVDN6okNpm6MB00CdeLdPXwM03LZcNgA=; b=fhnjAfUVgN3TC+QGEtOnB3eX+UdAg4gc+WAcCQsOLTIh1kRCNAqx0f1Llujo/U62SE Ja0bo+arbt6oeyMuWqLyaKOJfpJoOvoAm2/Rie8z2f750JZTs7ys8qBVCckCbt8aie4r uICCCZ0k6UDy31WRja9TcddEBB7S7bsGr8kzaUROaMCgunAkb+xk/154ntgERukr31J7 hRmM8rlttYN10RcVeNfJ3rCDYpMQvwLgRkUk9lGwRf+YHsqHFwYZ768OnpkD7kak7KjG JI5b8tQz7seRyBGb91bySIOlJDik7nmcmPz74QJUtQ91vai1MpO0NYJfi7h89dJ9m7kz 5DYw== X-Gm-Message-State: ALoCoQmLIoB5II6+Q1VNFaPm1qJ7q6VDwanF4tcqLDsstbuAeLUNpCmGjfxC4H6F8bSWDSWicTmS X-Received: by 10.67.3.3 with SMTP id bs3mr12376577pad.51.1432273512946; Thu, 21 May 2015 22:45:12 -0700 (PDT) Received: from localhost.localdomain (61-205-7-87m5.grp1.mineo.jp. [61.205.7.87]) by mx.google.com with ESMTPSA id pc9sm843249pdb.6.2015.05.21.22.45.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 22:45:11 -0700 (PDT) From: AKASHI Takahiro To: ard.biesheuvel@linaro.org Subject: [PATCH] fixup! arm64: allow kernel Image to be loaded anywhere in physical memory Date: Fri, 22 May 2015 14:43:07 +0900 Message-Id: <1432273387-7385-1-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431328388-3051-1-git-send-email-ard.biesheuvel@linaro.org> References: <1431328388-3051-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150521_224536_846858_912D1F2F X-CRM114-Status: GOOD ( 11.71 ) X-Spam-Score: -0.7 (/) Cc: mark.rutland@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, AKASHI Takahiro X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ard, In testing my kexec/dump code, I found that your patch doesn't work with initrd. Since the virtual addresses of initrd are calc'ed earlier than map_mem(), they have bogus values and unpack_to_rootfs() will fail. This patch fixes the issue. Please think of taking it in your next version. --- arch/arm64/mm/mmu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 7e3e6af..43c2317 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -452,6 +453,13 @@ static void __init map_mem(void) bootstrap_linear_mapping(new_va_offset); kernel_va_offset = new_va_offset; + + /* Recalculate virtual addresses of initrd region */ + if (initrd_start) { + initrd_start += new_va_offset; + initrd_end += new_va_offset; + } + memstart_addr = new_memstart_addr; /* map all the memory banks */