Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp686634ybv; Thu, 13 Feb 2020 07:46:11 -0800 (PST) X-Google-Smtp-Source: APXvYqyELF+EvnkQJO+k1OQ77qFWJqRI4je67e3UT/y2RWy7H/90JO2KdPgcdwz7e61IBUHhE9x/ X-Received: by 2002:a9d:7357:: with SMTP id l23mr13253523otk.10.1581608771462; Thu, 13 Feb 2020 07:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608771; cv=none; d=google.com; s=arc-20160816; b=G+xaLADo7aoni6kIWjRcx9EwzZR09zVY7sGzoooxRcL6u7K+dj7y+Y6oXeDmKRKGMY G1Sk7xdKjivf0jYOA/xc/Au95NaddMJn1rXu+xLuDidCcK5jTnU+0J1+fq9eveSemwBG GwusdKPmdBPuh1ez8TWs1XyaFwEy9XI/c/NecjMfgbxt5b2nc7Xt/1fIPaaGVaDFN6rh HCoLBPTlYNBM4L3Fz7OEgSZwyL+wLKhY99QdsVk2GpeM+qOFguqCmkv68pQb6UpbkQDb 3+rMxL5hh1Focg11ubXBTfdnMKyunJ9fd5ufibSlz1zatNxKiQC+FZDiR33yg90FBxQ1 P6YA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oXtSZsEkFEwi0kMF8DWjATYDC03KoeCuToLNkuyoK2Y=; b=CXgkTO1pxPF624/4pMVxxhNKC6Tr4LxmkBaCnovHxt3/jnewkoJR1HEFZd9XXFyMnh hsVOwOuKpNQuIRSxSSa8t43CmMx21K0vUDo2TWZ6pZRoS9QgiDnJCbooVEML/conjTvb NHDowpPeTBCHDCl13loh7/IvxAit40C3+f0oK3AqPYJ8JB1mCFp8tOsBRQ3si1pwnsfv 5DBVnVvuhhH6DOSFtbNmypa12+Na6kM5Ku0QzojT48blT/G9Xa3I3DgRofhDLl4S7d+/ gD5stXzacB3ztLwFV2T90F+DsW5ZgbnVe2Jr3hYw+vgxRy/eBCxtzjS/eamN8yKtEe9g s1Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vDsxi6e8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28si1380372oic.47.2020.02.13.07.45.58; Thu, 13 Feb 2020 07:46:11 -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; dkim=pass header.i=@kernel.org header.s=default header.b=vDsxi6e8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbgBMPoz (ORCPT + 99 others); Thu, 13 Feb 2020 10:44:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:51394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729447AbgBMP1f (ORCPT ); Thu, 13 Feb 2020 10:27:35 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0139E222C2; Thu, 13 Feb 2020 15:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607655; bh=GWMijhkMymqjblTVbuq2KK6lu2cqa3S12LTf6rYgJfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vDsxi6e80J+P0oIxSVxCJL2wrBbWBNsUe2MO2j0VdWXzIYgn0YRAGYBAl5mlqfeUB FJ+fyJINdDSkR2u1VzE+qi8asdJRGdbJf2dzHRXv5Ie7/J6SQ3ATi0WMInDLXb8hMX hPr5sMmsh5ecyh9FktAr2iDC9Vzb84JGYg1CsATQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Beata Michalska , James Morse , Marc Zyngier Subject: [PATCH 5.4 69/96] KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests Date: Thu, 13 Feb 2020 07:21:16 -0800 Message-Id: <20200213151905.391087429@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Morse commit 018f22f95e8a6c3e27188b7317ef2c70a34cb2cd upstream. Beata reports that KVM_SET_VCPU_EVENTS doesn't inject the expected exception to a non-LPAE aarch32 guest. The host intends to inject DFSR.FS=0x14 "IMPLEMENTATION DEFINED fault (Lockdown fault)", but the guest receives DFSR.FS=0x04 "Fault on instruction cache maintenance". This fault is hooked by do_translation_fault() since ARMv6, which goes on to silently 'handle' the exception, and restart the faulting instruction. It turns out, when TTBCR.EAE is clear DFSR is split, and FS[4] has to shuffle up to DFSR[10]. As KVM only does this in one place, fix up the static values. We now get the expected: | Unhandled fault: lock abort (0x404) at 0x9c800f00 Fixes: 74a64a981662a ("KVM: arm/arm64: Unify 32bit fault injection") Reported-by: Beata Michalska Signed-off-by: James Morse Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20200121123356.203000-2-james.morse@arm.com Signed-off-by: Greg Kroah-Hartman --- virt/kvm/arm/aarch32.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/virt/kvm/arm/aarch32.c +++ b/virt/kvm/arm/aarch32.c @@ -181,10 +181,12 @@ static void inject_abt32(struct kvm_vcpu /* Give the guest an IMPLEMENTATION DEFINED exception */ is_lpae = (vcpu_cp15(vcpu, c2_TTBCR) >> 31); - if (is_lpae) + if (is_lpae) { *fsr = 1 << 9 | 0x34; - else - *fsr = 0x14; + } else { + /* Surprise! DFSR's FS[4] lives in bit 10 */ + *fsr = BIT(10) | 0x4; /* 0x14 */ + } } void kvm_inject_dabt32(struct kvm_vcpu *vcpu, unsigned long addr)