From patchwork Mon Sep 30 08:50:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2962961 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 95F54BFF0B for ; Mon, 30 Sep 2013 08:53:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 747A2200F3 for ; Mon, 30 Sep 2013 08:52:59 +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 A4D9B201C7 for ; Mon, 30 Sep 2013 08:52:54 +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 1VQZCu-0003Ne-Ar; Mon, 30 Sep 2013 08:51:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQZCX-0004kb-Gh; Mon, 30 Sep 2013 08:51:33 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VQZCO-0004hS-2Y for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2013 08:51:25 +0000 Received: by mail-pa0-f44.google.com with SMTP id lf10so5593162pab.31 for ; Mon, 30 Sep 2013 01:51:02 -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=Kw920NH89+2PTF6EDOrfjambcRnmevrCNsnIXziVh5c=; b=iF8A3hgi8e0hrNM9o4ujGeVZZzUJbgM4NBm27i8ge7JVEBBmhX7WOjjmx8Wc/8OCas y6QpKj00pjEFYzikYNsX6bnZzjTqzyfSPFvAm3kjJxYVdFcpP9jpYe7i9WAEcbh47a2j 0vqL2SjrgNYPDKM5SLArxCG5cSKy8KEqlnY2kViIfNms0GpeHa3ubtQcmpn3qhqKSY/W zIqJasQJ++LE0910iiuwqR11XHT1lFx3C1UBjvOtmH4TzEBqnETPt/YsHl+xBvk2Kls4 Risl6En5yz6iIwRokBW5uwt2HuRcTNIU6k5SpbA3FuIqZ/uI+ZBQqwSOn6AmsorQaY/f dLew== X-Gm-Message-State: ALoCoQkF0ag69luO4y98MLUd1TghAEjmXbe5TO5yBkzlB2kdUxnKfXnkOBfHQdia9r61zZ9FS0TH X-Received: by 10.68.162.161 with SMTP id yb1mr403213pbb.202.1380531062521; Mon, 30 Sep 2013 01:51:02 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ta10sm31664460pab.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Sep 2013 01:51:01 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v5 2/4] ARM64: KVM: Implement kvm_vcpu_preferred_target() function Date: Mon, 30 Sep 2013 14:20:06 +0530 Message-Id: <1380531008-15901-3-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380531008-15901-1-git-send-email-anup.patel@linaro.org> References: <1380531008-15901-1-git-send-email-anup.patel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130930_045124_245323_CA8B3453 X-CRM114-Status: GOOD ( 12.55 ) 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@linaro.org 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 ARM64 which will help us implement KVM_ARM_PREFERRED_TARGET ioctl for user space. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- 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 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; diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index d7bf7d6..94e4b7a 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -254,6 +254,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;