From patchwork Thu Sep 19 13:11:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20447 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D625623906 for ; Thu, 19 Sep 2013 13:12:18 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lf12sf5179037vcb.6 for ; Thu, 19 Sep 2013 06:12:18 -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=ZmSnOGX2qMfApHP1EopRsBx2ob14zt8JWofViFqY+G0=; b=RAvutAyIQMQMCWLw2Rk4ecw0ze7Rna9Cw8UW/C5ci0w784jfIPwuzWTzlD64d0dmmc dyTeiWLxJhFTRIcTcGxVgE7QZn9rhTEao1USKYhIv8TTjJzkTKnYZQUH9JcF/GqdZBa/ cL0C8wDKXaiuHgfTVuAFupt0ViJA5pQ8p6RbxQ7zS+ddHhMBqQkisRzkYk48XEPZdxD9 emkIyC4yULKuaIxdFl7RMyHscK5hPen+ITFTBpVKXJwp/uGl+hs13Wlcp6I2HjBZ4vLJ BiHTo2josuEwkZtvJEtmnEKlGGjfm8klrOIgIzIfj8FwERcYsTdKyWC4Wj3QGBDOg8dJ QAag== X-Gm-Message-State: ALoCoQmUjIw2WGwCjZVgli6gr1G8IQ62ZV8ZydBtsXVvEvw60nAzmY0x4eXUiW3z04Uv3bqJ82h0 X-Received: by 10.236.174.232 with SMTP id x68mr620204yhl.42.1379596338675; Thu, 19 Sep 2013 06:12:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.68 with SMTP id da4ls3914909qeb.24.gmail; Thu, 19 Sep 2013 06:12:18 -0700 (PDT) X-Received: by 10.220.164.70 with SMTP id d6mr1133904vcy.19.1379596338570; Thu, 19 Sep 2013 06:12:18 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id cl2si1812716vdc.49.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 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.50; Received: by mail-vb0-f50.google.com with SMTP id x14so6290443vbb.37 for ; Thu, 19 Sep 2013 06:12:18 -0700 (PDT) X-Received: by 10.58.169.193 with SMTP id ag1mr582655vec.26.1379596338487; Thu, 19 Sep 2013 06:12:18 -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 u4csp277316vcz; Thu, 19 Sep 2013 06:12:17 -0700 (PDT) X-Received: by 10.66.49.68 with SMTP id s4mr2692227pan.98.1379596337471; Thu, 19 Sep 2013 06:12:17 -0700 (PDT) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id aw4si6259173pbd.277.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id p10so8385734pdj.18 for ; Thu, 19 Sep 2013 06:12:17 -0700 (PDT) X-Received: by 10.66.163.199 with SMTP id yk7mr2720360pab.136.1379596337058; Thu, 19 Sep 2013 06:12:17 -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:16 -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 v3 2/4] ARM64: KVM: Implement kvm_vcpu_preferred_target() function Date: Thu, 19 Sep 2013 18:41:39 +0530 Message-Id: <1379596302-21522-3-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-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.50 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 | 21 +++++++++++++++++++++ 2 files changed, 22 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..4da7882 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -254,6 +254,27 @@ 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); + 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;