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: 20446 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 B7CE423906 for ; Thu, 19 Sep 2013 13:12:12 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m11sf8189064yen.9 for ; Thu, 19 Sep 2013 06:12:12 -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=r6YWkp+NCQI+e2DNv8m7vf/TnE5IAlql+YpH8mrxu5E=; b=HHFoUNo4HkTcS6l/oywsDMRWNO0D9yPmbz08+dcEeX2KfZLsnrfHykqVsrcV4kla23 bzU/f8OWLghRbxlJqvohORYJgFnsGu4Emz1oci2ADIcIHE7hGQ4rZRM9w+dTQAOcM6EN L5T80ZxkZ9t1okeDveLtVspFybqGNB169Zi7ZGUB3IOF4hcEhvUFNS/j0X6IdnoCBqLN mldrby20a2OSQDVXQD4qWODGamfNBc3RKfidWvhkCp3STlMfxE9O4vbnY7L4zZlC5hit 36lAxO5uxnpaO60ZbfcOb6iczO7LZBGru9Db8vEwWEjtQ/bBmax0mU+dHP+CUbniLcCk N9Ng== X-Gm-Message-State: ALoCoQlD4/Amnnf6GiZCpWqe8nrKlepBkuPS+WRSryqyVK0hvwkYlsO7NKwxuCchvvHJP8oda3hD X-Received: by 10.236.45.102 with SMTP id o66mr530805yhb.47.1379596332379; Thu, 19 Sep 2013 06:12:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.230 with SMTP id d6ls3928072qey.93.gmail; Thu, 19 Sep 2013 06:12:12 -0700 (PDT) X-Received: by 10.58.233.173 with SMTP id tx13mr121810vec.31.1379596332299; Thu, 19 Sep 2013 06:12:12 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id d9si1817432vee.47.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so6847856veb.11 for ; Thu, 19 Sep 2013 06:12:12 -0700 (PDT) X-Received: by 10.52.107.226 with SMTP id hf2mr1001656vdb.2.1379596332186; Thu, 19 Sep 2013 06:12:12 -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 u4csp277314vcz; Thu, 19 Sep 2013 06:12:11 -0700 (PDT) X-Received: by 10.66.145.166 with SMTP id sv6mr2614549pab.31.1379596330773; Thu, 19 Sep 2013 06:12:10 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id ye6si7937134pab.194.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id q10so8353843pdj.20 for ; Thu, 19 Sep 2013 06:12:10 -0700 (PDT) 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 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 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-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.128.180 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 | 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;