From: Jan Kiszka <[email protected]> Recent QEMU disabled hotplugging support for the root bus. Linux will still find the ivshmem devices we inject there so far, but it will fail to allocate IRQs for it because the related irq domain was frozen in size, given that hotplug is not possible.
Work around this issue by moving the virtual devices behind a PCIe-PCI bridge that is hotplug-capable. Adding that bridge shuffles some memory regions around, so adjust the configs accordingly. Signed-off-by: Jan Kiszka <[email protected]> --- configs/x86/ivshmem-demo.c | 2 +- configs/x86/linux-x86-demo.c | 34 +++++----- configs/x86/qemu-x86.c | 118 +++++++++++++++++++++++++---------- 3 files changed, 102 insertions(+), 52 deletions(-) diff --git a/configs/x86/ivshmem-demo.c b/configs/x86/ivshmem-demo.c index ce05b6b5..4c24193f 100644 --- a/configs/x86/ivshmem-demo.c +++ b/configs/x86/ivshmem-demo.c @@ -107,7 +107,7 @@ struct { { .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0000, - .bdf = 0x0e << 3, + .bdf = 0x100 | (0x0e << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 16, .shmem_regions_start = 0, diff --git a/configs/x86/linux-x86-demo.c b/configs/x86/linux-x86-demo.c index 47cb6517..0703c5b9 100644 --- a/configs/x86/linux-x86-demo.c +++ b/configs/x86/linux-x86-demo.c @@ -144,31 +144,31 @@ struct { JAILHOUSE_MEM_LOADABLE, }, #ifdef CONFIG_QEMU_E1000E_ASSIGNMENT - /* MemRegion: feb40000-feb7ffff : 0000:00:02.0 */ + /* MemRegion: fea00000-fea3ffff : 0000:00:02.0 */ { - .phys_start = 0xfeb40000, - .virt_start = 0xfeb40000, + .phys_start = 0xfea00000, + .virt_start = 0xfea00000, .size = 0x40000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: feb80000-feb9ffff : e1000e */ + /* MemRegion: fea40000-fea5ffff : e1000e */ { - .phys_start = 0xfeb80000, - .virt_start = 0xfeb80000, + .phys_start = 0xfea40000, + .virt_start = 0xfea40000, .size = 0x20000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: feba0000-febbffff : e1000e */ + /* MemRegion: fea60000-fea7ffff : e1000e */ { - .phys_start = 0xfeba0000, - .virt_start = 0xfeba0000, + .phys_start = 0xfea60000, + .virt_start = 0xfea60000, .size = 0x20000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd1000-febd3fff : e1000e */ + /* MemRegion: fea91000-fea93fff : e1000e */ { - .phys_start = 0xfebd1000, - .virt_start = 0xfebd1000, + .phys_start = 0xfea91000, + .virt_start = 0xfea91000, .size = 0x3000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, @@ -203,7 +203,7 @@ struct { { .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0c << 3, + .bdf = 0x100 | (0x0c << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 2, .shmem_regions_start = 0, @@ -215,7 +215,7 @@ struct { { .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0d << 3, + .bdf = 0x100 | (0x0d << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 3, .shmem_regions_start = 4, @@ -227,7 +227,7 @@ struct { { .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0e << 3, + .bdf = 0x100 | (0x0e << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 16, .shmem_regions_start = 8, @@ -238,7 +238,7 @@ struct { { .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0f << 3, + .bdf = 0x100 | (0x0f << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 2, .shmem_regions_start = 13, @@ -261,7 +261,7 @@ struct { .msi_64bits = 1, .num_msix_vectors = 5, .msix_region_size = 0x1000, - .msix_address = 0xfebd0000, + .msix_address = 0xfea90000, }, #endif }, diff --git a/configs/x86/qemu-x86.c b/configs/x86/qemu-x86.c index 9ca5c528..c4d7ecfc 100644 --- a/configs/x86/qemu-x86.c +++ b/configs/x86/qemu-x86.c @@ -24,9 +24,9 @@ struct { __u64 cpus[1]; struct jailhouse_memory mem_regions[31]; struct jailhouse_irqchip irqchips[1]; - struct jailhouse_pio pio_regions[12]; - struct jailhouse_pci_device pci_devices[11]; - struct jailhouse_pci_capability pci_caps[11]; + struct jailhouse_pio pio_regions[13]; + struct jailhouse_pci_device pci_devices[12]; + struct jailhouse_pci_capability pci_caps[16]; } __attribute__((packed)) config = { .header = { .signature = JAILHOUSE_SYSTEM_SIGNATURE, @@ -171,59 +171,59 @@ struct { .size = 0x1000000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: fe000000-fe003fff : 0000:00:1f.7 (virtio-9p) */ + /* MemRegion: fe200000-fe203fff : 0000:00:1f.7 (virtio-9p) */ { - .phys_start = 0xfe000000, - .virt_start = 0xfe000000, + .phys_start = 0xfe200000, + .virt_start = 0xfe200000, .size = 0x4000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: feb40000-feb7ffff : 0000:00:02.0 */ + /* MemRegion: fea00000-fea3ffff : 0000:00:02.0 */ { - .phys_start = 0xfeb40000, - .virt_start = 0xfeb40000, + .phys_start = 0xfea00000, + .virt_start = 0xfea00000, .size = 0x40000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: feb80000-feb9ffff : e1000e */ + /* MemRegion: fea40000-fea5ffff : e1000e */ { - .phys_start = 0xfeb80000, - .virt_start = 0xfeb80000, + .phys_start = 0xfea40000, + .virt_start = 0xfea40000, .size = 0x20000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: feba0000-febbffff : e1000e */ + /* MemRegion: fea60000-fea7ffff : e1000e */ { - .phys_start = 0xfeba0000, - .virt_start = 0xfeba0000, + .phys_start = 0xfea60000, + .virt_start = 0xfea60000, .size = 0x20000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd1000-febd3fff : e1000e */ + /* MemRegion: fea91000-fea93fff : e1000e */ { - .phys_start = 0xfebd1000, - .virt_start = 0xfebd1000, + .phys_start = 0xfea91000, + .virt_start = 0xfea91000, .size = 0x3000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd4000-febd7fff : 0000:00:1b.0 (ICH HD audio) */ + /* MemRegion: fea94000-fea97fff : 0000:00:1b.0 (ICH HD audio) */ { - .phys_start = 0xfebd4000, - .virt_start = 0xfebd4000, + .phys_start = 0xfea94000, + .virt_start = 0xfea94000, .size = 0x4000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd8000-febd8fff : 0000:00:01.0 (vesafd) */ + /* MemRegion: fea98000-fea98fff : 0000:00:01.0 (vesafd) */ { - .phys_start = 0xfebd8000, - .virt_start = 0xfebd8000, + .phys_start = 0xfea98000, + .virt_start = 0xfea98000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd9000-febd9fff : 0000:00:1f.2 (ahci) */ + /* MemRegion: fea9a000-fea9afff : 0000:00:1f.2 (ahci) */ { - .phys_start = 0xfebd9000, - .virt_start = 0xfebd9000, + .phys_start = 0xfea9a000, + .virt_start = 0xfea9a000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, @@ -257,8 +257,9 @@ struct { PIO_RANGE(0x3b0, 0x30), /* VGA */ PIO_RANGE(0x3f0, 0x8), /* floppy */ PIO_RANGE(0x402, 0x1), /* invalid but accessed by X */ + PIO_RANGE(0xcd0, 0x8), /* QEMU ACPI hotplug */ PIO_RANGE(0x5658, 0x4), /* vmport */ - PIO_RANGE(0xc000, 0xff), /* PCI devices */ + PIO_RANGE(0xd000, 0xff), /* PCI devices */ }, .pci_devices = { @@ -281,7 +282,25 @@ struct { .msi_64bits = 1, .num_msix_vectors = 5, .msix_region_size = 0x1000, - .msix_address = 0xfebd0000, + .msix_address = 0xfea90000, + }, + /* PCI bridge */ + { + .type = JAILHOUSE_PCI_TYPE_BRIDGE, + .domain = 0x0000, + .bdf = 0x0018, + .bar_mask = { + 0xffffff00, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, + }, + .caps_start = 11, + .num_caps = 5, + .num_msi_vectors = 1, + .msi_64bits = 1, + .msi_maskable = 1, + .num_msix_vectors = 0, + .msix_region_size = 0x0, + .msix_address = 0x0, }, { /* ICH HD audio */ .type = JAILHOUSE_PCI_TYPE_DEVICE, @@ -323,12 +342,12 @@ struct { .num_caps = 1, .num_msix_vectors = 2, .msix_region_size = 0x1000, - .msix_address = 0xfebda000, + .msix_address = 0xfea9b000, }, { /* IVSHMEM (virtio-blk back-end) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0c << 3, + .bdf = 0x100 | (0x0c << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 2, .shmem_regions_start = 0, @@ -340,7 +359,7 @@ struct { { /* IVSHMEM (virtio-con back-end) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0, - .bdf = 0x0d << 3, + .bdf = 0x100 | (0x0d << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 3, .shmem_regions_start = 4, @@ -352,7 +371,7 @@ struct { { /* IVSHMEM (demo) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0000, - .bdf = 0x0e << 3, + .bdf = 0x100 | (0x0e << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 16, .shmem_regions_start = 8, @@ -363,7 +382,7 @@ struct { { /* IVSHMEM (networking) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 0x0000, - .bdf = 0x0f << 3, + .bdf = 0x100 | (0x0f << 3), .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX, .num_msix_vectors = 2, .shmem_regions_start = 13, @@ -439,5 +458,36 @@ struct { .len = 4, .flags = 0, }, + /* PCI bridge */ + { + .id = PCI_CAP_ID_MSI, + .start = 0x8c, + .len = 0x18, + .flags = JAILHOUSE_PCICAPS_WRITE, + }, + { + .id = PCI_CAP_ID_PM, + .start = 0x84, + .len = 0x8, + .flags = JAILHOUSE_PCICAPS_WRITE, + }, + { + .id = PCI_CAP_ID_EXP, + .start = 0x48, + .len = 0x3c, + .flags = 0, + }, + { + .id = 0xc, + .start = 0x40, + .len = 0x02, + .flags = 0, + }, + { + .id = PCI_EXT_CAP_ID_ERR | JAILHOUSE_PCI_EXT_CAP, + .start = 0x100, + .len = 0x40, + .flags = 0, + }, }, }; -- 2.35.3 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/11d89ccbe98ae77baaa18dbb68faaef04278ef83.1672643463.git.jan.kiszka%40siemens.com.
