From patchwork Fri May 15 14:27:06 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: 48565 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D25642121F for ; Fri, 15 May 2015 14:27:21 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf31613351lab.1 for ; Fri, 15 May 2015 07:27:20 -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=FsdFSSp4Gxz71p0uMiUvwkF0Qph5IPlVe3kpqmEjjxs=; b=Uyb66N54/w6vUxFwMO1YAoquYMHVIeIHNIQ+9L8xNdEkUw4mmfDwJYwm5Y5cIyk18S //AuaRcR26bmoDVvyQM0RYmVBaoqTiQ7p5WplwTsKMI4KjsYnnQobAXTt1Z7hm6er1ul hZpHpQMocqwUTAoaoYqXY3yVfmB2BNJW9VpZkofS4C/BEWfzHc3IlvqY30tQTyDPSqW5 oAM32P0g5EGejz+SEoG9NZS/wpuIn3pG/9b4XFnLV335WuqwAL03gLCUjXzEeAI3Gh9J WZHjy5mof+9UT75HLdafdYXAeebAySvlzwaDIkqFPnpwXWZBmtBKUwc8y+hBSgfovrbu N7kQ== X-Gm-Message-State: ALoCoQnCTKQwW7lnWdXndc4wqkjy8WENgZNafwPCwnYrqlCiFc8/NHH/0gFQ2RNbv23GqAoVRoB9 X-Received: by 10.180.86.226 with SMTP id s2mr1741191wiz.0.1431700040816; Fri, 15 May 2015 07:27:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.100 with SMTP id z4ls445266laz.57.gmail; Fri, 15 May 2015 07:27:20 -0700 (PDT) X-Received: by 10.152.23.66 with SMTP id k2mr5127463laf.89.1431700040629; Fri, 15 May 2015 07:27:20 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id l1si1142927lbj.175.2015.05.15.07.27.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 07:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagv1 with SMTP id v1so122029451lag.3 for ; Fri, 15 May 2015 07:27:20 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr7230155lag.112.1431700040343; Fri, 15 May 2015 07:27:20 -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 hn6csp2076113lbb; Fri, 15 May 2015 07:27:19 -0700 (PDT) X-Received: by 10.68.161.99 with SMTP id xr3mr18639732pbb.47.1431700038402; Fri, 15 May 2015 07:27:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si2869429pdn.1.2015.05.15.07.26.54; Fri, 15 May 2015 07:27:18 -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 S1754872AbbEOO0t (ORCPT + 28 others); Fri, 15 May 2015 10:26:49 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:36124 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754066AbbEOO0p (ORCPT ); Fri, 15 May 2015 10:26:45 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YtHqJ-0000D4-88; Fri, 15 May 2015 17:48:07 +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 v4 03/12] KVM: arm64: guest debug, define API headers Date: Fri, 15 May 2015 15:27:06 +0100 Message-Id: <1431700035-23479-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1431700035-23479-1-git-send-email-alex.bennee@linaro.org> References: <1431700035-23479-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.47 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 diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index d268320..8796610 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 { + __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; }; struct kvm_sync_regs {