From nobody Fri Nov 7 15:32:27 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; dkim=fail; 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 154820546955835.789877484938756; Tue, 22 Jan 2019 17:04:29 -0800 (PST) Received: from localhost ([127.0.0.1]:53115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm6xr-0008JU-Cj for importer@patchew.org; Tue, 22 Jan 2019 20:04:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm6vk-0007Bt-14 for qemu-devel@nongnu.org; Tue, 22 Jan 2019 20:02:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm6vh-0002Tg-Sp for qemu-devel@nongnu.org; Tue, 22 Jan 2019 20:02:11 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:45209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gm6vh-0002P5-JV for qemu-devel@nongnu.org; Tue, 22 Jan 2019 20:02:09 -0500 Received: by mail-wr1-x42c.google.com with SMTP id t6so434392wrr.12 for ; Tue, 22 Jan 2019 17:02:07 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id e17sm155062376wri.36.2019.01.22.17.02.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 17:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4D2HQDW6HQGJH4Hda2qDlfOaLgiEavqr8QlQnoTGPQI=; b=DbwrMUiPfZdsdE9e5WTYD+WdeKUW/egPadTs9wDajmcpUXFYiaRTeBd3FD+Bgq9Sh6 8fAbkiX8UcC+WRktqdv3Vhm/VEXriyzE4xIKukwp8j7EcFzj1EZaScvfJraTi3Ru+HEM wuYExj/jF3NO0WuQWNIQZeTedZczd/yf81lGOKBZVyo9dO9bT7G2N5c8G0wv0RFh9tjT KZNtGVLvd3qx8VDNlmPwncXhlsbcMuBNFhe2uZlIwOmMIVi2cr1E0FWsaRS8dXijQ+Du 5VYqsW3pYBAdnwXASU2m9xET7nNr5nrZ2FObbGgd3Tdnv9Wqe0LzPj6rx7asCRXU7uMg MpNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4D2HQDW6HQGJH4Hda2qDlfOaLgiEavqr8QlQnoTGPQI=; b=JfY1eYiiffYwLVORmRUHQQO7y3hTKEHwYOgte9lTmLJ0Wi0U/CGWiHAJm0lxcP/lfQ YkO5GeMlItvHDqg6atjrPU3RwDXofxpmTX/dKSAG7snk4Rx4XwqCryvEAV5U+Hl83KOf BHYRim9pTgc6P93rC2KFYex0D/HN46E2wqEE7f4W7LIU0uGkl7pMgihLpsFnRk2PI9S1 Fe6YpOcm/F2UJgefE/VHUZcrip01HJV7xq38RIG+6QNmpln931CftZVVT5yQwnSIgkgr wrgSlRIJbnx/df5rWBYLh8H+UsH6k5e9i/QP0S5obfvATA78E3J3KfzfGdgEmt9949wK 0v9w== X-Gm-Message-State: AJcUukfDGHel4pWq6qC0HgwGDtr5zpGDxJGdDuPoLfjDV5C5pnFcxEwP BxKtPCu6HotXASrfu7v6iJBgzGX3 X-Google-Smtp-Source: ALg8bN51fBCX9mki+F966aJV80Nq996fW4pZbDlW8mhI4m+PDRQ+BLugEbBoi/0YuB6JHEOD0Br2FQ== X-Received: by 2002:adf:94e4:: with SMTP id 91mr171305wrr.322.1548205326752; Tue, 22 Jan 2019 17:02:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 23 Jan 2019 02:02:02 +0100 Message-Id: <1548205322-36101-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548205322-36101-1-git-send-email-pbonzini@redhat.com> References: <1548205322-36101-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 33/51] 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: Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella 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 Signed-off-by: Paolo Bonzini --- 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 2833b13..3be4a06 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 63c84e3..fd0f2c2 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 b7b7959..4a175ea 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 0abbe45..e4e2c13 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 1.8.3.1