hyperv.c (6f50fa2a6f1395ad5f59ce7b87730f1f3ea19d76) | hyperv.c (ea1529873ab18c204688cf31746df851c098cbea) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * KVM Microsoft Hyper-V emulation 4 * 5 * derived from arch/x86/kvm/x86.c 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright (C) 2008 Qumranet, Inc. --- 1767 unchanged lines hidden (view full) --- 1776 if (args->flags == KVM_HYPERV_EVENTFD_DEASSIGN) 1777 return kvm_hv_eventfd_deassign(kvm, args->conn_id); 1778 return kvm_hv_eventfd_assign(kvm, args->conn_id, args->fd); 1779} 1780 1781int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, 1782 struct kvm_cpuid_entry2 __user *entries) 1783{ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * KVM Microsoft Hyper-V emulation 4 * 5 * derived from arch/x86/kvm/x86.c 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright (C) 2008 Qumranet, Inc. --- 1767 unchanged lines hidden (view full) --- 1776 if (args->flags == KVM_HYPERV_EVENTFD_DEASSIGN) 1777 return kvm_hv_eventfd_deassign(kvm, args->conn_id); 1778 return kvm_hv_eventfd_assign(kvm, args->conn_id, args->fd); 1779} 1780 1781int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, 1782 struct kvm_cpuid_entry2 __user *entries) 1783{ |
1784 uint16_t evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu); | 1784 uint16_t evmcs_ver = 0; |
1785 struct kvm_cpuid_entry2 cpuid_entries[] = { 1786 { .function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS }, 1787 { .function = HYPERV_CPUID_INTERFACE }, 1788 { .function = HYPERV_CPUID_VERSION }, 1789 { .function = HYPERV_CPUID_FEATURES }, 1790 { .function = HYPERV_CPUID_ENLIGHTMENT_INFO }, 1791 { .function = HYPERV_CPUID_IMPLEMENT_LIMITS }, 1792 { .function = HYPERV_CPUID_NESTED_FEATURES }, 1793 }; 1794 int i, nent = ARRAY_SIZE(cpuid_entries); 1795 | 1785 struct kvm_cpuid_entry2 cpuid_entries[] = { 1786 { .function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS }, 1787 { .function = HYPERV_CPUID_INTERFACE }, 1788 { .function = HYPERV_CPUID_VERSION }, 1789 { .function = HYPERV_CPUID_FEATURES }, 1790 { .function = HYPERV_CPUID_ENLIGHTMENT_INFO }, 1791 { .function = HYPERV_CPUID_IMPLEMENT_LIMITS }, 1792 { .function = HYPERV_CPUID_NESTED_FEATURES }, 1793 }; 1794 int i, nent = ARRAY_SIZE(cpuid_entries); 1795 |
1796 if (kvm_x86_ops->nested_get_evmcs_version) 1797 evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu); 1798 |
|
1796 /* Skip NESTED_FEATURES if eVMCS is not supported */ 1797 if (!evmcs_ver) 1798 --nent; 1799 1800 if (cpuid->nent < nent) 1801 return -E2BIG; 1802 1803 if (cpuid->nent > nent) --- 96 unchanged lines hidden --- | 1799 /* Skip NESTED_FEATURES if eVMCS is not supported */ 1800 if (!evmcs_ver) 1801 --nent; 1802 1803 if (cpuid->nent < nent) 1804 return -E2BIG; 1805 1806 if (cpuid->nent > nent) --- 96 unchanged lines hidden --- |