All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: kvm@vger.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: [PATCH kvmtool] x86/kvm-cpu.c: don't include <asm/msr-index.h>
Date: Sat, 19 Aug 2017 22:54:20 +0200	[thread overview]
Message-ID: <20170819205420.30848-1-thomas.petazzoni@free-electrons.com> (raw)

Since kernel commit 25dc1d6cc3082aab293e5dad47623b550f7ddd2a ("x86:
stop exporting msr-index.h to userland"), <asm/msr-index.h> is no
longer exported to userspace. Therefore, any toolchain built with
kernel headers >= 4.12 will no longer have this header file, causing a
build failure in kvmtool.

As a replacement, this patch includes inside x86/kvm-cpu.c the
necessary MSR_* definitions.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 x86/kvm-cpu.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/x86/kvm-cpu.c b/x86/kvm-cpu.c
index 5cc4e1e..b02ff65 100644
--- a/x86/kvm-cpu.c
+++ b/x86/kvm-cpu.c
@@ -4,7 +4,6 @@
 #include "kvm/util.h"
 #include "kvm/kvm.h"
 
-#include <asm/msr-index.h>
 #include <asm/apicdef.h>
 #include <linux/err.h>
 #include <sys/ioctl.h>
@@ -136,6 +135,22 @@ static struct kvm_msrs *kvm_msrs__new(size_t nmsrs)
 	return vcpu;
 }
 
+#define MSR_IA32_SYSENTER_CS            0x00000174
+#define MSR_IA32_SYSENTER_ESP           0x00000175
+#define MSR_IA32_SYSENTER_EIP           0x00000176
+
+#define MSR_STAR                0xc0000081 /* legacy mode SYSCALL target */
+#define MSR_LSTAR               0xc0000082 /* long mode SYSCALL target */
+#define MSR_CSTAR               0xc0000083 /* compat mode SYSCALL target */
+#define MSR_SYSCALL_MASK        0xc0000084 /* EFLAGS mask for syscall */
+#define MSR_KERNEL_GS_BASE      0xc0000102 /* SwapGS GS shadow */
+
+#define MSR_IA32_TSC                    0x00000010
+#define MSR_IA32_MISC_ENABLE            0x000001a0
+
+#define MSR_IA32_MISC_ENABLE_FAST_STRING_BIT            0
+#define MSR_IA32_MISC_ENABLE_FAST_STRING                (1ULL << MSR_IA32_MISC_ENABLE_FAST_STRING_BIT)
+
 #define KVM_MSR_ENTRY(_index, _data)	\
 	(struct kvm_msr_entry) { .index = _index, .data = _data }
 
-- 
2.9.4

             reply	other threads:[~2017-08-19 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19 20:54 Thomas Petazzoni [this message]
2017-08-30  8:36 ` [PATCH kvmtool] x86/kvm-cpu.c: don't include <asm/msr-index.h> Riku Voipio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170819205420.30848-1-thomas.petazzoni@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.