The function will later be called when probing QEMU capabilities.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
virHostCPUGetMap;
virHostCPUGetMicrocodeVersion;
virHostCPUGetMSR;
+virHostCPUGetMSRFromKVM;
virHostCPUGetOnline;
virHostCPUGetOnlineBitmap;
virHostCPUGetPhysAddrSize;
#if WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
(defined(__i386__) || defined(__x86_64__))
-static int
+/**
+ * virHostCPUGetMSRFromKVM:
+ * @index: MSR to read
+ * @result: where to store the content of the @index register
+ *
+ * Reads the 64b content of the specified register via KVM_GET_MSRS ioctl.
+ *
+ * Returns 0 on success,
+ * 1 when the MSR is not supported by the host CPU,
+ * -1 on error.
+ */
+int
virHostCPUGetMSRFromKVM(unsigned long index,
uint64_t *result)
{
return NULL;
}
+int
+virHostCPUGetMSRFromKVM(unsigned long index G_GNUC_UNUSED,
+ uint64_t *result G_GNUC_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Reading MSRs is not supported on this platform"));
+ return -1;
+}
+
int
virHostCPUGetMSR(unsigned long index G_GNUC_UNUSED,
uint64_t *msr G_GNUC_UNUSED)
unsigned int
virHostCPUGetMicrocodeVersion(virArch hostArch) ATTRIBUTE_MOCKABLE;
+int virHostCPUGetMSRFromKVM(unsigned long index,
+ uint64_t *result) ATTRIBUTE_MOCKABLE;
+
int virHostCPUGetMSR(unsigned long index,
uint64_t *msr);
#include "qemu/qemu_capspriv.h"
#include "testutilshostcpus.h"
#include "virarch.h"
+#include "util/virhostcpu.h"
virCPUDef *
return testUtilsHostCpusGetDefForModel(model);
}
+
+
+int
+virHostCPUGetMSRFromKVM(unsigned long index,
+ uint64_t *result)
+{
+ if (index == 0x10a) {
+ /* Return some arbitrary bits in arch-capabilities MSR */
+ *result =
+ 0x00000001 | /* rdctl-no */
+ 0x00000008 | /* skip-l1dfl-vmentry */
+ 0x00000020 | /* mds-no */
+ 0x00000040 | /* pschange-mc-no */
+ 0x04000000 | /* gds-no */
+ 0x08000000; /* rfds-no */
+ return 0;
+ }
+
+ errno = ENOTSUP;
+ return -1;
+}