From patchwork Mon May 25 15:05:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin O'Connor X-Patchwork-Id: 6475401 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64B98C0020 for ; Mon, 25 May 2015 15:05:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B85D2015E for ; Mon, 25 May 2015 15:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 738352012E for ; Mon, 25 May 2015 15:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbbEYPFX (ORCPT ); Mon, 25 May 2015 11:05:23 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:34147 "EHLO mail-qk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbbEYPFV (ORCPT ); Mon, 25 May 2015 11:05:21 -0400 Received: by qkgx75 with SMTP id x75so66508393qkg.1 for ; Mon, 25 May 2015 08:05:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=MAoJLs3q8t3z0rJkspsVUXhVO1ifW7bl2M5EL6kxKA0=; b=d+FY87+NuVVrlMhcZtORvvJJURvm8m/cEk0jq1Xj/SZfDva8+QT+uV/+CoYSJPP6KC ycyazfuArnN82Ww7TOjSBQkEZXS2U2E5t8hCatXlHtxoQUHVQFXMZjW5iP4BJCMVmxsU fDQTtlnoFbOGywaiXBw23pbABEOPUNTFNJZu/uqjnvXOXfXBFFKrwKdl4PcDJOjJIUFU vkFroKOpDEG+N+ekTMoHzPOzOzp3518jmGUyvVouk9AijzlPI+wODfciDh6sbfN4nu3S UCIuwZt6o2Ts+yj7pwTgZQd+4uBJW1Ys3+XYt/9/FIclkW0TPbz3wExr9Dr1O6QJ6Heg cEAA== X-Gm-Message-State: ALoCoQnpR/Y22IKZCgzVOcmnTO9PNGimEyTUA9Zq0mkk+zs57MxZASCwYXOXgTCpbOE3+QYMTQb1 X-Received: by 10.140.31.162 with SMTP id f31mr27905160qgf.23.1432566319950; Mon, 25 May 2015 08:05:19 -0700 (PDT) Received: from localhost (207-172-170-53.c3-0.avec-ubr1.nyr-avec.ny.cable.rcn.com. [207.172.170.53]) by mx.google.com with ESMTPSA id r88sm6999505qkh.12.2015.05.25.08.05.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2015 08:05:18 -0700 (PDT) Date: Mon, 25 May 2015 11:05:17 -0400 From: Kevin O'Connor To: Vasiliy Tolstov Cc: Paolo Bonzini , qemu-devel , KVM list Subject: Re: Announcing qboot, a minimal x86 firmware for QEMU Message-ID: <20150525150517.GA4140@morn.localdomain> References: <555DE2EF.1000509@redhat.com> <20150522232327.GA23114@morn.localdomain> <20150523035501.GA20419@morn.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, May 25, 2015 at 09:21:49AM +0300, Vasiliy Tolstov wrote: > 2015-05-23 6:55 GMT+03:00 Kevin O'Connor : > > Out of curiosity, I ran some additional timing tests. With SeaBIOS > > fully stripped down (via Kconfig), it takes ~20ms to get to the boot > > phase on my old AMD system. Of that 20ms, ~7ms is to enable shadow > > ram, 2ms is to calibrate the cpu timestamp counter, 4ms is for pci > > init, and ~6ms is to make the shadow ram area read-only. The time in > > the remaining parts of the SeaBIOS code is so small that it's hard to > > measure. > > Can you share config for seabios? As i understand i can safety to > remove keybord, ps2, usb, ata/ahci and leave only virtio (in case of > using qemu to boo linux/freebsd/windows systems) ? To get to 20ms, I basically disabled everything. (Actually, after sending my last email I found I cound get to 16ms by setting CONFIG_WRITABLE_UPPERMEMORY=y - it avoids much of the shadow ram read-only cost.) It's not possible to actually boot anything with this config - I was instead timing to the point where one could add a multiboot or vmlinux boot capability to SeaBIOS. To get to these times I disabled debug messages themselves (they take a few ms of the boot time). So, to time events without debug messages I added a few outb() calls to seabios at critical points. See patch and config below. -Kevin # # Automatically generated file; DO NOT EDIT. # SeaBIOS Configuration # # # General Features # # CONFIG_COREBOOT is not set CONFIG_QEMU=y # CONFIG_CSM is not set CONFIG_QEMU_HARDWARE=y # CONFIG_XEN is not set # CONFIG_THREADS is not set # CONFIG_RELOCATE_INIT is not set # CONFIG_BOOTMENU is not set # CONFIG_BOOTORDER is not set CONFIG_ENTRY_EXTRASTACK=y CONFIG_MALLOC_UPPERMEMORY=y CONFIG_ROM_SIZE=0 # # Hardware support # # CONFIG_ATA is not set # CONFIG_AHCI is not set # CONFIG_SDCARD is not set # CONFIG_VIRTIO_BLK is not set # CONFIG_VIRTIO_SCSI is not set # CONFIG_PVSCSI is not set # CONFIG_ESP_SCSI is not set # CONFIG_LSI_SCSI is not set # CONFIG_MEGASAS is not set # CONFIG_FLOPPY is not set # CONFIG_PS2PORT is not set # CONFIG_USB is not set # CONFIG_SERIAL is not set # CONFIG_LPT is not set # CONFIG_USE_SMM is not set CONFIG_MTRR_INIT=y CONFIG_PMTIMER=y # # BIOS interfaces # CONFIG_DRIVES=y CONFIG_CDROM_BOOT=y CONFIG_CDROM_EMU=y CONFIG_PCIBIOS=y CONFIG_APMBIOS=y CONFIG_PNPBIOS=y # CONFIG_OPTIONROMS is not set CONFIG_BOOT=y CONFIG_KEYBOARD=y CONFIG_KBD_CALL_INT15_4F=y CONFIG_MOUSE=y CONFIG_S3_RESUME=y # CONFIG_VGAHOOKS is not set # CONFIG_DISABLE_A20 is not set CONFIG_WRITABLE_UPPERMEMORY=y # CONFIG_TCGBIOS is not set # # BIOS Tables # # CONFIG_PIRTABLE is not set # CONFIG_MPTABLE is not set # CONFIG_SMBIOS is not set # CONFIG_ACPI is not set # CONFIG_FW_ROMFILE_LOAD is not set # # VGA ROM # CONFIG_NO_VGABIOS=y # CONFIG_VGA_STANDARD_VGA is not set # CONFIG_VGA_CIRRUS is not set # CONFIG_VGA_BOCHS is not set # CONFIG_VGA_GEODEGX2 is not set # CONFIG_VGA_GEODELX is not set # CONFIG_BUILD_VGABIOS is not set CONFIG_VGA_FIXUP_ASM=y CONFIG_VGA_EXTRA_STACK_SIZE=512 # # Debugging # CONFIG_DEBUG_LEVEL=0 --- a/src/post.c +++ b/src/post.c @@ -167,11 +167,15 @@ platform_hardware_setup(void) // Init base pc hardware. pic_setup(); mathcp_setup(); + outb('3', 0x402); outb('\n', 0x402); timer_setup(); + outb('4', 0x402); outb('\n', 0x402); clock_setup(); // Platform specific setup + outb('5', 0x402); outb('\n', 0x402); qemu_platform_setup(); + outb('6', 0x402); outb('\n', 0x402); coreboot_platform_setup(); } @@ -200,6 +204,7 @@ startBoot(void) // Clear low-memory allocations (required by PMM spec). memset((void*)BUILD_STACK_ADDR, 0, BUILD_EBDA_MINIMUM - BUILD_STACK_ADDR); + outb('8', 0x402); outb('\n', 0x402); dprintf(3, "Jump to int19\n"); struct bregs br; memset(&br, 0, sizeof(br)); @@ -247,6 +252,7 @@ maininit(void) prepareboot(); // Write protect bios memory. + outb('7', 0x402); outb('\n', 0x402); make_bios_readonly(); // Invoke int 19 to start boot process. @@ -331,12 +337,14 @@ handle_post(void) serial_debug_preinit(); debug_banner(); + outb('1', 0x402); outb('\n', 0x402); // Check if we are running under Xen. xen_preinit(); // Allow writes to modify bios area (0xf0000) make_bios_writable(); + outb('2', 0x402); outb('\n', 0x402); // Now that memory is read/writable - start post process. dopost();