From patchwork Thu Dec 1 17:06:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 9456575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 309B360756 for ; Thu, 1 Dec 2016 17:07:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DAC528517 for ; Thu, 1 Dec 2016 17:07:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124702851B; Thu, 1 Dec 2016 17:07:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E94128519 for ; Thu, 1 Dec 2016 17:07:27 +0000 (UTC) Received: from localhost ([::1]:57585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCUpS-00089m-MI for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Dec 2016 12:07:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCUop-00087B-4Y for qemu-devel@nongnu.org; Thu, 01 Dec 2016 12:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCUol-0006qZ-Tq for qemu-devel@nongnu.org; Thu, 01 Dec 2016 12:06:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45584) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCUol-0006ps-MF for qemu-devel@nongnu.org; Thu, 01 Dec 2016 12:06:43 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDA91935CF for ; Thu, 1 Dec 2016 17:06:42 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-138.phx2.redhat.com [10.3.116.138]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB1H6SN0022984; Thu, 1 Dec 2016 12:06:41 -0500 From: Laszlo Ersek To: qemu devel list Date: Thu, 1 Dec 2016 18:06:21 +0100 Message-Id: <20161201170624.26496-5-lersek@redhat.com> In-Reply-To: <20161201170624.26496-1-lersek@redhat.com> References: <20161201170624.26496-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 01 Dec 2016 17:06:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 4/7] hw/i386/pc: introduce 2.9 machine types with 0x20 fw_cfg file slots X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Paolo Bonzini , Gerd Hoffmann , Eduardo Habkost , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add "file_slots" compat properties for 2.8 and earlier machine types. Cc: "Michael S. Tsirkin" Cc: Eduardo Habkost Cc: Gerd Hoffmann Cc: Igor Mammedov Cc: Paolo Bonzini Signed-off-by: Laszlo Ersek --- 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"