From patchwork Wed Sep 25 09:26:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B5E0B25E71 for ; Wed, 25 Sep 2013 09:26:58 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id h10sf5132269vbh.9 for ; Wed, 25 Sep 2013 02:26:58 -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=a/Q+Wm3fSPYwkIrQiO2l8ASwS0PE3kBuurfA6EgbgjQ=; b=CJDADmBLNScrIlm7lMOM4tgKExwz795Cuw54UBuZFLIiuGoMV0BnRinKWCmUmapjmp iPrINB4E5xvTq0WLBa/AaYdegZgwUX1D9lPHAH/1YzuwKQjXLjeZ9RF5f7d7kd2kHsxn rZbE0SbWxG/DgNMM0S+20MSbNkyg7abaQLumyQFpQ5TCVZSfhrNiKGHioPEOYrATm5T1 ypDMC8PyCW17oTSrYzlSi9ig5WgvXWntftTIeQ62EN9n27jASzi3yJaBTgVIuunvVIH1 fy7GeTNGxFkvwr3dESUhwgjHDNjTzylnolaZSUEgmEro979GrAiTigFFoGg+PKK2azf4 UEKg== X-Gm-Message-State: ALoCoQk+hMTKurwmJOJ2pQZREzg7+JIjOs+BtpKUW7r7dvpDREy/XpHOytcDo0z3xGEbIpdyVb9V X-Received: by 10.224.51.68 with SMTP id c4mr496019qag.7.1380101218393; Wed, 25 Sep 2013 02:26:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.17.98 with SMTP id n2ls322733qed.12.gmail; Wed, 25 Sep 2013 02:26:58 -0700 (PDT) X-Received: by 10.220.13.20 with SMTP id z20mr32130324vcz.0.1380101218309; Wed, 25 Sep 2013 02:26:58 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ll17si9572498vec.84.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:26:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id ha12so4349981vcb.9 for ; Wed, 25 Sep 2013 02:26:58 -0700 (PDT) X-Received: by 10.220.237.208 with SMTP id kp16mr32027140vcb.4.1380101218214; Wed, 25 Sep 2013 02:26:58 -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 u4csp294122vcz; Wed, 25 Sep 2013 02:26:57 -0700 (PDT) X-Received: by 10.67.1.228 with SMTP id bj4mr10995190pad.157.1380101216925; Wed, 25 Sep 2013 02:26:56 -0700 (PDT) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by mx.google.com with ESMTPS id qc9si7244185pac.211.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:26:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.53 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.160.53; Received: by mail-pb0-f53.google.com with SMTP id up15so5750775pbc.40 for ; Wed, 25 Sep 2013 02:26:56 -0700 (PDT) X-Received: by 10.66.136.71 with SMTP id py7mr33189445pab.2.1380101216511; Wed, 25 Sep 2013 02:26:56 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id k4sm46364649pbd.11.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:26:55 -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, pranavkumar@linaro.org, Anup Patel Subject: [PATCH v4 1/4] ARM: KVM: Implement kvm_vcpu_preferred_target() function Date: Wed, 25 Sep 2013 14:56:00 +0530 Message-Id: <1380101163-20028-2-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380101163-20028-1-git-send-email-anup.patel@linaro.org> References: <1380101163-20028-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.178 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/include/asm/kvm_host.h | 1 + arch/arm/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/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 152d036..21beea0 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 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;