Message ID | 20221205191430.2455108-1-vipinsh@google.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2431267wrr; Mon, 5 Dec 2022 11:16:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+6WEC0aGFT0lY+8H39A0esvKJFjTl56t5MFfRQ/Xtmz6esH4dHpUnwBNjn2d9iBOTk8Ip X-Received: by 2002:a05:6402:240c:b0:462:2c1c:8791 with SMTP id t12-20020a056402240c00b004622c1c8791mr61647625eda.29.1670267788299; Mon, 05 Dec 2022 11:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670267788; cv=none; d=google.com; s=arc-20160816; b=bU+2qc9ghjB2rEXE/I3PAN+20EV9CUE8ECAHfd1bgVOl2oO60ch+PQ3AXRcFeb1kji DCRcVkD5nqZkqjujoLyELHlhxl1VRDXeeL15zj2tf4ImaZrWvfgq1fmvwHaf1NjRUswz HSDMa4b4cT2p95ZNy/+61X3AWXrcRs6pxIXmjPRPd939/fzMJ5wjlkWtWiIxM5/4gbTy TLltStqTPM9ilr7TDFLc40nVTN3oPgO+Bd+PrnN3vkPRNeunBB0V3U6cJL1gVsmINtG1 7UXBoSL8bRgdDj7Y6zKiW63QxJsECGFq/bb7NkOD+lHqDJBXZmoKTkjsdx2BkuYNdNx/ OYxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=pcO8knyiGDbFIfMjbOgDj3hfHzch+YeaDL5Ano9tTdg=; b=qLr5OPMksILZ9Mb9Fie2Ta4v8YGe/XqjYYjE85/4iKXZSO0THJF1WCd5h1Klm5Fqoi TvBsovcfjYfPr8XCeLGh5FJGAlmdRsd+jmX/A+c+gkvPS7dBgj54lLH52mThTKnMnJvZ itpC1hOZ871uztU8S8j/Vn2ogT8lNKxX/2bb2UAYrgqwmqnzduEfhlZ348grJqRitvqH 23KYIyLC6QxyN/ry1t9XaUZQFIrYYccwsdKzoUljF0PphRS5ox3EuambbYIIDQtRoMxR KzpUnDaNPWk/tQPwytNL+rxBkm8aMV5a16qHNHKanZLu4kQj3f97+LtT2oNjZfJ4IDR/ X98w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=INmgLual; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a056402278e00b0046afb32bfd9si244004ede.302.2022.12.05.11.16.03; Mon, 05 Dec 2022 11:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=INmgLual; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbiLETOp (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Mon, 5 Dec 2022 14:14:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232801AbiLETOl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Dec 2022 14:14:41 -0500 Received: from mail-oi1-x249.google.com (mail-oi1-x249.google.com [IPv6:2607:f8b0:4864:20::249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62FB01F2FF for <linux-kernel@vger.kernel.org>; Mon, 5 Dec 2022 11:14:40 -0800 (PST) Received: by mail-oi1-x249.google.com with SMTP id bh19-20020a056808181300b0035b6736ee50so5657335oib.22 for <linux-kernel@vger.kernel.org>; Mon, 05 Dec 2022 11:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=pcO8knyiGDbFIfMjbOgDj3hfHzch+YeaDL5Ano9tTdg=; b=INmgLualos+oybZKFZwP2HhkuPQ1uOH4G3pvi+LqGBVBQ0ECqs/2znFA5G+49vdVZt M3MgD4eE2R11m0AZ11wELWQ/wss3KXka1J2zfYzVg7WsiOjWG74u3JVnm+9lc0Gf17XW 2dxxoZ7jPNIEiZ5LBObcm7TT2mR5lZ9GEfWImBuJkIDCeU0xFENNgQ5p/hW7CeGXEmjQ 5leQnDtBiOMXG58CQwnynd7hqeC6Bf9Mv09MAYvgPSewiPU+ZB5ierKUyViU8qGOWkwj CX8I1fz7l/0Cobjx40GL0vk77NSz8MQa+UNfqNp8UKW2/4nvaJoqJxUDhOIMH5xI8uAK +fLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pcO8knyiGDbFIfMjbOgDj3hfHzch+YeaDL5Ano9tTdg=; b=DCQ3umyFf6+2Bvcz53QFkLWqtnHyq23r66d4YJw/GLsuNMWCm2Mgx6l/rmsBzUfRQH lv8lEKH0N2XTOg/taslwo8DWcdvoqJpQCN6s2ZD5L/fz/KGGWPDbZUkyhB+eBaeGEXel yYeluPF74FluV50JCQlFd6JHhkZ0ik3ZIAVAxs13HymAWib/CvtDoxohiqbHSHgUFbfR A+kk1QCqGDn5BXS6vfAN8owlAtsrqtyaY0+LGEqEAqXRPv+TA3uSHKQS5pQECtTI5cpg d/jtxS5u7ucojxry3gINC3W9e2AgRKHTqCtA0rHgc8EFhRO1LSNoJeV4qI0gbmwDVV63 hA7w== X-Gm-Message-State: ANoB5pmd6b0vronfQEftjwaAujwpRqOgaYNPxA1v6WNroIJTt3e8XlmF uwrKXyH49+moIhV8w1ZZ+nPKSe0tp2gL X-Received: from vipin.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:479f]) (user=vipinsh job=sendgmr) by 2002:a05:6870:aa88:b0:143:ca23:34a9 with SMTP id gr8-20020a056870aa8800b00143ca2334a9mr20657540oab.235.1670267679700; Mon, 05 Dec 2022 11:14:39 -0800 (PST) Date: Mon, 5 Dec 2022 11:14:17 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221205191430.2455108-1-vipinsh@google.com> Subject: [Patch v3 00/13] Add Hyper-v extended hypercall support in KVM From: Vipin Sharma <vipinsh@google.com> To: seanjc@google.com, pbonzini@redhat.com, vkuznets@redhat.com, dmatlack@google.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vipin Sharma <vipinsh@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751402716574337002?= X-GMAIL-MSGID: =?utf-8?q?1751402716574337002?= |
Series |
Add Hyper-v extended hypercall support in KVM
|
|
Message
Vipin Sharma
Dec. 5, 2022, 7:14 p.m. UTC
Hi, There are two patch series combined in this one because I have rebased my patch series (patches 8 to 13) on top of Vitaly's "Hyper-V invariant TSC control feature" (patches 1 to 7). https://lore.kernel.org/kvm/87o7szouyr.fsf@ovpn-194-185.brq.redhat.com/ Vitaly's series had some small merge conflicts on the KVM queue branch I have fixed them in this series, no code changes. My patches (8 to 13) add Hyper-V extended hypercall support and selftests. v3: - Rebased on top of Vitaly's "Hyper-V invariant TSC control feature" series. - Removed enabling KVM_CAP_HYPERV_ENFORCE_CPUID in hyperv_extended_hypercalls test. v2: https://lore.kernel.org/lkml/20221121234026.3037083-1-vipinsh@google.com/ - Intorduced ASSERT_EXIT_REASON macro and replaced all occurences of TEST_ASSERT for vcpu exit reason. - Skip hyperv_extended_hypercalls test if extended hypercalls are not supported by the kernel. - Rebased with latest KVM queue. - Addressed all of the comments in patch 6 of v1. v1: https://lore.kernel.org/lkml/20221105045704.2315186-1-vipinsh@google.com/ RFC: https://lore.kernel.org/lkml/20221021185916.1494314-1-vipinsh@google.com/ Vipin Sharma (6): KVM: x86: hyper-v: Use common code for hypercall userspace exit KVM: x86: hyper-v: Add extended hypercall support in Hyper-v KVM: selftests: Test Hyper-V extended hypercall enablement KVM: selftests: Replace hardcoded Linux OS id with HYPERV_LINUX_OS_ID KVM: selftests: Make vCPU exit reason test assertion common. KVM: selftests: Test Hyper-V extended hypercall exit to userspace Vitaly Kuznetsov (7): x86/hyperv: Add HV_EXPOSE_INVARIANT_TSC define KVM: x86: Add a KVM-only leaf for CPUID_8000_0007_EDX KVM: x86: Hyper-V invariant TSC control KVM: selftests: Rename 'msr->available' to 'msr->fault_exepected' in hyperv_features test KVM: selftests: Convert hyperv_features test to using KVM_X86_CPU_FEATURE() KVM: selftests: Test that values written to Hyper-V MSRs are preserved KVM: selftests: Test Hyper-V invariant TSC control arch/x86/include/asm/hyperv-tlfs.h | 3 + arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kernel/cpu/mshyperv.c | 2 +- arch/x86/kvm/cpuid.c | 11 +- arch/x86/kvm/hyperv.c | 74 +++- arch/x86/kvm/hyperv.h | 27 ++ arch/x86/kvm/reverse_cpuid.h | 7 + arch/x86/kvm/x86.c | 4 +- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../testing/selftests/kvm/aarch64/psci_test.c | 4 +- .../testing/selftests/kvm/include/test_util.h | 10 + .../selftests/kvm/include/x86_64/hyperv.h | 149 +++++--- .../selftests/kvm/include/x86_64/processor.h | 1 + .../kvm/lib/s390x/diag318_test_handler.c | 3 +- .../selftests/kvm/s390x/sync_regs_test.c | 15 +- .../selftests/kvm/set_memory_region_test.c | 6 +- tools/testing/selftests/kvm/x86_64/amx_test.c | 8 +- .../kvm/x86_64/cr4_cpuid_sync_test.c | 8 +- .../testing/selftests/kvm/x86_64/debug_regs.c | 2 +- .../selftests/kvm/x86_64/flds_emulation.h | 5 +- .../selftests/kvm/x86_64/hyperv_clock.c | 9 +- .../selftests/kvm/x86_64/hyperv_evmcs.c | 8 +- .../kvm/x86_64/hyperv_extended_hypercalls.c | 93 +++++ .../selftests/kvm/x86_64/hyperv_features.c | 353 +++++++++++------- .../testing/selftests/kvm/x86_64/hyperv_ipi.c | 6 +- .../selftests/kvm/x86_64/hyperv_svm_test.c | 7 +- .../selftests/kvm/x86_64/hyperv_tlb_flush.c | 14 +- .../selftests/kvm/x86_64/kvm_clock_test.c | 5 +- .../selftests/kvm/x86_64/kvm_pv_test.c | 5 +- .../selftests/kvm/x86_64/monitor_mwait_test.c | 9 +- .../kvm/x86_64/nested_exceptions_test.c | 5 +- .../selftests/kvm/x86_64/platform_info_test.c | 14 +- .../kvm/x86_64/pmu_event_filter_test.c | 6 +- tools/testing/selftests/kvm/x86_64/smm_test.c | 9 +- .../testing/selftests/kvm/x86_64/state_test.c | 8 +- .../selftests/kvm/x86_64/svm_int_ctl_test.c | 8 +- .../kvm/x86_64/svm_nested_shutdown_test.c | 7 +- .../kvm/x86_64/svm_nested_soft_inject_test.c | 6 +- .../selftests/kvm/x86_64/svm_vmcall_test.c | 6 +- .../selftests/kvm/x86_64/sync_regs_test.c | 25 +- .../kvm/x86_64/triple_fault_event_test.c | 9 +- .../selftests/kvm/x86_64/tsc_scaling_sync.c | 6 +- .../kvm/x86_64/ucna_injection_test.c | 22 +- .../selftests/kvm/x86_64/userspace_io_test.c | 6 +- .../kvm/x86_64/userspace_msr_exit_test.c | 22 +- .../kvm/x86_64/vmx_apic_access_test.c | 11 +- .../kvm/x86_64/vmx_close_while_nested_test.c | 5 +- .../selftests/kvm/x86_64/vmx_dirty_log_test.c | 7 +- .../vmx_exception_with_invalid_guest_state.c | 4 +- .../x86_64/vmx_invalid_nested_guest_state.c | 4 +- .../kvm/x86_64/vmx_nested_tsc_scaling_test.c | 6 +- .../kvm/x86_64/vmx_preemption_timer_test.c | 8 +- .../kvm/x86_64/vmx_tsc_adjust_test.c | 6 +- .../selftests/kvm/x86_64/xapic_ipi_test.c | 6 +- .../selftests/kvm/x86_64/xen_shinfo_test.c | 7 +- .../selftests/kvm/x86_64/xen_vmcall_test.c | 5 +- 57 files changed, 586 insertions(+), 493 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/hyperv_extended_hypercalls.c