From patchwork Wed Sep 26 13:56:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Thierry X-Patchwork-Id: 10616041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 671E2913 for ; Wed, 26 Sep 2018 14:02:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6340B2B107 for ; Wed, 26 Sep 2018 14:02:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6135E2B10B; Wed, 26 Sep 2018 14:02:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A34632B11D for ; Wed, 26 Sep 2018 14:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=m0o3sy6TjYmodRr6m+w5ilk73TpCyM2PEQ2tAq2/eSQ=; b=KaetgI9ERnbX+1OeWgIo2JL3Jk 6CQhBxnhzmOKPYi6DFdi/zBp5fX+fReI7RVgjMIqgXMrxo97dt6RBiQPzycNBYuksJgmaIJ1oqfPw JUd4LWSz7ZbtWG9NJbzXUFVp5LrL5BypDyq01dycNDGQK2xz0X+RXBfB9dbZQ+VOcQRzNIlng98oW tGznNvb77K0bmWXPuiA7oxlu3OvlkCUxnOUcElphgmbsD/Blzss4gPzQMDBkvTpfvKKBKh4aCJp/Z tPgrf9l4kl/ieFWDdtqSFw/nX1ZgA1EY+myZCzZSp1/2+HaUTdu5qxvI7Y4mgeVrOEpyK1He0xmL1 CvfJhkXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5AOe-0002TB-1G; Wed, 26 Sep 2018 14:02:32 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5AK9-0007W3-9K for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2018 13:58:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6A116168F; Wed, 26 Sep 2018 06:56:41 -0700 (PDT) Received: from e112298-lin.Emea.Arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BA40A3F5B3; Wed, 26 Sep 2018 06:56:39 -0700 (PDT) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/7] arm64: Do not apply vector harderning for hyp entries from EL2 Date: Wed, 26 Sep 2018 14:56:23 +0100 Message-Id: <1537970184-44348-7-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1537970184-44348-1-git-send-email-julien.thierry@arm.com> References: <1537970184-44348-1-git-send-email-julien.thierry@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_065753_374843_85C42AE1 X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Thierry , marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, christoffer.dall@arm.com, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, Dave.Martin@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When an EL2 entry of __kvm_hyp_vector is taken, it means an entry from a lower EL was previously taken to exit the guest. Taking that lower EL entry already applied vector hardening if needed, so there is no need to do it again. Only apply vector hardening for exception coming from lower EL. Signed-off-by: Julien Thierry Cc: kvmarm@lists.cs.columbia.edu --- arch/arm64/kvm/hyp/hyp-entry.S | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index 24b4fba..da31386 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -257,7 +257,15 @@ ENTRY(__kvm_hyp_vector) ENDPROC(__kvm_hyp_vector) #ifdef CONFIG_KVM_INDIRECT_VECTORS -.macro hyp_ventry +.macro hyp_el2_ventry + .align 7 +1: b __kvm_hyp_vector + (1b - 0b) + .rept 31 + nop + .endr +.endm + +.macro hyp_el1_ventry .align 7 1: .rept 27 nop @@ -290,8 +298,11 @@ alternative_cb_end .macro generate_vectors 0: - .rept 16 - hyp_ventry + .rept 8 + hyp_el2_ventry + .endr + .rept 8 + hyp_el1_ventry .endr .org 0b + SZ_2K // Safety measure .endm