qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: Vasiliy Tolstov <v.tolstov@selfip.ru>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	KVM list <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU
Date: Mon, 25 May 2015 11:05:17 -0400	[thread overview]
Message-ID: <20150525150517.GA4140@morn.localdomain> (raw)
In-Reply-To: <CACaajQuxiTFvD+wJpZK3ew8KZ8aPhJ3assCiw3xUhAMGmPry6g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2779 bytes --]

On Mon, May 25, 2015 at 09:21:49AM +0300, Vasiliy Tolstov wrote:
> 2015-05-23 6:55 GMT+03:00 Kevin O'Connor <kevin@koconnor.net>:
> > 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


--- 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();



[-- Attachment #2: .config --]
[-- Type: text/plain, Size: 1735 bytes --]

#
# 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

  reply	other threads:[~2015-05-25 15:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 13:51 [Qemu-devel] Announcing qboot, a minimal x86 firmware for QEMU Paolo Bonzini
2015-05-21 15:48 ` Avi Kivity
2015-05-21 16:21   ` Paolo Bonzini
2015-05-21 18:28     ` Avi Kivity
2015-05-21 17:04 ` Jan Kiszka
2015-05-22  2:53 ` Yong Wang
2015-05-26  8:47   ` Stefan Hajnoczi
2015-06-05 10:42     ` Stefan Hajnoczi
2015-05-22 11:01 ` Daniel P. Berrange
2015-05-22 11:04   ` Peter Maydell
2015-05-22 11:12     ` Daniel P. Berrange
2015-05-22 11:21       ` Peter Maydell
2015-05-22 11:33         ` Daniel P. Berrange
2015-05-22 11:34         ` Gerd Hoffmann
2015-05-22 11:42         ` Markus Armbruster
2015-05-25 12:53       ` Paolo Bonzini
2015-05-26 21:25         ` Christopher Covington
2015-05-27  9:30           ` Paolo Bonzini
2015-05-27  9:36             ` Avi Kivity
2015-05-27 11:00               ` Paolo Bonzini
2015-05-27 11:54             ` Peter Maydell
2015-05-27 12:05               ` Paolo Bonzini
2015-05-27 12:50             ` Christopher Covington
2015-05-27 12:59               ` Paolo Bonzini
2015-05-27 16:24             ` Dr. David Alan Gilbert
2015-05-22 14:06 ` Gerd Hoffmann
2015-05-22 23:23 ` Kevin O'Connor
2015-05-23  3:55   ` Kevin O'Connor
2015-05-25  6:21     ` Vasiliy Tolstov
2015-05-25 15:05       ` Kevin O'Connor [this message]
2015-05-25 12:52   ` Paolo Bonzini
2015-05-25 15:11     ` Kevin O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150525150517.GA4140@morn.localdomain \
    --to=kevin@koconnor.net \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=v.tolstov@selfip.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).