From patchwork Thu Nov 16 15:39: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: 10061421 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 21C54601AE for ; Thu, 16 Nov 2017 15:40:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12C502AA97 for ; Thu, 16 Nov 2017 15:40:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 074522AA9A; Thu, 16 Nov 2017 15:40:16 +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 90A322AA97 for ; Thu, 16 Nov 2017 15:40:15 +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=HF+bJIT/YyQIHhVD6xJVhEmTHV2s2zK9VXgby42xvIU=; b=BQUGKXW9ZeuMoM Avysd40MCpQADtLxbZE2tm4Ku6fBDc4O9l63DE+JFfVo97OVKN1IIR6t3k/dD9IA8WgzHqx8W5TZ5 32f9Nm+g1AsQpMtP31nUaPyWK6ilVprNWSdLQ+SFS8iupEglPFuo2d6G54stBwHf6PFeA+0Rf5NIt m3A2paBiXSiYJLVsi2NGyqiwNWhC0c3M2FIu0OAuasPC1+qC7gYmSG9wzuMhQIfab/uRcJ3KYFEiG Xl2J81JSaBEKKrkSY9FwjEU4wOfay1GZmZcIcXmW0HVw8z/kbCCEz5ZKQKa3r1MM4rZkl3UxMA6Gd HQUixZwh8GNxa1bM9Y0A==; 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 1eFMGs-0001th-V1; Thu, 16 Nov 2017 15:40:07 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFMGX-0001Pw-Sd for linux-arm-kernel@lists.infradead.org; Thu, 16 Nov 2017 15:39:48 +0000 Received: by mail-wr0-x241.google.com with SMTP id 4so23199733wrt.0 for ; Thu, 16 Nov 2017 07:39: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=vQQJ10t1lIqeeOaF2rAFpUln0qYoIa5cY0eg26tvcGk=; b=gtmUTmnyvfWM9aX+TFiIMfV6rtof0RF7YXgUvrRm/MBcCn6FiNr3RQyHKFTQkq+5Y5 e4MuKPvHvQiOdCpgOirvVSq7Zs4y2cLMjou2kMf//+DxxM5cdRUVRzNKqGFNFPMYgL9L 4weIDLJ2eDUKDXkD2gHkCVOUjRlOJE6ero6Lc= 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=vQQJ10t1lIqeeOaF2rAFpUln0qYoIa5cY0eg26tvcGk=; b=taIqf3LIy+GNGFP14BSKjqxotg6Nyzcb04/sYnd7MTJlMgNmF6RwHthyXgn78/g7bp CTG1PGzHeMqGIPcj/yAmk+rivJwQH3ehyYZOmKQYvfm9I8FmKnprNGJ5f1n4qBW6RaUy 4JkPocFFdkKpn5QdJYvRnFduqK7foXsZMxGKhMm3zKgFa5bm4dIryuBLC6dyzrQDfwps xHjoXjnd7d8791aUSd+p3dbkiL1ndUBAFba9+ditHBf79gxOOUfzmkIyEVynLsWQyBFB 4WqPJlvhIVNHwPW/VJ/vZHL57DirMY66cX3g0HIFk7Crwoi4ivMRMSQKl7sH2gCEq+lG XvHA== X-Gm-Message-State: AJaThX7OrAy394kmjrJ1SV6aJXH1vo0MZIJRcjdqoI8f2oenAas8tDEU X0dPnRc0q+FSvfYWcvmBiRhC1A== X-Google-Smtp-Source: AGs4zMY/vLHUx7qb2bES/D1Whk1ViuOnhGW1DqE55smtxmkL7xmlQUg6j3v/eT9xXU5ipe3FwlhGdg== X-Received: by 10.223.139.3 with SMTP id n3mr1963510wra.166.1510846765555; Thu, 16 Nov 2017 07:39:25 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m64sm1272694wmb.10.2017.11.16.07.39.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Nov 2017 07:39:23 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4EE983E0426; Thu, 16 Nov 2017 15:39: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 v3 3/3] kvm: arm64: handle single-step of userspace mmio instructions Date: Thu, 16 Nov 2017 15:39:21 +0000 Message-Id: <20171116153921.21991-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171116153921.21991-1-alex.bennee@linaro.org> References: <20171116153921.21991-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-20171116_073946_083709_73DF86C0 X-CRM114-Status: GOOD ( 11.10 ) 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 Reviewed-by: Julien Thierry --- v2 - call helper directly from kvm_arch_vcpu_ioctl_run v3 - return 0 (ioctl success) instead of 1 --- 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..b40440defca1 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 0; + } if (run->immediate_exit)