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: 118468 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1153742edl; Thu, 9 Nov 2017 09:00:53 -0800 (PST) X-Google-Smtp-Source: ABhQp+SjFz+s8JkXJw8TgGbh5/SYS2PmYr2SbP20s8XiIUr2JFKbaHSXIZYo4MjWySJekVX40GQZ X-Received: by 10.99.38.129 with SMTP id m123mr1053923pgm.53.1510246853650; Thu, 09 Nov 2017 09:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510246853; cv=none; d=google.com; s=arc-20160816; b=sEQ1SZzCucado3Yt01M3zvGaO6fw1HMyxWph3F1Kciml+Gd4GPkfN440BaQJOqLDkW YHJ50UA9Ybnw1VIWo88VyPaaHVmA6TzTzoIDIperF95DYgYaH8tQ8hsv4AJstNgsiWmj kZ9udcvioiwu5PTMWolIddiJJrY1V2IGH+TlCekR4HirK047k5fBpHAcUGdaJC2Y5oQ5 XTzpU7Y42tCdWhNqQBfGShJQmKE54ScSAa08xth+ggHTVVb5ER4W4aNnQAGMxipMWdbW vjOtANKNs9K4BclzQ8imP4jrm9uCx/ZhjrElQjea9EPAzO0xcvSb7OaJqJFqah1Vk1t1 JdpA== 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 :dkim-signature:arc-authentication-results; bh=0kwfNOPHCOS5a9cl6azOuqXOg0BkH0nP9G+GtCoKMII=; b=oBh9ugFTg6S4jzbP18M12KCMGbB+G41yUpPMxaQ+68J9IUL0MASbYQypQ3NQmQ0etl b9VZ6Rwwb9IGwZ+HJzxvZmJymVH2DmsoG+yKDhtXbs1+HUq8tXRpKW6Dr+/qLuKe9ZQV pTbQK2JS1me37c5Xqng46+87Sye2UzbRYW9ScxWRZ6gapReAiIddwEzngU42a4QgWkaS 3lvIcBFz0q2Psb/w8lrdrt4iKpMgLcGCAP/8qL7K1Qj87h5PABlYd+OEPLLWHymaS527 aMIxfKA5ZyTSELsLEYk4B3rGoKuczCNxbCNMAr/hLYu+yqejbL9yx3YhJ1ix0mbJguRZ +efA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aEZtK+BB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si7210774pfq.46.2017.11.09.09.00.53; Thu, 09 Nov 2017 09:00:53 -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=@linaro.org header.s=google header.b=aEZtK+BB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753803AbdKIRAw (ORCPT + 23 others); Thu, 9 Nov 2017 12:00:52 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:47961 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753956AbdKIRA0 (ORCPT ); Thu, 9 Nov 2017 12:00:26 -0500 Received: by mail-wr0-f194.google.com with SMTP id k61so6223755wrc.4 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=HEKv9IyuLTJ0/oASj2VB6bFDddGvENi6aQL2u7NYi8EgB7yjQV2q1+CH0UrDiCUUIP QklZFUwQDLHloAUpUzpgisXRta9S6h/mlNZBYjmuPVi+mLUh4EDnflHnv/96lORNSMiv 3CH2SlUUhpe7lG1NYOumQ9ZJF53W0YyasVioTNi3aJwCAAanQ/P7MwSX5sP9KoMNr0j1 caE84FYx5cXY9Jglu7Kf99NxnZyqjbyWsyM9Hpfm1LNuBNBm399EoyrG4JuPa/ihuErB K/Pb0e41Y88SyWQ9kF9Nm93WM24WXn+rhflA0EECeBdHnA4xWPS1k156maSec9QfLhTH Jx5Q== X-Gm-Message-State: AJaThX77nCZrcWpyy5ufdXzUmBjZp9HHpIdcjswu9LeUknBa5644nY5N Rgt8w93N24NaRuOHx7OEGA6nOA== 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_Benn=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 Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , linux-kernel@vger.kernel.org (open list) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.14.2 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)