1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
Massaki Archambault 4cbe134987 use transparent hugepage 2022-08-30 00:40:49 -04:00
Massaki Archambault 39bc28445b nvme setup 2022-08-15 20:45:14 -04:00
4 changed files with 67 additions and 27 deletions

View File

@ -1,16 +1,20 @@
- hosts: all, localhost
become: yes
vars:
audio:
source: EasyEffects Source
sink: EasyEffects Sink
vfio_pci_ids:
# - '8086:15b8' # Intel Corporation Ethernet Connection (2) I219-V
- '8086:15b8' # Intel Corporation Ethernet Connection (2) I219-V
- '1002:731f' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5700 / 5700 XT]
- '1002:ab38' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio
# - 'c0a9:2263' # Micron/Crucial Technology P1 NVMe PCIe SSD
pci_device_ids:
# Intel Corporation Ethernet Connection (2) I219-V
# - domain: '0000'
# bus: '00'
# slot: '1f'
# function: '6'
- domain: '0000'
bus: '00'
slot: '1f'
function: '6'
# Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5700 / 5700 XT]
- domain: '0000'
bus: '03'
@ -21,6 +25,12 @@
bus: '03'
slot: '00'
function: '1'
# Micron/Crucial Technology P1 NVMe PCIe SSD
# - alias: ua-nvme1
# domain: '0000'
# bus: '0b'
# slot: '00'
# function: '0'
usb_device_ids:
- '054c:05c4' # Sony Corp. DualShock 4 [CUH-ZCT1x]
- '046d:c539' # Logitech, Inc. USB Receiver

View File

@ -2,6 +2,7 @@
pacman:
name:
- qemu
# - qemu-audio-jack
- libvirt
- bridge-utils
- ovmf

View File

@ -14,21 +14,20 @@ prepare() {
irq-affinity mask C1-3,5-7 \
cpuset-modify --cpus C0,4 /system.slice \
cpuset-modify --cpus C0,4 /user.slice \
move-tasks / /host.slice \
cpu-governor performance C0-7
for _ in $(seq 5); do
sleep 3
# assign hugepages
sysctl -w vm.nr_hugepages=8192 && break
done
sleep 10
# for _ in $(seq 5); do
# sleep 3
# # assign hugepages
# sysctl -w vm.nr_overcommit_hugepages=8192 && break
# done
# sleep 10
}
release() {
systemctl stop win10-usb
vfio-isolate restore /tmp/win10.undo
sysctl -w vm.nr_hugepages=0
# sysctl -w vm.nr_overcommit_hugepages=0
}
if [ "$1" == "win10" ]; then

View File

@ -9,7 +9,7 @@
<memory unit='KiB'>16777216</memory>
<currentMemory unit='KiB'>16777216</currentMemory>
<memoryBacking>
<hugepages/>
<!-- <hugepages/> -->
<locked/>
</memoryBacking>
<vcpu placement='static'>6</vcpu>
@ -76,7 +76,7 @@
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<!-- Because of the AMD reset bug, we cannot actually restart normally -->
<!-- Because of the AMD reset bug, we cannot actually reboot normally -->
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<pm>
@ -88,21 +88,22 @@
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/data/marchambault/VirtualMachines/img/win10.img'/>
<target dev='sda' bus='scsi'/>
<boot order='1'/>
<target dev='sda' bus='scsi' rotation_rate="1"/>
<boot order='2'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native' discard='unmap' detect_zeroes='unmap'/>
<driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
<source dev='/dev/disk/by-id/nvme-CT1000P1SSD8_1910E1F03D8E'/>
<target dev='sdc' bus='scsi'/>
<target dev='sdc' bus='scsi' rotation_rate="1"/>
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/data/marchambault/VirtualMachines/iso/virtio-win-0.1.171.iso'/>
<!-- <source file=''/> -->
<target dev='sdb' bus='sata'/>
<readonly/>
<boot order='1'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'>
@ -168,21 +169,21 @@
</controller>
<!-- networking -->
<!-- <interface type='bridge'>
<interface type='bridge'>
<mac address='52:54:00:f5:2c:df'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<link state='up'/>
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
</interface> -->
<interface type='bridge'>
</interface>
<!-- <interface type='bridge'>
<mac address='52:54:00:f5:2c:df'/>
<source bridge='br0'/>
<target dev="vnet0"/>
<model type='virtio'/>
<link state='up'/>
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
</interface>
</interface> -->
<!-- HID -->
<input type='mouse' bus='ps2'/>
@ -205,20 +206,35 @@
<!-- audio -->
<sound model='ich9'>
<address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
<codec type='micro'/>
<audio id='1'/>
</sound>
<audio id='1' type='pulseaudio' serverName='/run/user/1000/pulse/native'>
<output mixingEngine='no' voices='1' bufferLength='100'>
<!-- <settings frequency='48000' channels='2' format='f32'/> -->
<input mixingEngine='yes' fixedSettings='yes' voices='1' bufferLength='100'/>
<output mixingEngine='yes' fixedSettings='yes' voices='1' bufferLength='100'>
<settings frequency='48000' channels='2' format='f32'/>
</output>
</audio>
<!-- <audio id='1' type='pulseaudio' serverName='/run/user/1000/pulse/native'>
<input mixingEngine='no'/>
<output mixingEngine='no'/>
</audio> -->
<!-- <audio id='1' type='jack'>
<input clientName="win10" connectPorts="{{ audio.source }}"/>
<output clientName="win10" connectPorts="{{ audio.sink }}"/>
</audio> -->
<!-- pci passthrough -->
{% for pci_device_id in pci_device_ids %}
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x{{ pci_device_id.domain }}' bus='0x{{ pci_device_id.bus }}' slot='0x{{ pci_device_id.slot }}' function='0x{{ pci_device_id.function }}'/>
</source>
{% if 'alias' in pci_device_id %}
<alias name='{{ pci_device_id.alias }}'/>
{% endif %}
</hostdev>
{% endfor %}
@ -245,6 +261,20 @@
</shmem>
</devices>
<qemu:override>
<!-- workaround for NVMe passthrough with SMI SM2262 controller -->
<!-- this breaks with >15 vCPUs! -->
<!-- https://bugzilla.kernel.org/show_bug.cgi?id=202055#c42 -->
<!-- <qemu:device alias='ua-nvme1'>
<qemu:frontend>
<qemu:property name='x-msix-relocation' type='string' value='bar2'/>
</qemu:frontend>
</qemu:device> -->
</qemu:override>
<qemu:commandline>
<!-- <qemu:env name="PIPEWIRE_RUNTIME_DIR" value="/run/user/1000"/>
<qemu:env name="PIPEWIRE_LATENCY" value="512/48000"/> -->
</qemu:commandline>
</domain>