Skip to content

Commit

Permalink
machines: replace COMPAT define with a static array
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
elmarco committed Jan 7, 2019
1 parent ea9ce89 commit fa386d9
Show file tree
Hide file tree
Showing 6 changed files with 577 additions and 438 deletions.
45 changes: 27 additions & 18 deletions hw/arm/virt.c
Expand Up @@ -1872,116 +1872,125 @@ static void virt_machine_4_0_options(MachineClass *mc)
}
DEFINE_VIRT_MACHINE_AS_LATEST(4, 0)

#define VIRT_COMPAT_3_1 \
static GlobalProperty virt_compat_3_1[] = {
HW_COMPAT_3_1
};

static void virt_machine_3_1_options(MachineClass *mc)
{
virt_machine_4_0_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_1);
SET_MACHINE_COMPAT(mc, virt_compat_3_1);
}
DEFINE_VIRT_MACHINE(3, 1)

#define VIRT_COMPAT_3_0 \
static GlobalProperty virt_compat_3_0[] = {
HW_COMPAT_3_0
};

static void virt_machine_3_0_options(MachineClass *mc)
{
virt_machine_3_1_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_0);
SET_MACHINE_COMPAT(mc, virt_compat_3_0);
}
DEFINE_VIRT_MACHINE(3, 0)

#define VIRT_COMPAT_2_12 \
static GlobalProperty virt_compat_2_12[] = {
HW_COMPAT_2_12
};

static void virt_machine_2_12_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));

virt_machine_3_0_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12);
SET_MACHINE_COMPAT(mc, virt_compat_2_12);
vmc->no_highmem_ecam = true;
mc->max_cpus = 255;
}
DEFINE_VIRT_MACHINE(2, 12)

#define VIRT_COMPAT_2_11 \
static GlobalProperty virt_compat_2_11[] = {
HW_COMPAT_2_11
};

static void virt_machine_2_11_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));

virt_machine_2_12_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11);
SET_MACHINE_COMPAT(mc, virt_compat_2_11);
vmc->smbios_old_sys_ver = true;
}
DEFINE_VIRT_MACHINE(2, 11)

#define VIRT_COMPAT_2_10 \
static GlobalProperty virt_compat_2_10[] = {
HW_COMPAT_2_10
};

static void virt_machine_2_10_options(MachineClass *mc)
{
virt_machine_2_11_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10);
SET_MACHINE_COMPAT(mc, virt_compat_2_10);
/* before 2.11 we never faulted accesses to bad addresses */
mc->ignore_memory_transaction_failures = true;
}
DEFINE_VIRT_MACHINE(2, 10)

#define VIRT_COMPAT_2_9 \
static GlobalProperty virt_compat_2_9[] = {
HW_COMPAT_2_9
};

static void virt_machine_2_9_options(MachineClass *mc)
{
virt_machine_2_10_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_9);
SET_MACHINE_COMPAT(mc, virt_compat_2_9);
}
DEFINE_VIRT_MACHINE(2, 9)

#define VIRT_COMPAT_2_8 \
static GlobalProperty virt_compat_2_8[] = {
HW_COMPAT_2_8
};

static void virt_machine_2_8_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));

virt_machine_2_9_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_8);
SET_MACHINE_COMPAT(mc, virt_compat_2_8);
/* For 2.8 and earlier we falsely claimed in the DT that
* our timers were edge-triggered, not level-triggered.
*/
vmc->claim_edge_triggered_timers = true;
}
DEFINE_VIRT_MACHINE(2, 8)

#define VIRT_COMPAT_2_7 \
static GlobalProperty virt_compat_2_7[] = {
HW_COMPAT_2_7
};

static void virt_machine_2_7_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));

virt_machine_2_8_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_7);
SET_MACHINE_COMPAT(mc, virt_compat_2_7);
/* ITS was introduced with 2.8 */
vmc->no_its = true;
/* Stick with 1K pages for migration compatibility */
mc->minimum_page_bits = 0;
}
DEFINE_VIRT_MACHINE(2, 7)

#define VIRT_COMPAT_2_6 \
static GlobalProperty virt_compat_2_6[] = {
HW_COMPAT_2_6
};

static void virt_machine_2_6_options(MachineClass *mc)
{
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));

virt_machine_2_7_options(mc);
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6);
SET_MACHINE_COMPAT(mc, virt_compat_2_6);
vmc->disallow_affinity_adjustment = true;
/* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */
vmc->no_pmu = true;
Expand Down

0 comments on commit fa386d9

Please sign in to comment.