From patchwork Tue Mar 31 15:40:45 2015 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: 46600 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 590FC2159A for ; Tue, 31 Mar 2015 15:42:22 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf357340lab.1 for ; Tue, 31 Mar 2015 08:42:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=24AmTkrefRErMFX3mVqztMTJALFvXgmw2eac8UjqTxM=; b=WVMcHADIpQv6Z41b1gVTFlnKvn27Suep1lpJ07gDiGk35XOhqO3fD0TFcZUkPMc450 LKp3rUy3AaDCYa5hhEhK7t+zK0uImML7M1gzLI86gRFiFVuM77eCNbe7uilt72XEIkec JfsPoGMWnP9rw4YG5f2MkNN0cySNmabQFpIiMko0KUPVqpRPmT/mTnP/VScM+PB9kUeM arUU+Eq1vsjE5816CC2CxdC0tTw5hSjBMjMlB2LeeztSQ3KdjngmXSlCfthWQqCeazJS itC6alKdn+hlnwJgY4P4E38vYUjIWzSCKFBDu/yOUUHKOWVcrPNwq5F07U/fqlJPJHGY kiYg== X-Gm-Message-State: ALoCoQkcN09rbaG09hmkQhtRfRuBF74c4tFf827/d+O2G/CaPpNwPC3YOi6QF4P98/mBik3glkR5 X-Received: by 10.112.159.135 with SMTP id xc7mr1337444lbb.0.1427816541269; Tue, 31 Mar 2015 08:42:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.133 with SMTP id w5ls65451lad.22.gmail; Tue, 31 Mar 2015 08:42:20 -0700 (PDT) X-Received: by 10.112.131.66 with SMTP id ok2mr31092193lbb.51.1427816540842; Tue, 31 Mar 2015 08:42:20 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id w7si9408013lbk.135.2015.03.31.08.42.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 08:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lboc7 with SMTP id c7so15536663lbo.1 for ; Tue, 31 Mar 2015 08:42:20 -0700 (PDT) X-Received: by 10.112.150.39 with SMTP id uf7mr30942766lbb.72.1427816540597; Tue, 31 Mar 2015 08:42:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp65640lbq; Tue, 31 Mar 2015 08:42:20 -0700 (PDT) X-Received: by 10.141.28.14 with SMTP id f14mr10304708qhe.74.1427816539408; Tue, 31 Mar 2015 08:42:19 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id q85si14019897qkh.112.2015.03.31.08.42.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 31 Mar 2015 08:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:39267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcyJ0-0001I3-Jd for patch@linaro.org; Tue, 31 Mar 2015 11:42:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcyHo-0006Li-H5 for qemu-devel@nongnu.org; Tue, 31 Mar 2015 11:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcyHj-0004Ad-Hv for qemu-devel@nongnu.org; Tue, 31 Mar 2015 11:41:04 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:54266 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcyHj-0004AJ-BV for qemu-devel@nongnu.org; Tue, 31 Mar 2015 11:40:59 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YczNu-0005y0-Hs; Tue, 31 Mar 2015 18:51:26 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, zhichao.huang@linaro.org Date: Tue, 31 Mar 2015 16:40:45 +0100 Message-Id: <1427816446-31586-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1427816446-31586-1-git-send-email-alex.bennee@linaro.org> References: <1427816446-31586-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: kvm@vger.kernel.org, marc.zyngier@arm.com, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [Qemu-devel] [PATCH v2 3/4] target-arm: kvm - support for single step X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This adds support for single-step. There isn't much to do on the QEMU side as after we set-up the request for single step via the debug ioctl it is all handled within the kernel. Signed-off-by: Alex Bennée --- v2 - convert to using HSR_EC diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 290c1fe..ae0f8b2 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -475,6 +475,7 @@ void kvm_arch_post_run(CPUState *cs, struct kvm_run *run) */ #define HSR_EC_SHIFT 26 +#define HSR_EC_SOFT_STEP 0x32 #define HSR_EC_SW_BKPT 0x3c static int kvm_handle_debug(CPUState *cs, struct kvm_run *run) @@ -483,6 +484,13 @@ static int kvm_handle_debug(CPUState *cs, struct kvm_run *run) int hsr_ec = arch_info->hsr >> HSR_EC_SHIFT; switch (hsr_ec) { + case HSR_EC_SOFT_STEP: + if (cs->singlestep_enabled) { + return true; + } else { + error_report("Came out of SINGLE STEP when not enabled"); + } + break; case HSR_EC_SW_BKPT: if (kvm_find_sw_breakpoint(cs, arch_info->pc)) { return true; @@ -542,6 +550,9 @@ int kvm_arch_on_sigbus(int code, void *addr) void kvm_arch_update_guest_debug(CPUState *cs, struct kvm_guest_debug *dbg) { + if (cs->singlestep_enabled) { + dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP; + } if (kvm_sw_breakpoints_active(cs)) { dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP; }