virtio-pci: move cap type to VirtIOPCIRegion
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
54790d71e4
commit
fc004905c5
|
@ -1252,18 +1252,21 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy)
|
||||||
proxy,
|
proxy,
|
||||||
"virtio-pci-common", 0x1000);
|
"virtio-pci-common", 0x1000);
|
||||||
proxy->common.offset = 0x0;
|
proxy->common.offset = 0x0;
|
||||||
|
proxy->common.type = VIRTIO_PCI_CAP_COMMON_CFG;
|
||||||
|
|
||||||
memory_region_init_io(&proxy->isr.mr, OBJECT(proxy),
|
memory_region_init_io(&proxy->isr.mr, OBJECT(proxy),
|
||||||
&isr_ops,
|
&isr_ops,
|
||||||
proxy,
|
proxy,
|
||||||
"virtio-pci-isr", 0x1000);
|
"virtio-pci-isr", 0x1000);
|
||||||
proxy->isr.offset = 0x1000;
|
proxy->isr.offset = 0x1000;
|
||||||
|
proxy->isr.type = VIRTIO_PCI_CAP_ISR_CFG;
|
||||||
|
|
||||||
memory_region_init_io(&proxy->device.mr, OBJECT(proxy),
|
memory_region_init_io(&proxy->device.mr, OBJECT(proxy),
|
||||||
&device_ops,
|
&device_ops,
|
||||||
virtio_bus_get_device(&proxy->bus),
|
virtio_bus_get_device(&proxy->bus),
|
||||||
"virtio-pci-device", 0x1000);
|
"virtio-pci-device", 0x1000);
|
||||||
proxy->device.offset = 0x2000;
|
proxy->device.offset = 0x2000;
|
||||||
|
proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG;
|
||||||
|
|
||||||
memory_region_init_io(&proxy->notify.mr, OBJECT(proxy),
|
memory_region_init_io(&proxy->notify.mr, OBJECT(proxy),
|
||||||
¬ify_ops,
|
¬ify_ops,
|
||||||
|
@ -1272,6 +1275,7 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy)
|
||||||
QEMU_VIRTIO_PCI_QUEUE_MEM_MULT *
|
QEMU_VIRTIO_PCI_QUEUE_MEM_MULT *
|
||||||
VIRTIO_QUEUE_MAX);
|
VIRTIO_QUEUE_MAX);
|
||||||
proxy->notify.offset = 0x3000;
|
proxy->notify.offset = 0x3000;
|
||||||
|
proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy,
|
static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy,
|
||||||
|
@ -1282,6 +1286,7 @@ static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy,
|
||||||
region->offset,
|
region->offset,
|
||||||
®ion->mr);
|
®ion->mr);
|
||||||
|
|
||||||
|
cap->cfg_type = region->type;
|
||||||
cap->offset = cpu_to_le32(region->offset);
|
cap->offset = cpu_to_le32(region->offset);
|
||||||
cap->length = cpu_to_le32(memory_region_size(®ion->mr));
|
cap->length = cpu_to_le32(memory_region_size(®ion->mr));
|
||||||
virtio_pci_add_mem_cap(proxy, cap);
|
virtio_pci_add_mem_cap(proxy, cap);
|
||||||
|
@ -1337,22 +1342,18 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
|
||||||
|
|
||||||
if (modern) {
|
if (modern) {
|
||||||
struct virtio_pci_cap common = {
|
struct virtio_pci_cap common = {
|
||||||
.cfg_type = VIRTIO_PCI_CAP_COMMON_CFG,
|
|
||||||
.cap_len = sizeof common,
|
.cap_len = sizeof common,
|
||||||
.bar = modern_mem_bar,
|
.bar = modern_mem_bar,
|
||||||
};
|
};
|
||||||
struct virtio_pci_cap isr = {
|
struct virtio_pci_cap isr = {
|
||||||
.cfg_type = VIRTIO_PCI_CAP_ISR_CFG,
|
|
||||||
.cap_len = sizeof isr,
|
.cap_len = sizeof isr,
|
||||||
.bar = modern_mem_bar,
|
.bar = modern_mem_bar,
|
||||||
};
|
};
|
||||||
struct virtio_pci_cap device = {
|
struct virtio_pci_cap device = {
|
||||||
.cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG,
|
|
||||||
.cap_len = sizeof device,
|
.cap_len = sizeof device,
|
||||||
.bar = modern_mem_bar,
|
.bar = modern_mem_bar,
|
||||||
};
|
};
|
||||||
struct virtio_pci_notify_cap notify = {
|
struct virtio_pci_notify_cap notify = {
|
||||||
.cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG,
|
|
||||||
.cap.cap_len = sizeof notify,
|
.cap.cap_len = sizeof notify,
|
||||||
.cap.bar = modern_mem_bar,
|
.cap.bar = modern_mem_bar,
|
||||||
.notify_off_multiplier =
|
.notify_off_multiplier =
|
||||||
|
|
|
@ -94,6 +94,7 @@ typedef struct VirtioPCIClass {
|
||||||
typedef struct VirtIOPCIRegion {
|
typedef struct VirtIOPCIRegion {
|
||||||
MemoryRegion mr;
|
MemoryRegion mr;
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
|
uint32_t type;
|
||||||
} VirtIOPCIRegion;
|
} VirtIOPCIRegion;
|
||||||
|
|
||||||
struct VirtIOPCIProxy {
|
struct VirtIOPCIProxy {
|
||||||
|
|
Loading…
Reference in a new issue