From patchwork Tue Nov 7 08:04:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10045829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E6666032D for ; Tue, 7 Nov 2017 08:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F92B28D84 for ; Tue, 7 Nov 2017 08:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 729BC29D38; Tue, 7 Nov 2017 08:04:32 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13BBF28D84 for ; Tue, 7 Nov 2017 08:04:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932418AbdKGIE3 (ORCPT ); Tue, 7 Nov 2017 03:04:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54306 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932258AbdKGIE2 (ORCPT ); Tue, 7 Nov 2017 03:04:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31D60356DB; Tue, 7 Nov 2017 08:04:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31D60356DB Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com Received: from sirius.home.kraxel.org (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3880460171; Tue, 7 Nov 2017 08:04:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8D15317532; Tue, 7 Nov 2017 09:04:25 +0100 (CET) From: Gerd Hoffmann To: kvm@vger.kernel.org Cc: jean-philippe.brucker@arm.com, darren.kenny@oracle.com, Gerd Hoffmann Subject: [PATCH v3] kvmtool: handle x86 firmware smaller than 128k Date: Tue, 7 Nov 2017 09:04:24 +0100 Message-Id: <20171107080424.1573-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 07 Nov 2017 08:04:28 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Firmware images smaller than the bios memory region (0xe0000 -> 0xfffff) must be mapped at the end of the region because the x86 cpu reset vector is 0xffff0. Signed-off-by: Gerd Hoffmann Reviewed-by: Darren Kenny --- x86/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/boot.c b/x86/boot.c index 61535eb57b..b7a4262d89 100644 --- a/x86/boot.c +++ b/x86/boot.c @@ -28,7 +28,7 @@ bool kvm__load_firmware(struct kvm *kvm, const char *firmware_filename) if (st.st_size > MB_FIRMWARE_BIOS_SIZE) die("firmware image %s is too big to fit in memory (%Lu KB).\n", firmware_filename, (u64)(st.st_size / 1024)); - p = guest_flat_to_host(kvm, MB_FIRMWARE_BIOS_BEGIN); + p = guest_flat_to_host(kvm, MB_BIOS_END + 1 - st.st_size); while ((nr = read(fd, p, st.st_size)) > 0) p += nr;