x86.c (861377730aa9db4cbaa0f3bd3f4d295c152732c4) | x86.c (16809ecdc1e8ab7278f1d60021ac809edd17d060) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * derived from drivers/kvm/kvm_main.c 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright (C) 2008 Qumranet, Inc. --- 866 unchanged lines hidden (view full) --- 875void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw) 876{ 877 (void)kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0eul) | (msw & 0x0f)); 878} 879EXPORT_SYMBOL_GPL(kvm_lmsw); 880 881void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) 882{ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * derived from drivers/kvm/kvm_main.c 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright (C) 2008 Qumranet, Inc. --- 866 unchanged lines hidden (view full) --- 875void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw) 876{ 877 (void)kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0eul) | (msw & 0x0f)); 878} 879EXPORT_SYMBOL_GPL(kvm_lmsw); 880 881void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) 882{ |
883 if (vcpu->arch.guest_state_protected) 884 return; 885 |
|
883 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE)) { 884 885 if (vcpu->arch.xcr0 != host_xcr0) 886 xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0); 887 888 if (vcpu->arch.xsaves_enabled && 889 vcpu->arch.ia32_xss != host_xss) 890 wrmsrl(MSR_IA32_XSS, vcpu->arch.ia32_xss); --- 4 unchanged lines hidden (view full) --- 895 (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU)) && 896 vcpu->arch.pkru != vcpu->arch.host_pkru) 897 __write_pkru(vcpu->arch.pkru); 898} 899EXPORT_SYMBOL_GPL(kvm_load_guest_xsave_state); 900 901void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) 902{ | 886 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE)) { 887 888 if (vcpu->arch.xcr0 != host_xcr0) 889 xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0); 890 891 if (vcpu->arch.xsaves_enabled && 892 vcpu->arch.ia32_xss != host_xss) 893 wrmsrl(MSR_IA32_XSS, vcpu->arch.ia32_xss); --- 4 unchanged lines hidden (view full) --- 898 (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU)) && 899 vcpu->arch.pkru != vcpu->arch.host_pkru) 900 __write_pkru(vcpu->arch.pkru); 901} 902EXPORT_SYMBOL_GPL(kvm_load_guest_xsave_state); 903 904void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) 905{ |
906 if (vcpu->arch.guest_state_protected) 907 return; 908 |
|
903 if (static_cpu_has(X86_FEATURE_PKU) && 904 (kvm_read_cr4_bits(vcpu, X86_CR4_PKE) || 905 (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU))) { 906 vcpu->arch.pkru = rdpkru(); 907 if (vcpu->arch.pkru != vcpu->arch.host_pkru) 908 __write_pkru(vcpu->arch.host_pkru); 909 } 910 --- 10648 unchanged lines hidden --- | 909 if (static_cpu_has(X86_FEATURE_PKU) && 910 (kvm_read_cr4_bits(vcpu, X86_CR4_PKE) || 911 (vcpu->arch.xcr0 & XFEATURE_MASK_PKRU))) { 912 vcpu->arch.pkru = rdpkru(); 913 if (vcpu->arch.pkru != vcpu->arch.host_pkru) 914 __write_pkru(vcpu->arch.host_pkru); 915 } 916 --- 10648 unchanged lines hidden --- |