AMD Ryzen 上的巢狀虛擬化與主機 Linux、客戶 Windows

AMD Ryzen 上的巢狀虛擬化與主機 Linux、客戶 Windows

我的主機是 Ubuntu 18,有 QEMU KVM。虛擬機器 Windows 10(啟用 Hyper-V)

我想在 Windows VM 上運行 Android Studio 模擬器。

在主機上我有 kvm_amd 巢狀 = 1

虛擬機器設定#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 監控模式擴充:是
  • 但是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

虛擬設定:

<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>

我安裝了 Windows 11 Pro,但沒有 SecureBoot 和 TPM。請谷歌詳細資訊。

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”

相關內容