Message ID | 1403632924-16603-4-git-send-email-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
On Tue, 2014-06-24 at 15:02 -0300, Eduardo Habkost wrote: > The QEMU_COMPAT_* macros will contain compat properties that are not > specific to PC, and may be reused by other machine-types. > > PC-specific properties were left on the PC_COMPAT_* macros. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > include/hw/i386/pc.h | 150 ++--------------------------------------------- > 2 files changed, 166 insertions(+), 145 deletions(-) > > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 605a970..709b582 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -134,4 +134,165 @@ struct MachineState { > const char *cpu_model; > }; > > + > +/* Macros for compat_props corresponding to specific QEMU versions: */ Only a suggestion: Maybe we can move all the compat props to a new header file, say include/hw/compat.h so we don't need to modify board.h every time we need a compat prop? board.h will remain cleaner this way. Thanks, Marcel > + > +#define QEMU_COMPAT_2_0 \ > + {\ > + .driver = "virtio-scsi-pci",\ > + .property = "any_layout",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "apic",\ > + .property = "version",\ > + .value = stringify(0x11),\ > + },\ > + {\ > + .driver = "nec-usb-xhci",\ > + .property = "superspeed-ports-first",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "pci-serial",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-2x",\ > + .property = "prof_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-4x",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "virtio-net-pci",\ > + .property = "guest_announce",\ > + .value = "off",\ > + } > + > +#define QEMU_COMPAT_1_7 \ > + {\ > + .driver = TYPE_USB_DEVICE,\ > + .property = "msos-desc",\ > + .value = "no",\ > + } > + > +#define QEMU_COMPAT_1_6 \ > + {\ > + .driver = "e1000",\ > + .property = "mitigation",\ > + .value = "off",\ > + },{\ > + .driver = "qemu64-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "qemu32-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(3),\ > + } > + > +#define QEMU_COMPAT_1_5 \ > + {\ > + .driver = "Conroe-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Conroe-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Penryn-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Penryn-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Nehalem-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Nehalem-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ > + },{\ > + .driver = "virtio-net-pci",\ > + .property = "any_layout",\ > + .value = "off",\ > + },{\ > + .driver = TYPE_X86_CPU,\ > + .property = "pmu",\ > + .value = "on",\ > + } > + > +#define QEMU_COMPAT_1_4 \ > + {\ > + .driver = "scsi-hd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "scsi-cd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "scsi-disk",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-hd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-cd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-drive",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "virtio-blk-pci",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "virtio-serial-pci",\ > + .property = "vectors",\ > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > + .value = stringify(0xFFFFFFFF),\ > + },{ \ > + .driver = "virtio-net-pci", \ > + .property = "ctrl_guest_offloads", \ > + .value = "off", \ > + },{\ > + .driver = "e1000",\ > + .property = "romfile",\ > + .value = "pxe-e1000.rom",\ > + },{\ > + .driver = "ne2k_pci",\ > + .property = "romfile",\ > + .value = "pxe-ne2k_pci.rom",\ > + },{\ > + .driver = "pcnet",\ > + .property = "romfile",\ > + .value = "pxe-pcnet.rom",\ > + },{\ > + .driver = "rtl8139",\ > + .property = "romfile",\ > + .value = "pxe-rtl8139.rom",\ > + },{\ > + .driver = "virtio-net-pci",\ > + .property = "romfile",\ > + .value = "pxe-virtio.rom",\ > + },{\ > + .driver = "486-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(0),\ > + } > + > #endif > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index d988b80..631afe7 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > #define PC_COMPAT_2_0 \ > + QEMU_COMPAT_2_0,\ > {\ > - .driver = "virtio-scsi-pci",\ > - .property = "any_layout",\ > - .value = "off",\ > - },{\ > .driver = "PIIX4_PM",\ > .property = "memory-hotplug-support",\ > .value = "off",\ > - },\ > - {\ > - .driver = "apic",\ > - .property = "version",\ > - .value = stringify(0x11),\ > - },\ > - {\ > - .driver = "nec-usb-xhci",\ > - .property = "superspeed-ports-first",\ > - .value = "off",\ > - },\ > - {\ > - .driver = "pci-serial",\ > - .property = "prog_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "pci-serial-2x",\ > - .property = "prof_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "pci-serial-4x",\ > - .property = "prog_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "virtio-net-pci",\ > - .property = "guest_announce",\ > - .value = "off",\ > } > > #define PC_COMPAT_1_7 \ > - {\ > - .driver = TYPE_USB_DEVICE,\ > - .property = "msos-desc",\ > - .value = "no",\ > - },\ > + QEMU_COMPAT_1_7,\ > {\ > .driver = "PIIX4_PM",\ > .property = "acpi-pci-hotplug-with-bridge-support",\ > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_6 \ > + QEMU_COMPAT_1_6,\ > {\ > - .driver = "e1000",\ > - .property = "mitigation",\ > - .value = "off",\ > - },{\ > - .driver = "qemu64-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "qemu32-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(3),\ > - },{\ > .driver = "i440FX-pcihost",\ > .property = "short_root_bus",\ > .value = stringify(1),\ > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_5 \ > + QEMU_COMPAT_1_7,\ > {\ > - .driver = "Conroe-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Conroe-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Penryn-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Penryn-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Nehalem-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Nehalem-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "virtio-net-pci",\ > - .property = "any_layout",\ > - .value = "off",\ > - },{\ > - .driver = TYPE_X86_CPU,\ > - .property = "pmu",\ > - .value = "on",\ > - },{\ > .driver = "i440FX-pcihost",\ > .property = "short_root_bus",\ > .value = stringify(0),\ > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_4 \ > - {\ > - .driver = "scsi-hd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "scsi-cd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "scsi-disk",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-hd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-cd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-drive",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "virtio-blk-pci",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "virtio-serial-pci",\ > - .property = "vectors",\ > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > - .value = stringify(0xFFFFFFFF),\ > - },{ \ > - .driver = "virtio-net-pci", \ > - .property = "ctrl_guest_offloads", \ > - .value = "off", \ > - },{\ > - .driver = "e1000",\ > - .property = "romfile",\ > - .value = "pxe-e1000.rom",\ > - },{\ > - .driver = "ne2k_pci",\ > - .property = "romfile",\ > - .value = "pxe-ne2k_pci.rom",\ > - },{\ > - .driver = "pcnet",\ > - .property = "romfile",\ > - .value = "pxe-pcnet.rom",\ > - },{\ > - .driver = "rtl8139",\ > - .property = "romfile",\ > - .value = "pxe-rtl8139.rom",\ > - },{\ > - .driver = "virtio-net-pci",\ > - .property = "romfile",\ > - .value = "pxe-virtio.rom",\ > - },{\ > - .driver = "486-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(0),\ > - } > + QEMU_COMPAT_1_4 > > #define PC_COMMON_MACHINE_OPTIONS \ > .default_boot_order = "cad"
On Tue, 24 Jun 2014, Eduardo Habkost wrote: > The QEMU_COMPAT_* macros will contain compat properties that are not > specific to PC, and may be reused by other machine-types. > > PC-specific properties were left on the PC_COMPAT_* macros. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > include/hw/i386/pc.h | 150 ++--------------------------------------------- > 2 files changed, 166 insertions(+), 145 deletions(-) > > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 605a970..709b582 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -134,4 +134,165 @@ struct MachineState { > const char *cpu_model; > }; > > + > +/* Macros for compat_props corresponding to specific QEMU versions: */ > + > +#define QEMU_COMPAT_2_0 \ > + {\ > + .driver = "virtio-scsi-pci",\ > + .property = "any_layout",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "apic",\ > + .property = "version",\ > + .value = stringify(0x11),\ > + },\ > + {\ > + .driver = "nec-usb-xhci",\ > + .property = "superspeed-ports-first",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "pci-serial",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-2x",\ > + .property = "prof_if",\ Just noticed a typo now in this part which was added by me previously. This should also be "prog_if" instead of "prof_if". Can you also correct that while changing this or otherwise while merging or should I send a separate patch with just this change? Regards, BALATON Zoltan > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-4x",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "virtio-net-pci",\ > + .property = "guest_announce",\ > + .value = "off",\ > + } > + > +#define QEMU_COMPAT_1_7 \
On Tue, Jun 24, 2014 at 10:58:29PM +0200, BALATON Zoltan wrote: > On Tue, 24 Jun 2014, Eduardo Habkost wrote: [...] > >+ .driver = "pci-serial",\ > >+ .property = "prog_if",\ > >+ .value = stringify(0),\ > >+ },\ > >+ {\ > >+ .driver = "pci-serial-2x",\ > >+ .property = "prof_if",\ > > Just noticed a typo now in this part which was added by me previously. This > should also be "prog_if" instead of "prof_if". Can you also correct that > while changing this or otherwise while merging or should I send a separate > patch with just this change? I just sent a separate patch for that. I prefer not to change code while moving it.
On Tue, Jun 24, 2014 at 03:02:03PM -0300, Eduardo Habkost wrote: > The QEMU_COMPAT_* macros will contain compat properties that are not > specific to PC, and may be reused by other machine-types. > > PC-specific properties were left on the PC_COMPAT_* macros. > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > --- > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > include/hw/i386/pc.h | 150 ++--------------------------------------------- > 2 files changed, 166 insertions(+), 145 deletions(-) > > diff --git a/include/hw/boards.h b/include/hw/boards.h > index 605a970..709b582 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -134,4 +134,165 @@ struct MachineState { > const char *cpu_model; > }; > > + > +/* Macros for compat_props corresponding to specific QEMU versions: */ > + > +#define QEMU_COMPAT_2_0 \ > + {\ > + .driver = "virtio-scsi-pci",\ > + .property = "any_layout",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "apic",\ > + .property = "version",\ > + .value = stringify(0x11),\ > + },\ > + {\ > + .driver = "nec-usb-xhci",\ > + .property = "superspeed-ports-first",\ > + .value = "off",\ > + },\ > + {\ > + .driver = "pci-serial",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-2x",\ > + .property = "prof_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "pci-serial-4x",\ > + .property = "prog_if",\ > + .value = stringify(0),\ > + },\ > + {\ > + .driver = "virtio-net-pci",\ > + .property = "guest_announce",\ > + .value = "off",\ > + } > + > +#define QEMU_COMPAT_1_7 \ > + {\ > + .driver = TYPE_USB_DEVICE,\ > + .property = "msos-desc",\ > + .value = "no",\ > + } > + > +#define QEMU_COMPAT_1_6 \ > + {\ > + .driver = "e1000",\ > + .property = "mitigation",\ > + .value = "off",\ > + },{\ > + .driver = "qemu64-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "qemu32-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(3),\ > + } > + > +#define QEMU_COMPAT_1_5 \ > + {\ > + .driver = "Conroe-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Conroe-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Penryn-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Penryn-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Nehalem-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(2),\ > + },{\ > + .driver = "Nehalem-" TYPE_X86_CPU,\ > + .property = "level",\ > + .value = stringify(2),\ Above are x86 CPUs - why have them in a common header? There's no chance any machine except PIIX&Q35 needs these. > + .driver = "virtio-net-pci",\ > + .property = "any_layout",\ > + .value = "off",\ Here's an example. If you are using a non x86 target, QEMU 2.0 has no way to select a machine with this value. So why expose it? > + },{\ > + .driver = TYPE_X86_CPU,\ > + .property = "pmu",\ > + .value = "on",\ > + } > + > +#define QEMU_COMPAT_1_4 \ > + {\ > + .driver = "scsi-hd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "scsi-cd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "scsi-disk",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-hd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-cd",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "ide-drive",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "virtio-blk-pci",\ > + .property = "discard_granularity",\ > + .value = stringify(0),\ > + },{\ > + .driver = "virtio-serial-pci",\ > + .property = "vectors",\ > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > + .value = stringify(0xFFFFFFFF),\ > + },{ \ > + .driver = "virtio-net-pci", \ > + .property = "ctrl_guest_offloads", \ > + .value = "off", \ > + },{\ > + .driver = "e1000",\ > + .property = "romfile",\ > + .value = "pxe-e1000.rom",\ > + },{\ > + .driver = "ne2k_pci",\ > + .property = "romfile",\ > + .value = "pxe-ne2k_pci.rom",\ > + },{\ > + .driver = "pcnet",\ > + .property = "romfile",\ > + .value = "pxe-pcnet.rom",\ > + },{\ > + .driver = "rtl8139",\ > + .property = "romfile",\ > + .value = "pxe-rtl8139.rom",\ > + },{\ > + .driver = "virtio-net-pci",\ > + .property = "romfile",\ > + .value = "pxe-virtio.rom",\ > + },{\ > + .driver = "486-" TYPE_X86_CPU,\ > + .property = "model",\ > + .value = stringify(0),\ > + } > + > #endif > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > index d988b80..631afe7 100644 > --- a/include/hw/i386/pc.h > +++ b/include/hw/i386/pc.h > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > #define PC_COMPAT_2_0 \ > + QEMU_COMPAT_2_0,\ > {\ > - .driver = "virtio-scsi-pci",\ > - .property = "any_layout",\ > - .value = "off",\ > - },{\ > .driver = "PIIX4_PM",\ > .property = "memory-hotplug-support",\ > .value = "off",\ > - },\ > - {\ > - .driver = "apic",\ > - .property = "version",\ > - .value = stringify(0x11),\ > - },\ > - {\ > - .driver = "nec-usb-xhci",\ > - .property = "superspeed-ports-first",\ > - .value = "off",\ > - },\ > - {\ > - .driver = "pci-serial",\ > - .property = "prog_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "pci-serial-2x",\ > - .property = "prof_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "pci-serial-4x",\ > - .property = "prog_if",\ > - .value = stringify(0),\ > - },\ > - {\ > - .driver = "virtio-net-pci",\ > - .property = "guest_announce",\ > - .value = "off",\ > } > > #define PC_COMPAT_1_7 \ > - {\ > - .driver = TYPE_USB_DEVICE,\ > - .property = "msos-desc",\ > - .value = "no",\ > - },\ > + QEMU_COMPAT_1_7,\ > {\ > .driver = "PIIX4_PM",\ > .property = "acpi-pci-hotplug-with-bridge-support",\ > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_6 \ > + QEMU_COMPAT_1_6,\ > {\ > - .driver = "e1000",\ > - .property = "mitigation",\ > - .value = "off",\ > - },{\ > - .driver = "qemu64-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "qemu32-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(3),\ > - },{\ > .driver = "i440FX-pcihost",\ > .property = "short_root_bus",\ > .value = stringify(1),\ > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_5 \ > + QEMU_COMPAT_1_7,\ > {\ > - .driver = "Conroe-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Conroe-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Penryn-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Penryn-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Nehalem-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(2),\ > - },{\ > - .driver = "Nehalem-" TYPE_X86_CPU,\ > - .property = "level",\ > - .value = stringify(2),\ > - },{\ > - .driver = "virtio-net-pci",\ > - .property = "any_layout",\ > - .value = "off",\ > - },{\ > - .driver = TYPE_X86_CPU,\ > - .property = "pmu",\ > - .value = "on",\ > - },{\ > .driver = "i440FX-pcihost",\ > .property = "short_root_bus",\ > .value = stringify(0),\ > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > } > > #define PC_COMPAT_1_4 \ > - {\ > - .driver = "scsi-hd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "scsi-cd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "scsi-disk",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-hd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-cd",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "ide-drive",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "virtio-blk-pci",\ > - .property = "discard_granularity",\ > - .value = stringify(0),\ > - },{\ > - .driver = "virtio-serial-pci",\ > - .property = "vectors",\ > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > - .value = stringify(0xFFFFFFFF),\ > - },{ \ > - .driver = "virtio-net-pci", \ > - .property = "ctrl_guest_offloads", \ > - .value = "off", \ > - },{\ > - .driver = "e1000",\ > - .property = "romfile",\ > - .value = "pxe-e1000.rom",\ > - },{\ > - .driver = "ne2k_pci",\ > - .property = "romfile",\ > - .value = "pxe-ne2k_pci.rom",\ > - },{\ > - .driver = "pcnet",\ > - .property = "romfile",\ > - .value = "pxe-pcnet.rom",\ > - },{\ > - .driver = "rtl8139",\ > - .property = "romfile",\ > - .value = "pxe-rtl8139.rom",\ > - },{\ > - .driver = "virtio-net-pci",\ > - .property = "romfile",\ > - .value = "pxe-virtio.rom",\ > - },{\ > - .driver = "486-" TYPE_X86_CPU,\ > - .property = "model",\ > - .value = stringify(0),\ > - } > + QEMU_COMPAT_1_4 > > #define PC_COMMON_MACHINE_OPTIONS \ > .default_boot_order = "cad" > -- > 1.9.3
On Tue, 24 Jun 2014 22:20:50 +0300 Marcel Apfelbaum <marcel.a@redhat.com> wrote: > On Tue, 2014-06-24 at 15:02 -0300, Eduardo Habkost wrote: > > The QEMU_COMPAT_* macros will contain compat properties that are not > > specific to PC, and may be reused by other machine-types. > > > > PC-specific properties were left on the PC_COMPAT_* macros. > > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > --- > > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > include/hw/i386/pc.h | 150 ++--------------------------------------------- > > 2 files changed, 166 insertions(+), 145 deletions(-) > > > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > index 605a970..709b582 100644 > > --- a/include/hw/boards.h > > +++ b/include/hw/boards.h > > @@ -134,4 +134,165 @@ struct MachineState { > > const char *cpu_model; > > }; > > > > + > > +/* Macros for compat_props corresponding to specific QEMU versions: */ > Only a suggestion: Maybe we can move all the compat props to a new header file, > say include/hw/compat.h so we don't need to modify board.h every time we need a > compat prop? board.h will remain cleaner this way. these are PC specific compat props, so it should be moved into target specific pc.h instead of global header. > Thanks, > Marcel > > > + > > +#define QEMU_COMPAT_2_0 \ > > + {\ > > + .driver = "virtio-scsi-pci",\ > > + .property = "any_layout",\ > > + .value = "off",\ > > + },\ > > + {\ > > + .driver = "apic",\ > > + .property = "version",\ > > + .value = stringify(0x11),\ > > + },\ > > + {\ > > + .driver = "nec-usb-xhci",\ > > + .property = "superspeed-ports-first",\ > > + .value = "off",\ > > + },\ > > + {\ > > + .driver = "pci-serial",\ > > + .property = "prog_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "pci-serial-2x",\ > > + .property = "prof_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "pci-serial-4x",\ > > + .property = "prog_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "virtio-net-pci",\ > > + .property = "guest_announce",\ > > + .value = "off",\ > > + } > > + > > +#define QEMU_COMPAT_1_7 \ > > + {\ > > + .driver = TYPE_USB_DEVICE,\ > > + .property = "msos-desc",\ > > + .value = "no",\ > > + } > > + > > +#define QEMU_COMPAT_1_6 \ > > + {\ > > + .driver = "e1000",\ > > + .property = "mitigation",\ > > + .value = "off",\ > > + },{\ > > + .driver = "qemu64-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "qemu32-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(3),\ > > + } > > + > > +#define QEMU_COMPAT_1_5 \ > > + {\ > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "virtio-net-pci",\ > > + .property = "any_layout",\ > > + .value = "off",\ > > + },{\ > > + .driver = TYPE_X86_CPU,\ > > + .property = "pmu",\ > > + .value = "on",\ > > + } > > + > > +#define QEMU_COMPAT_1_4 \ > > + {\ > > + .driver = "scsi-hd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "scsi-cd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "scsi-disk",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-hd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-cd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-drive",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "virtio-blk-pci",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "virtio-serial-pci",\ > > + .property = "vectors",\ > > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > + .value = stringify(0xFFFFFFFF),\ > > + },{ \ > > + .driver = "virtio-net-pci", \ > > + .property = "ctrl_guest_offloads", \ > > + .value = "off", \ > > + },{\ > > + .driver = "e1000",\ > > + .property = "romfile",\ > > + .value = "pxe-e1000.rom",\ > > + },{\ > > + .driver = "ne2k_pci",\ > > + .property = "romfile",\ > > + .value = "pxe-ne2k_pci.rom",\ > > + },{\ > > + .driver = "pcnet",\ > > + .property = "romfile",\ > > + .value = "pxe-pcnet.rom",\ > > + },{\ > > + .driver = "rtl8139",\ > > + .property = "romfile",\ > > + .value = "pxe-rtl8139.rom",\ > > + },{\ > > + .driver = "virtio-net-pci",\ > > + .property = "romfile",\ > > + .value = "pxe-virtio.rom",\ > > + },{\ > > + .driver = "486-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(0),\ > > + } > > + > > #endif > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > > index d988b80..631afe7 100644 > > --- a/include/hw/i386/pc.h > > +++ b/include/hw/i386/pc.h > > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > #define PC_COMPAT_2_0 \ > > + QEMU_COMPAT_2_0,\ > > {\ > > - .driver = "virtio-scsi-pci",\ > > - .property = "any_layout",\ > > - .value = "off",\ > > - },{\ > > .driver = "PIIX4_PM",\ > > .property = "memory-hotplug-support",\ > > .value = "off",\ > > - },\ > > - {\ > > - .driver = "apic",\ > > - .property = "version",\ > > - .value = stringify(0x11),\ > > - },\ > > - {\ > > - .driver = "nec-usb-xhci",\ > > - .property = "superspeed-ports-first",\ > > - .value = "off",\ > > - },\ > > - {\ > > - .driver = "pci-serial",\ > > - .property = "prog_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "pci-serial-2x",\ > > - .property = "prof_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "pci-serial-4x",\ > > - .property = "prog_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "virtio-net-pci",\ > > - .property = "guest_announce",\ > > - .value = "off",\ > > } > > > > #define PC_COMPAT_1_7 \ > > - {\ > > - .driver = TYPE_USB_DEVICE,\ > > - .property = "msos-desc",\ > > - .value = "no",\ > > - },\ > > + QEMU_COMPAT_1_7,\ > > {\ > > .driver = "PIIX4_PM",\ > > .property = "acpi-pci-hotplug-with-bridge-support",\ > > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_6 \ > > + QEMU_COMPAT_1_6,\ > > {\ > > - .driver = "e1000",\ > > - .property = "mitigation",\ > > - .value = "off",\ > > - },{\ > > - .driver = "qemu64-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "qemu32-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(3),\ > > - },{\ > > .driver = "i440FX-pcihost",\ > > .property = "short_root_bus",\ > > .value = stringify(1),\ > > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_5 \ > > + QEMU_COMPAT_1_7,\ > > {\ > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "virtio-net-pci",\ > > - .property = "any_layout",\ > > - .value = "off",\ > > - },{\ > > - .driver = TYPE_X86_CPU,\ > > - .property = "pmu",\ > > - .value = "on",\ > > - },{\ > > .driver = "i440FX-pcihost",\ > > .property = "short_root_bus",\ > > .value = stringify(0),\ > > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_4 \ > > - {\ > > - .driver = "scsi-hd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "scsi-cd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "scsi-disk",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-hd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-cd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-drive",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "virtio-blk-pci",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "virtio-serial-pci",\ > > - .property = "vectors",\ > > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > - .value = stringify(0xFFFFFFFF),\ > > - },{ \ > > - .driver = "virtio-net-pci", \ > > - .property = "ctrl_guest_offloads", \ > > - .value = "off", \ > > - },{\ > > - .driver = "e1000",\ > > - .property = "romfile",\ > > - .value = "pxe-e1000.rom",\ > > - },{\ > > - .driver = "ne2k_pci",\ > > - .property = "romfile",\ > > - .value = "pxe-ne2k_pci.rom",\ > > - },{\ > > - .driver = "pcnet",\ > > - .property = "romfile",\ > > - .value = "pxe-pcnet.rom",\ > > - },{\ > > - .driver = "rtl8139",\ > > - .property = "romfile",\ > > - .value = "pxe-rtl8139.rom",\ > > - },{\ > > - .driver = "virtio-net-pci",\ > > - .property = "romfile",\ > > - .value = "pxe-virtio.rom",\ > > - },{\ > > - .driver = "486-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(0),\ > > - } > > + QEMU_COMPAT_1_4 > > > > #define PC_COMMON_MACHINE_OPTIONS \ > > .default_boot_order = "cad" > > >
On Wed, 2014-06-25 at 08:20 +0300, Michael S. Tsirkin wrote: > On Tue, Jun 24, 2014 at 03:02:03PM -0300, Eduardo Habkost wrote: > > The QEMU_COMPAT_* macros will contain compat properties that are not > > specific to PC, and may be reused by other machine-types. > > > > PC-specific properties were left on the PC_COMPAT_* macros. > > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > --- > > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > include/hw/i386/pc.h | 150 ++--------------------------------------------- > > 2 files changed, 166 insertions(+), 145 deletions(-) > > > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > index 605a970..709b582 100644 > > --- a/include/hw/boards.h > > +++ b/include/hw/boards.h > > @@ -134,4 +134,165 @@ struct MachineState { > > const char *cpu_model; > > }; > > > > + > > +/* Macros for compat_props corresponding to specific QEMU versions: */ > > + > > +#define QEMU_COMPAT_2_0 \ > > + {\ > > + .driver = "virtio-scsi-pci",\ > > + .property = "any_layout",\ > > + .value = "off",\ > > + },\ > > + {\ > > + .driver = "apic",\ > > + .property = "version",\ > > + .value = stringify(0x11),\ > > + },\ > > + {\ > > + .driver = "nec-usb-xhci",\ > > + .property = "superspeed-ports-first",\ > > + .value = "off",\ > > + },\ > > + {\ > > + .driver = "pci-serial",\ > > + .property = "prog_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "pci-serial-2x",\ > > + .property = "prof_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "pci-serial-4x",\ > > + .property = "prog_if",\ > > + .value = stringify(0),\ > > + },\ > > + {\ > > + .driver = "virtio-net-pci",\ > > + .property = "guest_announce",\ > > + .value = "off",\ > > + } > > + > > +#define QEMU_COMPAT_1_7 \ > > + {\ > > + .driver = TYPE_USB_DEVICE,\ > > + .property = "msos-desc",\ > > + .value = "no",\ > > + } > > + > > +#define QEMU_COMPAT_1_6 \ > > + {\ > > + .driver = "e1000",\ > > + .property = "mitigation",\ > > + .value = "off",\ > > + },{\ > > + .driver = "qemu64-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "qemu32-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(3),\ > > + } > > + > > +#define QEMU_COMPAT_1_5 \ > > + {\ > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(2),\ > > + },{\ > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > + .property = "level",\ > > + .value = stringify(2),\ > > Above are x86 CPUs - why have them in a common header? > There's no chance any machine except PIIX&Q35 needs these. > > > + .driver = "virtio-net-pci",\ > > + .property = "any_layout",\ > > + .value = "off",\ > > Here's an example. > If you are using a non x86 target, QEMU 2.0 > has no way to select a machine with this > value. > So why expose it? As we talked on the KVM call, the objective is to assign the compat properties per QEMU version and close to their device. As a *middle* step we shall put all together in a common file per version and not per machine type, and then work on a registration mechanism that will be based on the fact that compat properties are per device and versioned by QEMU. Thanks, Marcel > > > > + },{\ > > + .driver = TYPE_X86_CPU,\ > > + .property = "pmu",\ > > + .value = "on",\ > > + } > > + > > +#define QEMU_COMPAT_1_4 \ > > + {\ > > + .driver = "scsi-hd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "scsi-cd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "scsi-disk",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-hd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-cd",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "ide-drive",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "virtio-blk-pci",\ > > + .property = "discard_granularity",\ > > + .value = stringify(0),\ > > + },{\ > > + .driver = "virtio-serial-pci",\ > > + .property = "vectors",\ > > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > + .value = stringify(0xFFFFFFFF),\ > > + },{ \ > > + .driver = "virtio-net-pci", \ > > + .property = "ctrl_guest_offloads", \ > > + .value = "off", \ > > + },{\ > > + .driver = "e1000",\ > > + .property = "romfile",\ > > + .value = "pxe-e1000.rom",\ > > + },{\ > > + .driver = "ne2k_pci",\ > > + .property = "romfile",\ > > + .value = "pxe-ne2k_pci.rom",\ > > + },{\ > > + .driver = "pcnet",\ > > + .property = "romfile",\ > > + .value = "pxe-pcnet.rom",\ > > + },{\ > > + .driver = "rtl8139",\ > > + .property = "romfile",\ > > + .value = "pxe-rtl8139.rom",\ > > + },{\ > > + .driver = "virtio-net-pci",\ > > + .property = "romfile",\ > > + .value = "pxe-virtio.rom",\ > > + },{\ > > + .driver = "486-" TYPE_X86_CPU,\ > > + .property = "model",\ > > + .value = stringify(0),\ > > + } > > + > > #endif > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > > index d988b80..631afe7 100644 > > --- a/include/hw/i386/pc.h > > +++ b/include/hw/i386/pc.h > > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > #define PC_COMPAT_2_0 \ > > + QEMU_COMPAT_2_0,\ > > {\ > > - .driver = "virtio-scsi-pci",\ > > - .property = "any_layout",\ > > - .value = "off",\ > > - },{\ > > .driver = "PIIX4_PM",\ > > .property = "memory-hotplug-support",\ > > .value = "off",\ > > - },\ > > - {\ > > - .driver = "apic",\ > > - .property = "version",\ > > - .value = stringify(0x11),\ > > - },\ > > - {\ > > - .driver = "nec-usb-xhci",\ > > - .property = "superspeed-ports-first",\ > > - .value = "off",\ > > - },\ > > - {\ > > - .driver = "pci-serial",\ > > - .property = "prog_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "pci-serial-2x",\ > > - .property = "prof_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "pci-serial-4x",\ > > - .property = "prog_if",\ > > - .value = stringify(0),\ > > - },\ > > - {\ > > - .driver = "virtio-net-pci",\ > > - .property = "guest_announce",\ > > - .value = "off",\ > > } > > > > #define PC_COMPAT_1_7 \ > > - {\ > > - .driver = TYPE_USB_DEVICE,\ > > - .property = "msos-desc",\ > > - .value = "no",\ > > - },\ > > + QEMU_COMPAT_1_7,\ > > {\ > > .driver = "PIIX4_PM",\ > > .property = "acpi-pci-hotplug-with-bridge-support",\ > > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_6 \ > > + QEMU_COMPAT_1_6,\ > > {\ > > - .driver = "e1000",\ > > - .property = "mitigation",\ > > - .value = "off",\ > > - },{\ > > - .driver = "qemu64-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "qemu32-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(3),\ > > - },{\ > > .driver = "i440FX-pcihost",\ > > .property = "short_root_bus",\ > > .value = stringify(1),\ > > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_5 \ > > + QEMU_COMPAT_1_7,\ > > {\ > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > - .property = "level",\ > > - .value = stringify(2),\ > > - },{\ > > - .driver = "virtio-net-pci",\ > > - .property = "any_layout",\ > > - .value = "off",\ > > - },{\ > > - .driver = TYPE_X86_CPU,\ > > - .property = "pmu",\ > > - .value = "on",\ > > - },{\ > > .driver = "i440FX-pcihost",\ > > .property = "short_root_bus",\ > > .value = stringify(0),\ > > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > } > > > > #define PC_COMPAT_1_4 \ > > - {\ > > - .driver = "scsi-hd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "scsi-cd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "scsi-disk",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-hd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-cd",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "ide-drive",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "virtio-blk-pci",\ > > - .property = "discard_granularity",\ > > - .value = stringify(0),\ > > - },{\ > > - .driver = "virtio-serial-pci",\ > > - .property = "vectors",\ > > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > - .value = stringify(0xFFFFFFFF),\ > > - },{ \ > > - .driver = "virtio-net-pci", \ > > - .property = "ctrl_guest_offloads", \ > > - .value = "off", \ > > - },{\ > > - .driver = "e1000",\ > > - .property = "romfile",\ > > - .value = "pxe-e1000.rom",\ > > - },{\ > > - .driver = "ne2k_pci",\ > > - .property = "romfile",\ > > - .value = "pxe-ne2k_pci.rom",\ > > - },{\ > > - .driver = "pcnet",\ > > - .property = "romfile",\ > > - .value = "pxe-pcnet.rom",\ > > - },{\ > > - .driver = "rtl8139",\ > > - .property = "romfile",\ > > - .value = "pxe-rtl8139.rom",\ > > - },{\ > > - .driver = "virtio-net-pci",\ > > - .property = "romfile",\ > > - .value = "pxe-virtio.rom",\ > > - },{\ > > - .driver = "486-" TYPE_X86_CPU,\ > > - .property = "model",\ > > - .value = stringify(0),\ > > - } > > + QEMU_COMPAT_1_4 > > > > #define PC_COMMON_MACHINE_OPTIONS \ > > .default_boot_order = "cad" > > -- > > 1.9.3
On Wed, Jun 25, 2014 at 09:46:40AM +0300, Marcel Apfelbaum wrote: > On Wed, 2014-06-25 at 08:20 +0300, Michael S. Tsirkin wrote: > > On Tue, Jun 24, 2014 at 03:02:03PM -0300, Eduardo Habkost wrote: > > > The QEMU_COMPAT_* macros will contain compat properties that are not > > > specific to PC, and may be reused by other machine-types. > > > > > > PC-specific properties were left on the PC_COMPAT_* macros. > > > > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > > --- > > > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > include/hw/i386/pc.h | 150 ++--------------------------------------------- > > > 2 files changed, 166 insertions(+), 145 deletions(-) > > > > > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > > index 605a970..709b582 100644 > > > --- a/include/hw/boards.h > > > +++ b/include/hw/boards.h > > > @@ -134,4 +134,165 @@ struct MachineState { > > > const char *cpu_model; > > > }; > > > > > > + > > > +/* Macros for compat_props corresponding to specific QEMU versions: */ > > > + > > > +#define QEMU_COMPAT_2_0 \ > > > + {\ > > > + .driver = "virtio-scsi-pci",\ > > > + .property = "any_layout",\ > > > + .value = "off",\ > > > + },\ > > > + {\ > > > + .driver = "apic",\ > > > + .property = "version",\ > > > + .value = stringify(0x11),\ > > > + },\ > > > + {\ > > > + .driver = "nec-usb-xhci",\ > > > + .property = "superspeed-ports-first",\ > > > + .value = "off",\ > > > + },\ > > > + {\ > > > + .driver = "pci-serial",\ > > > + .property = "prog_if",\ > > > + .value = stringify(0),\ > > > + },\ > > > + {\ > > > + .driver = "pci-serial-2x",\ > > > + .property = "prof_if",\ > > > + .value = stringify(0),\ > > > + },\ > > > + {\ > > > + .driver = "pci-serial-4x",\ > > > + .property = "prog_if",\ > > > + .value = stringify(0),\ > > > + },\ > > > + {\ > > > + .driver = "virtio-net-pci",\ > > > + .property = "guest_announce",\ > > > + .value = "off",\ > > > + } > > > + > > > +#define QEMU_COMPAT_1_7 \ > > > + {\ > > > + .driver = TYPE_USB_DEVICE,\ > > > + .property = "msos-desc",\ > > > + .value = "no",\ > > > + } > > > + > > > +#define QEMU_COMPAT_1_6 \ > > > + {\ > > > + .driver = "e1000",\ > > > + .property = "mitigation",\ > > > + .value = "off",\ > > > + },{\ > > > + .driver = "qemu64-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "qemu32-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(3),\ > > > + } > > > + > > > +#define QEMU_COMPAT_1_5 \ > > > + {\ > > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > > + .property = "level",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > > + .property = "level",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(2),\ > > > + },{\ > > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > > + .property = "level",\ > > > + .value = stringify(2),\ > > > > Above are x86 CPUs - why have them in a common header? > > There's no chance any machine except PIIX&Q35 needs these. > > > > > + .driver = "virtio-net-pci",\ > > > + .property = "any_layout",\ > > > + .value = "off",\ > > > > Here's an example. > > If you are using a non x86 target, QEMU 2.0 > > has no way to select a machine with this > > value. > > So why expose it? > As we talked on the KVM call, the objective is to assign the > compat properties per QEMU version and close to their device. > As a *middle* step we shall put all together in a common file > per version and not per machine type, and then work on a registration > mechanism that will be based on the fact that compat properties > are per device and versioned by QEMU. > > Thanks, > Marcel Yes but that'll stay on a branch and get merged after 2.1. Let's keep this patch on that branch there as well. > > > > > > > + },{\ > > > + .driver = TYPE_X86_CPU,\ > > > + .property = "pmu",\ > > > + .value = "on",\ > > > + } > > > + > > > +#define QEMU_COMPAT_1_4 \ > > > + {\ > > > + .driver = "scsi-hd",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "scsi-cd",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "scsi-disk",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "ide-hd",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "ide-cd",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "ide-drive",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "virtio-blk-pci",\ > > > + .property = "discard_granularity",\ > > > + .value = stringify(0),\ > > > + },{\ > > > + .driver = "virtio-serial-pci",\ > > > + .property = "vectors",\ > > > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > > + .value = stringify(0xFFFFFFFF),\ > > > + },{ \ > > > + .driver = "virtio-net-pci", \ > > > + .property = "ctrl_guest_offloads", \ > > > + .value = "off", \ > > > + },{\ > > > + .driver = "e1000",\ > > > + .property = "romfile",\ > > > + .value = "pxe-e1000.rom",\ > > > + },{\ > > > + .driver = "ne2k_pci",\ > > > + .property = "romfile",\ > > > + .value = "pxe-ne2k_pci.rom",\ > > > + },{\ > > > + .driver = "pcnet",\ > > > + .property = "romfile",\ > > > + .value = "pxe-pcnet.rom",\ > > > + },{\ > > > + .driver = "rtl8139",\ > > > + .property = "romfile",\ > > > + .value = "pxe-rtl8139.rom",\ > > > + },{\ > > > + .driver = "virtio-net-pci",\ > > > + .property = "romfile",\ > > > + .value = "pxe-virtio.rom",\ > > > + },{\ > > > + .driver = "486-" TYPE_X86_CPU,\ > > > + .property = "model",\ > > > + .value = stringify(0),\ > > > + } > > > + > > > #endif > > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > > > index d988b80..631afe7 100644 > > > --- a/include/hw/i386/pc.h > > > +++ b/include/hw/i386/pc.h > > > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > > > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > > > #define PC_COMPAT_2_0 \ > > > + QEMU_COMPAT_2_0,\ > > > {\ > > > - .driver = "virtio-scsi-pci",\ > > > - .property = "any_layout",\ > > > - .value = "off",\ > > > - },{\ > > > .driver = "PIIX4_PM",\ > > > .property = "memory-hotplug-support",\ > > > .value = "off",\ > > > - },\ > > > - {\ > > > - .driver = "apic",\ > > > - .property = "version",\ > > > - .value = stringify(0x11),\ > > > - },\ > > > - {\ > > > - .driver = "nec-usb-xhci",\ > > > - .property = "superspeed-ports-first",\ > > > - .value = "off",\ > > > - },\ > > > - {\ > > > - .driver = "pci-serial",\ > > > - .property = "prog_if",\ > > > - .value = stringify(0),\ > > > - },\ > > > - {\ > > > - .driver = "pci-serial-2x",\ > > > - .property = "prof_if",\ > > > - .value = stringify(0),\ > > > - },\ > > > - {\ > > > - .driver = "pci-serial-4x",\ > > > - .property = "prog_if",\ > > > - .value = stringify(0),\ > > > - },\ > > > - {\ > > > - .driver = "virtio-net-pci",\ > > > - .property = "guest_announce",\ > > > - .value = "off",\ > > > } > > > > > > #define PC_COMPAT_1_7 \ > > > - {\ > > > - .driver = TYPE_USB_DEVICE,\ > > > - .property = "msos-desc",\ > > > - .value = "no",\ > > > - },\ > > > + QEMU_COMPAT_1_7,\ > > > {\ > > > .driver = "PIIX4_PM",\ > > > .property = "acpi-pci-hotplug-with-bridge-support",\ > > > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > } > > > > > > #define PC_COMPAT_1_6 \ > > > + QEMU_COMPAT_1_6,\ > > > {\ > > > - .driver = "e1000",\ > > > - .property = "mitigation",\ > > > - .value = "off",\ > > > - },{\ > > > - .driver = "qemu64-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "qemu32-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(3),\ > > > - },{\ > > > .driver = "i440FX-pcihost",\ > > > .property = "short_root_bus",\ > > > .value = stringify(1),\ > > > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > } > > > > > > #define PC_COMPAT_1_5 \ > > > + QEMU_COMPAT_1_7,\ > > > {\ > > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > > - .property = "level",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > > - .property = "level",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > > - .property = "level",\ > > > - .value = stringify(2),\ > > > - },{\ > > > - .driver = "virtio-net-pci",\ > > > - .property = "any_layout",\ > > > - .value = "off",\ > > > - },{\ > > > - .driver = TYPE_X86_CPU,\ > > > - .property = "pmu",\ > > > - .value = "on",\ > > > - },{\ > > > .driver = "i440FX-pcihost",\ > > > .property = "short_root_bus",\ > > > .value = stringify(0),\ > > > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > } > > > > > > #define PC_COMPAT_1_4 \ > > > - {\ > > > - .driver = "scsi-hd",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "scsi-cd",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "scsi-disk",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "ide-hd",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "ide-cd",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "ide-drive",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "virtio-blk-pci",\ > > > - .property = "discard_granularity",\ > > > - .value = stringify(0),\ > > > - },{\ > > > - .driver = "virtio-serial-pci",\ > > > - .property = "vectors",\ > > > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > > - .value = stringify(0xFFFFFFFF),\ > > > - },{ \ > > > - .driver = "virtio-net-pci", \ > > > - .property = "ctrl_guest_offloads", \ > > > - .value = "off", \ > > > - },{\ > > > - .driver = "e1000",\ > > > - .property = "romfile",\ > > > - .value = "pxe-e1000.rom",\ > > > - },{\ > > > - .driver = "ne2k_pci",\ > > > - .property = "romfile",\ > > > - .value = "pxe-ne2k_pci.rom",\ > > > - },{\ > > > - .driver = "pcnet",\ > > > - .property = "romfile",\ > > > - .value = "pxe-pcnet.rom",\ > > > - },{\ > > > - .driver = "rtl8139",\ > > > - .property = "romfile",\ > > > - .value = "pxe-rtl8139.rom",\ > > > - },{\ > > > - .driver = "virtio-net-pci",\ > > > - .property = "romfile",\ > > > - .value = "pxe-virtio.rom",\ > > > - },{\ > > > - .driver = "486-" TYPE_X86_CPU,\ > > > - .property = "model",\ > > > - .value = stringify(0),\ > > > - } > > > + QEMU_COMPAT_1_4 > > > > > > #define PC_COMMON_MACHINE_OPTIONS \ > > > .default_boot_order = "cad" > > > -- > > > 1.9.3 > >
On Wed, 2014-06-25 at 10:18 +0300, Michael S. Tsirkin wrote: > On Wed, Jun 25, 2014 at 09:46:40AM +0300, Marcel Apfelbaum wrote: > > On Wed, 2014-06-25 at 08:20 +0300, Michael S. Tsirkin wrote: > > > On Tue, Jun 24, 2014 at 03:02:03PM -0300, Eduardo Habkost wrote: > > > > The QEMU_COMPAT_* macros will contain compat properties that are not > > > > specific to PC, and may be reused by other machine-types. > > > > > > > > PC-specific properties were left on the PC_COMPAT_* macros. > > > > > > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> > > > > --- > > > > include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > include/hw/i386/pc.h | 150 ++--------------------------------------------- > > > > 2 files changed, 166 insertions(+), 145 deletions(-) > > > > > > > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > > > index 605a970..709b582 100644 > > > > --- a/include/hw/boards.h > > > > +++ b/include/hw/boards.h > > > > @@ -134,4 +134,165 @@ struct MachineState { > > > > const char *cpu_model; > > > > }; > > > > > > > > + > > > > +/* Macros for compat_props corresponding to specific QEMU versions: */ > > > > + > > > > +#define QEMU_COMPAT_2_0 \ > > > > + {\ > > > > + .driver = "virtio-scsi-pci",\ > > > > + .property = "any_layout",\ > > > > + .value = "off",\ > > > > + },\ > > > > + {\ > > > > + .driver = "apic",\ > > > > + .property = "version",\ > > > > + .value = stringify(0x11),\ > > > > + },\ > > > > + {\ > > > > + .driver = "nec-usb-xhci",\ > > > > + .property = "superspeed-ports-first",\ > > > > + .value = "off",\ > > > > + },\ > > > > + {\ > > > > + .driver = "pci-serial",\ > > > > + .property = "prog_if",\ > > > > + .value = stringify(0),\ > > > > + },\ > > > > + {\ > > > > + .driver = "pci-serial-2x",\ > > > > + .property = "prof_if",\ > > > > + .value = stringify(0),\ > > > > + },\ > > > > + {\ > > > > + .driver = "pci-serial-4x",\ > > > > + .property = "prog_if",\ > > > > + .value = stringify(0),\ > > > > + },\ > > > > + {\ > > > > + .driver = "virtio-net-pci",\ > > > > + .property = "guest_announce",\ > > > > + .value = "off",\ > > > > + } > > > > + > > > > +#define QEMU_COMPAT_1_7 \ > > > > + {\ > > > > + .driver = TYPE_USB_DEVICE,\ > > > > + .property = "msos-desc",\ > > > > + .value = "no",\ > > > > + } > > > > + > > > > +#define QEMU_COMPAT_1_6 \ > > > > + {\ > > > > + .driver = "e1000",\ > > > > + .property = "mitigation",\ > > > > + .value = "off",\ > > > > + },{\ > > > > + .driver = "qemu64-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "qemu32-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(3),\ > > > > + } > > > > + > > > > +#define QEMU_COMPAT_1_5 \ > > > > + {\ > > > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "Conroe-" TYPE_X86_CPU,\ > > > > + .property = "level",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "Penryn-" TYPE_X86_CPU,\ > > > > + .property = "level",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(2),\ > > > > + },{\ > > > > + .driver = "Nehalem-" TYPE_X86_CPU,\ > > > > + .property = "level",\ > > > > + .value = stringify(2),\ > > > > > > Above are x86 CPUs - why have them in a common header? > > > There's no chance any machine except PIIX&Q35 needs these. > > > > > > > + .driver = "virtio-net-pci",\ > > > > + .property = "any_layout",\ > > > > + .value = "off",\ > > > > > > Here's an example. > > > If you are using a non x86 target, QEMU 2.0 > > > has no way to select a machine with this > > > value. > > > So why expose it? > > As we talked on the KVM call, the objective is to assign the > > compat properties per QEMU version and close to their device. > > As a *middle* step we shall put all together in a common file > > per version and not per machine type, and then work on a registration > > mechanism that will be based on the fact that compat properties > > are per device and versioned by QEMU. > > > > Thanks, > > Marcel > > Yes but that'll stay on a branch and get merged after 2.1. > Let's keep this patch on that branch there as well. Fine by me Thanks, Marcel > > > > > > > > > > > > + },{\ > > > > + .driver = TYPE_X86_CPU,\ > > > > + .property = "pmu",\ > > > > + .value = "on",\ > > > > + } > > > > + > > > > +#define QEMU_COMPAT_1_4 \ > > > > + {\ > > > > + .driver = "scsi-hd",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "scsi-cd",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "scsi-disk",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "ide-hd",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "ide-cd",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "ide-drive",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "virtio-blk-pci",\ > > > > + .property = "discard_granularity",\ > > > > + .value = stringify(0),\ > > > > + },{\ > > > > + .driver = "virtio-serial-pci",\ > > > > + .property = "vectors",\ > > > > + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > > > + .value = stringify(0xFFFFFFFF),\ > > > > + },{ \ > > > > + .driver = "virtio-net-pci", \ > > > > + .property = "ctrl_guest_offloads", \ > > > > + .value = "off", \ > > > > + },{\ > > > > + .driver = "e1000",\ > > > > + .property = "romfile",\ > > > > + .value = "pxe-e1000.rom",\ > > > > + },{\ > > > > + .driver = "ne2k_pci",\ > > > > + .property = "romfile",\ > > > > + .value = "pxe-ne2k_pci.rom",\ > > > > + },{\ > > > > + .driver = "pcnet",\ > > > > + .property = "romfile",\ > > > > + .value = "pxe-pcnet.rom",\ > > > > + },{\ > > > > + .driver = "rtl8139",\ > > > > + .property = "romfile",\ > > > > + .value = "pxe-rtl8139.rom",\ > > > > + },{\ > > > > + .driver = "virtio-net-pci",\ > > > > + .property = "romfile",\ > > > > + .value = "pxe-virtio.rom",\ > > > > + },{\ > > > > + .driver = "486-" TYPE_X86_CPU,\ > > > > + .property = "model",\ > > > > + .value = stringify(0),\ > > > > + } > > > > + > > > > #endif > > > > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h > > > > index d988b80..631afe7 100644 > > > > --- a/include/hw/i386/pc.h > > > > +++ b/include/hw/i386/pc.h > > > > @@ -295,52 +295,15 @@ int e820_get_num_entries(void); > > > > bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > > > > > #define PC_COMPAT_2_0 \ > > > > + QEMU_COMPAT_2_0,\ > > > > {\ > > > > - .driver = "virtio-scsi-pci",\ > > > > - .property = "any_layout",\ > > > > - .value = "off",\ > > > > - },{\ > > > > .driver = "PIIX4_PM",\ > > > > .property = "memory-hotplug-support",\ > > > > .value = "off",\ > > > > - },\ > > > > - {\ > > > > - .driver = "apic",\ > > > > - .property = "version",\ > > > > - .value = stringify(0x11),\ > > > > - },\ > > > > - {\ > > > > - .driver = "nec-usb-xhci",\ > > > > - .property = "superspeed-ports-first",\ > > > > - .value = "off",\ > > > > - },\ > > > > - {\ > > > > - .driver = "pci-serial",\ > > > > - .property = "prog_if",\ > > > > - .value = stringify(0),\ > > > > - },\ > > > > - {\ > > > > - .driver = "pci-serial-2x",\ > > > > - .property = "prof_if",\ > > > > - .value = stringify(0),\ > > > > - },\ > > > > - {\ > > > > - .driver = "pci-serial-4x",\ > > > > - .property = "prog_if",\ > > > > - .value = stringify(0),\ > > > > - },\ > > > > - {\ > > > > - .driver = "virtio-net-pci",\ > > > > - .property = "guest_announce",\ > > > > - .value = "off",\ > > > > } > > > > > > > > #define PC_COMPAT_1_7 \ > > > > - {\ > > > > - .driver = TYPE_USB_DEVICE,\ > > > > - .property = "msos-desc",\ > > > > - .value = "no",\ > > > > - },\ > > > > + QEMU_COMPAT_1_7,\ > > > > {\ > > > > .driver = "PIIX4_PM",\ > > > > .property = "acpi-pci-hotplug-with-bridge-support",\ > > > > @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > } > > > > > > > > #define PC_COMPAT_1_6 \ > > > > + QEMU_COMPAT_1_6,\ > > > > {\ > > > > - .driver = "e1000",\ > > > > - .property = "mitigation",\ > > > > - .value = "off",\ > > > > - },{\ > > > > - .driver = "qemu64-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "qemu32-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(3),\ > > > > - },{\ > > > > .driver = "i440FX-pcihost",\ > > > > .property = "short_root_bus",\ > > > > .value = stringify(1),\ > > > > @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > } > > > > > > > > #define PC_COMPAT_1_5 \ > > > > + QEMU_COMPAT_1_7,\ > > > > {\ > > > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "Conroe-" TYPE_X86_CPU,\ > > > > - .property = "level",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "Penryn-" TYPE_X86_CPU,\ > > > > - .property = "level",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "Nehalem-" TYPE_X86_CPU,\ > > > > - .property = "level",\ > > > > - .value = stringify(2),\ > > > > - },{\ > > > > - .driver = "virtio-net-pci",\ > > > > - .property = "any_layout",\ > > > > - .value = "off",\ > > > > - },{\ > > > > - .driver = TYPE_X86_CPU,\ > > > > - .property = "pmu",\ > > > > - .value = "on",\ > > > > - },{\ > > > > .driver = "i440FX-pcihost",\ > > > > .property = "short_root_bus",\ > > > > .value = stringify(0),\ > > > > @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); > > > > } > > > > > > > > #define PC_COMPAT_1_4 \ > > > > - {\ > > > > - .driver = "scsi-hd",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "scsi-cd",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "scsi-disk",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "ide-hd",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "ide-cd",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "ide-drive",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "virtio-blk-pci",\ > > > > - .property = "discard_granularity",\ > > > > - .value = stringify(0),\ > > > > - },{\ > > > > - .driver = "virtio-serial-pci",\ > > > > - .property = "vectors",\ > > > > - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ > > > > - .value = stringify(0xFFFFFFFF),\ > > > > - },{ \ > > > > - .driver = "virtio-net-pci", \ > > > > - .property = "ctrl_guest_offloads", \ > > > > - .value = "off", \ > > > > - },{\ > > > > - .driver = "e1000",\ > > > > - .property = "romfile",\ > > > > - .value = "pxe-e1000.rom",\ > > > > - },{\ > > > > - .driver = "ne2k_pci",\ > > > > - .property = "romfile",\ > > > > - .value = "pxe-ne2k_pci.rom",\ > > > > - },{\ > > > > - .driver = "pcnet",\ > > > > - .property = "romfile",\ > > > > - .value = "pxe-pcnet.rom",\ > > > > - },{\ > > > > - .driver = "rtl8139",\ > > > > - .property = "romfile",\ > > > > - .value = "pxe-rtl8139.rom",\ > > > > - },{\ > > > > - .driver = "virtio-net-pci",\ > > > > - .property = "romfile",\ > > > > - .value = "pxe-virtio.rom",\ > > > > - },{\ > > > > - .driver = "486-" TYPE_X86_CPU,\ > > > > - .property = "model",\ > > > > - .value = stringify(0),\ > > > > - } > > > > + QEMU_COMPAT_1_4 > > > > > > > > #define PC_COMMON_MACHINE_OPTIONS \ > > > > .default_boot_order = "cad" > > > > -- > > > > 1.9.3 > > > >
diff --git a/include/hw/boards.h b/include/hw/boards.h index 605a970..709b582 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -134,4 +134,165 @@ struct MachineState { const char *cpu_model; }; + +/* Macros for compat_props corresponding to specific QEMU versions: */ + +#define QEMU_COMPAT_2_0 \ + {\ + .driver = "virtio-scsi-pci",\ + .property = "any_layout",\ + .value = "off",\ + },\ + {\ + .driver = "apic",\ + .property = "version",\ + .value = stringify(0x11),\ + },\ + {\ + .driver = "nec-usb-xhci",\ + .property = "superspeed-ports-first",\ + .value = "off",\ + },\ + {\ + .driver = "pci-serial",\ + .property = "prog_if",\ + .value = stringify(0),\ + },\ + {\ + .driver = "pci-serial-2x",\ + .property = "prof_if",\ + .value = stringify(0),\ + },\ + {\ + .driver = "pci-serial-4x",\ + .property = "prog_if",\ + .value = stringify(0),\ + },\ + {\ + .driver = "virtio-net-pci",\ + .property = "guest_announce",\ + .value = "off",\ + } + +#define QEMU_COMPAT_1_7 \ + {\ + .driver = TYPE_USB_DEVICE,\ + .property = "msos-desc",\ + .value = "no",\ + } + +#define QEMU_COMPAT_1_6 \ + {\ + .driver = "e1000",\ + .property = "mitigation",\ + .value = "off",\ + },{\ + .driver = "qemu64-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "qemu32-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(3),\ + } + +#define QEMU_COMPAT_1_5 \ + {\ + .driver = "Conroe-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Conroe-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + },{\ + .driver = "Penryn-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Penryn-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + },{\ + .driver = "Nehalem-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Nehalem-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + },{\ + .driver = "virtio-net-pci",\ + .property = "any_layout",\ + .value = "off",\ + },{\ + .driver = TYPE_X86_CPU,\ + .property = "pmu",\ + .value = "on",\ + } + +#define QEMU_COMPAT_1_4 \ + {\ + .driver = "scsi-hd",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "scsi-cd",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "scsi-disk",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "ide-hd",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "ide-cd",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "ide-drive",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "virtio-blk-pci",\ + .property = "discard_granularity",\ + .value = stringify(0),\ + },{\ + .driver = "virtio-serial-pci",\ + .property = "vectors",\ + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ + .value = stringify(0xFFFFFFFF),\ + },{ \ + .driver = "virtio-net-pci", \ + .property = "ctrl_guest_offloads", \ + .value = "off", \ + },{\ + .driver = "e1000",\ + .property = "romfile",\ + .value = "pxe-e1000.rom",\ + },{\ + .driver = "ne2k_pci",\ + .property = "romfile",\ + .value = "pxe-ne2k_pci.rom",\ + },{\ + .driver = "pcnet",\ + .property = "romfile",\ + .value = "pxe-pcnet.rom",\ + },{\ + .driver = "rtl8139",\ + .property = "romfile",\ + .value = "pxe-rtl8139.rom",\ + },{\ + .driver = "virtio-net-pci",\ + .property = "romfile",\ + .value = "pxe-virtio.rom",\ + },{\ + .driver = "486-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(0),\ + } + #endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index d988b80..631afe7 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -295,52 +295,15 @@ int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_COMPAT_2_0 \ + QEMU_COMPAT_2_0,\ {\ - .driver = "virtio-scsi-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ .driver = "PIIX4_PM",\ .property = "memory-hotplug-support",\ .value = "off",\ - },\ - {\ - .driver = "apic",\ - .property = "version",\ - .value = stringify(0x11),\ - },\ - {\ - .driver = "nec-usb-xhci",\ - .property = "superspeed-ports-first",\ - .value = "off",\ - },\ - {\ - .driver = "pci-serial",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-2x",\ - .property = "prof_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "pci-serial-4x",\ - .property = "prog_if",\ - .value = stringify(0),\ - },\ - {\ - .driver = "virtio-net-pci",\ - .property = "guest_announce",\ - .value = "off",\ } #define PC_COMPAT_1_7 \ - {\ - .driver = TYPE_USB_DEVICE,\ - .property = "msos-desc",\ - .value = "no",\ - },\ + QEMU_COMPAT_1_7,\ {\ .driver = "PIIX4_PM",\ .property = "acpi-pci-hotplug-with-bridge-support",\ @@ -348,19 +311,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); } #define PC_COMPAT_1_6 \ + QEMU_COMPAT_1_6,\ {\ - .driver = "e1000",\ - .property = "mitigation",\ - .value = "off",\ - },{\ - .driver = "qemu64-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "qemu32-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(3),\ - },{\ .driver = "i440FX-pcihost",\ .property = "short_root_bus",\ .value = stringify(1),\ @@ -371,39 +323,8 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); } #define PC_COMPAT_1_5 \ + QEMU_COMPAT_1_7,\ {\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Conroe-" TYPE_X86_CPU,\ - .property = "level",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Penryn-" TYPE_X86_CPU,\ - .property = "level",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(2),\ - },{\ - .driver = "Nehalem-" TYPE_X86_CPU,\ - .property = "level",\ - .value = stringify(2),\ - },{\ - .driver = "virtio-net-pci",\ - .property = "any_layout",\ - .value = "off",\ - },{\ - .driver = TYPE_X86_CPU,\ - .property = "pmu",\ - .value = "on",\ - },{\ .driver = "i440FX-pcihost",\ .property = "short_root_bus",\ .value = stringify(0),\ @@ -414,68 +335,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); } #define PC_COMPAT_1_4 \ - {\ - .driver = "scsi-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "scsi-disk",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-hd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-cd",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "ide-drive",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-blk-pci",\ - .property = "discard_granularity",\ - .value = stringify(0),\ - },{\ - .driver = "virtio-serial-pci",\ - .property = "vectors",\ - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ - .value = stringify(0xFFFFFFFF),\ - },{ \ - .driver = "virtio-net-pci", \ - .property = "ctrl_guest_offloads", \ - .value = "off", \ - },{\ - .driver = "e1000",\ - .property = "romfile",\ - .value = "pxe-e1000.rom",\ - },{\ - .driver = "ne2k_pci",\ - .property = "romfile",\ - .value = "pxe-ne2k_pci.rom",\ - },{\ - .driver = "pcnet",\ - .property = "romfile",\ - .value = "pxe-pcnet.rom",\ - },{\ - .driver = "rtl8139",\ - .property = "romfile",\ - .value = "pxe-rtl8139.rom",\ - },{\ - .driver = "virtio-net-pci",\ - .property = "romfile",\ - .value = "pxe-virtio.rom",\ - },{\ - .driver = "486-" TYPE_X86_CPU,\ - .property = "model",\ - .value = stringify(0),\ - } + QEMU_COMPAT_1_4 #define PC_COMMON_MACHINE_OPTIONS \ .default_boot_order = "cad"
The QEMU_COMPAT_* macros will contain compat properties that are not specific to PC, and may be reused by other machine-types. PC-specific properties were left on the PC_COMPAT_* macros. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- include/hw/boards.h | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/i386/pc.h | 150 ++--------------------------------------------- 2 files changed, 166 insertions(+), 145 deletions(-)