pc: reduce duplication in compat machine types
Make it easier to add compat properties, by adding macros for properties duplicated across machine types. Note: there could be bugs in compat properties, this patch does not attempt to address them, the code is bug for bug identical to the original. Tested by: generated a preprocessed file, sorted and compared to sorted original. Lightly tested on x86_64. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
d50c6c8b0f
commit
d6c730086c
288
hw/pc_piix.c
288
hw/pc_piix.c
@ -359,50 +359,69 @@ static QEMUMachine pc_machine_v1_1 = {
|
|||||||
.is_default = 1,
|
.is_default = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_1_0 \
|
||||||
|
{\
|
||||||
|
.driver = "pc-sysfw",\
|
||||||
|
.property = "rom_only",\
|
||||||
|
.value = stringify(1),\
|
||||||
|
}, {\
|
||||||
|
.driver = "isa-fdc",\
|
||||||
|
.property = "check_media_rate",\
|
||||||
|
.value = "off",\
|
||||||
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v1_0 = {
|
static QEMUMachine pc_machine_v1_0 = {
|
||||||
.name = "pc-1.0",
|
.name = "pc-1.0",
|
||||||
.desc = "Standard PC",
|
.desc = "Standard PC",
|
||||||
.init = pc_init_pci,
|
.init = pc_init_pci,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
{
|
PC_COMPAT_1_0,
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
}, {
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_0_15 \
|
||||||
|
PC_COMPAT_1_0
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v0_15 = {
|
static QEMUMachine pc_machine_v0_15 = {
|
||||||
.name = "pc-0.15",
|
.name = "pc-0.15",
|
||||||
.desc = "Standard PC",
|
.desc = "Standard PC",
|
||||||
.init = pc_init_pci,
|
.init = pc_init_pci,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
{
|
PC_COMPAT_0_15,
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
}, {
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_0_14 \
|
||||||
|
PC_COMPAT_0_15,\
|
||||||
|
{\
|
||||||
|
.driver = "virtio-blk-pci",\
|
||||||
|
.property = "event_idx",\
|
||||||
|
.value = "off",\
|
||||||
|
},{\
|
||||||
|
.driver = "virtio-serial-pci",\
|
||||||
|
.property = "event_idx",\
|
||||||
|
.value = "off",\
|
||||||
|
},{\
|
||||||
|
.driver = "virtio-net-pci",\
|
||||||
|
.property = "event_idx",\
|
||||||
|
.value = "off",\
|
||||||
|
},{\
|
||||||
|
.driver = "virtio-balloon-pci",\
|
||||||
|
.property = "event_idx",\
|
||||||
|
.value = "off",\
|
||||||
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v0_14 = {
|
static QEMUMachine pc_machine_v0_14 = {
|
||||||
.name = "pc-0.14",
|
.name = "pc-0.14",
|
||||||
.desc = "Standard PC",
|
.desc = "Standard PC",
|
||||||
.init = pc_init_pci,
|
.init = pc_init_pci,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
|
PC_COMPAT_0_14,
|
||||||
{
|
{
|
||||||
.driver = "qxl",
|
.driver = "qxl",
|
||||||
.property = "revision",
|
.property = "revision",
|
||||||
@ -411,42 +430,30 @@ static QEMUMachine pc_machine_v0_14 = {
|
|||||||
.driver = "qxl-vga",
|
.driver = "qxl-vga",
|
||||||
.property = "revision",
|
.property = "revision",
|
||||||
.value = stringify(2),
|
.value = stringify(2),
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-net-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-balloon-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_0_13 \
|
||||||
|
PC_COMPAT_0_14,\
|
||||||
|
{\
|
||||||
|
.driver = "PCI",\
|
||||||
|
.property = "command_serr_enable",\
|
||||||
|
.value = "off",\
|
||||||
|
},{\
|
||||||
|
.driver = "AC97",\
|
||||||
|
.property = "use_broken_id",\
|
||||||
|
.value = stringify(1),\
|
||||||
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v0_13 = {
|
static QEMUMachine pc_machine_v0_13 = {
|
||||||
.name = "pc-0.13",
|
.name = "pc-0.13",
|
||||||
.desc = "Standard PC",
|
.desc = "Standard PC",
|
||||||
.init = pc_init_pci_no_kvmclock,
|
.init = pc_init_pci_no_kvmclock,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
|
PC_COMPAT_0_13,
|
||||||
{
|
{
|
||||||
.driver = "virtio-9p-pci",
|
.driver = "virtio-9p-pci",
|
||||||
.property = "vectors",
|
.property = "vectors",
|
||||||
@ -459,59 +466,31 @@ static QEMUMachine pc_machine_v0_13 = {
|
|||||||
.driver = "vmware-svga",
|
.driver = "vmware-svga",
|
||||||
.property = "rombar",
|
.property = "rombar",
|
||||||
.value = stringify(0),
|
.value = stringify(0),
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "command_serr_enable",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-net-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-balloon-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "AC97",
|
|
||||||
.property = "use_broken_id",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_0_12 \
|
||||||
|
PC_COMPAT_0_13,\
|
||||||
|
{\
|
||||||
|
.driver = "virtio-serial-pci",\
|
||||||
|
.property = "max_ports",\
|
||||||
|
.value = stringify(1),\
|
||||||
|
},{\
|
||||||
|
.driver = "virtio-serial-pci",\
|
||||||
|
.property = "vectors",\
|
||||||
|
.value = stringify(0),\
|
||||||
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v0_12 = {
|
static QEMUMachine pc_machine_v0_12 = {
|
||||||
.name = "pc-0.12",
|
.name = "pc-0.12",
|
||||||
.desc = "Standard PC",
|
.desc = "Standard PC",
|
||||||
.init = pc_init_pci_no_kvmclock,
|
.init = pc_init_pci_no_kvmclock,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
|
PC_COMPAT_0_12,
|
||||||
{
|
{
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "max_ports",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "vectors",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
|
||||||
.driver = "VGA",
|
.driver = "VGA",
|
||||||
.property = "rombar",
|
.property = "rombar",
|
||||||
.value = stringify(0),
|
.value = stringify(0),
|
||||||
@ -519,63 +498,27 @@ static QEMUMachine pc_machine_v0_12 = {
|
|||||||
.driver = "vmware-svga",
|
.driver = "vmware-svga",
|
||||||
.property = "rombar",
|
.property = "rombar",
|
||||||
.value = stringify(0),
|
.value = stringify(0),
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "command_serr_enable",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-net-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-balloon-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "AC97",
|
|
||||||
.property = "use_broken_id",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PC_COMPAT_0_11 \
|
||||||
|
PC_COMPAT_0_12,\
|
||||||
|
{\
|
||||||
|
.driver = "virtio-blk-pci",\
|
||||||
|
.property = "vectors",\
|
||||||
|
.value = stringify(0),\
|
||||||
|
}
|
||||||
|
|
||||||
static QEMUMachine pc_machine_v0_11 = {
|
static QEMUMachine pc_machine_v0_11 = {
|
||||||
.name = "pc-0.11",
|
.name = "pc-0.11",
|
||||||
.desc = "Standard PC, qemu 0.11",
|
.desc = "Standard PC, qemu 0.11",
|
||||||
.init = pc_init_pci_no_kvmclock,
|
.init = pc_init_pci_no_kvmclock,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
|
PC_COMPAT_0_11,
|
||||||
{
|
{
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "vectors",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "max_ports",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "vectors",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
|
||||||
.driver = "ide-drive",
|
.driver = "ide-drive",
|
||||||
.property = "ver",
|
.property = "ver",
|
||||||
.value = "0.11",
|
.value = "0.11",
|
||||||
@ -583,43 +526,6 @@ static QEMUMachine pc_machine_v0_11 = {
|
|||||||
.driver = "scsi-disk",
|
.driver = "scsi-disk",
|
||||||
.property = "ver",
|
.property = "ver",
|
||||||
.value = "0.11",
|
.value = "0.11",
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "rombar",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "command_serr_enable",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-net-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-balloon-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "AC97",
|
|
||||||
.property = "use_broken_id",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
}
|
}
|
||||||
@ -631,6 +537,7 @@ static QEMUMachine pc_machine_v0_10 = {
|
|||||||
.init = pc_init_pci_no_kvmclock,
|
.init = pc_init_pci_no_kvmclock,
|
||||||
.max_cpus = 255,
|
.max_cpus = 255,
|
||||||
.compat_props = (GlobalProperty[]) {
|
.compat_props = (GlobalProperty[]) {
|
||||||
|
PC_COMPAT_0_11,
|
||||||
{
|
{
|
||||||
.driver = "virtio-blk-pci",
|
.driver = "virtio-blk-pci",
|
||||||
.property = "class",
|
.property = "class",
|
||||||
@ -639,22 +546,10 @@ static QEMUMachine pc_machine_v0_10 = {
|
|||||||
.driver = "virtio-serial-pci",
|
.driver = "virtio-serial-pci",
|
||||||
.property = "class",
|
.property = "class",
|
||||||
.value = stringify(PCI_CLASS_DISPLAY_OTHER),
|
.value = stringify(PCI_CLASS_DISPLAY_OTHER),
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "max_ports",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "vectors",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
},{
|
||||||
.driver = "virtio-net-pci",
|
.driver = "virtio-net-pci",
|
||||||
.property = "vectors",
|
.property = "vectors",
|
||||||
.value = stringify(0),
|
.value = stringify(0),
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "vectors",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
},{
|
||||||
.driver = "ide-drive",
|
.driver = "ide-drive",
|
||||||
.property = "ver",
|
.property = "ver",
|
||||||
@ -663,43 +558,6 @@ static QEMUMachine pc_machine_v0_10 = {
|
|||||||
.driver = "scsi-disk",
|
.driver = "scsi-disk",
|
||||||
.property = "ver",
|
.property = "ver",
|
||||||
.value = "0.10",
|
.value = "0.10",
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "rombar",
|
|
||||||
.value = stringify(0),
|
|
||||||
},{
|
|
||||||
.driver = "PCI",
|
|
||||||
.property = "command_serr_enable",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-blk-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-serial-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-net-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "virtio-balloon-pci",
|
|
||||||
.property = "event_idx",
|
|
||||||
.value = "off",
|
|
||||||
},{
|
|
||||||
.driver = "AC97",
|
|
||||||
.property = "use_broken_id",
|
|
||||||
.value = stringify(1),
|
|
||||||
},{
|
|
||||||
.driver = "isa-fdc",
|
|
||||||
.property = "check_media_rate",
|
|
||||||
.value = "off",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.driver = "pc-sysfw",
|
|
||||||
.property = "rom_only",
|
|
||||||
.value = stringify(1),
|
|
||||||
},
|
},
|
||||||
{ /* end of list */ }
|
{ /* end of list */ }
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user