From patchwork Thu Nov 9 17:00:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 10051405 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 081F360381 for ; Thu, 9 Nov 2017 17:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2EA328AC6 for ; Thu, 9 Nov 2017 17:15:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D751C2B057; Thu, 9 Nov 2017 17:15:30 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 5CA4028AC6 for ; Thu, 9 Nov 2017 17:15:30 +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=HolrQtZ9cYFPxYaDXXUHiSSZAqYIY3uCiADdLdQNrbo=; b=dyiqIxOM8eDofH pYs6UJ95Ct+G/nHGwxB6bHsKZgrBWxDphvTIcouHtV0WNRdnZSJtO/GOE8pARWCkSYdzUpJ9jMFaC YiTPqya3qCv0X0pBNlJxRMYDYynmKMTlLrbada4v6afG44PwW0F+FAqhUPtEx0A7YMPf4hk6taSjM /t/G/2bZVR7bjxBQ+h7cf2IWW6bifopNMBEVv3vqDqayk7fD+Qk3rHAVcKeiDIrqXjNR/yAvvvj+4 FltMmjX7afOvqtBWgPhqUtxXpKvcSTpSnU6AKCxBvlPiq+r9BQ1Wuom/3q7f/3EwyXNbwXicqRVxb 6yBUptCtYC5viF3+BJKQ==; 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 1eCqQL-0003fn-NS; Thu, 09 Nov 2017 17:15:29 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eCqQJ-0003Zi-Fg for linux-arm-kernel@bombadil.infradead.org; Thu, 09 Nov 2017 17:15:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0kwfNOPHCOS5a9cl6azOuqXOg0BkH0nP9G+GtCoKMII=; b=BILoO4B/h8QaoWUMJ1wLz/NShM 22yflozC/8CMpYelr49r0x80UwnjuqnunWa1/2ZXJ/Py4v2KmdOSshgjGXalonq2/D5yhd58GifG3 KHMzwM4JdxsajoLjK0dzkMjdszIitzHeDliCT1X++wnLWUIcKCelj0C31wxAPQ6Z7LgQSDLt6CnIb ktDoaW3GEslZ0QtQjyFcxFUniHUmjdI+jFG+KPspD+VvDrJvmbbawZ8EtR6fBOm+MvzDdtIDp/Dei SVeEInsVdkuVNQCoesVuxV4skG0E5Xgap1W9xTFHSmwySOC94RMgKiTDuPaaWHnlyu0kwH4BIQ0uq Ps+UZPbw==; Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eCqC7-00061a-4X for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2017 17:00:53 +0000 Received: by mail-wr0-x244.google.com with SMTP id y42so6238235wrd.3 for ; Thu, 09 Nov 2017 09:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0kwfNOPHCOS5a9cl6azOuqXOg0BkH0nP9G+GtCoKMII=; b=aEZtK+BB65FzZcywHFF0hCMV8RXNjkWMese1n5BALHO6WXpGu1OAOjUbMC3ZSRzzju Df2C2ZK6TULAJnJkge1Nenu61iq5PGAVfo21lExBccWrLxa0CRBZM5gyBpgrQJ1txpE2 RPoL+i7MA/GkKGJ58dTd5E9EXBkB4f6+GqR4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0kwfNOPHCOS5a9cl6azOuqXOg0BkH0nP9G+GtCoKMII=; b=PGaqjHLITiOCaGXVNcg+a6FHIJJC4V8VdK5G8OPNQrtwA0uZcWT6VGqu1Zj9Shq45d Lwmxwkb3zdaG2nJYymoeMaitEGuD8DMrMWVN2Jv05viOGrhjEG4vm1KlSeNbypqHpuHP rPZGzkdj5g2NOMukKloRrisMjHct/1NLntQxOOjnTmxYmQW6GdM1q0WputZ6/W021Yun eYaJAgsPAPXlVCTOF7C/FhLsVJ6g8UhJGUk5LW6rX4hIwwMKNUOXZt3MIR42mcsYjiWn l7Btrrn9XB7vaUO/Uh8VU/aTrb524k997aHI8UpovR5eQjFA1w88h3wO9mWMLKE2OS6L TJiA== X-Gm-Message-State: AJaThX7GpFL+mTjKwf9kpIjmIbUJWq6s5AJl69DHPsLwpiruwXW17Fhe 5TPB7AE2ivvWjrDSA4EzhsxFKA== X-Google-Smtp-Source: ABhQp+Q/rhbkGlS2Zpt5phecFtmmrnMGmyeHfjv7cnCMDZ8ZbLiOtSqvQfoTrh6W9Rdzg/09IBv9vA== X-Received: by 10.223.184.47 with SMTP id h44mr923898wrf.11.1510246825316; Thu, 09 Nov 2017 09:00:25 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o70sm20941986wrb.62.2017.11.09.09.00.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 09:00:24 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 772783E03B5; Thu, 9 Nov 2017 17:00:22 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: julien.thierry@arm.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Subject: [PATCH v2 3/3] kvm: arm64: handle single-step of userspace mmio instructions Date: Thu, 9 Nov 2017 17:00:21 +0000 Message-Id: <20171109170021.2984-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171109170021.2984-1-alex.bennee@linaro.org> References: <20171109170021.2984-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171109_170047_201201_8BD07D9B X-CRM114-Status: GOOD ( 11.27 ) 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , open list 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 The system state of KVM when using userspace emulation is not complete until we return into KVM_RUN. To handle mmio related updates we wait until they have been committed and then schedule our KVM_EXIT_DEBUG. The kvm_arm_handle_step_debug() helper tells us if we need to return and sets up the exit_reason for us. Signed-off-by: Alex Bennée --- v2 - call helper directly from kvm_arch_vcpu_ioctl_run --- virt/kvm/arm/arm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 95cba0799828..2991adfaca9d 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -625,6 +625,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) ret = kvm_handle_mmio_return(vcpu, vcpu->run); if (ret) return ret; + if (kvm_arm_handle_step_debug(vcpu, vcpu->run)) + return 1; + } if (run->immediate_exit)