From patchwork Tue Nov 25 16:10:01 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: 41478 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6768F25E18 for ; Tue, 25 Nov 2014 16:13:19 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf620743wgh.9 for ; Tue, 25 Nov 2014 08:13:18 -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=8r4+zCd6o7MdmndUPi638hoRn5bVKQr9FAZH7hOXyXE=; b=A3HB/tSXtrvZVZe7H/V/IcuIUW8OsM9R4o8yQpgjiJdZoXyZMMrJgB4PuckJhSJGsu TJfWJSMVgSmtxSgRZ17tl97shEvp3JXbz3Lt8bpWHATixDX7SA1Kmw+rFogZro+Q98+q SgvskSEpTZCijh7dxLqmqtQDDmoPSStbHazlr4Kkyz7OVjeAF160QNspVj06BlvJx3pj hCWrqh+mkqamp+yQXRCib6iFckZRp93OxvIZWQZW8YvZL6Li5W6C9vdLU/ELGxbFcCO6 IWPu/7Tn4mB19xjFkt1QeXgXHr3dQLKiJgBUjolS4Q9hTsPEERu/Y8zpRbCIwcgiZWiT pwUA== X-Gm-Message-State: ALoCoQmypdbXzNhdm1Q4qiUDKt51o0mr3yVxh6em0KK4Cs3tTANxzaU9AL189uz4HTpiuWcHgUP0 X-Received: by 10.112.159.199 with SMTP id xe7mr597348lbb.21.1416931998649; Tue, 25 Nov 2014 08:13:18 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.9 with SMTP id p9ls613199lag.80.gmail; Tue, 25 Nov 2014 08:13:18 -0800 (PST) X-Received: by 10.112.156.138 with SMTP id we10mr27390995lbb.88.1416931998396; Tue, 25 Nov 2014 08:13:18 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id rd1si1801297lac.70.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.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gd6so846180lab.33 for ; Tue, 25 Nov 2014 08:13:18 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr28236774laa.71.1416931997430; Tue, 25 Nov 2014 08:13:17 -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 ew9csp462662lbc; Tue, 25 Nov 2014 08:13:16 -0800 (PST) X-Received: by 10.70.47.195 with SMTP id f3mr44181997pdn.156.1416931995722; Tue, 25 Nov 2014 08:13:15 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ks5si2714434pdb.42.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:15 -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 1XtIiL-0003R9-NW; Tue, 25 Nov 2014 16:11:41 +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 1XtIho-0003Hd-OD for linux-arm-kernel@lists.infradead.org; Tue, 25 Nov 2014 16:11:21 +0000 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1XtJJR-0005HW-Jp; 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 3/7] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl Date: Tue, 25 Nov 2014 16:10:01 +0000 Message-Id: <1416931805-23223-4-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_081108_993871_62F1C35E X-CRM114-Status: GOOD ( 10.94 ) 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: Russell King , Jonathan Corbet , Gleb Natapov , jan.kiszka@siemens.com, "open list:DOCUMENTATION" , 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.215.46 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 adds a stub function to support the KVM_SET_GUEST_DEBUG ioctl. Currently any operation flag will return EINVAL. Actual functionality will be added with further patches. Signed-off-by: Alex Bennée . diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 7610eaa..2c6386e 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2570,7 +2570,7 @@ handled. 4.87 KVM_SET_GUEST_DEBUG Capability: KVM_CAP_SET_GUEST_DEBUG -Architectures: x86, s390, ppc +Architectures: x86, s390, ppc, arm64 Type: vcpu ioctl Parameters: struct kvm_guest_debug (in) Returns: 0 on success; -1 on error diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9e193c8..a0ff410 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -180,6 +180,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_ARM_PSCI: case KVM_CAP_ARM_PSCI_0_2: case KVM_CAP_READONLY_MEM: + case KVM_CAP_SET_GUEST_DEBUG: r = 1; break; case KVM_CAP_COALESCED_MMIO: @@ -302,7 +303,34 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) { - return -EINVAL; + /* If it's not enabled clear all flags */ + if (!(dbg->control & KVM_GUESTDBG_ENABLE)) { + vcpu->guest_debug = 0; + return 0; + } + + vcpu->guest_debug = dbg->control; + kvm_info("%s: guest_debug is 0x%lx\n", __func__, vcpu->guest_debug); + + /* Single Step */ + if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) { + kvm_info("SS requested, not yet implemented\n"); + return -EINVAL; + } + + /* Software Break Points */ + if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP) { + kvm_info("SW BP support requested, not yet implemented\n"); + return -EINVAL; + } + + /* Hardware assisted Break and Watch points */ + if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) { + kvm_info("HW BP support requested, not yet implemented\n"); + return -EINVAL; + } + + return 0; }