bhyve: implement PCI address allocation

Automatically allocate PCI addresses for devices instead
of hardcoding them in the driver code. The current
allocation schema is to dedicate an entire slot for each devices.

Also, allow having arbitrary number of devices.
This commit is contained in:
Roman Bogorodskiy
2014-04-12 23:37:53 +04:00
parent 90ba5ef1bb
commit aad479dc4e
21 changed files with 424 additions and 68 deletions

View File

@@ -1,3 +1,3 @@
/usr/sbin/bhyve -c 1 -m 214 -A -I -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd.img bhyve

View File

@@ -15,10 +15,12 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@@ -1,3 +1,3 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd.img bhyve

View File

@@ -11,10 +11,12 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@@ -1,4 +1,4 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd.img \
-s 31,lpc -l com1,/dev/nmdm0A bhyve
-s 1,lpc -l com1,/dev/nmdm0A bhyve

View File

@@ -11,10 +11,12 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<console type='nmdm'>
<source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>

View File

@@ -1,3 +1,3 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,virtio-blk,/tmp/freebsd.img bhyve

View File

@@ -11,10 +11,12 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@@ -1,3 +1,3 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:22:ee:11 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:22:ee:11 \
-s 2:0,ahci-hd,/tmp/freebsd.img bhyve

View File

@@ -11,11 +11,13 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address="52:54:00:22:ee:11"/>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@@ -1,4 +1,4 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 1:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd.img \
-s 31,lpc -l com1,/dev/nmdm0A bhyve
-s 1,lpc -l com1,/dev/nmdm0A bhyve

View File

@@ -11,10 +11,12 @@
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='nmdm'>
<source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>