[libvirt] [PATCHv2 3/8] qemu: Add monitor APIs to fetch CPUID data from QEMU
Daniel P. Berrange
berrange at redhat.com
Wed Oct 30 15:41:04 UTC 2013
On Thu, Oct 17, 2013 at 03:10:17PM +0200, Peter Krempa wrote:
> From: Jiri Denemark <jdenemar at redhat.com>
>
> The qemu monitor supports retrieval of actual CPUID bits presented to
> the guest using QMP monitor. Add APIs to extract these information and
> tests for them.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> +/**
> + * qemuMonitorJSONGetGuestCPU:
> + * @mon: Pointer to the monitor
> + * @arch: arch of the guest
> + * @cpuData: Returned cpu definition of the gues
> + *
> + * Retrieve the definition of the guest CPU from a running qemu instance.
> + *
> + * Returns 0 on success; -1 on error; -2 if error may be caused by qemu not
> + * supporting reporting of CPU definition.
I'm not convinced we need the '-2' case here - I'd wrap it into the
regular '-1' case. I'll point out why in patch 8.
> + */
> +int
> +qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
> + virArch arch,
> + virCPUDataPtr *cpuData)
> +{
> + *cpuData = NULL;
> +
> + switch (arch) {
> + case VIR_ARCH_X86_64:
> + case VIR_ARCH_I686:
> + return qemuMonitorJSONGetCPUx86Data(mon, "feature-words", cpuData);
> +
> + default:
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("CPU definition retrieval insn't supported for '%s'"),
s/insn't/isn't/
> + virArchToString(arch));
> + return -2;
> + }
> +}
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list