Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp553072imm; Wed, 1 Aug 2018 01:02:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfBgNsfFOqOKVFGPxRqvsW1VpfvkjZKZW957WlIlodhoQzKb1ag720Z6oakiLnXhI90Bpwi X-Received: by 2002:aa7:824d:: with SMTP id e13-v6mr25696624pfn.97.1533110572257; Wed, 01 Aug 2018 01:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110572; cv=none; d=google.com; s=arc-20160816; b=i+j9pcm7lJ9M2DiWUnMPAe/aGvnw3/sZWYOZVnoATMba+WxKhyh9kTERUnPq22a4c4 TbKjxK61UNgMzliRzLj/h+1cuUwX/vDktVTwLZWUTi4U0SBpgWLl2J/UqGwgPr8GyaSn lt9kXHHbD/ABH2r21l4BGGL7U0uG3wHbLm5QKsNoH3CmWTIzMG/w83WNOn1JbSxNo/Mg QO3PddFcxCPVDRzRIqU909PWfp1slWglNLiKROz6x5UYwGTRGBfTZieIDRfHkx22B8ZJ h2wWClu7aVv1xWa5qRhK0VX3CwEgFdmh+ou6iDEiUCcM3KQ88XhxvVy7VTq1q3+0z618 QN4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=51KFAHSuDEEmK4w4TivyntHt2pXOtgfAOE9+35vlvvg=; b=lYyRha8d3cEYWQDPy6SS4CJS/e8ct/P76LWT9sRC1j+6Dbc3l0eUyDM2uTDvAWldZh gAYltm1kzMHtOO6+THkvZCQLV+w+P0pRWCflHfnItHfdGpXvR8pm5kGYVfL94KXdzTnc 2oXtP0DnX+OkKZjOf5WPyWZLygSX2LxVE/vJ/UZ+xVKFX6DT5Fv8PxDlr5Z7pGr9RDys dlmqUbU3wVKytOEzfoOgA0NMSF6N1Cs1vvdATgYJBvIfMbEuZFDCrPZL8AKj6rsLKrzV LxTbNeDDScO9G6XMeL1DOiswS/bVNR53Rth1Vs89OjDcYOsPFY39Ix5MfE1OBaz5CHIh rGcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bxrkEBZX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14-v6si16372940pgl.490.2018.08.01.01.02.38; Wed, 01 Aug 2018 01:02:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bxrkEBZX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388539AbeHAJpn (ORCPT + 99 others); Wed, 1 Aug 2018 05:45:43 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:44713 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387709AbeHAJpn (ORCPT ); Wed, 1 Aug 2018 05:45:43 -0400 Received: by mail-pl0-f67.google.com with SMTP id m16-v6so8406656pls.11 for ; Wed, 01 Aug 2018 01:01:17 -0700 (PDT) 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=51KFAHSuDEEmK4w4TivyntHt2pXOtgfAOE9+35vlvvg=; b=bxrkEBZXNqcYnVXYfofTMl+wEyc+V6K+tsKOHnDes2qAy23Bi/unqeMP5fXb4rwcwX jVhm3yJfolblrN6UpfKf/bEeYNx0fTKZmy/2YBAmlaKMiOzPB92Y9CvXIGkgghi5uNAr A0h7JdHDtZd9yquPU8REl7XYTwXvkyUm6fbZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=51KFAHSuDEEmK4w4TivyntHt2pXOtgfAOE9+35vlvvg=; b=R29s7eJHlShOGeEoWe0huiN3aVQfU/gl9MzZZXacDJ1rPBGSm6iD1JDS7/uyKQJ4tD C68kO9JeTTubBNYa2AAY+Hyo8iEAn7DUO6rpY4INXVk75mmoJX8E4sNVbu4VO5Vevvfv fSgDumwtIPkuYARn3dnTd9iItyHAOgG1U5d2Ds7vIh3jGBUA5Qpz7DM8dk+isrKzU7yn NqCmzcDE9yIVxI41v9gD1O53jg1lUrMdDanDHZuf6PTcQt5VJyWfDfrnBTRiRt5OwdZ6 QBpuK6fWYaTKmM/sgVfBC8e7CUzotT44EGlmYryG6+vcaAaFxqd4DsxJkGOLUMRuxd9m Bzag== X-Gm-Message-State: AOUpUlFH8ciM9nbjOJUgq2sk/yVZ9sVf5DYMWE+3kaI1+Ao/81GS4Xc2 6mEuz8Z0c6FPpe7OUt1vpICuVA== X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr23484079pls.238.1533110476812; Wed, 01 Aug 2018 01:01:16 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id v3-v6sm52649116pgb.54.2018.08.01.01.01.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 01:01:16 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: prudo@linux.ibm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v13 13/16] arm64: kexec_file: invoke the kernel without purgatory Date: Wed, 1 Aug 2018 16:58:17 +0900 Message-Id: <20180801075820.3753-14-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801075820.3753-1-takahiro.akashi@linaro.org> References: <20180801075820.3753-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64, purgatory would do almost nothing. So just invoke secondary kernel directly by jumping into its entry code. While, in this case, cpu_soft_restart() must be called with dtb address in the fifth argument, the behavior still stays compatible with kexec_load case as long as the argument is null. Signed-off-by: AKASHI Takahiro Reviewed-by: James Morse Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/kernel/cpu-reset.S | 8 ++++---- arch/arm64/kernel/machine_kexec.c | 12 ++++++++++-- arch/arm64/kernel/relocate_kernel.S | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S index 8021b46c9743..a2be30275a73 100644 --- a/arch/arm64/kernel/cpu-reset.S +++ b/arch/arm64/kernel/cpu-reset.S @@ -22,11 +22,11 @@ * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for * cpu_soft_restart. * - * @el2_switch: Flag to indicate a swich to EL2 is needed. + * @el2_switch: Flag to indicate a switch to EL2 is needed. * @entry: Location to jump to for soft reset. - * arg0: First argument passed to @entry. - * arg1: Second argument passed to @entry. - * arg2: Third argument passed to @entry. + * arg0: First argument passed to @entry. (relocation list) + * arg1: Second argument passed to @entry.(physical kernel entry) + * arg2: Third argument passed to @entry. (physical dtb address) * * Put the CPU into the same state as it would be if it had been reset, and * branch to what would be the reset vector. It must be executed with the diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index f6a5c6bc1434..c63c355e2f18 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -212,9 +212,17 @@ void machine_kexec(struct kimage *kimage) * uses physical addressing to relocate the new image to its final * position and transfers control to the image entry point when the * relocation is complete. + * In kexec case, kimage->start points to purgatory assuming that + * kernel entry and dtb address are embedded in purgatory by + * userspace (kexec-tools). + * In kexec_file case, the kernel starts directly without purgatory. */ - - cpu_soft_restart(reboot_code_buffer_phys, kimage->head, kimage->start, 0); + cpu_soft_restart(reboot_code_buffer_phys, kimage->head, kimage->start, +#ifdef CONFIG_KEXEC_FILE + kimage->arch.dtb_mem); +#else + 0); +#endif BUG(); /* Should never get here. */ } diff --git a/arch/arm64/kernel/relocate_kernel.S b/arch/arm64/kernel/relocate_kernel.S index f407e422a720..95fd94209aae 100644 --- a/arch/arm64/kernel/relocate_kernel.S +++ b/arch/arm64/kernel/relocate_kernel.S @@ -32,6 +32,7 @@ ENTRY(arm64_relocate_new_kernel) /* Setup the list loop variables. */ + mov x18, x2 /* x18 = dtb address */ mov x17, x1 /* x17 = kimage_start */ mov x16, x0 /* x16 = kimage_head */ raw_dcache_line_size x15, x0 /* x15 = dcache line size */ @@ -107,7 +108,7 @@ ENTRY(arm64_relocate_new_kernel) isb /* Start new image. */ - mov x0, xzr + mov x0, x18 mov x1, xzr mov x2, xzr mov x3, xzr -- 2.18.0