Re: [PATCH] softmmu/vl.c: Handle '-cpu help' and '-device help' before 'no default machine'

2020-03-16 Thread Kashyap Chamarthy
[Cc: Markus; he'd be pleasantly surprised with this, if he already
hadn't noticed this, as he was also mildly annoyed about this the other
day.]

On Fri, Mar 13, 2020 at 05:24:47PM +, Peter Maydell wrote:
> Currently if you try to ask for the list of CPUs for a target
> architecture which does not specify a default machine type
> you just get an error:
> 
>   $ qemu-system-arm -cpu help
>   qemu-system-arm: No machine specified, and there is no default
>   Use -machine help to list supported machines

I just applied the patch and built on QEMU.

With `qemu-system-arm`:

$> ./arm-softmmu/qemu-system-arm -cpu help | head -5
Available CPUs:
  arm1026
  arm1136
  arm1136-r2
  arm1176

$> ./arm-softmmu/qemu-system-arm -device help | head -5
Controller/Bridge/Hub devices:
name "i82801b11-bridge", bus PCI
name "ioh3420", bus PCI, desc "Intel IOH device id 3420 PCIE Root Port"
name "pci-bridge", bus PCI, desc "Standard PCI Bridge"
name "pci-bridge-seat", bus PCI, desc "Standard PCI Bridge (multiseat)"

With `qemu-system-aarch64`:

$> ./aarch64-softmmu/qemu-system-aarch64 -cpu help | head -5
Available CPUs:
  arm1026
  arm1136
  arm1136-r2
  arm1176

$> ./aarch64-softmmu/qemu-system-aarch64 -device help | head -5
Controller/Bridge/Hub devices:
name "i82801b11-bridge", bus PCI
name "ioh3420", bus PCI, desc "Intel IOH device id 3420 PCIE Root Port"
name "pci-bridge", bus PCI, desc "Standard PCI Bridge"
name "pci-bridge-seat", bus PCI, desc "Standard PCI Bridge (multiseat)"

> Since the list of CPUs doesn't depend on the machine, this is
> unnecessarily unhelpful. "-device help" has a similar problem.
> 
> Move the checks for "did the user ask for -cpu help or -device help"
> up so they precede the select_machine() call which checks that the
> user specified a valid machine type.
> 
> Signed-off-by: Peter Maydell 

Tested-by: Kashyap Chamarthy 

> ---
> This has been on-and-off irritating me for years, and it's
> embarrassing how simple the fix turns out to be...
> ---
>  softmmu/vl.c | 26 --
>  1 file changed, 16 insertions(+), 10 deletions(-)

[...] 

Thanks. :)

-- 
/kashyap




Re: [PATCH] softmmu/vl.c: Handle '-cpu help' and '-device help' before 'no default machine'

2020-03-14 Thread Markus Armbruster
Peter Maydell  writes:

> Currently if you try to ask for the list of CPUs for a target
> architecture which does not specify a default machine type
> you just get an error:
>
>   $ qemu-system-arm -cpu help
>   qemu-system-arm: No machine specified, and there is no default
>   Use -machine help to list supported machines
>
> Since the list of CPUs doesn't depend on the machine, this is
> unnecessarily unhelpful. "-device help" has a similar problem.
>
> Move the checks for "did the user ask for -cpu help or -device help"
> up so they precede the select_machine() call which checks that the
> user specified a valid machine type.
>
> Signed-off-by: Peter Maydell 
> ---
> This has been on-and-off irritating me for years, and it's
> embarrassing how simple the fix turns out to be...

Same here.  The patch works as advertized, thus:
Reviewed-by: Markus Armbruster 

Can you offer a completeness argument?  We call is_help_option() and
qemu_opt_has_help_opt() from quite a few places.