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: 2893121 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 17F6F9F1BF for ; Sat, 14 Sep 2013 11:23:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C6E220299 for ; Sat, 14 Sep 2013 11:23:25 +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 130C82021F for ; Sat, 14 Sep 2013 11:23:24 +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 1VKnkj-0005ba-6l; Sat, 14 Sep 2013 11:11:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VKnk5-0001gP-UM; Sat, 14 Sep 2013 11:10:21 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VKnjc-0001ai-9S for linux-arm-kernel@lists.infradead.org; Sat, 14 Sep 2013 11:09:53 +0000 Received: by mail-pd0-f180.google.com with SMTP id y10so2259626pdj.39 for ; Sat, 14 Sep 2013 04:09:30 -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=k7ZyBnEF22rlQGFvGjxxPxAc37qgztGjXwuSMXHaQdg=; b=SWpS9TLX7D5oKf+wJHdGJW93qtV7jUUshb2XEPadaF2LG7sFxYKfNS6F5YarHyZkRx Egbsv+bVsBnryMSoS/W43nyfnq9npD163YE02gyeY3oOl11tMhgHR0AdX9xim4wv5dUv ZVVn5LuSLmSUwc1AH5kUPGW75gCEz2olykZLZjVM8LFSUhIc7y4nJvnY+JuOOTELjpz0 ipC+t6YUuEJ08UAy+jpXhfy66boDqT9SoyV+msC+QPECkxj1bWgm3yFliU5VcXPx7cYG aCtEKHmMAr6qpQ6eaIE495EokraP5NKsiPN+KbiciFeqZMJw6I/gIBvwPi3bzPr5SguX 6BrQ== X-Gm-Message-State: ALoCoQkJTL8spbC8uxdS1wzHyrYpbrKeRW7nxO42n5qbsB9E7keugaLzfHRzCp715hjH7b4JnXSW 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130914_070952_511535_41A70EC9 X-CRM114-Status: GOOD ( 11.64 ) X-Spam-Score: -1.9 (-) 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 Sawargaonkar 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=-5.1 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 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)