From patchwork Wed Sep 25 09:26:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2941041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ED8F39F288 for ; Wed, 25 Sep 2013 09:29:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 629632057D for ; Wed, 25 Sep 2013 09:29:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 192E02057B for ; Wed, 25 Sep 2013 09:29:19 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOlOH-0005t6-Gd; Wed, 25 Sep 2013 09:28:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOlNv-00026s-Jg; Wed, 25 Sep 2013 09:27:51 +0000 Received: from mail-pb0-f54.google.com ([209.85.160.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOlNY-000213-DW for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2013 09:27:29 +0000 Received: by mail-pb0-f54.google.com with SMTP id ro12so5775803pbb.41 for ; Wed, 25 Sep 2013 02:27:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JR1463iHDXL5jKLgZ84bouY8qgUNkhTx/Wi6BqUO+58=; b=iAwS/BFOQkZ66XF1GMbQkfr10zTiwT+MAYQojGxlzGn/t8KbIwPj+SrRthrxAajX3P EQ6XxjaFJcYpZeROad2lzXit61a7/Erw2oOvCFAmgSYpzLWD6p10yrCNUWa3mzJNcO+h Q76RpynpJhv8e3L+Ns/6ZuHwXBAwgko55caGAp01skB4a5zhSVeJIqFr7RS3fFIfd7+k Y+MJ3o5OUuCv3/Fn5Miz9xEy7sSWTAKFrJz6w2uQNms7s3Rc1d6AAW//p7cAElJpoz85 MCR8umY2bZZg4N2t7w2NurWzz/AWUWAKoTketb2ktcFnX5KJpVew8Rx8SAaCrpehV1ke KWvQ== X-Gm-Message-State: ALoCoQkq/m8VDAc/GEBuod5e7vHu4Dm7zCwgu8PAZN1HOi8E6ak1+aL8JHY+BQQ/1X4Y8i5dqnce X-Received: by 10.68.253.227 with SMTP id ad3mr9835046pbd.189.1380101227273; Wed, 25 Sep 2013 02:27:07 -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:06 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v4 3/4] ARM/ARM64: KVM: Implement KVM_ARM_PREFERRED_TARGET ioctl Date: Wed, 25 Sep 2013 14:56:02 +0530 Message-Id: <1380101163-20028-4-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130925_052728_582391_E8908F9D X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, Anup Patel , patches@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org, pranavkumar@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 target specific features available for it. 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)