vcpu = kvm_arch_vcpu_create(kvm, id); preempt_notifier_init(&vcpu->preempt_notifier, &kvm_preempt_ops); r = kvm_arch_vcpu_setup(vcpu); r = kvm_create_vcpu_debugfs(vcpu); /* Now it's all set up, let userspace reach it */ kvm_get_kvm(kvm); r = create_vcpu_fd(vcpu); kvm...
vcpu创建流程用于为vcpu准备好运行条件,其代码流程图如下: 由上图可知其主要包含以下几部分功能: (1)kvm_arch_vcpu_precreate 在aarch64架构下,该函数用于判断该vcpu是否已被创建 (2)kvm_vcpu_init 为该vcpu初始化preempt_notifiers通知,用于在进程切换时执行vcpu的切入切出操作 (3)kvm_arch_vcpu_create aarch6...
kvm_vm_ioctl_create_vcpu() --> kvm_arch_vcpu_create() --> vmx_create_vcpu --> kvm_arch_vcpu_setup(vcpu); 1. 2. 3. 4. 5. 函数首先通过kvm_arch_vcpu_create()创建基本信息,之后调用kvm_arch_vcpu_setup()建立整个环境信息。 struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, un...
(1)kvm_init_vcpu(1.1)通过ret =kvm_vm_ioctl(s,KVM_CREATE_VCPU, (void *)kvm_arch_vcpu_id(cpu));创建虚拟机的vcpu。对应到kvm的kvm_main.c中kvm_vm_ioctl函数,当传入的参数为VM_CREATE_VCPU时,与KVM_CREATE_VM过程类似,它创建一个vcpu并且返回可以操作该vcpu的vcpu_fd;(1.2)mmap_size = kvm_ioct...
init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) { struct kvm_mmu *context = vcpu->arch.walk_mmu; context->base_role.word = 0; context->new_cr3 = nonpaging_new_cr3; context->page_fault = tdp_page_fault; context->free = nonpaging_free; context->sync_page = ...
staticint__initvmx_init(void){intr, cpu; if(!kvm_is_vmx_supported)return-EOPNOTSUPP;...r = kvm_x86_vendor_init(&vmx_init_ops);.../** Common KVM initialization _must_ come last, after this, /dev/kvm is* exposed to userspace!*/r = kvm_init(sizeof(structvcpu_vmx), __alignof...
对于Realm VMh还需要通过KVM_ARM_VCPU_FINALIZE kvm_arch_vcpu_ioctl系统调用, kvm_arm_vcpu_finalize kvm_create_rec->rmi_rec_create, 通过RMI REC_CREATE调用(通过SMC指令)到ATF,ATF再将此调用dispatch到TF-RMM,TF-RMM通过smc_rec_create在Realm状态创建对应于host Linux KVM struct kvm_vcpu的struct rec...
===》kvm_irqfd_init ===》kvm_arch_hardware_setup ===》kvm_arch_check_processor_compat ===》misc_register(&kvm_dev) // 创建字符设备文件/dev/kvm misc_register函数是linux内核的一个通用接口,主要作用是为了注册设备文件,kvm模块借用该接口创建了/dev/kvm设备文件,下面是设备文件的描述结构: ...
13--vcpus sockets=2,cores=4,threads=2 14--cpuset=CPUSET Setwhichphysical CPUs domain can use. 15--cpu=CPU#CPU的模式及特点 例: --cpu coreduo,+x2apic 16--description=DESCRIPTION#虚拟机描述 17--security=SECURITY#安全配置设置 18--numatune=NUMATUNE#NUMA政策调整 ...
kvm_arch_vcpu_create主要完成体系架构相关的初始化,包括timer,pmu,vgic等; create_hyp_mappings将kvm_vcpu结构体建立映射,以便在Hypervisor模式下能访问该结构; create_vcpu_fd注册了kvm_vcpu_fops操作函数集,针对vcpu进行操作,Qemu中设置KVM_ARM_VCPU_INIT,将触发kvm_arch_vcpu_ioctl_vcpu_init的执行,完成的工作主...