From patchwork Tue Sep 9 16:27:18 2014 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: 37145 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B29B20566 for ; Tue, 9 Sep 2014 16:29:31 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id i57sf11554308yha.2 for ; Tue, 09 Sep 2014 09:29:31 -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:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=y/MW4XPdbyk5FPw/bH6MHPXWHp3Kgci6OFg8AVP8YPI=; b=ddioe4lIAIApicpvFdMgfqxJbcDvP/vun7DKWkzFVo6JKNl1WFnn9WgPtahY4DLg4i tAs/WGzni5O4/Z5cZ3Yubtm7i8O8jlfvpEBM2VVjF6u0DzG8F0UxznaIEWtdSnTQmulK UXALT6CBhRPEPSCwRaNwO8Rb969Vxi59JC0WKdWu5Q3dF3Ha/s0gA7um2OONDblrvD+G n35xISiyOeW0qgYKwgC6QoVvM5i2+NxXilMtztD/LQlpcWWPIgmpL7l5TDCwwlelboLM 3hoIu9ATKZU1TZqYCOC42fCUbzu3EPS/usCBjtCg/CFGlc7Cla4o/GxrFUsYebP1s4wi d46Q== X-Gm-Message-State: ALoCoQlFI7NaC2PKCNGmYKeIn/1XG9t+8lxk4vcbJGw2yQWY8hT67fuzJXmgyrww0sbdsQb2m213 X-Received: by 10.52.74.230 with SMTP id x6mr22270089vdv.6.1410280171091; Tue, 09 Sep 2014 09:29:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.231 with SMTP id g94ls2050350qge.74.gmail; Tue, 09 Sep 2014 09:29:31 -0700 (PDT) X-Received: by 10.220.113.15 with SMTP id y15mr31390783vcp.17.1410280170954; Tue, 09 Sep 2014 09:29:30 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id j6si5362402vcs.30.2014.09.09.09.29.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 09:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf12so17142930vcb.20 for ; Tue, 09 Sep 2014 09:29:30 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr2991472vcq.50.1410280170863; Tue, 09 Sep 2014 09:29:30 -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.221.45.67 with SMTP id uj3csp310761vcb; Tue, 9 Sep 2014 09:29:30 -0700 (PDT) X-Received: by 10.68.236.227 with SMTP id ux3mr16366586pbc.159.1410280169946; Tue, 09 Sep 2014 09:29:29 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id db4si23931890pdb.240.2014.09.09.09.29.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 09:29:29 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XROHF-0005om-O6; Tue, 09 Sep 2014 16:28:21 +0000 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155] helo=socrates.bennee.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XROH6-0005ep-Hy for linux-arm-kernel@lists.infradead.org; Tue, 09 Sep 2014 16:28:13 +0000 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1XROaE-0007mw-GQ; Tue, 09 Sep 2014 18:47:58 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] KVM: document KVM_SET_GUEST_DEBUG api Date: Tue, 9 Sep 2014 17:27:18 +0100 Message-Id: <1410280039-2823-2-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410280039-2823-1-git-send-email-alex.bennee@linaro.org> References: <1410280039-2823-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140909_092812_771596_A74FDBFB X-CRM114-Status: GOOD ( 12.71 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: peter.maydell@linaro.org, Randy Dunlap , "open list:DOCUMENTATION" , marc.zyngier@arm.com, jan.kiszka@siemens.com, Gleb Natapov , open list , dahi@linux.vnet.ibm.com, r65777@freescale.com, pbonzini@redhat.com, bp@suse.de, =?UTF-8?q?Alex=20Benn=C3=A9e?= , christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.220.175 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 In preparation for working on the ARM implementation I noticed the debug interface was missing from the API document. I've pieced together the expected behaviour from the code and commit messages written it up as best I can. Signed-off-by: Alex Bennée diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index d3dde61..723d3f3 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2575,6 +2575,50 @@ associated with the service will be forgotten, and subsequent RTAS calls by the guest for that service will be passed to userspace to be handled. +4.87 KVM_SET_GUEST_DEBUG + +Capability: KVM_CAP_SET_GUEST_DEBUG +Architectures: x86, s390, ppc +Type: vcpu ioctl +Parameters: struct kvm_guest_debug (in) +Returns: 0 on success; -1 on error + +struct kvm_guest_debug { + __u32 control; + __u32 pad; + struct kvm_guest_debug_arch arch; +}; + +Set up the processor specific debug registers and configure vcpu for +handling guest debug events. There are two parts to the structure, the +first a control bitfield indicates the type of debug events to handle +when running. Common control bits are: + + - KVM_GUESTDBG_ENABLE: guest debugging is enabled + - KVM_GUESTDBG_SINGLESTEP: the next run should single-step + +The top 16 bits of the control field are architecture specific control +flags which can include the following: + + - KVM_GUESTDBG_USE_SW_BP: using software breakpoints [x86] + - KVM_GUESTDBG_USE_HW_BP: using hardware breakpoints [x86, s390] + - KVM_GUESTDBG_INJECT_DB: inject DB type exception [x86] + - KVM_GUESTDBG_INJECT_BP: inject BP type exception [x86] + - KVM_GUESTDBG_EXIT_PENDING: trigger an immediate guest exit [s390] + +For example KVM_GUESTDBG_USE_SW_BP indicates that software breakpoints +are enabled in memory so we need to ensure breakpoint exceptions are +correctly trapped and the KVM run loop exits at the breakpoint and not +running off into the normal guest vector. For KVM_GUESTDBG_USE_HW_BP +we need to ensure the guest vCPUs architecture specific registers are +updated to the correct (supplied) values. + +The second part of the structure is architecture specific and +typically contains a set of debug registers. + +When debug events exit the main run loop with the reason +KVM_EXIT_DEBUG with the kvm_debug_exit_arch part of the kvm_run +structure containing architecture specific debug information. 5. The kvm_run structure ------------------------