From patchwork Wed Dec 11 15:42:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 181259 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp700963ile; Wed, 11 Dec 2019 07:43:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz6HYrloK8zxGUWwbxgHzqIKynP7QE1PoT/7NB/4JUnfvNio5vgw8zHPdi0QOw+h8Q1hYpQ X-Received: by 2002:aca:fdc2:: with SMTP id b185mr3382842oii.74.1576079002384; Wed, 11 Dec 2019 07:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079002; cv=none; d=google.com; s=arc-20160816; b=XXMNzVFiGJ0UTlRECUrg1/q35pgWwSU8eq4O0EWfea/QERlq+U+nDCUGGH21FQoRN9 VgL3zWzaHr4kHQtUODa9jYMTqQodmHK2IJqOvHjcJN5bb5KH+moQqZfTdTP5GXFuOMp/ ps9XUU5WYgu0RsnSF1OMsVHVz4lPNVXxBBjpvFwZCzenoGyd00eA9YSESZC4QHEZtP8q ScrqWzlpzqARJfHtksQMg3ac9M0wNfI3OAJFB6JsaaGZVdFc2er4Z5nW+94G3BycBK0V +dvq0Zenf0XWp7SQEDCGjWLkMgtLIwmmUtQJUNcEX6GCiKiovzt3m4l7DqN+o9x0PJDt eB1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vpl2P6UO5jzxb8HeyntRKDCXPB5CQyax+bousJop3xA=; b=t61nR/bhQZMMjE9pJH56qwDkG/xnj+YjHFTx0S7mmtLzn1u5vOxw3XOOlD5Ocwj5LF 15Hc2mlzQOAlVpH2R2Mx0V2d2Pwb/a1lPSXSPzPdsbWni3e8hg6ymqJaJJ9rLEhX3JsQ vT4sE2wdIWkvjex/ZV3r7CdUPG9d/Hb64iUzXt/EX2QPHDOZQF6Q8bJMQNvhcbmwtNe/ SXyeJxV4opqAl5w1c1+1unNClqZDOYmZUXrbVGZZOBvJO/zw1epnHWnv/fE3bbzPZ4sZ H3+IoVq41+d+ua/LIjftojlRMWsYM4ED9hJjf6bWZsRbvDZnZgKm5Ueg+qWpliDe5s7g 3H2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si1166055oig.170.2019.12.11.07.43.22; Wed, 11 Dec 2019 07:43:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388741AbfLKPnU (ORCPT + 27 others); Wed, 11 Dec 2019 10:43:20 -0500 Received: from foss.arm.com ([217.140.110.172]:35634 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731277AbfLKPnQ (ORCPT ); Wed, 11 Dec 2019 10:43:16 -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 EB6A71007; Wed, 11 Dec 2019 07:43:15 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 448323F52E; Wed, 11 Dec 2019 07:43:15 -0800 (PST) From: Mark Brown To: Catalin Marinas , Will Deacon Cc: 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=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Dave Martin , Mark Brown Subject: [PATCH v4 11/12] KVM: arm64: BTI: Reset BTYPE when skipping emulated instructions Date: Wed, 11 Dec 2019 15:42:05 +0000 Message-Id: <20191211154206.46260-12-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191211154206.46260-1-broonie@kernel.org> References: <20191211154206.46260-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_emulate.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.20.1 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;