From patchwork Fri Oct 14 07:31:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 682142 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3swK8F12fBz9s9N for ; Fri, 14 Oct 2016 18:33:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=fe6wziLG; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3swK8D73H8zDt41 for ; Fri, 14 Oct 2016 18:33:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=fe6wziLG; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x244.google.com (mail-pa0-x244.google.com [IPv6:2607:f8b0:400e:c03::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3swK6c2SSxzDt2k for ; Fri, 14 Oct 2016 18:31:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=fe6wziLG; dkim-atps=neutral Received: by mail-pa0-x244.google.com with SMTP id hh10so5775538pac.0 for ; Fri, 14 Oct 2016 00:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CZcSaxIZA8WMVsqUr183urTRiDA+hAqAkyrwrqjqiDo=; b=fe6wziLGwpjyzV+rU6QzgZ1RE6iVxSz5sEZEq5XRy8ZjhI4UP/1XqecvC1wjn8MICW XRmGyeKPajzjCbr+5epFbUfk6+FklIfUxAZvOQb9lhNCLmesfcW5AhirQaEGAROYnEB5 bQYXb8nyml1Op1HAUpbEmw38ouDg+fxNYtErC4r8MrMaqkblqVTNyYi7eEhPLLhbjc0J MORnvmkOT3V1Y/7ToJ0+sqtVEkvbV8CvZw5UpGSYYA+gtUtY5JHLxTkKt6l4zLcJpT/g qVbhSwpM3ODHV+COgfEa70ULUp5H5NwkzrLEkfqAZqc8IBldiK2NBucs9tw0tvRHX+9f yEBw== 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; bh=CZcSaxIZA8WMVsqUr183urTRiDA+hAqAkyrwrqjqiDo=; b=eR0fzBj/zGW8EaT/Ctk4qo3y8jwf2Dy5Hct2RxksHL+/sH4HDZhHTVgOi7WDW96I2A BQjX4dLuGVrELHPs0voO4yVl68i6dfGbI/iD0I0ar5V/B7AKsTrOe60VlDlRlzKOKFug TwGP0kT/+KZDAPEaxYwDt8syC+L673syuYTP1u6a8zwojy2BO5Rk+foHtdXV6yPlhG/m GIws9vKMYVGoU0m6YCogRCJ6Z3YTjfZWRe6xKVQrX9FR1Vwmv870gAGXqCL80/X1ICtp GgzC2EE1wM/OmcIYF+KMvw9iZ/C0/Ft1nBsV+5U1LH8rITFSVj067yXigE6DWTs0YRfv DpGw== X-Gm-Message-State: AA6/9RnFlAtCoTkDXB9ez3bAuWEFD1qyCdPYrJ9CJ+/RCx5bF8uv8nn+SDymkygImmFfug== X-Received: by 10.66.86.229 with SMTP id s5mr13470606paz.72.1476430309362; Fri, 14 Oct 2016 00:31:49 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id 65sm10405381pfw.1.2016.10.14.00.31.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Oct 2016 00:31:48 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2] powerpc/64: option to force run-at-load to test relocation Date: Fri, 14 Oct 2016 18:31:33 +1100 Message-Id: <20161014073133.24548-1-npiggin@gmail.com> X-Mailer: git-send-email 2.9.3 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This adds a config option that can help exercise the case when the kernel is not running at PAGE_OFFSET. Signed-off-by: Nicholas Piggin Reviewed-by: Balbir Singh --- Changes since v1: - Improved style as suggested by Balbir and Michael arch/powerpc/Kconfig | 9 +++++++++ arch/powerpc/kernel/head_64.S | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 65fba4c..5d43cb8 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -478,6 +478,15 @@ config RELOCATABLE setting can still be useful to bootwrappers that need to know the load address of the kernel (eg. u-boot/mkimage). +config RELOCATABLE_TEST + bool "Test relocatable kernel" + depends on (PPC64 && RELOCATABLE) + default n + help + This runs the relocatable kernel at the address it was initially + loaded at, which tends to be non-zero and therefore test the + relocation code. + config CRASH_DUMP bool "Build a kdump crash kernel" depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 79da0641..a0aaced 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S @@ -107,11 +107,17 @@ __secondary_hold_acknowledge: * observing the alignment requirement. */ /* Do not move this variable as kexec-tools knows about it. */ +#ifdef CONFIG_RELOCATABLE_TEST +#define RUN_AT_LOAD_DEFAULT 1 /* Test relocation, do not copy to 0 */ +#else +#define RUN_AT_LOAD_DEFAULT 0x72756e30 /* "run0" -- relocate to 0 by default */ +#endif + . = 0x5c .globl __run_at_load __run_at_load: DEFINE_FIXED_SYMBOL(__run_at_load) - .long 0x72756e30 /* "run0" -- relocate to 0 by default */ + .long RUN_AT_LOAD_DEFAULT #endif . = 0x60