提交 7a25126d 编写于 作者: C Chen Fan 提交者: Michael Tokarev

virtio: rename the bar index field name in VirtIOPCIProxy

the bar index names are much similar to the bar memory regions,
distinguish them to improve the code readability.
Signed-off-by: NChen Fan <fan.chen@easystack.cn>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 0839f11c
...@@ -120,8 +120,8 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) ...@@ -120,8 +120,8 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
* virtio regions are moved to the end of bar #2, to make room for * virtio regions are moved to the end of bar #2, to make room for
* the stdvga mmio registers at the start of bar #2. * the stdvga mmio registers at the start of bar #2.
*/ */
vpci_dev->modern_mem_bar = 2; vpci_dev->modern_mem_bar_idx = 2;
vpci_dev->msix_bar = 4; vpci_dev->msix_bar_idx = 4;
if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) { if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) {
/* /*
......
...@@ -1551,7 +1551,7 @@ static void virtio_pci_modern_mem_region_map(VirtIOPCIProxy *proxy, ...@@ -1551,7 +1551,7 @@ static void virtio_pci_modern_mem_region_map(VirtIOPCIProxy *proxy,
struct virtio_pci_cap *cap) struct virtio_pci_cap *cap)
{ {
virtio_pci_modern_region_map(proxy, region, cap, virtio_pci_modern_region_map(proxy, region, cap,
&proxy->modern_bar, proxy->modern_mem_bar); &proxy->modern_bar, proxy->modern_mem_bar_idx);
} }
static void virtio_pci_modern_io_region_map(VirtIOPCIProxy *proxy, static void virtio_pci_modern_io_region_map(VirtIOPCIProxy *proxy,
...@@ -1559,7 +1559,7 @@ static void virtio_pci_modern_io_region_map(VirtIOPCIProxy *proxy, ...@@ -1559,7 +1559,7 @@ static void virtio_pci_modern_io_region_map(VirtIOPCIProxy *proxy,
struct virtio_pci_cap *cap) struct virtio_pci_cap *cap)
{ {
virtio_pci_modern_region_map(proxy, region, cap, virtio_pci_modern_region_map(proxy, region, cap,
&proxy->io_bar, proxy->modern_io_bar); &proxy->io_bar, proxy->modern_io_bar_idx);
} }
static void virtio_pci_modern_mem_region_unmap(VirtIOPCIProxy *proxy, static void virtio_pci_modern_mem_region_unmap(VirtIOPCIProxy *proxy,
...@@ -1670,14 +1670,14 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) ...@@ -1670,14 +1670,14 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
memory_region_init(&proxy->io_bar, OBJECT(proxy), memory_region_init(&proxy->io_bar, OBJECT(proxy),
"virtio-pci-io", 0x4); "virtio-pci-io", 0x4);
pci_register_bar(&proxy->pci_dev, proxy->modern_io_bar, pci_register_bar(&proxy->pci_dev, proxy->modern_io_bar_idx,
PCI_BASE_ADDRESS_SPACE_IO, &proxy->io_bar); PCI_BASE_ADDRESS_SPACE_IO, &proxy->io_bar);
virtio_pci_modern_io_region_map(proxy, &proxy->notify_pio, virtio_pci_modern_io_region_map(proxy, &proxy->notify_pio,
&notify_pio.cap); &notify_pio.cap);
} }
pci_register_bar(&proxy->pci_dev, proxy->modern_mem_bar, pci_register_bar(&proxy->pci_dev, proxy->modern_mem_bar_idx,
PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_PREFETCH | PCI_BASE_ADDRESS_MEM_PREFETCH |
PCI_BASE_ADDRESS_MEM_TYPE_64, PCI_BASE_ADDRESS_MEM_TYPE_64,
...@@ -1693,7 +1693,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) ...@@ -1693,7 +1693,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
if (proxy->nvectors) { if (proxy->nvectors) {
int err = msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, int err = msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors,
proxy->msix_bar); proxy->msix_bar_idx);
if (err) { if (err) {
/* Notice when a system that supports MSIx can't initialize it. */ /* Notice when a system that supports MSIx can't initialize it. */
if (err != -ENOTSUP) { if (err != -ENOTSUP) {
...@@ -1716,7 +1716,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) ...@@ -1716,7 +1716,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
&virtio_pci_config_ops, &virtio_pci_config_ops,
proxy, "virtio-pci", size); proxy, "virtio-pci", size);
pci_register_bar(&proxy->pci_dev, proxy->legacy_io_bar, pci_register_bar(&proxy->pci_dev, proxy->legacy_io_bar_idx,
PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar);
} }
...@@ -1760,10 +1760,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) ...@@ -1760,10 +1760,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
* region 4+5 -- virtio modern memory (64bit) bar * region 4+5 -- virtio modern memory (64bit) bar
* *
*/ */
proxy->legacy_io_bar = 0; proxy->legacy_io_bar_idx = 0;
proxy->msix_bar = 1; proxy->msix_bar_idx = 1;
proxy->modern_io_bar = 2; proxy->modern_io_bar_idx = 2;
proxy->modern_mem_bar = 4; proxy->modern_mem_bar_idx = 4;
proxy->common.offset = 0x0; proxy->common.offset = 0x0;
proxy->common.size = 0x1000; proxy->common.size = 0x1000;
......
...@@ -143,10 +143,10 @@ struct VirtIOPCIProxy { ...@@ -143,10 +143,10 @@ struct VirtIOPCIProxy {
MemoryRegion io_bar; MemoryRegion io_bar;
MemoryRegion modern_cfg; MemoryRegion modern_cfg;
AddressSpace modern_as; AddressSpace modern_as;
uint32_t legacy_io_bar; uint32_t legacy_io_bar_idx;
uint32_t msix_bar; uint32_t msix_bar_idx;
uint32_t modern_io_bar; uint32_t modern_io_bar_idx;
uint32_t modern_mem_bar; uint32_t modern_mem_bar_idx;
int config_cap; int config_cap;
uint32_t flags; uint32_t flags;
bool disable_modern; bool disable_modern;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册