From patchwork Mon Sep 30 08:50:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20700 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 39A5125A2B for ; Mon, 30 Sep 2013 08:51:28 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf4851835yhz.11 for ; Mon, 30 Sep 2013 01:51:28 -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=a/Q+Wm3fSPYwkIrQiO2l8ASwS0PE3kBuurfA6EgbgjQ=; b=i7Jd+267oK3BmDTlCxrRowekMP+5L2gGYXcNKLd2E/BbnysYPuM12CpMovq/z/+g8r jgRi1U6a1mDZo3p8bo9zpN0jUNUGU0AyjkIYJrjbXdM1Yhg373SP/pu0rI9xaE3eaxNI j6L+lZ2J0zH7HRGtvuNgNqk8Gl8GGEsRhoFPdjkkQdh46qc1OwWwWQvKPAjvQtU5ibWI bQeE56/HZXonr779iTeO5D+sZHiS8n7J9admcCZB2zZSNSuMd1mMMUEJKkKHAhjor+Yq bQnC8jWpiIH/S5dhAYQGOlVWKfaZmHwJq804PM8A1qVF9a5notY9jw3g93WzrJm8ex6c IcIg== X-Received: by 10.236.220.39 with SMTP id n37mr3300320yhp.15.1380531088030; Mon, 30 Sep 2013 01:51:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.200 with SMTP id j8ls1939915qez.6.gmail; Mon, 30 Sep 2013 01:51:27 -0700 (PDT) X-Received: by 10.52.64.143 with SMTP id o15mr18001281vds.16.1380531087933; Mon, 30 Sep 2013 01:51:27 -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 zw7si5495334vec.36.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Sep 2013 01:51:27 -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 lh4so1017145vcb.9 for ; Mon, 30 Sep 2013 01:50:57 -0700 (PDT) X-Gm-Message-State: ALoCoQm8fnCvA1OTdhNX9uEHsV73Jz0XLYSIyidEJTdU7SMrLPYAEXdEQGKHzGvYYcrZefSxcAAA X-Received: by 10.220.145.132 with SMTP id d4mr21271914vcv.9.1380531057846; Mon, 30 Sep 2013 01:50:57 -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 u4csp92767vcz; Mon, 30 Sep 2013 01:50:57 -0700 (PDT) X-Received: by 10.66.121.234 with SMTP id ln10mr26507927pab.20.1380531056646; Mon, 30 Sep 2013 01:50: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 qb7si16569876pbb.84.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Sep 2013 01:50: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 up15so5265323pbc.40 for ; Mon, 30 Sep 2013 01:50:56 -0700 (PDT) X-Received: by 10.66.122.100 with SMTP id lr4mr1694861pab.164.1380531056001; Mon, 30 Sep 2013 01:50:56 -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:50:55 -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 1/4] ARM: KVM: Implement kvm_vcpu_preferred_target() function Date: Mon, 30 Sep 2013 14:20:05 +0530 Message-Id: <1380531008-15901-2-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.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;