From patchwork Fri May 29 09:30:19 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: 49146 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 03973218E7 for ; Fri, 29 May 2015 09:31:07 +0000 (UTC) Received: by wgez8 with SMTP id z8sf16594285wge.2 for ; Fri, 29 May 2015 02:31:06 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=1cfn8uCjzchDjbfop1EJ7IR17L/dnpx2qe06izIg9Ik=; b=ZC2tyGlxuBMCSCUilkAI0Rr/vOSpMfVf1kbbRi4nV2iPGAlGQqgooyIRG/dfIc8pN6 gNXfYpyTcbmSyx+nZcKvXiUlsfN/SMi73DaHJssC3NSQE9jlkhBxCoh+/EJDXDf/c60p jvo5XXfXawC76D5T9xXEubv2IP0D1cU+dgcgWHJRkBAqW1N0OBNjfcvl4I4mWm0534a8 pINv0aQ5t+dZuIrk3uw+pZvV/4aekVSWMIayun+wPq9tN5uFnQU1Ncx7+FeZTkM5eBRB OTbBpKn+qUqo5o75SDaGriPlFDg7T6VIhL5hprK3+kSNWfdF4JB5yXLeh3N6SbR6X4at 4gPQ== X-Gm-Message-State: ALoCoQnhTFiThq1+/li7gJnXZRfToSbEqCikzwNga+8e+h27HJcjI+OlrJN/3nMN/Qwh/IFXXoWV X-Received: by 10.152.206.36 with SMTP id ll4mr6569923lac.6.1432891866303; Fri, 29 May 2015 02:31:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.68 with SMTP id be4ls269081lab.47.gmail; Fri, 29 May 2015 02:31:06 -0700 (PDT) X-Received: by 10.112.40.9 with SMTP id t9mr7211526lbk.55.1432891866130; Fri, 29 May 2015 02:31:06 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id ja2si4212457lbc.160.2015.05.29.02.31.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 02:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labpy14 with SMTP id py14so39634394lab.0 for ; Fri, 29 May 2015 02:31:06 -0700 (PDT) X-Received: by 10.152.44.166 with SMTP id f6mr7107297lam.86.1432891866011; Fri, 29 May 2015 02:31:06 -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.108.230 with SMTP id hn6csp165018lbb; Fri, 29 May 2015 02:31:04 -0700 (PDT) X-Received: by 10.68.113.132 with SMTP id iy4mr13443459pbb.71.1432891863692; Fri, 29 May 2015 02:31:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si7712831par.13.2015.05.29.02.31.02; Fri, 29 May 2015 02:31:03 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755844AbbE2Ja4 (ORCPT + 28 others); Fri, 29 May 2015 05:30:56 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:56416 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755745AbbE2Jaq (ORCPT ); Fri, 29 May 2015 05:30:46 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YyHwn-0004KD-UE; Fri, 29 May 2015 12:55:30 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, peter.maydell@linaro.org, agraf@suse.de, drjones@redhat.com, pbonzini@redhat.com, zhichao.huang@linaro.org Cc: jan.kiszka@siemens.com, dahi@linux.vnet.ibm.com, r65777@freescale.com, bp@suse.de, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 03/12] KVM: arm64: guest debug, define API headers Date: Fri, 29 May 2015 10:30:19 +0100 Message-Id: <1432891828-4816-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1432891828-4816-1-git-send-email-alex.bennee@linaro.org> References: <1432891828-4816-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.215.45 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This commit defines the API headers for guest debugging. There are two architecture specific debug structures: - kvm_guest_debug_arch, allows us to pass in HW debug registers - kvm_debug_exit_arch, signals exception and possible faulting address The type of debugging being used is controlled by the architecture specific control bits of the kvm_guest_debug->control flags in the ioctl structure. Signed-off-by: Alex Bennée Reviewed-by: David Hildenbrand Reviewed-by: Andrew Jones Acked-by: Christoffer Dall --- v2 - expose hsr and pc directly to user-space v3 - s/control/controlled/ in commit message - add v8 to ARM ARM comment (ARM Architecture Reference Manual) - add rb tag - rm pc, add far - re-word comments on alignment - rename KVM_ARM_NDBG_REGS -> KVM_ARM_MAX_DBG_REGS v4 - now uses common HW/SW BP define - add a-b-tag - use u32 for control regs v5 - revert to have arch specific KVM_GUESTDBG_USE_SW/HW_BP - rm stale comments dbgctrl was stored as u64 --- arch/arm64/include/uapi/asm/kvm.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index d268320..43758e7 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -100,12 +100,32 @@ struct kvm_sregs { struct kvm_fpu { }; +/* + * See v8 ARM ARM D7.3: Debug Registers + * + * The architectural limit is 16 debug registers of each type although + * in practice there are usually less (see ID_AA64DFR0_EL1). + */ +#define KVM_ARM_MAX_DBG_REGS 16 struct kvm_guest_debug_arch { + __u32 dbg_bcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_bvr[KVM_ARM_MAX_DBG_REGS]; + __u32 dbg_wcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS]; }; struct kvm_debug_exit_arch { + __u32 hsr; + __u64 far; }; +/* + * Architecture specific defines for kvm_guest_debug->control + */ + +#define KVM_GUESTDBG_USE_SW_BP (1 << 16) +#define KVM_GUESTDBG_USE_HW_BP (1 << 17) + struct kvm_sync_regs { };