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 X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70AD7C4338F for ; Fri, 13 Aug 2021 13:10:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 11BCA61038 for ; Fri, 13 Aug 2021 13:10:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 11BCA61038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=y9J2irdtJ/n3SBEBE/aoHxYZNbhWuSdQoteBIdKE410=; b=cFh5vZXx2bEjKWc0RndHt8G5Dz VClkU2JJ1DnkwZ/uvpK/I+j9HBTFQVZAnYhMBwNAgTX4o8B+GUIInqBrbEeYemR6JbVJJpynfjObP 5hJifbz4YOSWY6lez3IBgNcFRa6PuLrynPcki/UCwWuNGs4eaKlh2fPtTgCpBVMxEbHVsmejsy2Go OuF1Ha0dshRLidtq8k/23oRIBrP1li31aUZO3XGZvhzOZJwVwZATEhgf3fvPuiEASBWB2wWF2Chq9 tQVbb6bpY8gK8IY9FQdgTHJO0l5ae5HWERW9DaHyIHtkGhSE9GkiSh3jPDPQg9G6BLP8BE/lF7SsM UpGYYcJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEWvM-00Cf12-TJ; Fri, 13 Aug 2021 13:08:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEWvG-00Cf0G-CZ for linux-arm-kernel@lists.infradead.org; Fri, 13 Aug 2021 13:08:34 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 038001042; Fri, 13 Aug 2021 06:08:27 -0700 (PDT) Received: from [10.57.36.146] (unknown [10.57.36.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6204E3F718; Fri, 13 Aug 2021 06:08:25 -0700 (PDT) Subject: Re: [PATCH 2/5] arm64: Handle UNDEF in the EL2 stub vectors To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Will Deacon , Catalin Marinas , Mark Rutland , Ard Biesheuvel , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, kernel-team@android.com References: <20210812190213.2601506-1-maz@kernel.org> <20210812190213.2601506-3-maz@kernel.org> From: Robin Murphy Message-ID: <2f6bf17f-d235-8311-13d5-dcb3d00e23c4@arm.com> Date: Fri, 13 Aug 2021 14:08:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210812190213.2601506-3-maz@kernel.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210813_060830_529236_8D0EB66A X-CRM114-Status: GOOD ( 20.31 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-08-12 20:02, Marc Zyngier wrote: > As we want to handle the silly case where HVC has been disabled > from EL3, augment our ability to handle exception at EL2. > > Check for unknown exceptions (usually UNDEF) coming from EL2, > and treat them as a failing HVC call into the stubs. While > this isn't great and obviously doesn't catter for the gigantic > range of possible exceptions, it isn't any worse than what we > have today. > > Just don't try and use it for anything else. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kernel/hyp-stub.S | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S > index 43d212618834..026a34515b21 100644 > --- a/arch/arm64/kernel/hyp-stub.S > +++ b/arch/arm64/kernel/hyp-stub.S > @@ -46,7 +46,16 @@ SYM_CODE_END(__hyp_stub_vectors) > .align 11 > > SYM_CODE_START_LOCAL(elx_sync) > - cmp x0, #HVC_SET_VECTORS > + mrs x4, spsr_el2 > + and x4, x4, #PSR_MODE_MASK > + orr x4, x4, #1 > + cmp x4, #PSR_MODE_EL2h > + b.ne 0f > + mrs x4, esr_el2 > + eor x4, x4, #ESR_ELx_IL > + cbz x4, el2_undef Hmm, might it be neater to check ESR_EL2.ISS to see if we landed here for any reason *other* than a successfully-executed HVC? Robin. > + > +0: cmp x0, #HVC_SET_VECTORS > b.ne 1f > msr vbar_el2, x1 > b 9f > @@ -71,6 +80,14 @@ SYM_CODE_START_LOCAL(elx_sync) > > 9: mov x0, xzr > eret > + > +el2_undef: > + // Assumes this was a HVC that went really wrong... > + mrs x0, elr_el2 > + add x0, x0, #4 > + msr elr_el2, x0 > + mov_q x0, HVC_STUB_ERR > + eret > SYM_CODE_END(elx_sync) > > // nVHE? No way! Give me the real thing! > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel