From patchwork Sat Sep 14 11:08:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20314 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01E4E248D3 for ; Sat, 14 Sep 2013 11:09:32 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ht10sf2447219vcb.1 for ; Sat, 14 Sep 2013 04:09:32 -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=k7ZyBnEF22rlQGFvGjxxPxAc37qgztGjXwuSMXHaQdg=; b=ExV5pJ3I6w3OwAmg4xIHW8XR+30m2bxWDBtWfJb5ObRQXfGQ+AIDXx689iio9BK5vd uadoKUeY9/OcMVDHUuf8OzJS6jV8XM77bQVqejSNJMDP1lRKmdtlmPM1DssuJOpC4mRx 6arNTUH73jW1z68BlU2F064wrSOCAD1A+eatNk/5rUJTUp8XzXkeCcjOw4cuZQKJHFrg st4CwY0z9/rbFyIH3nVa4mAIvniQO7MC6ie6LB90lNCbLemBFVjOwqadQnVIh7OBvgcS YuTGwGQExeYTmPRm2CibzJYv1ARhDuolzo8Wcie9KcPktNcx+tidnO79eHKQ+Xa8bLmQ qnww== X-Gm-Message-State: ALoCoQk1XA0l7pENYX0HS6rCG4X3U010szstZCXEEKgLbzK0iOIYvkeoUEuqAJ03Ix/DtAnrGfG3 X-Received: by 10.236.90.67 with SMTP id d43mr6915106yhf.36.1379156972681; Sat, 14 Sep 2013 04:09:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.70 with SMTP id i6ls1445182qei.26.gmail; Sat, 14 Sep 2013 04:09:32 -0700 (PDT) X-Received: by 10.220.10.194 with SMTP id q2mr16466129vcq.2.1379156972611; Sat, 14 Sep 2013 04:09:32 -0700 (PDT) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id nr7si424448vec.141.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:32 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id w16so1656471vbb.8 for ; Sat, 14 Sep 2013 04:09:32 -0700 (PDT) X-Received: by 10.52.118.73 with SMTP id kk9mr13914896vdb.13.1379156972227; Sat, 14 Sep 2013 04:09:32 -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 u4csp7144vcz; Sat, 14 Sep 2013 04:09:31 -0700 (PDT) X-Received: by 10.68.189.39 with SMTP id gf7mr15317pbc.184.1379156971296; Sat, 14 Sep 2013 04:09:31 -0700 (PDT) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by mx.google.com with ESMTPS id ds3si10984637pbb.19.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.177 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.177; Received: by mail-pd0-f177.google.com with SMTP id y10so2266438pdj.36 for ; Sat, 14 Sep 2013 04:09:30 -0700 (PDT) X-Received: by 10.68.33.100 with SMTP id q4mr11011037pbi.119.1379156970885; Sat, 14 Sep 2013 04:09:30 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id xe9sm24434350pab.0.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Sep 2013 04:09:30 -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 v2 3/4] ARM/ARM64: KVM: Implement KVM_ARM_PREFERRED_TARGET ioctl Date: Sat, 14 Sep 2013 16:38:36 +0530 Message-Id: <1379156917-17497-4-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379156917-17497-1-git-send-email-anup.patel@linaro.org> References: <1379156917-17497-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.212.49 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: , For implementing CPU=host, we need a mechanism for querying preferred VCPU target type on underlying Host. This patch implements KVM_ARM_PREFERRED_TARGET ioctl which return struct kvm_vcpu_init instance to user space for KVM ARM and KVM ARM64 containing information about preferred VCPU target type and optional VCPU features available for it. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm/kvm/arm.c | 12 ++++++++++++ include/uapi/linux/kvm.h | 1 + 2 files changed, 13 insertions(+) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9c697db..192212c 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -713,7 +713,19 @@ long kvm_arch_vcpu_ioctl(struct file *filp, return -EFAULT; return kvm_vcpu_set_target(vcpu, &init); + } + case KVM_ARM_PREFERRED_TARGET: { + int err; + struct kvm_vcpu_init init; + + err = kvm_vcpu_preferred_target(&init); + if (err) + return err; + if (copy_to_user(argp, &init, sizeof(init))) + return -EFAULT; + + return 0; } case KVM_SET_ONE_REG: case KVM_GET_ONE_REG: { diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 99c2533..e32e776 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1012,6 +1012,7 @@ struct kvm_s390_ucas_mapping { /* VM is being stopped by host */ #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) +#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)