From patchwork Wed Oct 16 00:49:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 3049531 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62CC9BF924 for ; Wed, 16 Oct 2013 00:51:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B18D201BE for ; Wed, 16 Oct 2013 00:51:45 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EC0F20190 for ; Wed, 16 Oct 2013 00:51:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFJm-0001Zm-BP; Wed, 16 Oct 2013 00:50:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFJR-0002au-23; Wed, 16 Oct 2013 00:50:09 +0000 Received: from mail-pa0-f52.google.com ([209.85.220.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFIw-0002Ux-TU for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2013 00:49:40 +0000 Received: by mail-pa0-f52.google.com with SMTP id kl14so217495pab.39 for ; Tue, 15 Oct 2013 17:49:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qwpp6UCQbAkVXEaxrE+oOzw3Q+6/96ASBbqnIPhDtO0=; b=Gm6jwcYBoZ2/KXYjyH4b4yTN734Jm7UtKoU6npAZkEuJ/0khJgdYhyBXlTh86kHMsg lUffPiNEpzYGj4ue5UjrsfvIjO6qpXpp1Kg7pZMeeBw8MYd5wZC7iFhhOIfZCX0IH+QP cRPwB/CX2n0ctflwrRAIlgAPnviooKG9MblnZX4yn+H6WlbdCriFLY9tvqb2GO0ssPON Bk/INFpbErTNVEJThlCbyTba0qQe17eY2JhXeAgqUVxA0GOxGQGDxLpuMr1sY4h/cZEH XQY4749/xT1WjahsKUHjVWuuJhEs0Shepgux00scPaVRYRuykGco5jgp4zMjrVLjFW2j +avw== X-Gm-Message-State: ALoCoQkwARap5L9FQtgtZrAszQkpF0PZDQykdK9u7RuXAFY6r1XK5B34MlXD6ln+ISjxYoRArQft X-Received: by 10.67.3.34 with SMTP id bt2mr644343pad.3.1381884556649; Tue, 15 Oct 2013 17:49:16 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id bp4sm84715543pbb.42.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Oct 2013 17:49:15 -0700 (PDT) From: Christoffer Dall To: Gleb Natapov , Paolo Bonzini Subject: [PATCH 3/9] ARM64: KVM: Implement kvm_vcpu_preferred_target() function Date: Tue, 15 Oct 2013 17:49:31 -0700 Message-Id: <1381884577-24747-4-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1381884577-24747-1-git-send-email-christoffer.dall@linaro.org> References: <1381884577-24747-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131015_204939_090672_A40C010E X-CRM114-Status: GOOD ( 12.10 ) X-Spam-Score: -2.6 (--) Cc: Anup Patel , kvm@vger.kernel.org, Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Anup Patel This patch implements kvm_vcpu_preferred_target() function for KVM ARM64 which will help us implement KVM_ARM_PREFERRED_TARGET ioctl for user space. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Christoffer Dall --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/guest.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 0859a4d..4cc8c70 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -151,6 +151,7 @@ struct kvm_vcpu_stat { struct kvm_vcpu_init; int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, const struct kvm_vcpu_init *init); +int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init); unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); struct kvm_one_reg; diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 2c3ff67..3f0731e 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -248,6 +248,26 @@ int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, return kvm_reset_vcpu(vcpu); } +int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init) +{ + int target = kvm_target_cpu(); + + if (target < 0) + return -ENODEV; + + memset(init, 0, sizeof(*init)); + + /* + * For now, we don't return any features. + * In future, we might use features to return target + * specific features available for the preferred + * target type. + */ + init->target = (__u32)target; + + return 0; +} + int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) { return -EINVAL;