From: Jean-Philippe Brucker Subject: Re: [PATCH] kvmtool: handle x86 firmware smaller than 128k Date: Mon, 6 Nov 2017 17:09:14 +0000 Message-ID: <3b1b32c5-7b71-7b9d-ab00-a7610b564fcc@arm.com> References: <20171106114837.6882-1-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Gerd Hoffmann , "kvm@vger.kernel.org" Return-path: Received: from foss.arm.com ([217.140.101.70]:37904 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753113AbdKFRHB (ORCPT ); Mon, 6 Nov 2017 12:07:01 -0500 In-Reply-To: <20171106114837.6882-1-kraxel@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: Hi Gerd, This change deserves a comment, as it's not obvious what we're doing here. How about: """ When using an external firmware on x86, kvmtool follows the legacy BIOS standard, by entering firmware at address 0xffff0 in 16bit real mode. SeaBIOS images built for emulators follow this convention by having their reset vector 16 bytes before the end of the image. In order to support images of arbitrary size, move the image at the end of the BIOS region. """ Thanks, Jean On 06/11/17 11:48, Gerd Hoffmann wrote: > --- > 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; >