From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Morse Subject: Re: [PATCH v3 01/25] arm64: hyp-stub: Implement HVC_RESET_VECTORS stub hypercall Date: Tue, 21 Mar 2017 17:25:34 +0000 Message-ID: <58D1620E.30001@arm.com> References: <20170306142458.8875-1-marc.zyngier@arm.com> <20170306142458.8875-2-marc.zyngier@arm.com> <20170321170407.GD21829@e104818-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F1E4A40A54 for ; Tue, 21 Mar 2017 13:24:07 -0400 (EDT) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oU9zh0O07w-T for ; Tue, 21 Mar 2017 13:24:07 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0B3EC40A14 for ; Tue, 21 Mar 2017 13:24:05 -0400 (EDT) In-Reply-To: <20170321170407.GD21829@e104818-lin.cambridge.arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Catalin Marinas Cc: cdall@linaro.org, Russell King , kvm@vger.kernel.org, Ard Biesheuvel , Marc Zyngier , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org List-Id: kvmarm@lists.cs.columbia.edu Hi Catalin, On 21/03/17 17:04, Catalin Marinas wrote: > On Mon, Mar 06, 2017 at 02:24:34PM +0000, Marc Zyngier wrote: >> Let's define a new stub hypercall that resets the HYP configuration >> to its default: hyp-stub vectors, and MMU disabled. >> >> Of course, for the hyp-stub itself, this is a trivial no-op. >> Hypervisors will have a bit more work to do. >> >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/include/asm/virt.h | 9 +++++++++ >> arch/arm64/kernel/hyp-stub.S | 13 ++++++++++++- >> 2 files changed, 21 insertions(+), 1 deletion(-) > [...] >> +ENTRY(__hyp_reset_vectors) >> + str lr, [sp, #-16]! >> + mov x0, #HVC_RESET_VECTORS >> + hvc #0 >> + ldr lr, [sp], #16 >> + ret >> +ENDPROC(__hyp_reset_vectors) > > Why do we need to specifically preserve lr across the hvc call? Is it > corrupted by the EL2 code (if yes, are other caller-saved registers that > need preserving)? I don't see something similar in the arch/arm code. Kexec on arm64 needed a register to clobber in the hyp-stub's el1_sync code. We wanted to preserve all the registers so soft_restart() could look more like a function call. Thanks, James From mboxrd@z Thu Jan 1 00:00:00 1970 From: james.morse@arm.com (James Morse) Date: Tue, 21 Mar 2017 17:25:34 +0000 Subject: [PATCH v3 01/25] arm64: hyp-stub: Implement HVC_RESET_VECTORS stub hypercall In-Reply-To: <20170321170407.GD21829@e104818-lin.cambridge.arm.com> References: <20170306142458.8875-1-marc.zyngier@arm.com> <20170306142458.8875-2-marc.zyngier@arm.com> <20170321170407.GD21829@e104818-lin.cambridge.arm.com> Message-ID: <58D1620E.30001@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Catalin, On 21/03/17 17:04, Catalin Marinas wrote: > On Mon, Mar 06, 2017 at 02:24:34PM +0000, Marc Zyngier wrote: >> Let's define a new stub hypercall that resets the HYP configuration >> to its default: hyp-stub vectors, and MMU disabled. >> >> Of course, for the hyp-stub itself, this is a trivial no-op. >> Hypervisors will have a bit more work to do. >> >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/include/asm/virt.h | 9 +++++++++ >> arch/arm64/kernel/hyp-stub.S | 13 ++++++++++++- >> 2 files changed, 21 insertions(+), 1 deletion(-) > [...] >> +ENTRY(__hyp_reset_vectors) >> + str lr, [sp, #-16]! >> + mov x0, #HVC_RESET_VECTORS >> + hvc #0 >> + ldr lr, [sp], #16 >> + ret >> +ENDPROC(__hyp_reset_vectors) > > Why do we need to specifically preserve lr across the hvc call? Is it > corrupted by the EL2 code (if yes, are other caller-saved registers that > need preserving)? I don't see something similar in the arch/arm code. Kexec on arm64 needed a register to clobber in the hyp-stub's el1_sync code. We wanted to preserve all the registers so soft_restart() could look more like a function call. Thanks, James