From patchwork Sat Sep 14 11:08:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E27E9248D3 for ; Sat, 14 Sep 2013 11:09:20 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id j7sf132478qaq.11 for ; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=v47rloX9gKtWICjaD9VgZTkHpO9S+FB2o7VMSahcpeY=; b=d3tuhvtO3mPI9iqT4A2DtvAZWf5tAliKQRAm7rI3Qe7fVtmgi5VqFmBq9SR/Q1Q8Bc JeU5DkbWqWBvvps23rJ25/wmfqxUSX7xxttkBsffx+e7vf5tqg8Sw9fr+Vesp3kMSwiX KYCQFShl2RQc8lE7BsvzCgL/LGDP4rqVVUbPWtyZXM0+fKOQDd0hAbuaW9qdrIIqoA5A 8H9aE6jngTLKemHx2lMN51VrFXGBaRm1Cg6a4Vs6JhpE5txC/7mhNZ7WdOSwkKcYaByw CiLT1ge2tInPdZFULrikiiJs423zSzXSxdPqDGQIImO3XLw2OqbcoGTJgr4KWIZNbnp9 X6Nw== X-Gm-Message-State: ALoCoQl+FkIhVxw7sLxsoSnYPNsGAo6GCRbiDRkjbJqMxMI7bPq6Mg9rEmJ/LHqupYMF0Arqbp5U X-Received: by 10.236.115.198 with SMTP id e46mr7489680yhh.33.1379156960722; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.164 with SMTP id ll4ls1434291qeb.17.gmail; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) X-Received: by 10.58.118.130 with SMTP id km2mr16553636veb.0.1379156960657; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id gq6si4523295veb.129.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id gd11so1683311vcb.19 for ; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) X-Received: by 10.52.116.74 with SMTP id ju10mr13923930vdb.20.1379156960498; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp7134vcz; Sat, 14 Sep 2013 04:09:20 -0700 (PDT) X-Received: by 10.66.188.203 with SMTP id gc11mr19931908pac.63.1379156959498; Sat, 14 Sep 2013 04:09:19 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id rt3si10984496pbc.23.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kl13so3546923pab.34 for ; Sat, 14 Sep 2013 04:09:19 -0700 (PDT) X-Received: by 10.68.218.163 with SMTP id ph3mr18428615pbc.19.1379156959085; Sat, 14 Sep 2013 04:09:19 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id xe9sm24434350pab.0.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:18 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, marc.zyngier@arm.com, christoffer.dall@linaro.org, Anup Patel , Pranavkumar Sawargaonkar Subject: [PATCH v2 1/4] ARM: KVM: Implement kvm_vcpu_preferred_target() function Date: Sat, 14 Sep 2013 16:38:34 +0530 Message-Id: <1379156917-17497-2-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379156917-17497-1-git-send-email-anup.patel@linaro.org> References: <1379156917-17497-1-git-send-email-anup.patel@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anup.patel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 | 19 +++++++++++++++++++ arch/arm64/include/asm/kvm_host.h | 1 + 2 files changed, 20 insertions(+) diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 152d036..dae1e9f 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -222,6 +222,25 @@ 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 target; + + 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;