Re: [SeaBIOS] [PATCH v2] qemu: fast boot when linuxboot optionrom is used

On Fri, Nov 30, 2018 at 11:23:30AM +0100, Stefano Garzarella wrote:
On Thu, Nov 29, 2018 at 5:55 PM Kevin O'Connor <kevin@koconnor.net> wrote:
Interesting. I tracked down this printf delay - it's due to the save/restore of cpu state when thunking to 16bit mode. (For every character displayed on the screen the code enters 16bit mode to invoke the vgabios and it saves/restores the cr0, gdt, fs, gs, a20, nmi states during that process.) It's trivial to eliminate the calls when there is no vgabios though (see patch below).
Thanks, the patch works, but unfortunately, when I use qemu -nographic, the /etc/sercon-port is set to PORT_SERIAL1 (in src/fw/paravirt.c:623), bypassing the patch. Maybe in QEMU is better to set /etc/sercom-port to 0 when there is no serial port, or when we want a fast boot.
You should be able to use "-device VGA,romfile=" instead.
--- a/src/output.c +++ b/src/output.c @@ -74,6 +74,9 @@ static struct putcinfo debuginfo = { debug_putc }; static void screenc(char c) { + if (!MODESEGMENT && GET_IVT(0x10).segoff == FUNC16(entry_10).segoff) + // No need to thunk to 16bit mode if vgabios is not present + return; struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF;
Do you plan to commit this patch?
Only if it's useful - does sercon make it not worthwhile? -Kevin

Hi Kevin, On Wed, Dec 5, 2018 at 6:00 PM Kevin O'Connor <kevin@koconnor.net> wrote:
On Fri, Nov 30, 2018 at 11:23:30AM +0100, Stefano Garzarella wrote:
On Thu, Nov 29, 2018 at 5:55 PM Kevin O'Connor <kevin@koconnor.net> wrote:
Interesting. I tracked down this printf delay - it's due to the save/restore of cpu state when thunking to 16bit mode. (For every character displayed on the screen the code enters 16bit mode to invoke the vgabios and it saves/restores the cr0, gdt, fs, gs, a20, nmi states during that process.) It's trivial to eliminate the calls when there is no vgabios though (see patch below).
Thanks, the patch works, but unfortunately, when I use qemu -nographic, the /etc/sercon-port is set to PORT_SERIAL1 (in src/fw/paravirt.c:623), bypassing the patch. Maybe in QEMU is better to set /etc/sercom-port to 0 when there is no serial port, or when we want a fast boot.
You should be able to use "-device VGA,romfile=" instead.
My issue was releated to "-nographic" option. In this case if I disable the VGA or if I use "-device VGA,romfile=", at the end of the qemu_cfg_init() there are these lines that enable in any case the sercom: // serial console u16 nogfx = 0; qemu_cfg_read_entry(&nogfx, QEMU_CFG_NOGRAPHIC, sizeof(nogfx)); if (nogfx && !romfile_find("etc/sercon-port") && !romfile_find("vgaroms/sgabios.bin")) const_romfile_add_int("etc/sercon-port", PORT_SERIAL1); }
--- a/src/output.c +++ b/src/output.c @@ -74,6 +74,9 @@ static struct putcinfo debuginfo = { debug_putc }; static void screenc(char c) { + if (!MODESEGMENT && GET_IVT(0x10).segoff == FUNC16(entry_10).segoff) + // No need to thunk to 16bit mode if vgabios is not present + return; struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF;
Do you plan to commit this patch?
Only if it's useful - does sercon make it not worthwhile?
Yes, I think it is useful. If I don't use "-nographic" it works as expected. Thanks, Stefano
-Kevin
-- Stefano Garzarella Red Hat
participants (2)
-
Kevin O'Connor
-
Stefano Garzarella