From patchwork Wed Sep 25 09:26:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20559 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B96625E71 for ; Wed, 25 Sep 2013 09:27:04 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf5242129veb.7 for ; Wed, 25 Sep 2013 02:27:04 -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=Kw920NH89+2PTF6EDOrfjambcRnmevrCNsnIXziVh5c=; b=m5LAkolJ/tg1y9yTk8FN0C7AIw0Kq9r69Yjyp7tR+YoxBo5FMz8ATLF6IFp+VCEQOV 36/D+Y/BPfIIymNKrdvy3ZWOgM//j48dskrRjg9OoqpR60A4YB8ELuH8f9FaimUyyBEG eTblD/SENwNRRMGUWnKi3lPfChDRudCULS1Ox17TKqNsZpYQvfSlROjFvJBl08HnIeeH yQAgfsyww8904DX5kcT1apmt95OJLlgo6/aJYxvNouKn+817pPWdCSsAb9qXkl6QKYus 5cuB09omMrdJic0aHE3mlf/FoDLq9rFyxCzJ6SjxSBbLHLVCzOJzHytyEnhI+B/0LSj+ 83sg== X-Gm-Message-State: ALoCoQkgrZd9EOOuNSeTJbYsVny9sBqv+VUqAqxk2K8j+cMB4wEvBlWY6imQPHvJI4TeDX27Q+Ed X-Received: by 10.224.5.5 with SMTP id 5mr15291575qat.4.1380101224306; Wed, 25 Sep 2013 02:27:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.70.228 with SMTP id p4ls309479qeu.43.gmail; Wed, 25 Sep 2013 02:27:04 -0700 (PDT) X-Received: by 10.52.26.69 with SMTP id j5mr6399275vdg.21.1380101224174; Wed, 25 Sep 2013 02:27:04 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id k10si9557489vca.124.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:27:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 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.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so4545350veb.3 for ; Wed, 25 Sep 2013 02:27:04 -0700 (PDT) X-Received: by 10.58.161.116 with SMTP id xr20mr31917213veb.2.1380101224068; Wed, 25 Sep 2013 02:27:04 -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 u4csp294127vcz; Wed, 25 Sep 2013 02:27:03 -0700 (PDT) X-Received: by 10.66.7.102 with SMTP id i6mr6272920paa.149.1380101223020; Wed, 25 Sep 2013 02:27:03 -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 is7si7254128pbc.149.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:27:03 -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 y13so5820752pdi.19 for ; Wed, 25 Sep 2013 02:27:02 -0700 (PDT) X-Received: by 10.68.189.163 with SMTP id gj3mr32265514pbc.102.1380101222625; Wed, 25 Sep 2013 02:27:02 -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:27:01 -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 2/4] ARM64: KVM: Implement kvm_vcpu_preferred_target() function Date: Wed, 25 Sep 2013 14:56:01 +0530 Message-Id: <1380101163-20028-3-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.128.172 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;