From patchwork Thu Dec 6 16:58:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 10716421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0332013BF for ; Thu, 6 Dec 2018 16:59:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E68562F141 for ; Thu, 6 Dec 2018 16:59:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA5762F14E; Thu, 6 Dec 2018 16:59:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854162F141 for ; Thu, 6 Dec 2018 16:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725965AbeLFQ63 (ORCPT ); Thu, 6 Dec 2018 11:58:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58838 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725898AbeLFQ63 (ORCPT ); Thu, 6 Dec 2018 11:58:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B7EC30012FC; Thu, 6 Dec 2018 16:58:29 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id D431519C7D; Thu, 6 Dec 2018 16:58:26 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , x86@kernel.org, "Michael Kelley (EOSG)" , Eduardo Habkost Subject: [PATCH 0/6] x86/kvm/hyper-v: Implement KVM_GET_SUPPORTED_HV_CPUID Date: Thu, 6 Dec 2018 17:58:19 +0100 Message-Id: <20181206165825.1832-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 06 Dec 2018 16:58:29 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As suggested by Paolo, introduce new KVM_GET_SUPPORTED_HV_CPUID returning all Hyper-V CPUID feature leaves, this way we won't need to add a new KVM_CAP_HYPERV_* for every new Hyper-V enlightenment we implement in KVM. (Using the existing KVM_GET_SUPPORTED_CPUID doesn't seem to be possible: Hyper-V CPUID feature leaves intersect with KVM's (e.g. 0x40000000, 0x40000001) and we would probably confuse userspace in case we decide to return these twice). This patch series also does some housekeeping work in hyperv-tlfs.h, adds a simple selftest (that's how I actually checked that the newly added ioctl works) and removes recently added KVM_CAP_HYPERV_STIMER_DIRECT before it's too late. Vitaly Kuznetsov (6): x86/hyper-v: Do some housekeeping in hyperv-tlfs.h x86/hyper-v: Drop HV_X64_CONFIGURE_PROFILER definition x86/kvm/hyper-v: Introduce nested_get_evmcs_version() helper x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID x86/kvm/hyper-v: Drop KVM_CAP_HYPERV_STIMER_DIRECT KVM: selftests: Add hyperv_cpuid test arch/x86/include/asm/hyperv-tlfs.h | 185 +++++++++--------- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/hyperv.c | 131 ++++++++++++- arch/x86/kvm/hyperv.h | 2 + arch/x86/kvm/svm.c | 7 + arch/x86/kvm/vmx.c | 24 ++- arch/x86/kvm/x86.c | 21 +- include/uapi/linux/kvm.h | 5 +- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/x86_64/hyperv_cpuid.c | 142 ++++++++++++++ 10 files changed, 413 insertions(+), 106 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c