From patchwork Thu Jul 28 10:50:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9251113 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 E8E2A60757 for ; Thu, 28 Jul 2016 11:19:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9B3726D17 for ; Thu, 28 Jul 2016 11:19:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE6D127813; Thu, 28 Jul 2016 11:19:00 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D88D26D17 for ; Thu, 28 Jul 2016 11:19:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSjIZ-0001kt-PY; Thu, 28 Jul 2016 11:16:19 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSjIY-0001kY-Qm for xen-devel@lists.xen.org; Thu, 28 Jul 2016 11:16:18 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id E7/F4-19721-289E9975; Thu, 28 Jul 2016 11:16:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHRDpG7jy5n hBu+Palgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnrHi9gLLgjW9Hb4tTA2C7ZxcjJISHgL/Fw 9npmEJtNwEBixfSrjCC2iICsxOquOexdjFwczAJHGCVu3fwJlhAW8JX41DCbDcRmEVCV+Db/H guIzStgL7H8/0NGiKFyEg3n74MN5QSKrzx8nx3EFhKwkzi0cSEzhK0mcWPhMqheQYmTM5+A2c wCEhIHX7xghpjDLXH79FTmCYx8s5CUzUJStoCRaRWjRnFqUVlqka6RpV5SUWZ6RkluYmaOrqG BqV5uanFxYnpqTmJSsV5yfu4mRmBQ1TMwMO5gvLzF7xCjJAeTkihvWOjMcCG+pPyUyozE4oz4 otKc1OJDjDIcHEoSvAIvgHKCRanpqRVpmTnA8IZJS3DwKInwPn4OlOYtLkjMLc5Mh0idYlSUE ueVB+kTAElklObBtcFi6hKjrJQwLyMDA4MQT0FqUW5mCar8K0ZxDkYlYd73ION5MvNK4Ka/Al rMBLS4OHYGyOKSRISUVANjfp5qed6utMl3ci/vbhedulQtKOHWrD/xjyQvFVkc3bHrVlL1jz+ ChVI91wKZNU/e+fL1tXfw4pUzJ7bsl9jEaeP1dg9X3b3wo323RXon/MuQCUrayfzv9PUT61bf T5700Fvp3c6M+T5tr8JWzEk5p3V4mjZX08T/mvdW5Phrdn6uv++tf6x3lRJLcUaioRZzUXEiA PDT79CkAgAA X-Env-Sender: prvs=0100a76d6=anthony.perard@citrix.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1469704574!35779524!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15296 invoked from network); 28 Jul 2016 11:16:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jul 2016 11:16:17 -0000 X-IronPort-AV: E=Sophos;i="5.28,433,1464652800"; d="scan'208";a="368933875" From: Anthony PERARD To: Date: Thu, 28 Jul 2016 11:50:08 +0100 Message-ID: <20160728105013.22310-11-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160728105013.22310-1-anthony.perard@citrix.com> References: <20160728105013.22310-1-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Anthony PERARD , Andrew Cooper , Ian Jackson , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v7 10/15] hvmloader: Load SeaBIOS from hvm_start_info modules X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP ... and do not include the SeaBIOS ROM into hvmloader anymore. This also fix the dependency on roms.inc, hvmloader.o does not include it. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich Reviewed-by: Andrew Cooper --- Change in V6: acked Change in V5: - update BUG_ON in seabios_setup_e820(). Change in V4: - check that seabios_config.bios_address have a probably good value instead of checking only if it's set. Change in V3: - change makefile to not include seabios roms into roms.inc. - update the struct bios_config with the location of the bios blob. --- tools/firmware/hvmloader/Makefile | 15 +-------------- tools/firmware/hvmloader/seabios.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile index f2f4791..ed0bfad 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile @@ -45,7 +45,6 @@ CIRRUSVGA_DEBUG ?= n OVMF_DIR := ../ovmf-dir ROMBIOS_DIR := ../rombios -SEABIOS_DIR := ../seabios-dir ifeq ($(CONFIG_ROMBIOS),y) STDVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.bin @@ -80,19 +79,13 @@ endif ifeq ($(CONFIG_SEABIOS),y) OBJS += seabios.o CFLAGS += -DENABLE_SEABIOS -ifeq ($(SEABIOS_PATH),) - SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin -else - SEABIOS_ROM := $(SEABIOS_PATH) -endif -ROMS += $(SEABIOS_ROM) endif .PHONY: all all: subdirs-all $(MAKE) hvmloader -ovmf.o rombios.o seabios.o hvmloader.o: roms.inc +ovmf.o rombios.o: roms.inc smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" hvmloader: $(OBJS) acpi/acpi.a @@ -109,12 +102,6 @@ ifneq ($(ROMBIOS_ROM),) echo "#endif" >> $@.new endif -ifneq ($(SEABIOS_ROM),) - echo "#ifdef ROM_INCLUDE_SEABIOS" >> $@.new - sh ./mkhex seabios $(SEABIOS_ROM) >> $@.new - echo "#endif" >> $@.new -endif - ifneq ($(OVMF_ROM),) echo "#ifdef ROM_INCLUDE_OVMF" >> $@.new sh ./mkhex ovmf $(OVMF_ROM) >> $@.new diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c index c6b3d9f..c5d2b34 100644 --- a/tools/firmware/hvmloader/seabios.c +++ b/tools/firmware/hvmloader/seabios.c @@ -27,9 +27,6 @@ #include "smbios_types.h" #include "acpi/acpi2_0.h" -#define ROM_INCLUDE_SEABIOS -#include "roms.inc" - extern unsigned char dsdt_anycpu_qemu_xen[]; extern int dsdt_anycpu_qemu_xen_len; @@ -127,22 +124,30 @@ static void seabios_setup_e820(void) struct e820entry *e820 = scratch_alloc(sizeof(struct e820entry)*16, 0); info->e820 = (uint32_t)e820; + /* Upper boundary already checked by seabios_load(). */ + BUG_ON(seabios_config.bios_address < 0x000c0000); /* SeaBIOS reserves memory in e820 as necessary so no low reservation. */ - info->e820_nr = build_e820_table(e820, 0, 0x100000-sizeof(seabios)); + info->e820_nr = build_e820_table(e820, 0, seabios_config.bios_address); dump_e820_table(e820, info->e820_nr); } -struct bios_config seabios_config = { - .name = "SeaBIOS", +static void seabios_load(const struct bios_config *bios, + void *bios_addr, uint32_t bios_length) +{ + unsigned int bios_dest = 0x100000 - bios_length; - .image = seabios, - .image_size = sizeof(seabios), + BUG_ON(bios_dest + bios_length > HVMLOADER_PHYSICAL_ADDRESS); + memcpy((void *)bios_dest, bios_addr, bios_length); + seabios_config.bios_address = bios_dest; + seabios_config.image_size = bios_length; +} - .bios_address = 0x100000 - sizeof(seabios), +struct bios_config seabios_config = { + .name = "SeaBIOS", .load_roms = NULL, - .bios_load = NULL, + .bios_load = seabios_load, .bios_info_setup = seabios_setup_bios_info, .bios_info_finish = seabios_finish_bios_info,