Revision 4d700430

b/hmp-commands.hx
1643 1643
show roms
1644 1644
@item info tpm
1645 1645
show the TPM device
1646
@item info cpu_max
1647
show the number of CPUs supported by the machine being emulated.
1646 1648
@end table
1647 1649
ETEXI
1648 1650

  
b/hmp.c
748 748
    g_free(data);
749 749
}
750 750

  
751
void hmp_query_cpu_max(Monitor *mon, const QDict *qdict)
752
{
753
    int cpu_max;
754

  
755
    cpu_max = qmp_query_cpu_max(NULL);
756
    monitor_printf(mon, "Maximum number of CPUs is %d\n", cpu_max);
757
}
758

  
751 759
static void hmp_cont_cb(void *opaque, int err)
752 760
{
753 761
    if (!err) {
b/hmp.h
42 42
void hmp_system_reset(Monitor *mon, const QDict *qdict);
43 43
void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
44 44
void hmp_cpu(Monitor *mon, const QDict *qdict);
45
void hmp_query_cpu_max(Monitor *mon, const QDict *qdict);
45 46
void hmp_memsave(Monitor *mon, const QDict *qdict);
46 47
void hmp_pmemsave(Monitor *mon, const QDict *qdict);
47 48
void hmp_ringbuf_write(Monitor *mon, const QDict *qdict);
b/monitor.c
2746 2746
        .mhandler.cmd = hmp_info_tpm,
2747 2747
    },
2748 2748
    {
2749
        .name       = "cpu_max",
2750
        .args_type  = "",
2751
        .params     = "",
2752
        .help       = "Get maximum number of VCPUs supported by machine",
2753
        .mhandler.cmd = hmp_query_cpu_max,
2754
    },
2755
    {
2749 2756
        .name       = NULL,
2750 2757
    },
2751 2758
};
b/qapi-schema.json
1832 1832
{ 'command': 'query-migrate-cache-size', 'returns': 'int' }
1833 1833

  
1834 1834
##
1835
## @query-cpu-max
1836
##
1837
## query maximum number of CPUs supported by machine
1838
##
1839
## Returns: number of CPUs
1840
##
1841
## Since: 1.5
1842
###
1843
{ 'command': 'query-cpu-max', 'returns': 'int' }
1844

  
1845
##
1835 1846
# @ObjectPropertyInfo:
1836 1847
#
1837 1848
# @name: the name of the property
b/qmp-commands.hx
385 385
EQMP
386 386

  
387 387
    {
388
        .name       = "query-cpu-max",
389
        .args_type  = "",
390
        .mhandler.cmd_new = qmp_marshal_input_query_cpu_max,
391
    },
392

  
393
SQMP
394
query-cpu-max
395
-------------
396

  
397
Get the maximum CPUs supported by the machine being currently
398
emulated.
399

  
400
Returns json-int.
401

  
402
Example:
403

  
404
-> { "execute": "query-cpu-max" }
405
<- { "return": 255 }
406

  
407
EQMP
408

  
409
    {
388 410
        .name       = "memsave",
389 411
        .args_type  = "val:l,size:i,filename:s,cpu:i?",
390 412
        .mhandler.cmd_new = qmp_marshal_input_memsave,
b/vl.c
662 662
    return info;
663 663
}
664 664

  
665
int64_t qmp_query_cpu_max(Error **errp)
666
{
667
    return current_machine->max_cpus;
668
}
669

  
665 670
/***********************************************************/
666 671
/* real time host monotonic timer */
667 672

  

Also available in: Unified diff