mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
bhyve: auto-assign PCI addresses for hostdevs
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -196,6 +196,16 @@ bhyveAssignDevicePCISlots(virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < def->nhostdevs; i++) {
|
||||
if (!virDeviceInfoPCIAddressIsWanted(def->hostdevs[i]->info))
|
||||
continue;
|
||||
if (virDomainPCIAddressReserveNextAddr(addrs,
|
||||
def->hostdevs[i]->info,
|
||||
VIR_PCI_CONNECT_TYPE_PCI_DEVICE,
|
||||
-1) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
bhyve \
|
||||
-c 1 \
|
||||
-m 214 \
|
||||
-S \
|
||||
-H \
|
||||
-P \
|
||||
-s 0:0,hostbridge \
|
||||
-s 2:0,ahci,hd:/tmp/freebsd.img \
|
||||
-s 7:1,passthru,3/0/4 \
|
||||
-s 3:0,passthru,4/0/0 \
|
||||
-s 4:0,passthru,5/2/0 \
|
||||
bhyve
|
||||
@@ -0,0 +1,4 @@
|
||||
bhyveload \
|
||||
-m 214 \
|
||||
-d /tmp/freebsd.img \
|
||||
bhyve
|
||||
@@ -0,0 +1,41 @@
|
||||
<domain type='bhyve'>
|
||||
<name>bhyve</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<memoryBacking>
|
||||
<locked/>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
</os>
|
||||
<clock offset='localtime'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file'>
|
||||
<driver name='file' type='raw'/>
|
||||
<source file='/tmp/freebsd.img'/>
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x03' slot='0x00' function='0x4'/>
|
||||
</source>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
|
||||
</hostdev>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
|
||||
</source>
|
||||
</hostdev>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x05' slot='0x02' function='0x0'/>
|
||||
</source>
|
||||
</hostdev>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -223,6 +223,7 @@ mymain(void)
|
||||
DO_TEST("localtime");
|
||||
DO_TEST("net-e1000");
|
||||
DO_TEST("passthru");
|
||||
DO_TEST("passthru-multiple-devs");
|
||||
DO_TEST("uefi");
|
||||
DO_TEST("uefi-nvram");
|
||||
DO_TEST("uefi-nvram-template-set");
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<domain type='bhyve'>
|
||||
<name>bhyve</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<currentMemory unit='KiB'>219136</currentMemory>
|
||||
<memoryBacking>
|
||||
<locked/>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='localtime'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file' type='raw'/>
|
||||
<source file='/tmp/freebsd.img'/>
|
||||
<target dev='hda' bus='sata'/>
|
||||
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
|
||||
</disk>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<controller type='sata' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
</controller>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x03' slot='0x00' function='0x4'/>
|
||||
</source>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
|
||||
</hostdev>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
|
||||
</source>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</hostdev>
|
||||
<hostdev mode='subsystem' type='pci' managed='no'>
|
||||
<source>
|
||||
<address domain='0x0000' bus='0x05' slot='0x02' function='0x0'/>
|
||||
</source>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</hostdev>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -119,6 +119,7 @@ mymain(void)
|
||||
DO_TEST_DIFFERENT("4-consoles");
|
||||
DO_TEST_DIFFERENT("nvme");
|
||||
DO_TEST_DIFFERENT("2-nvme-2-controllers");
|
||||
DO_TEST_DIFFERENT("passthru-multiple-devs");
|
||||
|
||||
/* Address allocation tests */
|
||||
DO_TEST_DIFFERENT("addr-single-sata-disk");
|
||||
|
||||
Reference in New Issue
Block a user