qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 6ef471: vl: Clean up parsing of -boot option


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6ef471: vl: Clean up parsing of -boot option argument
Date: Wed, 19 Jun 2013 13:00:10 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6ef4716cecdfa1b3794c1a33edba9840e1aa6b5f
      
https://github.com/qemu/qemu/commit/6ef4716cecdfa1b3794c1a33edba9840e1aa6b5f
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Clean up parsing of -boot option argument

Commit 3d3b8303 threw in some QemuOpts parsing without replacing the
existing ad hoc parser, resulting in a confusing mess.  Clean it up.

Two user-visible changes:

1. Invalid options are reported more nicely.  Before:
   qemu: unknown boot parameter 'x' in 'x=y'

   After:
   qemu-system-x86_64: -boot x=y: Invalid parameter 'x'

2. If -boot is given multiple times, options accumulate, just like for
   -machine.  Before, only options order, once and menu accumulated.
   For the other ones, all but the first -boot in non-legacy syntax
   got simply ignored.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: a86b35f992f107323e432c0a96107e11e1b699ad
      
https://github.com/qemu/qemu/commit/a86b35f992f107323e432c0a96107e11e1b699ad
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M include/qemu/option.h
    M util/qemu-option.c

  Log Message:
  -----------
  qemu-option: check_params() is now unused, drop it

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 8281abd548d840d84223e66812491918c713e56c
      
https://github.com/qemu/qemu/commit/8281abd548d840d84223e66812491918c713e56c
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Fix -boot order and once regressions, and related bugs

Option "once" sets up a different boot order just for the initial
boot.  Boot order reverts back to normal on reset.  Option "order"
changes the normal boot order.

The reversal is implemented by reset handler restore_boot_devices(),
which takes the boot order to revert to as argument.
restore_boot_devices() does nothing on its first call, because that
must be the initial machine reset.  On its second call, it changes the
boot order back, and unregisters itself.

Because we register the handler right when -boot gets parsed, we can
revert to an incorrect normal boot order, and multiple -boot can
interact in funny ways.

Here's how things work without -boot once or order:

* boot_devices is "".

* main() passes machine->boot_order to to machine->init(), because
  boot_devices is "".  machine->init() configures firmware
  accordingly.  For PC machines, machine->boot_order is "cad", and
  pc_cmos_init() writes it to RTC CMOS, where SeaBIOS picks it up.

Now consider -boot order=:

* boot_devices is "".

* -boot order= sets boot_devices to "" (no change).

* main() passes machine->boot_order to to machine->init(), because
  boot_devices is "", as above.

  Bug: -boot order= has no effect.  Broken in commit e4ada29e.

Next, consider -boot once=a:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* main() passes boot_devices "a" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

* Machine boots, boot order is "a".

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Bug: boot order reverts to "" instead of machine->boot_order.  The
    actual boot order depends on how firmware interprets "".  Broken
    in commit e4ada29e.

Next, consider -boot once=a -boot order=c:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* -boot order=c sets boot_devices to "c".

* main() passes boot_devices "c" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

* Machine boots, boot order is "c".

  Bug: it should be "a".  I figure this has always been broken.

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Bug: boot order reverts to "" instead of "c".  I figure this has
    always been broken, just differently broken before commit
    e4ada29e.

Next, consider -boot once=a -boot once=b -boot once=c:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* -boot once=b registers restore_boot_devices() with argument "a", and
  sets boot_devices to "b".

* -boot once=c registers restore_boot_devices() with argument "b", and
  sets boot_devices to "c".

* main() passes boot_devices "c" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

  - restore_boot_devices() gets called with argument "a".  Calls
    qemu_boot_set("a") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

  - restore_boot_devices() gets called with argument "b".  Calls
    qemu_boot_set("b") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

* Machine boots, boot order is "b".

  Bug: should really be "c", because that came last, and for all other
  -boot options, the last one wins.  I figure this was broken some
  time before commit 37905d6a, and fixed there only for a single
  occurence of "once".

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Same bug as above: boot order reverts to "" instead of
    machine->boot_order.

Fix by acting upon -boot options order, once and menu only after
option parsing is complete, and the machine is known.  This is how the
other -boot options work already.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 083b79c9fea0e3842f0b2b57ff0d20ab5f57084a
      
https://github.com/qemu/qemu/commit/083b79c9fea0e3842f0b2b57ff0d20ab5f57084a
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M include/hw/hw.h
    M vl.c

  Log Message:
  -----------
  vl: Rename *boot_devices to *boot_order, for consistency

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: e1123015a50abf44f9daa9495f40eeaaf4c9bb98
      
https://github.com/qemu/qemu/commit/e1123015a50abf44f9daa9495f40eeaaf4c9bb98
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M hw/i386/pc.c

  Log Message:
  -----------
  pc: Make -no-fd-bootchk stick across boot order changes

Option -no-fd-bootchk asks the BIOS to attempt booting from a floppy
even when the boot sector signature isn't there, by setting a bit in
RTC CMOS.  It was added back in 2006 (commit 52ca8d6a).

Two years later, commit 0ecdffbb added monitor command boot_set.
Implemented by new function pc_boot_set().  It unconditionally clears
the floppy signature bit in CMOS.

Commit e0f084bf added -boot option once to automatically change the
boot order on first reset.  Reuses pc_boot_set(), thus also clears the
floppy signature bit.  Commit d9346e81 took care to preserve this
behavior.

Thus, -no-fd-bootchk applies to any number of boots.  Except it
applies just to the first boot with -boot once, and never after
boot_set.  Weird.  Make it stick instead: set the bit according to
-no-fd-bootchk in pc_boot_set().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 4eda32f588086b6cd0ec2be6a7a6c131f8c2b427
      
https://github.com/qemu/qemu/commit/4eda32f588086b6cd0ec2be6a7a6c131f8c2b427
  Author: Markus Armbruster <address@hidden>
  Date:   2013-06-19 (Wed, 19 Jun 2013)

  Changed paths:
    M qemu-options.hx

  Log Message:
  -----------
  doc: Drop ref to Bochs from -no-fd-bootchk documentation

Manual page and qemu-doc on talk about "Bochs BIOS".  We use SeaBIOS,
and it implements the feature.  Replace by just "BIOS", and drop the
TODO line wondering about the Bochs reference.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


Compare: https://github.com/qemu/qemu/compare/c1990468d5a1...4eda32f58808

reply via email to

[Prev in Thread] Current Thread [Next in Thread]