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: 20560 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EBAAB25E71 for ; Wed, 25 Sep 2013 09:27:08 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id a11sf5204525qen.6 for ; Wed, 25 Sep 2013 02:27:08 -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=JR1463iHDXL5jKLgZ84bouY8qgUNkhTx/Wi6BqUO+58=; b=cuYH7a65q/nSrCOj3M0bC8ZTiA6kgHBl+mZWAiZmc5JBJ4H7msUTjJaImLzXjvXL+Y ODwXb7i7MHhqwITU9NlASdZto9NnFwg04HTN7aa+rb5iRt5sx1Uw+hYlkG4GQ0/f7KhQ 5bxOUmxqYze6NNNDOH5vy8D3ZoJnjLAbWEqmHLenoBjD+zfUcfFN3vOtLxU9PpXOeBuK WXrHzOJAn8tz3MKCg0HORRLi9fV4uNgoB3UsSuW4bT3RUB0QiBiSrC3t+4S6oWVCC44f xm+Mjjc3FGg+MXODf+bcexkROXnnHkzvy7VbkJVAU+kSu75VYBuJfOpimLk7gvBjiWjL ZyLg== X-Gm-Message-State: ALoCoQm+Nb0sVROtTbZ/scTqx2tvD1I9GhtW3Neabrqr2CiFQQZ128UJlZr/rtjkNJzPvWW/S4QE X-Received: by 10.224.97.1 with SMTP id j1mr916394qan.6.1380101228826; Wed, 25 Sep 2013 02:27:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.69 with SMTP id kc5ls351107qeb.42.gmail; Wed, 25 Sep 2013 02:27:08 -0700 (PDT) X-Received: by 10.58.67.9 with SMTP id j9mr31823076vet.3.1380101228659; Wed, 25 Sep 2013 02:27:08 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id f10si9581213vck.20.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:27:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 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.41; Received: by mail-vb0-f41.google.com with SMTP id g17so4236138vbg.14 for ; Wed, 25 Sep 2013 02:27:08 -0700 (PDT) X-Received: by 10.52.36.239 with SMTP id t15mr26857222vdj.11.1380101228552; Wed, 25 Sep 2013 02:27:08 -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 u4csp294129vcz; Wed, 25 Sep 2013 02:27:08 -0700 (PDT) X-Received: by 10.68.202.6 with SMTP id ke6mr10191128pbc.173.1380101227671; Wed, 25 Sep 2013 02:27:07 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id se2si7253928pbc.286.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 02:27:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of anup.patel@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id x10so5861506pdj.15 for ; Wed, 25 Sep 2013 02:27:07 -0700 (PDT) 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 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 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-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.41 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 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)