From patchwork Tue Nov 25 16:10:00 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: 5380521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 318BDC11AC for ; Tue, 25 Nov 2014 16:14:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 780C020179 for ; Tue, 25 Nov 2014 16:14:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B45620114 for ; Tue, 25 Nov 2014 16:13:54 +0000 (UTC) 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 1XtIiA-0003Og-SL; Tue, 25 Nov 2014 16:11:30 +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 1XtIhl-0003Hc-It for linux-arm-kernel@lists.infradead.org; Tue, 25 Nov 2014 16:11:15 +0000 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1XtJJQ-0005HW-RP; Tue, 25 Nov 2014 17:50:01 +0100 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 Subject: [PATCH 2/7] KVM: arm: guest debug, define API headers Date: Tue, 25 Nov 2014 16:10:00 +0000 Message-Id: <1416931805-23223-3-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1416931805-23223-1-git-send-email-alex.bennee@linaro.org> References: <1416931805-23223-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-20141125_081105_798340_67285871 X-CRM114-Status: UNSURE ( 8.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) Cc: Catalin Marinas , jan.kiszka@siemens.com, Will Deacon , open list , dahi@linux.vnet.ibm.com, r65777@freescale.com, pbonzini@redhat.com, bp@suse.de, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 the exact debug exit and address The type of debugging being used is control by the architecture specific control bits of the kvm_guest_debug->control flags in the ioctl structure. Signed-off-by: Alex Bennée diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 8e38878..de2450c 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -93,10 +93,30 @@ struct kvm_sregs { struct kvm_fpu { }; +/* See ARM ARM D7.3: Debug Registers + * + * The control registers are stored as 64bit values as the setup code + * is shared with the normal cpu context restore code in hyp.S which + * is 64 bit only. + */ +#define KVM_ARM_NDBG_REGS 16 struct kvm_guest_debug_arch { + __u64 dbg_bcr[KVM_ARM_NDBG_REGS]; + __u64 dbg_bvr[KVM_ARM_NDBG_REGS]; + __u64 dbg_wcr[KVM_ARM_NDBG_REGS]; + __u64 dbg_wvr[KVM_ARM_NDBG_REGS]; }; +/* Exit types which define why we did a debug exit */ +#define KVM_DEBUG_EXIT_ERROR 0x0 +#define KVM_DEBUG_EXIT_SINGLE_STEP 0x1 +#define KVM_DEBUG_EXIT_SW_BKPT 0x2 +#define KVM_DEBUG_EXIT_HW_BKPT 0x3 +#define KVM_DEBUG_EXIT_HW_WTPT 0x4 + struct kvm_debug_exit_arch { + __u64 address; + __u32 exit_type; }; struct kvm_sync_regs { @@ -198,4 +218,12 @@ struct kvm_arch_memory_slot { #endif +/* Architecture related debug defines - upper 16 bits of + * kvm_guest_debug->control + */ +#define KVM_GUESTDBG_USE_SW_BP_SHIFT 16 +#define KVM_GUESTDBG_USE_SW_BP (1 << KVM_GUESTDBG_USE_SW_BP_SHIFT) +#define KVM_GUESTDBG_USE_HW_BP_SHIFT 17 +#define KVM_GUESTDBG_USE_HW_BP (1 << KVM_GUESTDBG_USE_HW_BP_SHIFT) + #endif /* __ARM_KVM_H__ */