From patchwork Thu Sep 19 13:11:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 20448 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 4B38C23906 for ; Thu, 19 Sep 2013 13:12:24 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf8842094veb.3 for ; Thu, 19 Sep 2013 06:12:24 -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=J/sBDkvUynrnmamAfiESzCoU0ZXDNo9ym7+vkSeqoHg=; b=I3MFRkGZZDeGs5ATf0WRqT/Hg50OZq/Kblx1zjoasBFLpvLwuNFPdsOdhLKVXukmOx yTQQCBpG1CPfgmJ14GbjFvMLXK7jXzZ6xUbqZxs7Up4e+G5S2vzrnTMjQ8x0qJQ8nw14 nw7BCLKdoW1UApEt8ns1Ek9sBXVjCmOUpaBhDSVN4VotmznkHMnmbCQrPbPTZAh6vFs2 UjZqCX6UAc/qvDaDeyP1zAceg6m5lq5IWY4l0Tk5BaSP6YqIqR9H3KmEn1t4yG6nzX7i y+HdZFy0jg5a4f/L2SnXArBkJyVSrTqvTk4JJQvaSb//1rclRGBWcie5m4ULSASwMXJl whPQ== X-Gm-Message-State: ALoCoQnLe/x2u0CpYnRuJarlk8DweLgNrVx5q9qibFTlxMmluBezfJX0C6BB19iUh02YOuIQfCDB X-Received: by 10.236.220.39 with SMTP id n37mr560471yhp.15.1379596344111; Thu, 19 Sep 2013 06:12:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.231 with SMTP id n7ls3804832qen.14.gmail; Thu, 19 Sep 2013 06:12:24 -0700 (PDT) X-Received: by 10.58.8.231 with SMTP id u7mr36600vea.44.1379596344019; Thu, 19 Sep 2013 06:12:24 -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 xz7si1816638vcb.50.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:23 -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 w16so6254386vbb.36 for ; Thu, 19 Sep 2013 06:12:23 -0700 (PDT) X-Received: by 10.220.97.145 with SMTP id l17mr128680vcn.35.1379596343601; Thu, 19 Sep 2013 06:12:23 -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 u4csp277320vcz; Thu, 19 Sep 2013 06:12:23 -0700 (PDT) X-Received: by 10.67.24.7 with SMTP id ie7mr2672066pad.112.1379596342720; Thu, 19 Sep 2013 06:12:22 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id it5si6270133pbc.245.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id q10so8354084pdj.20 for ; Thu, 19 Sep 2013 06:12:22 -0700 (PDT) X-Received: by 10.66.161.229 with SMTP id xv5mr2651890pab.87.1379596342298; Thu, 19 Sep 2013 06:12:22 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ye1sm12118225pab.19.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 06:12:21 -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 v3 3/4] ARM/ARM64: KVM: Implement KVM_ARM_PREFERRED_TARGET ioctl Date: Thu, 19 Sep 2013 18:41:40 +0530 Message-Id: <1379596302-21522-4-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379596302-21522-1-git-send-email-anup.patel@linaro.org> References: <1379596302-21522-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 vm ioctl which returns struct kvm_vcpu_init instance containing information about preferred VCPU target type and available optional VCPU features to user space. Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- arch/arm/kvm/arm.c | 13 +++++++++++++ include/uapi/linux/kvm.h | 1 + 2 files changed, 14 insertions(+) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9c697db..cc5adb9 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -797,6 +797,19 @@ long kvm_arch_vm_ioctl(struct file *filp, return -EFAULT; return kvm_vm_ioctl_set_device_addr(kvm, &dev_addr); } + 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; + } default: return -EINVAL; } 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)