From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBC0EC25B10 for ; Mon, 13 May 2024 14:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tY9h3377JsD2AVStvI8iAFu+RIq2bkpM2ataUAPfLK4=; b=O9HTW+WzlG8iKK rKB3juenszQbtWSTfc9HygoADsvtPTtxY03q1EovLF7EdhZZCg9aGl5O8+9vSi+pS3RUtfZod6Fm4 gWk6dxYJUvF04fq0Z+6l8EGfQiNZpd/wU2QLRLIeUHdoxHXNFvhGT4diuG3JKetWoGx57DfODJn1c Xr44K9/uIFTA/qfeVPyGwDU/udUVygbRigf9CgvzDKMeXAQ7xAR1KhmTJ/OFI40X0o3wVT7Malffw Nx8fJpM9YieZyvRCFMJFqRK+PsWLfrc3v76N8A6DqF+k2v1brXMHnH4jeAlsH4KMPgwyYrfp/sZY3 Xx65nV5WkdhwioNjSHzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6WeR-0000000DBvM-0wup; Mon, 13 May 2024 14:27:39 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6WeN-0000000DBuF-3Vwx for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2024 14:27:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A5D2FCE0CFB; Mon, 13 May 2024 14:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67B1BC113CC; Mon, 13 May 2024 14:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715610447; bh=HVHpf2elAFBZKACu2uMRIpTn32N6FD85xEHkCXA62ps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J7WPT6zcUxFB0eamH4r3GjQ57QdCbcAjyoGlx0an1ZgEqclUPJhPpXqmTaS6tmn4J BJTA4UCLe/ghr5ErZZ9OPqmblk0RYfl8FB3SrsLFd1DYCEqbpXAg6quhI8zOn+inOB /EJ3Y1MlVLVzI/jSp1v8Ig+5Tdchp1J/Asc6cHtahWF992zNlm+l/HFsuUA/LWgZUp eARAmeIGp7Yz5p/qt5XClS3DOG6CXmOGNAAoZ8RcTAH0wijxQOCDpwNoPkd+HMOl+o CW/GlKCVf4ukgexcDeSQc0l4J+Z1eNSp8yjmaRKfPQdPbGTxQAKzoQ1lYAWvs4zSzy gHEDoJEegQq/Q== Date: Mon, 13 May 2024 15:27:22 +0100 From: Will Deacon To: =?iso-8859-1?Q?Pierre-Cl=E9ment?= Tosi Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Oliver Upton , Suzuki K Poulose , Vincent Donnefort Subject: Re: [PATCH v3 04/12] KVM: arm64: nVHE: Remove __guest_exit_panic path Message-ID: <20240513142721.GD28749@willie-the-truck> References: <20240510112645.3625702-1-ptosi@google.com> <20240510112645.3625702-5-ptosi@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240510112645.3625702-5-ptosi@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240513_072736_258830_B4E627AD X-CRM114-Status: GOOD ( 17.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 10, 2024 at 12:26:33PM +0100, Pierre-Cl=E9ment Tosi wrote: > In invalid_host_el2_vect (i.e. EL2{t,h} handlers in nVHE guest context), > remove the duplicate vCPU context check that __guest_exit_panic also > performs, allowing an unconditional branch to it. > = > Rename __guest_exit_panic to __hyp_panic to better reflect that it might > not exit through the guest but will always (directly or indirectly) end > up executing hyp_panic(). Fix its wrong (probably bitrotten) ABI doc to > reflect the ABI expected by VHE and (now) nVHE. > > Use CPU_LR_OFFSET to clarify that the routine returns to hyp_panic(). > = > Restore x0, x1 before calling hyp_panic when __hyp_panic is executed in > host context (i.e. called from __kvm_hyp_vector). Please don't mix cosmetic changes with functional changes. It really makes the reviewer's life more difficult, especially when the diff is nearly all in asm! > diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S > index bcaaf1a11b4e..6a1ce9d21e5b 100644 > --- a/arch/arm64/kvm/hyp/entry.S > +++ b/arch/arm64/kvm/hyp/entry.S > @@ -83,7 +83,7 @@ alternative_else_nop_endif > eret > sb > = > -SYM_INNER_LABEL(__guest_exit_restore_elr_and_panic, SYM_L_GLOBAL) > +SYM_INNER_LABEL(__hyp_restore_elr_and_panic, SYM_L_GLOBAL) > // x0-x29,lr: hyp regs > = > stp x0, x1, [sp, #-16]! > @@ -92,13 +92,15 @@ SYM_INNER_LABEL(__guest_exit_restore_elr_and_panic, S= YM_L_GLOBAL) > msr elr_el2, x0 > ldp x0, x1, [sp], #16 > = > -SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) > - // x2-x29,lr: vcpu regs > - // vcpu x0-x1 on the stack > +SYM_INNER_LABEL(__hyp_panic, SYM_L_GLOBAL) > + // x0-x29,lr: vcpu regs > + > + stp x0, x1, [sp, #-16]! > = > // If the hyp context is loaded, go straight to hyp_panic > get_loaded_vcpu x0, x1 > cbnz x0, 1f > + ldp x0, x1, [sp], #16 > b hyp_panic Aren't these new stack accesses unnecessary for the case where the vector is valid? > = > 1: > @@ -110,10 +112,12 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) > // accurate if the guest had been completely restored. > adr_this_cpu x0, kvm_hyp_ctxt, x1 > adr_l x1, hyp_panic > - str x1, [x0, #CPU_XREG_OFFSET(30)] > + str x1, [x0, #CPU_LR_OFFSET] > = > get_vcpu_ptr x1, x0 > = > + // Keep x0-x1 on the stack for __guest_exit Didn't these get pushed twice? Once by the valid_vect macro and then again by your stp in __hyp_panic? I feel like I must be missing something here, but I don't really see why this patch is needed. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel