From patchwork Wed Jan 22 21:21:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11346407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E0BB17EA for ; Wed, 22 Jan 2020 21:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E61F524689 for ; Wed, 22 Jan 2020 21:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579728147; bh=DZ2HIDD8TxmqEBBPXNVR6M2J5s6MVZTCVp9OzvWcvfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dz5/V06Vg525cPczv/qiFE4+u1eq1OTDu1FPVm55xbWGwJ82BZDmshECGUfCE6sCN 3dkTn3ruoP/un2s0kRrlR3f12wKyLRxxBHkzLN6olcDAfeiTFZdn3KSvqpPHNzf+K9 cgXPfdDg8PDdHTkfwwDDzmKw3w7yWNT4PFqxXnfY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729418AbgAVVWZ (ORCPT ); Wed, 22 Jan 2020 16:22:25 -0500 Received: from foss.arm.com ([217.140.110.172]:32828 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729299AbgAVVWY (ORCPT ); Wed, 22 Jan 2020 16:22:24 -0500 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 DC23D1424; Wed, 22 Jan 2020 13:22:23 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F1183F52E; Wed, 22 Jan 2020 13:22:23 -0800 (PST) From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Alexander Viro , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H . J . Lu " , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , =?utf-8?q?Kristina_Mart?= =?utf-8?q?=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, Dave Martin , Mark Brown Subject: [PATCH v5 11/12] KVM: arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Wed, 22 Jan 2020 21:21:43 +0000 Message-Id: <20200122212144.6409-12-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122212144.6409-1-broonie@kernel.org> References: <20200122212144.6409-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Dave Martin Since normal execution of any non-branch instruction resets the PSTATE BTYPE field to 0, so do the same thing when emulating a trapped instruction. Branches don't trap directly, so we should never need to assign a non-zero value to BTYPE here. Signed-off-by: Dave Martin Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_emulate.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 5efe5ca8fecf..05fb1b4e0fa2 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -470,10 +470,12 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu, static inline void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr) { - if (vcpu_mode_is_32bit(vcpu)) + if (vcpu_mode_is_32bit(vcpu)) { kvm_skip_instr32(vcpu, is_wide_instr); - else + } else { *vcpu_pc(vcpu) += 4; + *vcpu_cpsr(vcpu) &= ~PSR_BTYPE_MASK; + } /* advance the singlestep state machine */ *vcpu_cpsr(vcpu) &= ~DBG_SPSR_SS;