我有一台带有 QEMU KVM 的 Ubuntu 18 主机。虚拟机 Windows 10(已启用 hyper-v)
我想在 Windows VM 上运行 Android Studio 模拟器。
在主机上我有 kvm_amd nested=1
VM 设置 #1:
<vcpu placement='static'>8</vcpu>
<cpu mode='host-model' check='partial'>
<model fallback='allow'/>
<feature policy='disable' name='hypervisor'/>
</cpu>
使用此设置,Windows VM 具有:
- 固件虚拟化:是
- VM 监视模式扩展:否
虚拟机设置 #2:
<vcpu placement='static'>8</vcpu>
<cpu mode='host-passthrough' check='none'/>
使用此设置虚拟机具有:
- 固件虚拟化:是
- VM 监控模式扩展:是
- 但虚拟机很慢,无法运行
- 如果我将拓扑更改为默认值以外的其他值,VM 将进入启动循环
如果需要更多信息,请告诉我。你能帮助我吗?
答案1
我最终让 qemu-kvm 与 Windows 11 Professional 客户端以及 Hyper-V 和 Docker Desktop 顺利运行。
这是我的设置,也许对其他人有帮助。无意做广告!硬件:
Gigabyte X570 I AORUS PRO WIFI
BIOS-Version F37a (Virtualization enabled, Hyperthreading disabled)
AMD Ryzen 9 3950X 16-Core Processor
64Gb RAM
软件:
OS: Centos Stream 8
Kernel: 4.18.0-448.el8.x86_64
libvirt 8.0.0
QEMU 6.2.0
/etc/modprobe.d/kvm.conf
options kvm ignore_msrs=1
options kvm_amd nested=1
virsh 设置:
<memory unit='KiB'>16777216</memory>
<currentMemory unit='KiB'>16777216</currentMemory>
<vcpu placement='static'>12</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-q35-rhel8.2.0'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
<hyperv mode='custom'>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vpindex state='on'/>
<runtime state='on'/>
<synic state='on'/>
<stimer state='on'/>
<reset state='on'/>
<vendor_id state='on' value='1234567890ab'/>
<frequencies state='on'/>
<reenlightenment state='on'/>
<tlbflush state='on'/>
<ipi state='on'/>
<evmcs state='off'/>
</hyperv>
<kvm>
<hidden state='on'/>
<hint-dedicated state='on'/>
<poll-control state='on'/>
</kvm>
<vmport state='off'/>
<smm state='on'/>
</features>
<cpu mode='host-passthrough' check='none' migratable='off'>
<topology sockets='1' dies='1' cores='12' threads='1'/>
<cache mode='passthrough'/>
<feature policy='require' name='topoext'/>
<feature policy='require' name='svm'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='invtsc'/>
</cpu>
<clock offset='localtime'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<timer name='hypervclock' present='yes'/>
<timer name='tsc' present='yes' mode='native'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
我安装了没有 SecureBoot 和 TPM 的 Windows 11 Pro。请 Google 提供详细信息。
Shift+F10 to launch cmd in windows setup regedit goto “HKEY_LOCAL_MACHINE\SYSTEM\Setup”
right-click “New ⇒ Key ⇒ LabConfig” “New ⇒ DWORD (32-bit) ⇒
BypassTPMCheck ⇒ 1” same for “BypassRAMCheck” and “BypassSecureBootCheck”