From patchwork Tue Nov 7 07:34:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10045799 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 888706031B for ; Tue, 7 Nov 2017 07:34:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791952881A for ; Tue, 7 Nov 2017 07:34:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B37C28F8B; Tue, 7 Nov 2017 07:34:40 +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 14C202881A for ; Tue, 7 Nov 2017 07:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755386AbdKGHei (ORCPT ); Tue, 7 Nov 2017 02:34:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45308 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755377AbdKGHeh (ORCPT ); Tue, 7 Nov 2017 02:34:37 -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 62AFA15447; Tue, 7 Nov 2017 07:34:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 62AFA15447 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.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 BF537600D3; Tue, 7 Nov 2017 07:34:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1E63E409CB; Tue, 7 Nov 2017 08:34:34 +0100 (CET) From: Gerd Hoffmann To: kvm@vger.kernel.org Cc: jean-philippe.brucker@arm.com, Gerd Hoffmann Subject: [PATCH v2] kvmtool: handle x86 firmware smaller than 128k Date: Tue, 7 Nov 2017 08:34:32 +0100 Message-Id: <20171107073432.29561-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.29]); Tue, 07 Nov 2017 07:34:37 +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 if 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;