From nobody Mon Feb 9 10:11:59 2026 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552324476275303.1764969922856; Mon, 11 Mar 2019 10:14:36 -0700 (PDT) Received: from localhost ([127.0.0.1]:37067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3OVV-0005Lr-5t for importer@patchew.org; Mon, 11 Mar 2019 13:14:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ODM-0006qS-Lt for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ODJ-0002rC-OO for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:46 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:35246) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3ODJ-0002qE-G6 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:45 -0400 Received: by mail-wm1-x332.google.com with SMTP id y15so5067570wma.0 for ; Mon, 11 Mar 2019 09:55:45 -0700 (PDT) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id e12sm6484836wrs.91.2019.03.11.09.55.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 09:55:43 -0700 (PDT) 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=AM8HhrwvKQY6Ow4NfI33vktmHaZVGL6hHIAkSjpQLFY=; b=leLxCvkUSUplTeCOi68Wb5d1GQcx+ldfuVnUlOF89RcNeGMcuhFE3+Fdr0WRpGmGOT c4MnB5w/o27cGP18vKHBeafgiT4zmCKIPxgDq7ha3Pj8UUSVPSNEfMf+NWUZWlUe7hSY mRFn9UJnWbEBhshYk0D35wt5WSfBSwDLupnHlL7y+9BZoAYx3Dh9IkSkcjPM1ZZkuQFb VogJ9ACeZEsYrx/2VyOoPrz3Ks9XcRzEMF5HFEcDul6++Z8UD0o26bUrUBirywP3ov1T 7E+gHuEjFZwbvEOUkEO/eKxRsErVWlVHEyX2nBmKKlMH/1+TGaybVba2ZPbW2awvfvUh m5Jg== 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=AM8HhrwvKQY6Ow4NfI33vktmHaZVGL6hHIAkSjpQLFY=; b=ccLFAWzBESPekcdJDe2lLFbQiiBXwQwqvXd28Jd+0AqP/IugHE1ABqtxrJeBZDY/md ml/PJG/7jeLFqAkqiYTOZPBR0y2oMONhQMwLpNeq6AvjQuJn1ZJR1wKABff7asP2zwuG +Rc7z0IMYU5u7On4KvwSrKwoY9lpgaY6Hv+uvBdK7eFDfdtxWILWhR6wuRYSTo9XzZ7V 8GOe3YMIZPPMUI01Mep92QzAsuKOkTKIEkpPYjidVc/msKbU643GpLv/BUqL/r1E2GDg d9RRpQn+urPUOemVAx5Y1AhMzfLus19gsrz8gHhaBlMU7so9anXYi/aM+xHyrWfWbF9t /aWQ== X-Gm-Message-State: APjAAAUnD97BroaG8L5gKYfidbj5xX+iZdPkfN+2Bb/a+c3qaW5aoUqc Ze9NNXzfiT5oImGpiJkLld0lJ+9y X-Google-Smtp-Source: APXvYqyfNx+KvfRztBS0bBeojMsI/JTp6RPjJGvi3pFFA9+Dc6/dKnX+oCQd6aMl0gcUBYnJzBDLoA== X-Received: by 2002:a1c:c90b:: with SMTP id f11mr2326wmb.61.1552323344101; Mon, 11 Mar 2019 09:55:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 11 Mar 2019 17:55:09 +0100 Message-Id: <1552323335-46779-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1552323335-46779-1-git-send-email-pbonzini@redhat.com> References: <1552323335-46779-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::332 Subject: [Qemu-devel] [PULL v2 05/31] hw/i386/pc: run the multiboot loader before the PVH loader 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 Some multiboot images could be in the ELF format. In the current implementation QEMU fails because we try to load these images as a PVH image. In order to fix this issue, we should try multiboot first (we already check the multiboot magic header before to load it). If it is not a multiboot image, we can try the PVH loader. Fixes: ab969087da6 ("pvh: Boot uncompressed kernel using direct boot ABI", = 2019-01-15) Reported-by: Paolo Bonzini Signed-off-by: Stefano Garzarella Message-Id: <20190214180216.246707-1-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4212818..9c8f833 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1210,6 +1210,17 @@ static void load_linux(PCMachineState *pcms, protocol =3D lduw_p(header+0x206); } else { /* + * This could be a multiboot kernel. If it is, let's stop treating= it + * like a Linux kernel. + * Note: some multiboot images could be in the ELF format (the sam= e of + * PVH), so we try multiboot first since we check the multiboot ma= gic + * header before to load it. + */ + if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, + kernel_cmdline, kernel_size, header)) { + return; + } + /* * Check if the file is an uncompressed kernel file (ELF) and load= it, * saving the PVH entry point used by the x86/HVM direct boot ABI. * If load_elfboot() is successful, populate the fw_cfg info. @@ -1262,12 +1273,6 @@ static void load_linux(PCMachineState *pcms, =20 return; } - /* This looks like a multiboot kernel. If it is, let's stop - treating it like a Linux kernel. */ - if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename, - kernel_cmdline, kernel_size, header)) { - return; - } protocol =3D 0; } =20 --=20 1.8.3.1