Add "file_slots" compat properties for 2.8 and earlier machine types.
Cc: "Michael S. Tsirkin" <m...@redhat.com> Cc: Eduardo Habkost <ehabk...@redhat.com> Cc: Gerd Hoffmann <kra...@redhat.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- include/hw/compat.h | 11 +++++++++++ include/hw/i386/pc.h | 3 +++ include/hw/nvram/fw_cfg_keys.h | 6 ++++-- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 16 +++++++++++++--- hw/i386/pc_q35.c | 13 +++++++++++-- hw/nvram/fw_cfg.c | 2 -- 7 files changed, 43 insertions(+), 10 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 0f06e113bee2..4eca87dc9c85 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,8 +1,19 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H +#define HW_COMPAT_2_8 \ + {\ + .driver = "fw_cfg_mem",\ + .property = "file_slots",\ + .value = stringify(0x10),\ + },{\ + .driver = "fw_cfg_io",\ + .property = "file_slots",\ + .value = stringify(0x10),\ + }, + #define HW_COMPAT_2_7 \ {\ .driver = "virtio-pci",\ .property = "page-per-vq",\ .value = "on",\ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4b7413055989..430735e501dd 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -365,11 +365,14 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); +#define PC_COMPAT_2_9 \ + #define PC_COMPAT_2_8 \ + HW_COMPAT_2_8 \ #define PC_COMPAT_2_7 \ HW_COMPAT_2_7 \ {\ .driver = TYPE_X86_CPU,\ diff --git a/include/hw/nvram/fw_cfg_keys.h b/include/hw/nvram/fw_cfg_keys.h index 627589793671..335a0df79f23 100644 --- a/include/hw/nvram/fw_cfg_keys.h +++ b/include/hw/nvram/fw_cfg_keys.h @@ -26,12 +26,14 @@ #define FW_CFG_SETUP_ADDR 0x16 #define FW_CFG_SETUP_SIZE 0x17 #define FW_CFG_SETUP_DATA 0x18 #define FW_CFG_FILE_DIR 0x19 -#define FW_CFG_FILE_FIRST 0x20 -#define FW_CFG_FILE_SLOTS_TRAD 0x10 +#define FW_CFG_FILE_FIRST 0x20 /* never change this */ +#define FW_CFG_FILE_SLOTS_TRAD 0x10 /* never change this */ +#define FW_CFG_FILE_SLOTS_DFLT 0x20 /* update HW_COMPAT_xxx in sync */ + #define FW_CFG_WRITE_CHANNEL 0x4000 #define FW_CFG_ARCH_LOCAL 0x8000 #define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5d929d8fc887..af51e8372db5 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -742,11 +742,11 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; int i, j; fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as, - FW_CFG_FILE_SLOTS_TRAD); + FW_CFG_FILE_SLOTS_DFLT); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: * * For machine types prior to 1.8, SeaBIOS needs FW_CFG_MAX_CPUS for diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a54a468c0ab3..2b67cf85371a 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -435,26 +435,36 @@ static void pc_i440fx_machine_options(MachineClass *m) m->hot_add_cpu = pc_hot_add_cpu; m->default_machine_opts = "firmware=bios-256k.bin"; m->default_display = "std"; } -static void pc_i440fx_2_8_machine_options(MachineClass *m) +static void pc_i440fx_2_9_machine_options(MachineClass *m) { pc_i440fx_machine_options(m); m->alias = "pc"; m->is_default = 1; } +DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, + pc_i440fx_2_9_machine_options); + + +static void pc_i440fx_2_8_machine_options(MachineClass *m) +{ + pc_i440fx_2_9_machine_options(m); + m->alias = NULL; + m->is_default = 0; + SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); +} + DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, pc_i440fx_2_8_machine_options); static void pc_i440fx_2_7_machine_options(MachineClass *m) { pc_i440fx_2_8_machine_options(m); - m->is_default = 0; - m->alias = NULL; SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); } DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, pc_i440fx_2_7_machine_options); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b40d19ee00da..7fa40e7cbe0e 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -292,23 +292,32 @@ static void pc_q35_machine_options(MachineClass *m) m->no_floppy = 1; m->has_dynamic_sysbus = true; m->max_cpus = 288; } -static void pc_q35_2_8_machine_options(MachineClass *m) +static void pc_q35_2_9_machine_options(MachineClass *m) { pc_q35_machine_options(m); m->alias = "q35"; } +DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, + pc_q35_2_9_machine_options); + +static void pc_q35_2_8_machine_options(MachineClass *m) +{ + pc_q35_2_9_machine_options(m); + m->alias = NULL; + SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); +} + DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, pc_q35_2_8_machine_options); static void pc_q35_2_7_machine_options(MachineClass *m) { pc_q35_2_8_machine_options(m); - m->alias = NULL; m->max_cpus = 255; SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); } DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index c33c76ab93b1..feb4760830db 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -33,12 +33,10 @@ #include "qemu/error-report.h" #include "qemu/config-file.h" #include "qemu/cutils.h" #include "qapi/error.h" -#define FW_CFG_FILE_SLOTS_DFLT 0x20 - #define FW_CFG_NAME "fw_cfg" #define FW_CFG_PATH "/machine/" FW_CFG_NAME #define TYPE_FW_CFG "fw_cfg" #define TYPE_FW_CFG_IO "fw_cfg_io" -- 2.9.2