From patchwork Wed Jan 23 01:02:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10776463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE635746 for ; Wed, 23 Jan 2019 01:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0AD0284A3 for ; Wed, 23 Jan 2019 01:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF23E284F5; Wed, 23 Jan 2019 01:03:51 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A571284A3 for ; Wed, 23 Jan 2019 01:03:51 +0000 (UTC) Received: from localhost ([127.0.0.1]:53115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm6xK-0008JU-Jm for patchwork-qemu-devel@patchwork.kernel.org; Tue, 22 Jan 2019 20:03:50 -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) 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) 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) 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefano Garzarella In order to avoid migration issues, we enable PVH only for machine type >= 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); @@ -2774,6 +2775,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->acpi_data_size = 0x20000 + 0x8000; pcmc->save_tsc_khz = true; pcmc->linuxboot_dma_enabled = true; + pcmc->pvh_enabled = true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_instance_props = 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, static void pc_i440fx_3_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_i440fx_4_0_machine_options(m); m->is_default = 0; m->alias = NULL; + pcmc->pvh_enabled = 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, static void pc_q35_3_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_q35_4_0_machine_options(m); m->default_kernel_irqchip_split = false; m->alias = NULL; + pcmc->pvh_enabled = 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 { /* use DMA capable linuxboot option rom */ bool linuxboot_dma_enabled; + + /* use PVH to load kernels that support this feature */ + bool pvh_enabled; }; #define TYPE_PC_MACHINE "generic-pc-machine"