From patchwork Tue Mar 31 15:08:02 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: 46588 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 75490216E5 for ; Tue, 31 Mar 2015 15:11:27 +0000 (UTC) Received: by wgtj4 with SMTP id j4sf4392446wgt.0 for ; Tue, 31 Mar 2015 08:11:25 -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=GZmhK/JuictFmvzmB0bfhQyTOQ8DUgMffh8VYVBXmOQ=; b=Z61eAUI6Uo8A9ZnbePduJo6iiIqe4vjm40qzOgrPvv3MfnKZJQRefVKBv4d1Ps6YL6 3dLLvCklldvSlc0W6kY5CppnKKN9Syxc8xF+RS48NnGMtJJjgc36m53G6ROqPMWlFoHA 5GNhvC86Jo/2iQtTqP+dqeP51Jx9yNRn9rAvX0cKux+lMchT3szCOfOjrfml6Oql1d0X Ai7RTU7+KK8erMV5C8HSA6+MxfW5U+XXdJSe4KlgG6bfjv4qDncNAPvBLoVrWCLpMIOf TFxoRfEGYD7vNnelwSLXZ6ip0zNM21mx+k07q/0g0XMKthAuSsG9910XXWXYDBN09Xv6 rkpQ== X-Gm-Message-State: ALoCoQliIDjGqIx1+e4FfVGTd4GKBBC3zdJ3TfjldUCl5wn8czm4oi9nmVbvQHccTrDMlPPN0Hz1 X-Received: by 10.194.161.194 with SMTP id xu2mr9903735wjb.1.1427814685781; Tue, 31 Mar 2015 08:11:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.240 with SMTP id jr16ls728171lab.69.gmail; Tue, 31 Mar 2015 08:11:25 -0700 (PDT) X-Received: by 10.152.43.3 with SMTP id s3mr31616834lal.101.1427814685471; Tue, 31 Mar 2015 08:11:25 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id p1si7046451laj.165.2015.03.31.08.11.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 08:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labe2 with SMTP id e2so15088257lab.3 for ; Tue, 31 Mar 2015 08:11:25 -0700 (PDT) X-Received: by 10.152.36.169 with SMTP id r9mr8255393laj.29.1427814685267; Tue, 31 Mar 2015 08:11:25 -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.57.201 with SMTP id k9csp46184lbq; Tue, 31 Mar 2015 08:11:24 -0700 (PDT) X-Received: by 10.70.48.37 with SMTP id i5mr69078723pdn.111.1427814683381; Tue, 31 Mar 2015 08:11:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ac10si19804452pac.147.2015.03.31.08.11.18; Tue, 31 Mar 2015 08:11:23 -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 S932092AbbCaPJE (ORCPT + 27 others); Tue, 31 Mar 2015 11:09:04 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:48120 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754538AbbCaPI7 (ORCPT ); Tue, 31 Mar 2015 11:08:59 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YcysR-0005gI-O2; Tue, 31 Mar 2015 18:18:55 +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?= , Gleb Natapov , Jonathan Corbet , Russell King , linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 04/10] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl Date: Tue, 31 Mar 2015 16:08:02 +0100 Message-Id: <1427814488-28467-5-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1427814488-28467-1-git-send-email-alex.bennee@linaro.org> References: <1427814488-28467-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.49 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 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 . --- v2 - simplified form of the ioctl (stuff will go into setup_debug) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index b112efc..06c5064 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2604,7 +2604,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 5560f74..445933d 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -183,6 +183,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: @@ -303,10 +304,21 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) kvm_arm_set_running_vcpu(NULL); } +#define KVM_GUESTDBG_VALID (KVM_GUESTDBG_ENABLE) + int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) { - return -EINVAL; + if (dbg->control & KVM_GUESTDBG_ENABLE) { + if (dbg->control & ~KVM_GUESTDBG_VALID) + return -EINVAL; + + vcpu->guest_debug = dbg->control; + } else { + /* If not enabled clear all flags */ + vcpu->guest_debug = 0; + } + return 0; }