[libvirt] [PATCH 34/36] vircpuhost: Add support for reading MSRs
Bjoern Walk
bwalk at linux.ibm.com
Sat Apr 13 15:17:59 UTC 2019
Jiri Denemark <jdenemar at redhat.com> [2019-04-08, 10:42AM +0200]:
> @@ -1254,3 +1255,82 @@ virHostCPUGetMicrocodeVersion(void)
> }
>
> #endif /* __linux__ */
> +
> +
> +#if HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS)
> +static int
> +virHostCPUGetMSRFromKVM(unsigned long index,
> + uint64_t *result)
> +{
> + VIR_AUTOCLOSE fd = -1;
> + struct {
> + struct kvm_msrs header;
> + struct kvm_msr_entry entry;
> + } msr = {
> + .header = { .nmsrs = 1 },
> + .entry = { .index = index },
> + };
> +
> + if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) {
> + virReportSystemError(errno, _("Unable to open %s"), KVM_DEVICE);
> + return -1;
> + }
> +
> + if (ioctl(fd, KVM_GET_MSRS, &msr) < 0) {
> + VIR_DEBUG("Cannot get MSR 0x%lx from KVM", index);
> + return 1;
> + }
> +
> + *result = msr.entry.data;
> + return 0;
> +}
This breaks build on S390:
../../src/util/virhostcpu.c: In function 'virHostCPUGetMSRFromKVM':
../../src/util/virhostcpu.c:1267:25: error: field 'header' has incomplete type
struct kvm_msrs header;
^~~~~~
../../src/util/virhostcpu.c:1268:30: error: field 'entry' has incomplete type
struct kvm_msr_entry entry;
^~~~~
../../src/util/virhostcpu.c:1270:21: error: field name not in record or union initializer
.header = { .nmsrs = 1 },
^
../../src/util/virhostcpu.c:1270:21: note: (near initialization for 'msr.header')
../../src/util/virhostcpu.c:1271:20: error: field name not in record or union initializer
.entry = { .index = index },
^
../../src/util/virhostcpu.c:1271:20: note: (near initialization for 'msr.entry')
In file included from /usr/include/asm/ioctl.h:1,
from /usr/include/linux/ioctl.h:5,
from /usr/include/asm-generic/ioctls.h:5,
from /usr/include/asm/ioctls.h:7,
from /usr/include/bits/ioctls.h:23,
from /usr/include/sys/ioctl.h:26,
from ../gnulib/lib/sys/ioctl.h:27,
from ../../src/util/virhostcpu.c:27:
../../src/util/virhostcpu.c:1279:19: error: invalid application of 'sizeof' to incomplete type 'struct kvm_msrs'
if (ioctl(fd, KVM_GET_MSRS, &msr) < 0) {
^~~~~~~~~~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190413/761bc1ba/attachment-0001.sig>
More information about the libvir-list
mailing list