On Mon, Apr 27, 2015 at 04:53:15PM +0200, Michael Mueller wrote:
> This patch introduces the function cpu_desc_avail() which returns by
> default true if not architecture specific implemented. Its intention
> is to indicate if the cpu model description is available for display
> by list_cpus(). This change allows cpu model descriptions to become
> dynamically created by evaluating the runtime context instead of
> putting static cpu model information at display.

Why are you deliberately breaking "-cpu ?" when cpu_desc_avail() is
false?

What exactly could cause cpu_desc_avail() to be false? If CPU model
information is not yet available when cpu_list() is called, it is a bug.

> 
> Signed-off-by: Michael Mueller <m...@linux.vnet.ibm.com>
> Reviewed-by: Thomas Huth <th...@linux.vnet.ibm.com>
> Acked-by: Christian Borntraeger <borntrae...@de.ibm.com>
> ---
>  include/qemu-common.h  | 2 ++
>  stubs/Makefile.objs    | 1 +
>  stubs/cpu-desc-avail.c | 6 ++++++
>  vl.c                   | 2 +-
>  4 files changed, 10 insertions(+), 1 deletion(-)
>  create mode 100644 stubs/cpu-desc-avail.c
> 
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index 1b5cffb..386750f 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -484,4 +484,6 @@ int parse_debug_env(const char *name, int max, int 
> initial);
>  
>  const char *qemu_ether_ntoa(const MACAddr *mac);
>  
> +bool cpu_desc_avail(void);
> +
>  #endif
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 8beff4c..dce9cd2 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -39,3 +39,4 @@ stub-obj-$(CONFIG_WIN32) += fd-register.o
>  stub-obj-y += cpus.o
>  stub-obj-y += kvm.o
>  stub-obj-y += qmp_pc_dimm_device_list.o
> +stub-obj-y += cpu-desc-avail.o
> diff --git a/stubs/cpu-desc-avail.c b/stubs/cpu-desc-avail.c
> new file mode 100644
> index 0000000..0cd594e
> --- /dev/null
> +++ b/stubs/cpu-desc-avail.c
> @@ -0,0 +1,6 @@
> +#include "qemu-common.h"
> +
> +bool cpu_desc_avail(void)
> +{
> +    return true;
> +}
> diff --git a/vl.c b/vl.c
> index 74c2681..c552561 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3820,7 +3820,7 @@ int main(int argc, char **argv, char **envp)
>       */
>      cpudef_init();
>  
> -    if (cpu_model && is_help_option(cpu_model)) {
> +    if (cpu_model && cpu_desc_avail() && is_help_option(cpu_model)) {
>          list_cpus(stdout, &fprintf, cpu_model);
>          exit(0);
>      }
> -- 
> 1.8.3.1
> 

-- 
Eduardo

Reply via email to