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: 41479 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31C3B25E18 for ; Tue, 25 Nov 2014 16:13:20 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf778449eek.10 for ; Tue, 25 Nov 2014 08:13:19 -0800 (PST) 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 :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=FIBoSbw8GwT3oDmBqqroBquDZSDe0hK013rSr5p36w0=; b=fn9WpDgS3Lvdx/8xZNBG8DHhMbCBRit1bpE0SntfXHnAFQl9gZ6ZI5xuOAri3He+Nv CzCV7xy2r+U304gNjUQrNcySgz4HFIs6bptdbPK08QKDn8eb6NXk9rulllbZMHkWGRid FR19DG076Xg/C/gp5xaea7KenUnunaXFmLREKaKfTcppoq9LxXTXZx3SmMAZ8OkT6fkG zqvPVI6KdS8OWSm9w1YT8UR22YYjqZigEJ1Mfz415sNSglaruwUeh8foRBzN8BAuJK/s bImqfDJ/NaivEDDsJW4Y6jVu6RhuhdoJuZhSJ+bVM3eWTBaq56hel3aVU2AnE5nXu6fb fPxA== X-Gm-Message-State: ALoCoQkTROtiPEMW6km0KsPAPzoXiJfdoIbK+WaxZ4MII1APrZefv1WviNuZyXtEHHiss1CuOYWG X-Received: by 10.152.29.226 with SMTP id n2mr589059lah.9.1416931999142; Tue, 25 Nov 2014 08:13:19 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.102 with SMTP id ln6ls555839lac.95.gmail; Tue, 25 Nov 2014 08:13:18 -0800 (PST) X-Received: by 10.152.234.140 with SMTP id ue12mr27757121lac.78.1416931998865; Tue, 25 Nov 2014 08:13:18 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id l2si1797075lbp.76.2014.11.25.08.13.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 08:13:18 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so841468lbv.35 for ; Tue, 25 Nov 2014 08:13:18 -0800 (PST) X-Received: by 10.152.43.103 with SMTP id v7mr4807121lal.29.1416931998696; Tue, 25 Nov 2014 08:13:18 -0800 (PST) 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.184.201 with SMTP id ew9csp462669lbc; Tue, 25 Nov 2014 08:13:17 -0800 (PST) X-Received: by 10.68.222.199 with SMTP id qo7mr44654917pbc.14.1416931996226; Tue, 25 Nov 2014 08:13:16 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cu3si2617649pbc.108.2014.11.25.08.13.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Nov 2014 08:13:16 -0800 (PST) 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 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 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 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+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.217.176 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 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__ */