Commit 786a9f88 authored by Amos Kong's avatar Amos Kong Committed by Avi Kivity

KVM: set upper bounds for iobus dev to limit userspace

kvm_io_bus devices are used for ioevent, pit, pic, ioapic,
coalesced_mmio.

Currently Qemu only emulates one PCI bus, it contains 32 slots,
one slot contains 8 functions, maximum of supported PCI devices:
 1 * 32 * 8 = 256. One virtio-blk takes one iobus device,
one virtio-net(vhost=on) takes two iobus devices.
The maximum of coalesced mmio zone is 100, each zone
has an iobus devices. So 300 io_bus devices are not enough.

Set an upper bounds for kvm_io_range to limit userspace.
1000 is a very large limit and not bloat the typical user.
Signed-off-by: default avatarAmos Kong <akong@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent a1300716
...@@ -68,7 +68,7 @@ struct kvm_io_range { ...@@ -68,7 +68,7 @@ struct kvm_io_range {
struct kvm_io_device *dev; struct kvm_io_device *dev;
}; };
#define NR_IOBUS_DEVS 300 #define NR_IOBUS_DEVS 1000
struct kvm_io_bus { struct kvm_io_bus {
int dev_count; int dev_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment