From patchwork Sat Sep 14 11:08:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20313 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 90BFA248D3 for ; Sat, 14 Sep 2013 11:09:27 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m11sf2247842yen.9 for ; Sat, 14 Sep 2013 04:09:27 -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=zq7J7T8IvczXZHUInMp075hbUC6LAtTxQUxpjyzbV/M=; b=cCLRWhSJURWFQuUy8HM8bqOw8RrHgL3crLwLHZefVLEjN1GYmMM7ocDLBv4VKe3PXt 05Hp4Xz+WSShBR+4g8wqiaGUNxV1m5vRZyIVpA8BgCyt/T22LxlOEOk8CPrVNmPLsO0K g0y3NxsRC+YnBsOEVmE9qP3MF/Zphyx08LRXQBNJj1aV1gd38mTbIe4ahj5O8MioAsmG Le+fiPPDncKGNdAX77+BnYTakh/NveRdtSQeTGgs2gfEXS03/nf0GP8L1KEgKNUPuXcu T9wBSYa5zgwPW/lsOHjgVSLtGFFOX/nVEvJnNFipdsx4QQtLhGHsVAQyEFruXu+eRKpq H6LA== X-Gm-Message-State: ALoCoQlNDkIe9mLLsfLOKIATQjpAkjTAI4qrxKqqkUMz6cRLq+kB/GMNqBvv5BSozwg2A5Agrkeh X-Received: by 10.236.172.34 with SMTP id s22mr6807509yhl.25.1379156967320; Sat, 14 Sep 2013 04:09:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls1518323qed.78.gmail; Sat, 14 Sep 2013 04:09:27 -0700 (PDT) X-Received: by 10.58.108.74 with SMTP id hi10mr16921579veb.14.1379156967242; Sat, 14 Sep 2013 04:09:27 -0700 (PDT) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by mx.google.com with ESMTPS id bk8si4531571vec.94.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.43; Received: by mail-vb0-f43.google.com with SMTP id h11so1742018vbh.30 for ; Sat, 14 Sep 2013 04:09:27 -0700 (PDT) X-Received: by 10.52.113.99 with SMTP id ix3mr31533vdb.22.1379156967157; Sat, 14 Sep 2013 04:09:27 -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 u4csp7141vcz; Sat, 14 Sep 2013 04:09:26 -0700 (PDT) X-Received: by 10.68.137.170 with SMTP id qj10mr18252937pbb.31.1379156966188; Sat, 14 Sep 2013 04:09:26 -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 lp9si14714706pab.163.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:26 -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 kl13so3547001pab.34 for ; Sat, 14 Sep 2013 04:09:25 -0700 (PDT) X-Received: by 10.68.26.202 with SMTP id n10mr18300662pbg.97.1379156965790; Sat, 14 Sep 2013 04:09:25 -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:25 -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 2/4] ARM64: KVM: Implement kvm_vcpu_preferred_target() function Date: Sat, 14 Sep 2013 16:38:35 +0530 Message-Id: <1379156917-17497-3-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.212.43 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 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/arm/include/asm/kvm_host.h | 1 + arch/arm64/kvm/guest.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 7d22517..76f3c19 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h @@ -154,6 +154,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..f8eb062 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 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); + init->features[0] |= (1 << KVM_ARM_VCPU_EL1_32BIT); + + return 0; +} + int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) { return -EINVAL;