nested.c (ffb1e76f4f32d2b8ea4189df0484980370476395) | nested.c (e85d3e7b495bb6c0b847a693f5f6d4bd429fae55) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * AMD SVM support 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright 2010 Red Hat, Inc. and/or its affiliates. --- 565 unchanged lines hidden (view full) --- 574 * 575 * VMLOAD/VMSAVE state would also belong in this category, but KVM 576 * always performs VMLOAD and VMSAVE from the VMCB01. 577 */ 578 to_vmcb->save.spec_ctrl = from_vmcb->save.spec_ctrl; 579} 580 581int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * AMD SVM support 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright 2010 Red Hat, Inc. and/or its affiliates. --- 565 unchanged lines hidden (view full) --- 574 * 575 * VMLOAD/VMSAVE state would also belong in this category, but KVM 576 * always performs VMLOAD and VMSAVE from the VMCB01. 577 */ 578 to_vmcb->save.spec_ctrl = from_vmcb->save.spec_ctrl; 579} 580 581int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, |
582 struct vmcb *vmcb12) | 582 struct vmcb *vmcb12, bool from_vmrun) |
583{ 584 struct vcpu_svm *svm = to_svm(vcpu); 585 int ret; 586 587 trace_kvm_nested_vmrun(svm->vmcb->save.rip, vmcb12_gpa, 588 vmcb12->save.rip, 589 vmcb12->control.int_ctl, 590 vmcb12->control.event_inj, --- 13 unchanged lines hidden (view full) --- 604 605 nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr); 606 607 svm_switch_vmcb(svm, &svm->nested.vmcb02); 608 nested_vmcb02_prepare_control(svm); 609 nested_vmcb02_prepare_save(svm, vmcb12); 610 611 ret = nested_svm_load_cr3(&svm->vcpu, vmcb12->save.cr3, | 583{ 584 struct vcpu_svm *svm = to_svm(vcpu); 585 int ret; 586 587 trace_kvm_nested_vmrun(svm->vmcb->save.rip, vmcb12_gpa, 588 vmcb12->save.rip, 589 vmcb12->control.int_ctl, 590 vmcb12->control.event_inj, --- 13 unchanged lines hidden (view full) --- 604 605 nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr); 606 607 svm_switch_vmcb(svm, &svm->nested.vmcb02); 608 nested_vmcb02_prepare_control(svm); 609 nested_vmcb02_prepare_save(svm, vmcb12); 610 611 ret = nested_svm_load_cr3(&svm->vcpu, vmcb12->save.cr3, |
612 nested_npt_enabled(svm), true); | 612 nested_npt_enabled(svm), from_vmrun); |
613 if (ret) 614 return ret; 615 616 if (!npt_enabled) 617 vcpu->arch.mmu->inject_page_fault = svm_inject_page_fault_nested; 618 | 613 if (ret) 614 return ret; 615 616 if (!npt_enabled) 617 vcpu->arch.mmu->inject_page_fault = svm_inject_page_fault_nested; 618 |
619 if (!from_vmrun) 620 kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); 621 |
|
619 svm_set_gif(svm, true); 620 621 return 0; 622} 623 624int nested_svm_vmrun(struct kvm_vcpu *vcpu) 625{ 626 struct vcpu_svm *svm = to_svm(vcpu); --- 49 unchanged lines hidden (view full) --- 676 svm->vmcb01.ptr->save.rflags = kvm_get_rflags(vcpu); 677 svm->vmcb01.ptr->save.rip = kvm_rip_read(vcpu); 678 679 if (!npt_enabled) 680 svm->vmcb01.ptr->save.cr3 = kvm_read_cr3(vcpu); 681 682 svm->nested.nested_run_pending = 1; 683 | 622 svm_set_gif(svm, true); 623 624 return 0; 625} 626 627int nested_svm_vmrun(struct kvm_vcpu *vcpu) 628{ 629 struct vcpu_svm *svm = to_svm(vcpu); --- 49 unchanged lines hidden (view full) --- 679 svm->vmcb01.ptr->save.rflags = kvm_get_rflags(vcpu); 680 svm->vmcb01.ptr->save.rip = kvm_rip_read(vcpu); 681 682 if (!npt_enabled) 683 svm->vmcb01.ptr->save.cr3 = kvm_read_cr3(vcpu); 684 685 svm->nested.nested_run_pending = 1; 686 |
684 if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12)) | 687 if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, true)) |
685 goto out_exit_err; 686 687 if (nested_svm_vmrun_msrpm(svm)) 688 goto out; 689 690out_exit_err: 691 svm->nested.nested_run_pending = 0; 692 --- 746 unchanged lines hidden --- | 688 goto out_exit_err; 689 690 if (nested_svm_vmrun_msrpm(svm)) 691 goto out; 692 693out_exit_err: 694 svm->nested.nested_run_pending = 0; 695 --- 746 unchanged lines hidden --- |