tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c
Extension
.c
Size
3204 bytes
Lines
133
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (get_ucall(vcpu, &uc)) {
		case UCALL_ABORT:
			REPORT_GUEST_ASSERT(uc);
			/* NOT REACHED */
		case UCALL_SYNC:
			break;
		case UCALL_DONE:
			goto done;
		default:
			TEST_FAIL("Unknown ucall %lu", uc.cmd);
		}

		TEST_ASSERT(uc.args[1] == stage,
			    "Expected stage %d, got stage %lu", stage, (ulong)uc.args[1]);
		if (stage == 1) {
			pr_info("L2 is active; performing save/restore.\n");
			state = vcpu_save_state(vcpu);

			kvm_vm_release(vm);

			/* Restore state in a new VM. */
			vcpu = vm_recreate_with_one_vcpu(vm);
			vcpu_load_state(vcpu, state);
			kvm_x86_state_cleanup(state);
		}
	}

done:
	kvm_vm_free(vm);
	return 0;
}

Annotation

Implementation Notes