From patchwork Thu Sep 19 13:11:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2911411 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 F090CBFF05 for ; Thu, 19 Sep 2013 13:13:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB97720412 for ; Thu, 19 Sep 2013 13:13:06 +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 02A6A201B4 for ; Thu, 19 Sep 2013 13:13:02 +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 1VMe2H-0007tA-BK; Thu, 19 Sep 2013 13:12:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMe29-0005fj-Kc; Thu, 19 Sep 2013 13:12:37 +0000 Received: from mail-pb0-f51.google.com ([209.85.160.51]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMe24-0005di-1s for linux-arm-kernel@lists.infradead.org; Thu, 19 Sep 2013 13:12:33 +0000 Received: by mail-pb0-f51.google.com with SMTP id jt11so8419621pbb.10 for ; Thu, 19 Sep 2013 06:12:10 -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=r6YWkp+NCQI+e2DNv8m7vf/TnE5IAlql+YpH8mrxu5E=; b=c6l44dT6wyY6HxXP9JDuBjxweBCigejvpzZFFsMyYAOfD8PXGnD51p3sDy3U+ns9Rw hKI+uxqq1VHaaFDY5hGH4rKDY9jcl4XVaJFrPsD5fc+ULZ3ZGM96U3/uCR09NwmsRNuG RrBm7n1wUxNfymqINfrtBsLIX6AzDXEWLn3EYk9MWBPVoaY3FQHHRAFWsZUHX2ikx3c3 kbNrIzErwnklFhsaUeloGgUY8Igts/r2t08uyzdV9YgCnkIo9xDddVwwCKtLJ51u23T3 FzLWBKzufNjfNNjBFxnyZ8CaWEjb5ly5/c/rfUGWvKzcFA2LEUdV+KBto/w6/7gCeprw MbIA== X-Gm-Message-State: ALoCoQkJHx9Fbr6mRgHhAywjnDkEKoDLbRrfReW2MHqjvu22CDWYt8eEBAJUZKuLDieiGKS6R09V X-Received: by 10.67.3.34 with SMTP id bt2mr2693731pad.3.1379596330336; Thu, 19 Sep 2013 06:12:10 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ye1sm12118225pab.19.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:09 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v3 1/4] ARM: KVM: Implement kvm_vcpu_preferred_target() function Date: Thu, 19 Sep 2013 18:41:38 +0530 Message-Id: <1379596302-21522-2-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379596302-21522-1-git-send-email-anup.patel@linaro.org> References: <1379596302-21522-1-git-send-email-anup.patel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130919_091232_265203_57B61193 X-CRM114-Status: GOOD ( 12.74 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, Anup Patel , patches@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.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.8 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 This patch implements kvm_vcpu_preferred_target() function for KVM ARM which will help us implement KVM_ARM_PREFERRED_TARGET ioctl for user space. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm/kvm/guest.c | 20 ++++++++++++++++++++ arch/arm64/include/asm/kvm_host.h | 1 + 2 files changed, 21 insertions(+) diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 152d036..b407e6c 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -222,6 +222,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 return all optional features are available + * for preferred target. In future, we might have features + * available based on underlying host. + */ + init->target = (__u32)target; + init->features[0] |= (1 << KVM_ARM_VCPU_POWER_OFF); + + return 0; +} + int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) { return -EINVAL; diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index f318c43..b609db3 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -156,6 +156,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;