From nobody Fri Nov 7 10:17:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548184549416846.0631475197711; Tue, 22 Jan 2019 11:15:49 -0800 (PST) Received: from localhost ([127.0.0.1]:47641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm1WP-0002K8-Ib for importer@patchew.org; Tue, 22 Jan 2019 14:15:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm14Q-0004Aj-55 for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:46:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm14O-000507-3p for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:46:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44478) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gm14N-0004a4-Mz for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:46:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28B8289ACF; Tue, 22 Jan 2019 12:10:59 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-116-154.ams2.redhat.com [10.36.116.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 791835D73F; Tue, 22 Jan 2019 12:10:50 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2019 13:10:48 +0100 Message-Id: <20190122121048.76469-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 22 Jan 2019 12:10:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] hw/i386/pc: enable PVH only for machine type >= 4.0 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: "Michael S. Tsirkin" , Eduardo Habkost , Stefan Hajnoczi , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In order to avoid migration issues, we enable PVH only for machine type >=3D 4.0 Suggested-by: Michael S. Tsirkin Signed-off-by: Stefano Garzarella Reviewed-by: Eduardo Habkost Reviewed-by: Liam Merwick Reviewed-by: Stefan Hajnoczi --- Based-on: <1548093980-43088-1-git-send-email-pbonzini@redhat.com> hw/i386/pc.c | 4 +++- hw/i386/pc_piix.c | 3 +++ hw/i386/pc_q35.c | 3 +++ include/hw/i386/pc.h | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2833b130ba..3be4a06c4f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1211,7 +1211,8 @@ static void load_linux(PCMachineState *pcms, * saving the PVH entry point used by the x86/HVM direct boot ABI. * If load_elfboot() is successful, populate the fw_cfg info. */ - if (load_elfboot(kernel_filename, kernel_size, + if (pcmc->pvh_enabled && + load_elfboot(kernel_filename, kernel_size, header, pvh_start_addr, fw_cfg)) { fclose(f); =20 @@ -2774,6 +2775,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) pcmc->acpi_data_size =3D 0x20000 + 0x8000; pcmc->save_tsc_khz =3D true; pcmc->linuxboot_dma_enabled =3D true; + pcmc->pvh_enabled =3D true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D pc_get_hotpug_handler; mc->cpu_index_to_instance_props =3D pc_cpu_index_to_props; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 5088e2f492..a51b83e50e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -440,9 +440,12 @@ DEFINE_I440FX_MACHINE(v4_0, "pc-i440fx-4.0", NULL, =20 static void pc_i440fx_3_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pc_i440fx_4_0_machine_options(m); m->is_default =3D 0; m->alias =3D NULL; + pcmc->pvh_enabled =3D false; compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len); compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b7b7959934..4a175ea50e 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -376,9 +376,12 @@ DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL, =20 static void pc_q35_3_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pc_q35_4_0_machine_options(m); m->default_kernel_irqchip_split =3D false; m->alias =3D NULL; + pcmc->pvh_enabled =3D false; compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len); compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 0abbe45637..e4e2c1352d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -133,6 +133,9 @@ struct PCMachineClass { =20 /* use DMA capable linuxboot option rom */ bool linuxboot_dma_enabled; + + /* use PVH to load kernels that support this feature */ + bool pvh_enabled; }; =20 #define TYPE_PC_MACHINE "generic-pc-machine" --=20 2.20.1