From nobody Tue May 7 08:16:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149306037243441.10566261280053; Mon, 24 Apr 2017 11:59:32 -0700 (PDT) Received: from localhost ([::1]:45490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2jCs-0003ir-QF for importer@patchew.org; Mon, 24 Apr 2017 14:59:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2jC0-0003Mf-Ca for qemu-devel@nongnu.org; Mon, 24 Apr 2017 14:58:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2jBu-0005ZW-CO for qemu-devel@nongnu.org; Mon, 24 Apr 2017 14:58:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2jBu-0005YP-3D for qemu-devel@nongnu.org; Mon, 24 Apr 2017 14:58:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C60B0C04B94E for ; Mon, 24 Apr 2017 18:58:28 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89704C14D9; Mon, 24 Apr 2017 18:58:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C60B0C04B94E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C60B0C04B94E From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 24 Apr 2017 20:58:17 +0200 Message-Id: <20170424185817.41002-1-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 24 Apr 2017 18:58:28 +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] pc/fwcfg: unbreak migration from qemu-2.5 and qemu-2.6 during firmware boot 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: pbonzini@redhat.com, lersek@redhat.com, ehabkost@redhat.com, dgilbert@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since 2.7 commit (b2a575a Add optionrom compatible with fw_cfg DMA version) regressed migration during firmware exection time by abusing fwcfg.dma_enabled property to decide loading dma version of option rom AND by mistake disabling DMA for 2.6 and earlier globally instead of only for option rom. so 2.6 machine type guest is broken when it already runs firmware in DMA mode but migrated to qemu-2.7(pc-2.6) at that time; a) qemu-2.6:pc2.6 (fwcfg.dma=3Don,firmware=3Ddma,oprom=3Dmmio) b) qemu-2.7:pc2.6 (fwcfg.dma=3Doff,firmware=3Dmmio,oprom=3Dmmio) to: a b from a OK FAIL b OK OK So we currently have broken forward migration from qemu-2.6 to qemu-2.[789] that however could be fixed for 2.10 by re-enabling DMA for 2.[56] machine types and allowing dma capable option rom only since 2.7. As result qemu should end up with: c) qemu-2.10:pc2.6 (fwcfg.dma=3Don,firmware=3Ddma,oprom=3Dmmio) to: a b c from a OK FAIL OK b OK OK OK c OK FAIL OK where forward migration from qemu-2.6 to qemu-2.10 should work again leaving only qemu-2.[789]:pc-2.6 broken. Patch should also help downstream to maintain migration the way it used to be since dma cable option rom is managed by new Signed-off-by: Igor Mammedov --- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + include/hw/i386/pc.h | 6 ++---- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f3b372a18f..3f2d96da64 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1047,7 +1047,7 @@ static void load_linux(PCMachineState *pcms, fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, setup_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, setup, setup_size); =20 - if (fw_cfg_dma_enabled(fw_cfg)) { + if (!pcmc->linuxboot_dma_disabled && fw_cfg_dma_enabled(fw_cfg)) { option_rom[nb_option_roms].name =3D "linuxboot_dma.bin"; option_rom[nb_option_roms].bootindex =3D 0; } else { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 9f102aa388..dd3a2bb02a 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -474,6 +474,7 @@ static void pc_i440fx_2_6_machine_options(MachineClass = *m) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; + pcmc->linuxboot_dma_disabled =3D true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index dd792a8547..9988ecc578 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -335,6 +335,7 @@ static void pc_q35_2_6_machine_options(MachineClass *m) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; + pcmc->linuxboot_dma_disabled =3D true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f278b3ae89..ff6f13b61b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -151,6 +151,8 @@ struct PCMachineClass { bool save_tsc_khz; /* generate legacy CPU hotplug AML */ bool legacy_cpu_hotplug; + + bool linuxboot_dma_disabled; }; =20 #define TYPE_PC_MACHINE "generic-pc-machine" @@ -432,10 +434,6 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_= t *); #define PC_COMPAT_2_6 \ HW_COMPAT_2_6 \ {\ - .driver =3D "fw_cfg_io",\ - .property =3D "dma_enabled",\ - .value =3D "off",\ - },{\ .driver =3D TYPE_X86_CPU,\ .property =3D "cpuid-0xb",\ .value =3D "off",\ --=20 2.11.0 (Apple Git-81)