Hi Gerd,
On Tue, Nov 20, 2018 at 7:21 AM Gerd Hoffmann kraxel@redhat.com wrote:
Hi,
just an update, I enabled the debug prints and I saw two timeouts fired with a lot of time lost (~780ms between "init timer" and "Scan for VGA ..."), putting other prints I discovered that a lot of time is spent in the tpm_setup(), during the probe of the 2 TPM devices:
00.548869 init timer 00.549677 ./src/post.c:157 platform_hardware_setup 00.550182 ./src/hw/tpm_drivers.c:579 tpmhw_probe 01.300833 WARNING - Timeout at wait_reg8:81! 01.301388 ./src/hw/tpm_drivers.c:579 tpmhw_probe 01.331843 WARNING - Timeout at wait_reg8:81! 01.332316 ./src/post.c:160 platform_hardware_setup 01.333358 Scan for VGA option rom
Indeed, in the probe of the TPM devices (TIS and CRB) there are timeouts of 750 ms and 30 ms respectively.
Then, statically disabling TPM and TCG (CONFIG_TCGBIOS) the time spent in SeaBIOS goes down from ~846ms to ~56ms: # SeaBIOS disabling CONFIG_TCGBIOS BIOS=/home/stefano/repos/seabios/out_notcgbios/bios.bin qemu_init_end: 40.658371 fw_start: 40.850395 (+0.192024) fw_do_boot: 96.750142 (+55.899747) linux_start_boot: 98.880578 (+2.130436)
The tpm_setup() is called after the qemu_cfg_init(), so I think we can disable this call using some fw_cfg parameters, if we will decide to implement a runtime approach.
Another possible option is to simply use shorter timeouts on qemu (using runningOnQEMU()), I'd suggest to check with the TPM maintainers whenever that is ok.
Yes, it is a good idea!
Background: The drivers in seabios work on both virtual and physical hardware (you can run seabios as coreboot payload on physical hardware). There are quite a few places where are delays and timeouts which are required to work properly on physical hardware. But typically virtual hardware is alot faster. There is -- for example -- no time needed to establish a sata link. Link detection in ahci is instant on qemu.
I'll investigate also other timeouts.
Thanks, Stefano
cheers, Gerd
-- Stefano Garzarella Red Hat