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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B942C433EF for ; Thu, 3 Feb 2022 17:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353000AbiBCRnk (ORCPT ); Thu, 3 Feb 2022 12:43:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352965AbiBCRnk (ORCPT ); Thu, 3 Feb 2022 12:43:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F22C061714 for ; Thu, 3 Feb 2022 09:43:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7407061767 for ; Thu, 3 Feb 2022 17:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA546C340E8; Thu, 3 Feb 2022 17:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643910218; bh=GXzpfeX2dU4ciuvs0rjklTbN/OCnPy0khj9+uIZBI3k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EQPp34N+iZmTtf3ZIkXXu/JeEyCoYTdXCni8yqMmEGjJSqj7MIrTyq4c1mk2zN4WF WlAVg1+dzuxy/bnOUEtBVZDg5UQItBh/Qcb7dhmGWi3lIw0L2UFEOhW1sMZ60lOPDc jfLNXDfwP/7nITUgn8brcVv3QJZL4QlEkgdzoNYUnFqlveCK0D5Oxl9Y8Qdg+iQEjK 8jT28Fz5Yf3zQryvIgAJERqT2ki7KKDInOBL4fLQvCc+PsCU6qVqATYE8TXULyVcxB LkrYjFKNdGrQLr+J0YG7WPXVKnsDr+LqvomtcVgn55uGFwC565edZRMnKPRfESLt8x cc/vUqPuc2ehA== Received: from sofa.misterjones.org ([185.219.108.64] helo=billy-the-mountain.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nFg8u-005DPW-PU; Thu, 03 Feb 2022 17:43:36 +0000 Date: Thu, 03 Feb 2022 17:43:36 +0000 Message-ID: <87h79f3kxj.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , Ganapatrao Kulkarni , Chase Conklin , "Russell King (Oracle)" , James Morse , Suzuki K Poulose , karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com Subject: Re: [PATCH v6 09/64] KVM: arm64: nv: Support virtual EL2 exceptions In-Reply-To: References: <20220128121912.509006-1-maz@kernel.org> <20220128121912.509006-10-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, jintack@cs.columbia.edu, haibo.xu@linaro.org, gankulkarni@os.amperecomputing.com, chase.conklin@arm.com, linux@armlinux.org.uk, james.morse@arm.com, suzuki.poulose@arm.com, karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, 02 Feb 2022 15:23:20 +0000, Alexandru Elisei wrote: > > Hi, > > On Fri, Jan 28, 2022 at 12:18:17PM +0000, Marc Zyngier wrote: > > diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c > > new file mode 100644 > > index 000000000000..f52cd4458947 > > --- /dev/null > > +++ b/arch/arm64/kvm/emulate-nested.c > > @@ -0,0 +1,197 @@ > > Looks like this line: > > // SPDX-License-Identifier: GPL-2.0-only > > is missing. Indeed. I should check all the new files, as they are a bit... off. > > > +/* > > + * Copyright (C) 2016 - Linaro and Columbia University > > + * Author: Jintack Lim > > + */ > > + > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include "hyp/include/hyp/adjust_pc.h" > > + > > +#include "trace.h" > > + > > +static u64 kvm_check_illegal_exception_return(struct kvm_vcpu *vcpu, u64 spsr) > > +{ > > + u64 mode = spsr & PSR_MODE_MASK; > > + > > + /* > > + * Possible causes for an Illegal Exception Return from EL2: > > + * - trying to return to EL3 > > + * - trying to return to a 32bit EL > > + * - trying to return to EL1 with HCR_EL2.TGE set > > + */ > > + if (mode == PSR_MODE_EL3t || mode == PSR_MODE_EL3h || > > + spsr & PSR_MODE32_BIT || > > I take it KVM will not allow a L1 hypervisor to run EL1 or EL0 in 32 > bit mode? No, that'd really be a distraction at this stage. I don't expect any HW supporting NV NV to support AArch32 at EL1, and if someone really needs EL0 support (the HW support actually exists), they'll have to revisit this. > > > + (vcpu_el2_tge_is_set(vcpu) && (mode == PSR_MODE_EL1t || > > + mode == PSR_MODE_EL1h))) { > > I think these checks should also be added: > > "A return where the value of the saved process state M[4] bit is 0, > indicating a return to AArch64 state, and one of the following is > true: > > - The M[1] bit is 1. > - The M[3:0] bits are 0b0001. Definitely should add these two, probably in the form of a switch enumerating all the possible exception levels rather than checking for discrete bits that are hard to reason about. > - The Exception level being returned to is using AArch32 state, as > programmed by the SCR_EL3.RW or HCR_EL2.RW bits, or as configured > from reset." That's already caught with the SPSR check above. Thanks, M. -- Without deviation from the norm, progress is not possible. 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1054DC433F5 for ; Thu, 3 Feb 2022 17:43:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9E5D14B118; Thu, 3 Feb 2022 12:43:44 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org 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 sBt5+pbVo6gO; Thu, 3 Feb 2022 12:43:43 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2F94D4B0BD; Thu, 3 Feb 2022 12:43:43 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C42324B0BD for ; Thu, 3 Feb 2022 12:43:41 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu 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 s1sI9ZDMxSvW for ; Thu, 3 Feb 2022 12:43:40 -0500 (EST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 65AC24B0B9 for ; Thu, 3 Feb 2022 12:43:40 -0500 (EST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73DE161625; Thu, 3 Feb 2022 17:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA546C340E8; Thu, 3 Feb 2022 17:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643910218; bh=GXzpfeX2dU4ciuvs0rjklTbN/OCnPy0khj9+uIZBI3k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EQPp34N+iZmTtf3ZIkXXu/JeEyCoYTdXCni8yqMmEGjJSqj7MIrTyq4c1mk2zN4WF WlAVg1+dzuxy/bnOUEtBVZDg5UQItBh/Qcb7dhmGWi3lIw0L2UFEOhW1sMZ60lOPDc jfLNXDfwP/7nITUgn8brcVv3QJZL4QlEkgdzoNYUnFqlveCK0D5Oxl9Y8Qdg+iQEjK 8jT28Fz5Yf3zQryvIgAJERqT2ki7KKDInOBL4fLQvCc+PsCU6qVqATYE8TXULyVcxB LkrYjFKNdGrQLr+J0YG7WPXVKnsDr+LqvomtcVgn55uGFwC565edZRMnKPRfESLt8x cc/vUqPuc2ehA== Received: from sofa.misterjones.org ([185.219.108.64] helo=billy-the-mountain.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nFg8u-005DPW-PU; Thu, 03 Feb 2022 17:43:36 +0000 Date: Thu, 03 Feb 2022 17:43:36 +0000 Message-ID: <87h79f3kxj.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Subject: Re: [PATCH v6 09/64] KVM: arm64: nv: Support virtual EL2 exceptions In-Reply-To: References: <20220128121912.509006-1-maz@kernel.org> <20220128121912.509006-10-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, jintack@cs.columbia.edu, haibo.xu@linaro.org, gankulkarni@os.amperecomputing.com, chase.conklin@arm.com, linux@armlinux.org.uk, james.morse@arm.com, suzuki.poulose@arm.com, karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kernel-team@android.com, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Chase Conklin , kvmarm@lists.cs.columbia.edu, mihai.carabas@oracle.com, Ganapatrao Kulkarni , "Russell King \(Oracle\)" , linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, 02 Feb 2022 15:23:20 +0000, Alexandru Elisei wrote: > > Hi, > > On Fri, Jan 28, 2022 at 12:18:17PM +0000, Marc Zyngier wrote: > > diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c > > new file mode 100644 > > index 000000000000..f52cd4458947 > > --- /dev/null > > +++ b/arch/arm64/kvm/emulate-nested.c > > @@ -0,0 +1,197 @@ > > Looks like this line: > > // SPDX-License-Identifier: GPL-2.0-only > > is missing. Indeed. I should check all the new files, as they are a bit... off. > > > +/* > > + * Copyright (C) 2016 - Linaro and Columbia University > > + * Author: Jintack Lim > > + */ > > + > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include "hyp/include/hyp/adjust_pc.h" > > + > > +#include "trace.h" > > + > > +static u64 kvm_check_illegal_exception_return(struct kvm_vcpu *vcpu, u64 spsr) > > +{ > > + u64 mode = spsr & PSR_MODE_MASK; > > + > > + /* > > + * Possible causes for an Illegal Exception Return from EL2: > > + * - trying to return to EL3 > > + * - trying to return to a 32bit EL > > + * - trying to return to EL1 with HCR_EL2.TGE set > > + */ > > + if (mode == PSR_MODE_EL3t || mode == PSR_MODE_EL3h || > > + spsr & PSR_MODE32_BIT || > > I take it KVM will not allow a L1 hypervisor to run EL1 or EL0 in 32 > bit mode? No, that'd really be a distraction at this stage. I don't expect any HW supporting NV NV to support AArch32 at EL1, and if someone really needs EL0 support (the HW support actually exists), they'll have to revisit this. > > > + (vcpu_el2_tge_is_set(vcpu) && (mode == PSR_MODE_EL1t || > > + mode == PSR_MODE_EL1h))) { > > I think these checks should also be added: > > "A return where the value of the saved process state M[4] bit is 0, > indicating a return to AArch64 state, and one of the following is > true: > > - The M[1] bit is 1. > - The M[3:0] bits are 0b0001. Definitely should add these two, probably in the form of a switch enumerating all the possible exception levels rather than checking for discrete bits that are hard to reason about. > - The Exception level being returned to is using AArch32 state, as > programmed by the SCR_EL3.RW or HCR_EL2.RW bits, or as configured > from reset." That's already caught with the SPSR check above. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 4CBEBC433FE for ; Thu, 3 Feb 2022 17:52:02 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KFouVi4o1fXWHBMNkWV8xwxeIw9kJSzE5kKnZW/i06c=; b=cbx6vyjFnIOR7m muAIh7BWa0d1kqRgjkPUuD55znWb50mbIiJQ1AzGL92zA9z3jqL4iI50ipl58N+4N/k6L8/jUWqAL YI1hA7lWcl7lCVwWhOXwTjNEpJuvb6+m/bioyuhKZaweFkbmuC6Fmxfa0gid57qOCqkr944sVjGxr itdc9M3MfP6oQ8tyHfK+U1bOG8quaragwulokCzMe6XQbhwDQ05niR7v6pOul/VpXgC767F+s4Xbm Eo2cWfxVxMW6sy/W+QIWTyv0+DV3R34DmTWOM5AZECDf60A6BbidlVca+C0mX9X9VnvLmWvGpVshP SSZOoexUoEDlcJ4Sdgbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFgF3-002L9M-To; Thu, 03 Feb 2022 17:49:58 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg8x-002Ipx-Su for linux-arm-kernel@lists.infradead.org; Thu, 03 Feb 2022 17:43:41 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73DE161625; Thu, 3 Feb 2022 17:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA546C340E8; Thu, 3 Feb 2022 17:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643910218; bh=GXzpfeX2dU4ciuvs0rjklTbN/OCnPy0khj9+uIZBI3k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EQPp34N+iZmTtf3ZIkXXu/JeEyCoYTdXCni8yqMmEGjJSqj7MIrTyq4c1mk2zN4WF WlAVg1+dzuxy/bnOUEtBVZDg5UQItBh/Qcb7dhmGWi3lIw0L2UFEOhW1sMZ60lOPDc jfLNXDfwP/7nITUgn8brcVv3QJZL4QlEkgdzoNYUnFqlveCK0D5Oxl9Y8Qdg+iQEjK 8jT28Fz5Yf3zQryvIgAJERqT2ki7KKDInOBL4fLQvCc+PsCU6qVqATYE8TXULyVcxB LkrYjFKNdGrQLr+J0YG7WPXVKnsDr+LqvomtcVgn55uGFwC565edZRMnKPRfESLt8x cc/vUqPuc2ehA== Received: from sofa.misterjones.org ([185.219.108.64] helo=billy-the-mountain.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nFg8u-005DPW-PU; Thu, 03 Feb 2022 17:43:36 +0000 Date: Thu, 03 Feb 2022 17:43:36 +0000 Message-ID: <87h79f3kxj.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , Ganapatrao Kulkarni , Chase Conklin , "Russell King (Oracle)" , James Morse , Suzuki K Poulose , karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com Subject: Re: [PATCH v6 09/64] KVM: arm64: nv: Support virtual EL2 exceptions In-Reply-To: References: <20220128121912.509006-1-maz@kernel.org> <20220128121912.509006-10-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, jintack@cs.columbia.edu, haibo.xu@linaro.org, gankulkarni@os.amperecomputing.com, chase.conklin@arm.com, linux@armlinux.org.uk, james.morse@arm.com, suzuki.poulose@arm.com, karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_094340_071202_2F0CEAF1 X-CRM114-Status: GOOD ( 31.13 ) 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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 02 Feb 2022 15:23:20 +0000, Alexandru Elisei wrote: > > Hi, > > On Fri, Jan 28, 2022 at 12:18:17PM +0000, Marc Zyngier wrote: > > diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c > > new file mode 100644 > > index 000000000000..f52cd4458947 > > --- /dev/null > > +++ b/arch/arm64/kvm/emulate-nested.c > > @@ -0,0 +1,197 @@ > > Looks like this line: > > // SPDX-License-Identifier: GPL-2.0-only > > is missing. Indeed. I should check all the new files, as they are a bit... off. > > > +/* > > + * Copyright (C) 2016 - Linaro and Columbia University > > + * Author: Jintack Lim > > + */ > > + > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include "hyp/include/hyp/adjust_pc.h" > > + > > +#include "trace.h" > > + > > +static u64 kvm_check_illegal_exception_return(struct kvm_vcpu *vcpu, u64 spsr) > > +{ > > + u64 mode = spsr & PSR_MODE_MASK; > > + > > + /* > > + * Possible causes for an Illegal Exception Return from EL2: > > + * - trying to return to EL3 > > + * - trying to return to a 32bit EL > > + * - trying to return to EL1 with HCR_EL2.TGE set > > + */ > > + if (mode == PSR_MODE_EL3t || mode == PSR_MODE_EL3h || > > + spsr & PSR_MODE32_BIT || > > I take it KVM will not allow a L1 hypervisor to run EL1 or EL0 in 32 > bit mode? No, that'd really be a distraction at this stage. I don't expect any HW supporting NV NV to support AArch32 at EL1, and if someone really needs EL0 support (the HW support actually exists), they'll have to revisit this. > > > + (vcpu_el2_tge_is_set(vcpu) && (mode == PSR_MODE_EL1t || > > + mode == PSR_MODE_EL1h))) { > > I think these checks should also be added: > > "A return where the value of the saved process state M[4] bit is 0, > indicating a return to AArch64 state, and one of the following is > true: > > - The M[1] bit is 1. > - The M[3:0] bits are 0b0001. Definitely should add these two, probably in the form of a switch enumerating all the possible exception levels rather than checking for discrete bits that are hard to reason about. > - The Exception level being returned to is using AArch32 state, as > programmed by the SCR_EL3.RW or HCR_EL2.RW bits, or as configured > from reset." That's already caught with the SPSR check above. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel