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: 20701 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B68B25A2B for ; Mon, 30 Sep 2013 08:51:34 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id cm18sf3081809qab.8 for ; Mon, 30 Sep 2013 01:51:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=Kw920NH89+2PTF6EDOrfjambcRnmevrCNsnIXziVh5c=; b=HGtIJssnZKAx/tO3Uv0EP96OzbZ8AY1HfUhK/npbNWyvf8XUjZnBpY+7M1epH0MeLa EArHSe0Cvc7CwAmrI7v3WriMq5Tr9+ebzMu29W841IYePiq3PKoipWMz3JFXsGCA4z81 xvlyR00qZszelHT1esw1+KMAt9YZuAUltp78hywITEs7tXtFLmqblVJhGHSg8GsfXvOs 7q6oHTDXKPBHfpvju0pJ+kaXZ82omlgDbm91sZ7GYq4ro+ryfBPKgiq8o2a11OWj0IXB sF7isMzfxrNzQGQ9CEYBoR/fRJQRht8Txw6gdhjU2vFq+HT0WNbxBM1mIpVdHZvp5ush N3nA== X-Received: by 10.236.69.35 with SMTP id m23mr3568220yhd.6.1380531094092; Mon, 30 Sep 2013 01:51:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.74.69 with SMTP id r5ls2049467qev.1.gmail; Mon, 30 Sep 2013 01:51:34 -0700 (PDT) X-Received: by 10.52.228.137 with SMTP id si9mr713989vdc.29.1380531093978; Mon, 30 Sep 2013 01:51:33 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id us10si5492170vcb.59.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Sep 2013 01:51:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 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.177; Received: by mail-ve0-f177.google.com with SMTP id db12so3710260veb.36 for ; Mon, 30 Sep 2013 01:51:03 -0700 (PDT) X-Gm-Message-State: ALoCoQl1ijHQlqohz+yYDHtF4LZ8YqFiC5wXc+DZqSlG211bbzaKSusNa5b3WWXeuatQR1AE4ZAS X-Received: by 10.58.161.116 with SMTP id xr20mr21158273veb.2.1380531063870; Mon, 30 Sep 2013 01:51:03 -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 u4csp92773vcz; Mon, 30 Sep 2013 01:51:03 -0700 (PDT) X-Received: by 10.66.171.13 with SMTP id aq13mr26922809pac.30.1380531062908; Mon, 30 Sep 2013 01:51:02 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id qm9si15662907pac.146.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Sep 2013 01:51:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id y13so5333204pdi.5 for ; Mon, 30 Sep 2013 01:51:02 -0700 (PDT) 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 Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, pranavkumar@linaro.org, Anup Patel 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-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.177 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/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;