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@xxxxxxxxxxxx>: > > 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();
# # 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