提交 1d0148fe 编写于 作者: P Peter Maydell

hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation

Use the utility function pow2ceil() for rounding up to the next
largest power of 2, rather than inline calculation.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Message-id: 1437741192-20955-3-git-send-email-peter.maydell@linaro.org
上级 9bff5d81
...@@ -1505,9 +1505,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) ...@@ -1505,9 +1505,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
if (legacy) { if (legacy) {
size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev)
+ virtio_bus_get_vdev_config_len(bus); + virtio_bus_get_vdev_config_len(bus);
if (size & (size - 1)) { size = pow2ceil(size);
size = 1 << qemu_fls(size);
}
memory_region_init_io(&proxy->bar, OBJECT(proxy), memory_region_init_io(&proxy->bar, OBJECT(proxy),
&virtio_pci_config_ops, &virtio_pci_config_ops,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册