Message ID | 20201105133923.23821-5-kraxel@redhat.com |
---|---|
State | New |
Headers | show |
Series | microvm: add second ioapic | expand |
On Thu, 5 Nov 2020 14:39:15 +0100 Gerd Hoffmann <kraxel@redhat.com> wrote: "runtime configurable" I read as being able to change during VM life cycle, which isn't the case here, nor this patch makes it actually configurable. So perhaps it needs to be renamed and a commit message explaining why dropping macro and adding a field with hardcoded value is necessary. > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > include/hw/i386/microvm.h | 2 +- > hw/i386/microvm.c | 9 +++++++-- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h > index 0fc216007777..c5d60bacb5e8 100644 > --- a/include/hw/i386/microvm.h > +++ b/include/hw/i386/microvm.h > @@ -52,7 +52,6 @@ > > /* Platform virtio definitions */ > #define VIRTIO_MMIO_BASE 0xfeb00000 > -#define VIRTIO_NUM_TRANSPORTS 8 > #define VIRTIO_CMDLINE_MAXLEN 64 > > #define GED_MMIO_BASE 0xfea00000 > @@ -98,6 +97,7 @@ struct MicrovmMachineState { > > /* Machine state */ > uint32_t virtio_irq_base; > + uint32_t virtio_num_transports; > bool kernel_cmdline_fixed; > Notifier machine_done; > Notifier powerdown_req; > diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c > index 5428448b7059..e92f236bf442 100644 > --- a/hw/i386/microvm.c > +++ b/hw/i386/microvm.c > @@ -178,8 +178,13 @@ static void microvm_devices_init(MicrovmMachineState *mms) > > kvmclock_create(true); > > - mms->virtio_irq_base = x86_machine_is_acpi_enabled(x86ms) ? 16 : 5; > - for (i = 0; i < VIRTIO_NUM_TRANSPORTS; i++) { > + mms->virtio_irq_base = 5; > + mms->virtio_num_transports = 8; > + if (x86_machine_is_acpi_enabled(x86ms)) { > + mms->virtio_irq_base = 16; > + } > + > + for (i = 0; i < mms->virtio_num_transports; i++) { > sysbus_create_simple("virtio-mmio", > VIRTIO_MMIO_BASE + i * 512, > x86ms->gsi[mms->virtio_irq_base + i]);
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index 0fc216007777..c5d60bacb5e8 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -52,7 +52,6 @@ /* Platform virtio definitions */ #define VIRTIO_MMIO_BASE 0xfeb00000 -#define VIRTIO_NUM_TRANSPORTS 8 #define VIRTIO_CMDLINE_MAXLEN 64 #define GED_MMIO_BASE 0xfea00000 @@ -98,6 +97,7 @@ struct MicrovmMachineState { /* Machine state */ uint32_t virtio_irq_base; + uint32_t virtio_num_transports; bool kernel_cmdline_fixed; Notifier machine_done; Notifier powerdown_req; diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 5428448b7059..e92f236bf442 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -178,8 +178,13 @@ static void microvm_devices_init(MicrovmMachineState *mms) kvmclock_create(true); - mms->virtio_irq_base = x86_machine_is_acpi_enabled(x86ms) ? 16 : 5; - for (i = 0; i < VIRTIO_NUM_TRANSPORTS; i++) { + mms->virtio_irq_base = 5; + mms->virtio_num_transports = 8; + if (x86_machine_is_acpi_enabled(x86ms)) { + mms->virtio_irq_base = 16; + } + + for (i = 0; i < mms->virtio_num_transports; i++) { sysbus_create_simple("virtio-mmio", VIRTIO_MMIO_BASE + i * 512, x86ms->gsi[mms->virtio_irq_base + i]);
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/hw/i386/microvm.h | 2 +- hw/i386/microvm.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)