From patchwork Wed May 6 16:23:18 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: 48070 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97B7E2121F for ; Wed, 6 May 2015 16:25:52 +0000 (UTC) Received: by wgin8 with SMTP id n8sf4708054wgi.0 for ; Wed, 06 May 2015 09:25:51 -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=hpi1QLajOfJlUA+UeesUpCO4cVxpI4mVrshw7XmEI88=; b=QyYlaogi3h8h2Nr1XaFemEZiPTwhM5Ank1qZepxKw52kmR4rlC+vA/zN38km5X29K0 DvL/i1Da1GUvrJN2P6yJV7qF13SRrxmwYQNUebW+IxaWSGxXM/y4EsIXVGRTmAJRGZoR I4WIK/qn46sepD2A/unXbH72nH76CHtMDE9IfGBlgWiB+VJC3OgkCJlR6/PDaQC3HgNC hkTtlToUllNtyBC3WW71YI9gzt6ubavZkw+tyL1Aszm4L0TWwGOS4DWRyFVIc1t0/Wgw 5Ku8990RnCZ5RcIe7rDA8IzIABR09wzyJmHkZteTcMZVAa6ZlziZYY+bjHcgeBF39Zjf A2/Q== X-Gm-Message-State: ALoCoQml6TucvwJnmxLI6tKW6DrErZU2aWwlDBY2tYXT0OZ9BKbfHt2Arx1OD3PZDfhtfXG8Thz9 X-Received: by 10.112.28.111 with SMTP id a15mr26339507lbh.21.1430929551916; Wed, 06 May 2015 09:25:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.9 with SMTP id 9ls85064laq.89.gmail; Wed, 06 May 2015 09:25:51 -0700 (PDT) X-Received: by 10.112.235.133 with SMTP id um5mr29778045lbc.7.1430929551738; Wed, 06 May 2015 09:25:51 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id r6si15009105lag.118.2015.05.06.09.25.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 May 2015 09:25:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laat2 with SMTP id t2so11448108laa.1 for ; Wed, 06 May 2015 09:25:51 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr28508415lag.112.1430929551453; Wed, 06 May 2015 09:25:51 -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.67.65 with SMTP id l1csp2953383lbt; Wed, 6 May 2015 09:25:50 -0700 (PDT) X-Received: by 10.68.167.66 with SMTP id zm2mr62718686pbb.164.1430929549602; Wed, 06 May 2015 09:25:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si29673706pdr.182.2015.05.06.09.25.48; Wed, 06 May 2015 09:25:49 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbbEFQZo (ORCPT + 29 others); Wed, 6 May 2015 12:25:44 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:35227 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190AbbEFQXV (ORCPT ); Wed, 6 May 2015 12:23:21 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1Yq3Kt-00052O-Ty; Wed, 06 May 2015 19:42:20 +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 v3 03/12] KVM: arm64: guest debug, define API headers Date: Wed, 6 May 2015 17:23:18 +0100 Message-Id: <1430929407-3487-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430929407-3487-1-git-send-email-alex.bennee@linaro.org> References: <1430929407-3487-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.44 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 diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index d268320..04957d7 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -100,10 +100,28 @@ struct kvm_sregs { struct kvm_fpu { }; +/* + * See v8 ARM ARM D7.3: Debug Registers + * + * The control registers are architecturally defined as 32 bits but are + * stored as 64 bit values alongside the value registers. This is done + * to keep the copying of these values into the vcpu context simple as + * everything is 64 bit aligned (see DBGBCR0_EL1 onwards in kvm_asm.h). + * + * 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 { + __u64 dbg_bcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_bvr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_wcr[KVM_ARM_MAX_DBG_REGS]; + __u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS]; }; struct kvm_debug_exit_arch { + __u32 hsr; + __u64 far; }; struct kvm_sync_regs { @@ -216,4 +234,11 @@ struct kvm_arch_memory_slot { #endif +/* + * Architecture related debug defines - upper 16 bits of + * kvm_guest_debug->control + */ +#define KVM_GUESTDBG_USE_SW_BP __KVM_GUESTDBG_USE_SW_BP +#define KVM_GUESTDBG_USE_HW_BP __KVM_GUESTDBG_USE_HW_BP + #endif /* __ARM_KVM_H__ */