From patchwork Mon Oct 15 21:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Hildebrand X-Patchwork-Id: 10642483 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 4D20615E2 for ; Mon, 15 Oct 2018 21:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5BF29FE9 for ; Mon, 15 Oct 2018 21:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F3952A0D1; Mon, 15 Oct 2018 21:28:02 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A95D229FE9 for ; Mon, 15 Oct 2018 21:28:01 +0000 (UTC) Received: from localhost ([::1]:54946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCAPA-0003N3-19 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Oct 2018 17:28:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCAO0-0002WD-SS for qemu-devel@nongnu.org; Mon, 15 Oct 2018 17:26:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCAO0-0001Ct-07 for qemu-devel@nongnu.org; Mon, 15 Oct 2018 17:26:48 -0400 Received: from mail.dornerworks.com ([12.207.209.150]:42433 helo=webmail.dornerworks.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCANu-00013Z-F9; Mon, 15 Oct 2018 17:26:42 -0400 From: Stewart Hildebrand To: "qemu-arm@nongnu.org" , "qemu-devel@nongnu.org" Thread-Topic: [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol. Thread-Index: AdRkyzsaagNMJ8GXSq2USPRWdR9FZg== Date: Mon, 15 Oct 2018 21:26:39 +0000 Message-ID: <40eb19fb56b24e10a5eaa99ccb78aff6@dornerworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.27.14.152] MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 12.207.209.150 Subject: [Qemu-devel] [PATCH] hw/arm/boot: Increase compliance with kernel arm64 boot protocol. 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: Andre Przywara , Julien Grall , Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP "The Image must be placed text_offset bytes from a 2MB aligned base address anywhere in usable system RAM and called there." For the virt board, we write our startup bootloader at the very bottom of RAM, so that bit can't be used for the image. To avoid overlap in case the image requests to be loaded at an offset smaller than our bootloader, we increment the load offset to the next 2MB. This fixes a boot failure for Xen AArch64. Signed-off-by: Stewart Hildebrand --- hw/arm/boot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 20c71d7d96..559ddbcd53 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -919,6 +919,16 @@ static uint64_t load_aarch64_image(const char *filename, hwaddr mem_base, memcpy(&hdrvals, buffer + ARM64_TEXT_OFFSET_OFFSET, sizeof(hdrvals)); if (hdrvals[1] != 0) { kernel_load_offset = le64_to_cpu(hdrvals[0]); + + /* For the virt board, we write our startup "bootloader" at the very + * bottom of RAM, so that bit can't be used for the image. To avoid + * overlap in case the image requests to be loaded at an offset + * smaller than our bootloader, we increment the load offset to the + * next 2MB. + */ + if (kernel_load_offset < FIXUP_MAX) { + kernel_load_offset += 2 << 20; + } } }