From patchwork Mon Dec 4 14:03:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10090393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A1AC605B4 for ; Mon, 4 Dec 2017 14:07:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 141FB2842D for ; Mon, 4 Dec 2017 14:07:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 079182877F; Mon, 4 Dec 2017 14:07:44 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 8C6E32842D for ; Mon, 4 Dec 2017 14:07:43 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=KOD7FA1XXWWid1ACXu4nEBgOsn6IVwKb1COxfFt2EN4=; b=Ze4qCj90KkrZBa OkVSZhYanvC8cFIEf39hryx+7r67hQTZzPxaDGJe/P/0iO0wxblqKNyWrVFQbDM5Zd0Defa+pUfZz vPz4IEN9RQ4NmNzK8kgF+rNF4WXFqAyZUfTe1R3+cYYMepY1k5BbfCeBmw9tkkxpzY7NKBiWy5hI+ hJx1I4ljDCIw+ULOpOFvdBmAcn0IRro6H6/hNEGMiVuh8OTE/fLA+8fYZxusMkugqRRIbCNT51n08 BW+Ml8busPBG7pPxnG7SwpCuanObop1f4bcVhfxS8ePSb4KWOqgMEPr+Y5u4l5a3c7fjMacMKF026 U7JcOyi7TIxCO+6a/6Tw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLrPK-00071M-34; Mon, 04 Dec 2017 14:07:42 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrM6-0002PM-7C for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:04:32 +0000 Received: by mail-wr0-x243.google.com with SMTP id v22so17415231wrb.0 for ; Mon, 04 Dec 2017 06:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3CMNdB7iJi3DvINvq0odIh/GBCIHpAw40rBq/VrH2i0=; b=jI8MkmgKsf9y9HPXxkvLzBBBHbrCvbM3c0Yej7BgkyJ/XJwETwA96NPMhF+MnnTqyo UJPfxcBacosk/mrH3q7xgXvbh/62oi0LlwpwqW84esGL6W5IiV9mUmYTfF+9eVRkLaqz cV+vmpyvN+P+pf3+kANrJ1paCnrb69a7+of59QE+TejfY7iUfM7tc5kvtrshST21h1Gq 0TYgVLWGL3slnDnH63yqx4Humxn/uPJpW/lw483sdZPgQSJoe12fgz0V10ZaOfsjYrEa oHnIB2dZVv1IW0siiwyqGSh7uGo3Zoj96O6tYvqKe0ov2vuVIl6/rYyQOxeuSzqfd3Gk OKng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3CMNdB7iJi3DvINvq0odIh/GBCIHpAw40rBq/VrH2i0=; b=njJfw0hk/2ckIh3iP+XjnzcIisecE3q7UEB/Eo6UiueC2gO8/gt/Pd3FuU6urIM4gM sGTWxuTUMb41jOPG7x06ac8L6cqJX3Ih8PcnUjdDtmUEzC2bIGIlqsCewtjaIk2vyan+ UOo25S9JhLj33I7UPu98NwV60aL7Xnix3FmCeS8x3CtGvcI+HW4vDTF/3wpVx7/ajh6z y3pSmXJecJfUlrFdPPPHc5DJVOPlGdIW69pSKVB+qRMb8xeinkONSX14sNxvR3bzz38M /vf7RDoG2aAOknm/nWzfkLQ6HqI1GRsyJXf1GTmfhml5gPgYP5g8UsgENoSvg2vyUqwb PEUg== X-Gm-Message-State: AJaThX5rTAl7RGW17ZSsdEZ1QFNwNGuiO0cOVclGZD0pUKd/7vFB2QAi VHf8/B1Kz6zIPe0AT0cFdNx095daBME= X-Google-Smtp-Source: AGs4zMb2cfvSGiAi5SJYj+V1NI/SiUnp/jtPPrW56RHkwDGJi07HY/5A+D+Bd5MfKYfT4x6A9HjvwQ== X-Received: by 10.223.172.146 with SMTP id o18mr12988842wrc.128.1512396245568; Mon, 04 Dec 2017 06:04:05 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.04.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:04:04 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 13/19] kvm: arm64: handle single-step during SError exceptions Date: Mon, 4 Dec 2017 15:03:42 +0100 Message-Id: <20171204140348.21965-11-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_060423_001361_E40C36E6 X-CRM114-Status: GOOD ( 13.08 ) 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: Marc Zyngier , Christoffer Dall , =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 From: Alex Bennée When an SError arrives during single-step both the SError and debug exceptions may be pending when the step is completed, and the architecture doesn't define the ordering of the two. This means that we can observe en SError even though we've just completed a step, without receiving a debug exception. In that case the DBG_SPSR_SS bit will have flipped as the instruction executed. After handling the abort in handle_exit() we test to see if the bit is clear and we were single-stepping before deciding if we need to exit to user space. Acked-by: Marc Zyngier Reviewed-by: Christoffer Dall Signed-off-by: Alex Bennée Signed-off-by: Christoffer Dall --- arch/arm64/kvm/handle_exit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index 029c28dd25e9..304203fa9e33 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -28,6 +28,7 @@ #include #include #include +#include #define CREATE_TRACE_POINTS #include "trace.h" @@ -252,7 +253,12 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, return 1; case ARM_EXCEPTION_EL1_SERROR: kvm_inject_vabt(vcpu); - return 1; + /* We may still need to return for single-step */ + if (!(*vcpu_cpsr(vcpu) & DBG_SPSR_SS) + && kvm_arm_handle_step_debug(vcpu, run)) + return 0; + else + return 1; case ARM_EXCEPTION_TRAP: return handle_trap_exceptions(vcpu, run); case ARM_EXCEPTION_HYP_GONE: