All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] move kvm_para.h to standard-headers
@ 2018-04-17 18:58 ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Paolo Bonzini, Eduardo Habkost, kvm,
	Radim Krčmář

kvm_para.h is normally an interface for guest.  It's natural to need the
header in host to emulate that in qemu.

ATM it does not actually work on non-kvm systems, which allowed us to
get by sticking it in linux-headers and only pulling it in on Linux, but
that turns out to be more pain than it's worth.

The result seems to be that we are forced to duplicate
more and more code from there when we are in portable code.
Not nice.

Let's just pull it into standard-headers instead, and use
on all platforms unconditionally.

It turns out we only need the x86 version, so that is
and extra a plus - drop the rest.

Michael S. Tsirkin (4):
  update-linux-headers.sh: drop kvm_para.h hacks
  include/standard-headers: add asm-x86/kvm_para.h
  x86/cpu: use standard-headers/asm-x86.kvm_para.h
  linux-headers: drop kvm_para.h

 .../standard-headers}/asm-x86/kvm_para.h           | 49 ++++++-----
 include/sysemu/kvm.h                               |  1 -
 linux-headers/asm-arm/kvm_para.h                   |  2 -
 linux-headers/asm-arm64/kvm_para.h                 |  1 -
 linux-headers/asm-generic/kvm_para.h               |  4 -
 linux-headers/asm-mips/kvm_para.h                  |  5 --
 linux-headers/asm-powerpc/epapr_hcalls.h           | 99 ----------------------
 linux-headers/asm-powerpc/kvm_para.h               | 98 ---------------------
 linux-headers/asm-s390/kvm_para.h                  |  8 --
 linux-headers/linux/kvm_para.h                     | 35 --------
 target/i386/cpu.h                                  |  2 -
 target/i386/kvm_i386.h                             |  6 --
 hw/i386/kvm/clock.c                                |  2 +-
 target/i386/cpu.c                                  |  4 +-
 target/i386/kvm.c                                  |  4 +-
 scripts/update-linux-headers.sh                    | 16 ++--
 16 files changed, 35 insertions(+), 301 deletions(-)
 rename {linux-headers => include/standard-headers}/asm-x86/kvm_para.h (80%)
 delete mode 100644 linux-headers/asm-arm/kvm_para.h
 delete mode 100644 linux-headers/asm-arm64/kvm_para.h
 delete mode 100644 linux-headers/asm-generic/kvm_para.h
 delete mode 100644 linux-headers/asm-mips/kvm_para.h
 delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
 delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
 delete mode 100644 linux-headers/asm-s390/kvm_para.h
 delete mode 100644 linux-headers/linux/kvm_para.h

-- 
MST

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers
@ 2018-04-17 18:58 ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost

kvm_para.h is normally an interface for guest.  It's natural to need the
header in host to emulate that in qemu.

ATM it does not actually work on non-kvm systems, which allowed us to
get by sticking it in linux-headers and only pulling it in on Linux, but
that turns out to be more pain than it's worth.

The result seems to be that we are forced to duplicate
more and more code from there when we are in portable code.
Not nice.

Let's just pull it into standard-headers instead, and use
on all platforms unconditionally.

It turns out we only need the x86 version, so that is
and extra a plus - drop the rest.

Michael S. Tsirkin (4):
  update-linux-headers.sh: drop kvm_para.h hacks
  include/standard-headers: add asm-x86/kvm_para.h
  x86/cpu: use standard-headers/asm-x86.kvm_para.h
  linux-headers: drop kvm_para.h

 .../standard-headers}/asm-x86/kvm_para.h           | 49 ++++++-----
 include/sysemu/kvm.h                               |  1 -
 linux-headers/asm-arm/kvm_para.h                   |  2 -
 linux-headers/asm-arm64/kvm_para.h                 |  1 -
 linux-headers/asm-generic/kvm_para.h               |  4 -
 linux-headers/asm-mips/kvm_para.h                  |  5 --
 linux-headers/asm-powerpc/epapr_hcalls.h           | 99 ----------------------
 linux-headers/asm-powerpc/kvm_para.h               | 98 ---------------------
 linux-headers/asm-s390/kvm_para.h                  |  8 --
 linux-headers/linux/kvm_para.h                     | 35 --------
 target/i386/cpu.h                                  |  2 -
 target/i386/kvm_i386.h                             |  6 --
 hw/i386/kvm/clock.c                                |  2 +-
 target/i386/cpu.c                                  |  4 +-
 target/i386/kvm.c                                  |  4 +-
 scripts/update-linux-headers.sh                    | 16 ++--
 16 files changed, 35 insertions(+), 301 deletions(-)
 rename {linux-headers => include/standard-headers}/asm-x86/kvm_para.h (80%)
 delete mode 100644 linux-headers/asm-arm/kvm_para.h
 delete mode 100644 linux-headers/asm-arm64/kvm_para.h
 delete mode 100644 linux-headers/asm-generic/kvm_para.h
 delete mode 100644 linux-headers/asm-mips/kvm_para.h
 delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
 delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
 delete mode 100644 linux-headers/asm-s390/kvm_para.h
 delete mode 100644 linux-headers/linux/kvm_para.h

-- 
MST

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Brijesh Singh, Eduardo Habkost, kvm,
	Radim Krčmář,
	Cornelia Huck, Roman Kagan, Paolo Bonzini, Gerd Hoffmann

It turns out (as will be clear from follow-up patches)
we do not really need any kvm para macros host side
for now, except on x86, and there we need it
unconditionally whether we run on kvm or we don't.

Import the x86 asm/kvm_para.h into standard-headers,
follow-up patches remove a bunch of code using this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 scripts/update-linux-headers.sh | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 5b1d8dc..a017b53 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -43,6 +43,7 @@ cp_portable() {
                                      -e 'limits' \
                                      -e 'linux/kernel' \
                                      -e 'linux/sysinfo' \
+                                     -e 'asm-generic/kvm_para' \
                                      > /dev/null
     then
         echo "Unexpected #include in input file $f".
@@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
 
     rm -rf "$output/linux-headers/asm-$arch"
     mkdir -p "$output/linux-headers/asm-$arch"
-    for header in kvm.h kvm_para.h unistd.h; do
+    for header in kvm.h unistd.h; do
         cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
     done
-    if [ $arch = powerpc ]; then
-        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
-    fi
-
     rm -rf "$output/include/standard-headers/asm-$arch"
     mkdir -p "$output/include/standard-headers/asm-$arch"
     if [ $arch = s390 ]; then
@@ -124,20 +121,17 @@ EOF
         cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
+        cp_portable "$tmpdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch"
     fi
 done
 
 rm -rf "$output/linux-headers/linux"
 mkdir -p "$output/linux-headers/linux"
-for header in kvm.h kvm_para.h vfio.h vfio_ccw.h vhost.h \
+for header in kvm.h vfio.h vfio_ccw.h vhost.h \
               psci.h psp-sev.h userfaultfd.h; do
     cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
 done
-rm -rf "$output/linux-headers/asm-generic"
-mkdir -p "$output/linux-headers/asm-generic"
-for header in kvm_para.h; do
-    cp "$tmpdir/include/asm-generic/$header" "$output/linux-headers/asm-generic"
-done
+
 if [ -L "$linux/source" ]; then
     cp "$linux/source/COPYING" "$output/linux-headers"
 else
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost, Roman Kagan, Brijesh Singh, Gerd Hoffmann,
	Cornelia Huck

It turns out (as will be clear from follow-up patches)
we do not really need any kvm para macros host side
for now, except on x86, and there we need it
unconditionally whether we run on kvm or we don't.

Import the x86 asm/kvm_para.h into standard-headers,
follow-up patches remove a bunch of code using this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 scripts/update-linux-headers.sh | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 5b1d8dc..a017b53 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -43,6 +43,7 @@ cp_portable() {
                                      -e 'limits' \
                                      -e 'linux/kernel' \
                                      -e 'linux/sysinfo' \
+                                     -e 'asm-generic/kvm_para' \
                                      > /dev/null
     then
         echo "Unexpected #include in input file $f".
@@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
 
     rm -rf "$output/linux-headers/asm-$arch"
     mkdir -p "$output/linux-headers/asm-$arch"
-    for header in kvm.h kvm_para.h unistd.h; do
+    for header in kvm.h unistd.h; do
         cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
     done
-    if [ $arch = powerpc ]; then
-        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
-    fi
-
     rm -rf "$output/include/standard-headers/asm-$arch"
     mkdir -p "$output/include/standard-headers/asm-$arch"
     if [ $arch = s390 ]; then
@@ -124,20 +121,17 @@ EOF
         cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/"
         cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
+        cp_portable "$tmpdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch"
     fi
 done
 
 rm -rf "$output/linux-headers/linux"
 mkdir -p "$output/linux-headers/linux"
-for header in kvm.h kvm_para.h vfio.h vfio_ccw.h vhost.h \
+for header in kvm.h vfio.h vfio_ccw.h vhost.h \
               psci.h psp-sev.h userfaultfd.h; do
     cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
 done
-rm -rf "$output/linux-headers/asm-generic"
-mkdir -p "$output/linux-headers/asm-generic"
-for header in kvm_para.h; do
-    cp "$tmpdir/include/asm-generic/$header" "$output/linux-headers/asm-generic"
-done
+
 if [ -L "$linux/source" ]; then
     cp "$linux/source/COPYING" "$output/linux-headers"
 else
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/4] include/standard-headers: add asm-x86/kvm_para.h
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Peter Maydell, Eduardo Habkost, kvm,
	Radim Krčmář,
	Christian Borntraeger, Eric Auger, Paolo Bonzini

Import asm-x86/kvm_para.h from linux where it can
be easily used on Linux and non-Linux platforms.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/standard-headers/asm-x86/kvm_para.h | 121 ++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 include/standard-headers/asm-x86/kvm_para.h

diff --git a/include/standard-headers/asm-x86/kvm_para.h b/include/standard-headers/asm-x86/kvm_para.h
new file mode 100644
index 0000000..53a85ae
--- /dev/null
+++ b/include/standard-headers/asm-x86/kvm_para.h
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ASM_X86_KVM_PARA_H
+#define _ASM_X86_KVM_PARA_H
+
+#include "standard-headers/linux/types.h"
+
+/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
+ * should be used to determine that a VM is running under KVM.
+ */
+#define KVM_CPUID_SIGNATURE	0x40000000
+
+/* This CPUID returns two feature bitmaps in eax, edx. Before enabling
+ * a particular paravirtualization, the appropriate feature bit should
+ * be checked in eax. The performance hint feature bit should be checked
+ * in edx.
+ */
+#define KVM_CPUID_FEATURES	0x40000001
+#define KVM_FEATURE_CLOCKSOURCE		0
+#define KVM_FEATURE_NOP_IO_DELAY	1
+#define KVM_FEATURE_MMU_OP		2
+/* This indicates that the new set of kvmclock msrs
+ * are available. The use of 0x11 and 0x12 is deprecated
+ */
+#define KVM_FEATURE_CLOCKSOURCE2        3
+#define KVM_FEATURE_ASYNC_PF		4
+#define KVM_FEATURE_STEAL_TIME		5
+#define KVM_FEATURE_PV_EOI		6
+#define KVM_FEATURE_PV_UNHALT		7
+#define KVM_FEATURE_PV_TLB_FLUSH	9
+#define KVM_FEATURE_ASYNC_PF_VMEXIT	10
+
+#define KVM_HINTS_DEDICATED      0
+
+/* The last 8 bits are used to indicate how to interpret the flags field
+ * in pvclock structure. If no bits are set, all flags are ignored.
+ */
+#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT	24
+
+#define MSR_KVM_WALL_CLOCK  0x11
+#define MSR_KVM_SYSTEM_TIME 0x12
+
+#define KVM_MSR_ENABLED 1
+/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
+#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
+#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
+#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
+#define MSR_KVM_STEAL_TIME  0x4b564d03
+#define MSR_KVM_PV_EOI_EN      0x4b564d04
+
+struct kvm_steal_time {
+	uint64_t steal;
+	uint32_t version;
+	uint32_t flags;
+	uint8_t  preempted;
+	uint8_t  uint8_t_pad[3];
+	uint32_t pad[11];
+};
+
+#define KVM_VCPU_PREEMPTED          (1 << 0)
+#define KVM_VCPU_FLUSH_TLB          (1 << 1)
+
+#define KVM_CLOCK_PAIRING_WALLCLOCK 0
+struct kvm_clock_pairing {
+	int64_t sec;
+	int64_t nsec;
+	uint64_t tsc;
+	uint32_t flags;
+	uint32_t pad[9];
+};
+
+#define KVM_STEAL_ALIGNMENT_BITS 5
+#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
+#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
+
+#define KVM_MAX_MMU_OP_BATCH           32
+
+#define KVM_ASYNC_PF_ENABLED			(1 << 0)
+#define KVM_ASYNC_PF_SEND_ALWAYS		(1 << 1)
+#define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT	(1 << 2)
+
+/* Operations for KVM_HC_MMU_OP */
+#define KVM_MMU_OP_WRITE_PTE            1
+#define KVM_MMU_OP_FLUSH_TLB	        2
+#define KVM_MMU_OP_RELEASE_PT	        3
+
+/* Payload for KVM_HC_MMU_OP */
+struct kvm_mmu_op_header {
+	uint32_t op;
+	uint32_t pad;
+};
+
+struct kvm_mmu_op_write_pte {
+	struct kvm_mmu_op_header header;
+	uint64_t pte_phys;
+	uint64_t pte_val;
+};
+
+struct kvm_mmu_op_flush_tlb {
+	struct kvm_mmu_op_header header;
+};
+
+struct kvm_mmu_op_release_pt {
+	struct kvm_mmu_op_header header;
+	uint64_t pt_phys;
+};
+
+#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
+#define KVM_PV_REASON_PAGE_READY 2
+
+struct kvm_vcpu_pv_apf_data {
+	uint32_t reason;
+	uint8_t pad[60];
+	uint32_t enabled;
+};
+
+#define KVM_PV_EOI_BIT 0
+#define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT)
+#define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
+#define KVM_PV_EOI_DISABLED 0x0
+
+#endif /* _ASM_X86_KVM_PARA_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/4] x86/cpu: use standard-headers/asm-x86.kvm_para.h
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Eduardo Habkost, kvm, Radim Krčmář,
	Marcelo Tosatti, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson

Switch to the header we imported from Linux,
this allows us to drop a hack in kvm_i386.h.
More code will be dropped in the next patch.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/sysemu/kvm.h   | 1 -
 target/i386/cpu.h      | 2 --
 target/i386/kvm_i386.h | 6 ------
 hw/i386/kvm/clock.c    | 2 +-
 target/i386/cpu.c      | 4 +---
 target/i386/kvm.c      | 4 ++--
 6 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 23669c4..0b64b8e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -22,7 +22,6 @@
 #ifdef NEED_CPU_H
 # ifdef CONFIG_KVM
 #  include <linux/kvm.h>
-#  include <linux/kvm_para.h>
 #  define CONFIG_KVM_IS_POSSIBLE
 # endif
 #else
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 1b219fa..9aaab70 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -685,8 +685,6 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
 #define CPUID_7_0_EDX_SPEC_CTRL     (1U << 26) /* Speculation Control */
 
-#define KVM_HINTS_DEDICATED (1U << 0)
-
 #define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
 
 #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index 1de9876..e5df24c 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -30,12 +30,6 @@
 #define kvm_pic_in_kernel()      0
 #define kvm_ioapic_in_kernel()   0
 
-/* These constants must never be used at runtime if kvm_enabled() is false.
- * They exist so we don't need #ifdefs around KVM-specific code that already
- * checks kvm_enabled() properly.
- */
-#define KVM_CPUID_FEATURES       0
-
 #endif  /* CONFIG_KVM */
 
 bool kvm_allows_irq0_override(void);
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 7dac319..0bf1c60 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -26,7 +26,7 @@
 #include "qapi/error.h"
 
 #include <linux/kvm.h>
-#include <linux/kvm_para.h>
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #define TYPE_KVM_CLOCK "kvmclock"
 #define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1a6b082..efdca33 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -40,9 +40,7 @@
 #include "qom/qom-qobject.h"
 #include "sysemu/arch_init.h"
 
-#if defined(CONFIG_KVM)
-#include <linux/kvm_para.h>
-#endif
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #include "sysemu/sysemu.h"
 #include "hw/qdev-properties.h"
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6c49954..44f8584 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -18,7 +18,7 @@
 #include <sys/utsname.h>
 
 #include <linux/kvm.h>
-#include <linux/kvm_para.h>
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #include "qemu-common.h"
 #include "cpu.h"
@@ -385,7 +385,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
             ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
         }
     } else if (function == KVM_CPUID_FEATURES && reg == R_EDX) {
-        ret |= KVM_HINTS_DEDICATED;
+        ret |= 1U << KVM_HINTS_DEDICATED;
         found = 1;
     }
 
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [Qemu-devel] [PATCH 2/4] include/standard-headers: add asm-x86/kvm_para.h
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost, Christian Borntraeger, Peter Maydell,
	Eric Auger

Import asm-x86/kvm_para.h from linux where it can
be easily used on Linux and non-Linux platforms.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/standard-headers/asm-x86/kvm_para.h | 121 ++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 include/standard-headers/asm-x86/kvm_para.h

diff --git a/include/standard-headers/asm-x86/kvm_para.h b/include/standard-headers/asm-x86/kvm_para.h
new file mode 100644
index 0000000..53a85ae
--- /dev/null
+++ b/include/standard-headers/asm-x86/kvm_para.h
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ASM_X86_KVM_PARA_H
+#define _ASM_X86_KVM_PARA_H
+
+#include "standard-headers/linux/types.h"
+
+/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
+ * should be used to determine that a VM is running under KVM.
+ */
+#define KVM_CPUID_SIGNATURE	0x40000000
+
+/* This CPUID returns two feature bitmaps in eax, edx. Before enabling
+ * a particular paravirtualization, the appropriate feature bit should
+ * be checked in eax. The performance hint feature bit should be checked
+ * in edx.
+ */
+#define KVM_CPUID_FEATURES	0x40000001
+#define KVM_FEATURE_CLOCKSOURCE		0
+#define KVM_FEATURE_NOP_IO_DELAY	1
+#define KVM_FEATURE_MMU_OP		2
+/* This indicates that the new set of kvmclock msrs
+ * are available. The use of 0x11 and 0x12 is deprecated
+ */
+#define KVM_FEATURE_CLOCKSOURCE2        3
+#define KVM_FEATURE_ASYNC_PF		4
+#define KVM_FEATURE_STEAL_TIME		5
+#define KVM_FEATURE_PV_EOI		6
+#define KVM_FEATURE_PV_UNHALT		7
+#define KVM_FEATURE_PV_TLB_FLUSH	9
+#define KVM_FEATURE_ASYNC_PF_VMEXIT	10
+
+#define KVM_HINTS_DEDICATED      0
+
+/* The last 8 bits are used to indicate how to interpret the flags field
+ * in pvclock structure. If no bits are set, all flags are ignored.
+ */
+#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT	24
+
+#define MSR_KVM_WALL_CLOCK  0x11
+#define MSR_KVM_SYSTEM_TIME 0x12
+
+#define KVM_MSR_ENABLED 1
+/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
+#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
+#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
+#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
+#define MSR_KVM_STEAL_TIME  0x4b564d03
+#define MSR_KVM_PV_EOI_EN      0x4b564d04
+
+struct kvm_steal_time {
+	uint64_t steal;
+	uint32_t version;
+	uint32_t flags;
+	uint8_t  preempted;
+	uint8_t  uint8_t_pad[3];
+	uint32_t pad[11];
+};
+
+#define KVM_VCPU_PREEMPTED          (1 << 0)
+#define KVM_VCPU_FLUSH_TLB          (1 << 1)
+
+#define KVM_CLOCK_PAIRING_WALLCLOCK 0
+struct kvm_clock_pairing {
+	int64_t sec;
+	int64_t nsec;
+	uint64_t tsc;
+	uint32_t flags;
+	uint32_t pad[9];
+};
+
+#define KVM_STEAL_ALIGNMENT_BITS 5
+#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
+#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
+
+#define KVM_MAX_MMU_OP_BATCH           32
+
+#define KVM_ASYNC_PF_ENABLED			(1 << 0)
+#define KVM_ASYNC_PF_SEND_ALWAYS		(1 << 1)
+#define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT	(1 << 2)
+
+/* Operations for KVM_HC_MMU_OP */
+#define KVM_MMU_OP_WRITE_PTE            1
+#define KVM_MMU_OP_FLUSH_TLB	        2
+#define KVM_MMU_OP_RELEASE_PT	        3
+
+/* Payload for KVM_HC_MMU_OP */
+struct kvm_mmu_op_header {
+	uint32_t op;
+	uint32_t pad;
+};
+
+struct kvm_mmu_op_write_pte {
+	struct kvm_mmu_op_header header;
+	uint64_t pte_phys;
+	uint64_t pte_val;
+};
+
+struct kvm_mmu_op_flush_tlb {
+	struct kvm_mmu_op_header header;
+};
+
+struct kvm_mmu_op_release_pt {
+	struct kvm_mmu_op_header header;
+	uint64_t pt_phys;
+};
+
+#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
+#define KVM_PV_REASON_PAGE_READY 2
+
+struct kvm_vcpu_pv_apf_data {
+	uint32_t reason;
+	uint8_t pad[60];
+	uint32_t enabled;
+};
+
+#define KVM_PV_EOI_BIT 0
+#define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT)
+#define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
+#define KVM_PV_EOI_DISABLED 0x0
+
+#endif /* _ASM_X86_KVM_PARA_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [Qemu-devel] [PATCH 3/4] x86/cpu: use standard-headers/asm-x86.kvm_para.h
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost, Richard Henderson, Marcel Apfelbaum,
	Marcelo Tosatti

Switch to the header we imported from Linux,
this allows us to drop a hack in kvm_i386.h.
More code will be dropped in the next patch.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/sysemu/kvm.h   | 1 -
 target/i386/cpu.h      | 2 --
 target/i386/kvm_i386.h | 6 ------
 hw/i386/kvm/clock.c    | 2 +-
 target/i386/cpu.c      | 4 +---
 target/i386/kvm.c      | 4 ++--
 6 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 23669c4..0b64b8e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -22,7 +22,6 @@
 #ifdef NEED_CPU_H
 # ifdef CONFIG_KVM
 #  include <linux/kvm.h>
-#  include <linux/kvm_para.h>
 #  define CONFIG_KVM_IS_POSSIBLE
 # endif
 #else
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 1b219fa..9aaab70 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -685,8 +685,6 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
 #define CPUID_7_0_EDX_SPEC_CTRL     (1U << 26) /* Speculation Control */
 
-#define KVM_HINTS_DEDICATED (1U << 0)
-
 #define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
 
 #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index 1de9876..e5df24c 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -30,12 +30,6 @@
 #define kvm_pic_in_kernel()      0
 #define kvm_ioapic_in_kernel()   0
 
-/* These constants must never be used at runtime if kvm_enabled() is false.
- * They exist so we don't need #ifdefs around KVM-specific code that already
- * checks kvm_enabled() properly.
- */
-#define KVM_CPUID_FEATURES       0
-
 #endif  /* CONFIG_KVM */
 
 bool kvm_allows_irq0_override(void);
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 7dac319..0bf1c60 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -26,7 +26,7 @@
 #include "qapi/error.h"
 
 #include <linux/kvm.h>
-#include <linux/kvm_para.h>
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #define TYPE_KVM_CLOCK "kvmclock"
 #define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1a6b082..efdca33 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -40,9 +40,7 @@
 #include "qom/qom-qobject.h"
 #include "sysemu/arch_init.h"
 
-#if defined(CONFIG_KVM)
-#include <linux/kvm_para.h>
-#endif
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #include "sysemu/sysemu.h"
 #include "hw/qdev-properties.h"
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6c49954..44f8584 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -18,7 +18,7 @@
 #include <sys/utsname.h>
 
 #include <linux/kvm.h>
-#include <linux/kvm_para.h>
+#include "standard-headers/asm-x86/kvm_para.h"
 
 #include "qemu-common.h"
 #include "cpu.h"
@@ -385,7 +385,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
             ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
         }
     } else if (function == KVM_CPUID_FEATURES && reg == R_EDX) {
-        ret |= KVM_HINTS_DEDICATED;
+        ret |= 1U << KVM_HINTS_DEDICATED;
         found = 1;
     }
 
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/4] linux-headers: drop kvm_para.h
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Paolo Bonzini, Eduardo Habkost, kvm,
	Radim Krčmář

Unused now and can be removed.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 linux-headers/asm-arm/kvm_para.h         |   2 -
 linux-headers/asm-arm64/kvm_para.h       |   1 -
 linux-headers/asm-generic/kvm_para.h     |   4 --
 linux-headers/asm-mips/kvm_para.h        |   5 --
 linux-headers/asm-powerpc/epapr_hcalls.h |  99 --------------------------
 linux-headers/asm-powerpc/kvm_para.h     |  98 -------------------------
 linux-headers/asm-s390/kvm_para.h        |   8 ---
 linux-headers/asm-x86/kvm_para.h         | 118 -------------------------------
 linux-headers/linux/kvm_para.h           |  35 ---------
 9 files changed, 370 deletions(-)
 delete mode 100644 linux-headers/asm-arm/kvm_para.h
 delete mode 100644 linux-headers/asm-arm64/kvm_para.h
 delete mode 100644 linux-headers/asm-generic/kvm_para.h
 delete mode 100644 linux-headers/asm-mips/kvm_para.h
 delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
 delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
 delete mode 100644 linux-headers/asm-s390/kvm_para.h
 delete mode 100644 linux-headers/asm-x86/kvm_para.h
 delete mode 100644 linux-headers/linux/kvm_para.h

diff --git a/linux-headers/asm-arm/kvm_para.h b/linux-headers/asm-arm/kvm_para.h
deleted file mode 100644
index baacc49..0000000
--- a/linux-headers/asm-arm/kvm_para.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
diff --git a/linux-headers/asm-arm64/kvm_para.h b/linux-headers/asm-arm64/kvm_para.h
deleted file mode 100644
index 14fab8f..0000000
--- a/linux-headers/asm-arm64/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/kvm_para.h>
diff --git a/linux-headers/asm-generic/kvm_para.h b/linux-headers/asm-generic/kvm_para.h
deleted file mode 100644
index 486f0af..0000000
--- a/linux-headers/asm-generic/kvm_para.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * There isn't anything here, but the file must not be empty or patch
- * will delete it.
- */
diff --git a/linux-headers/asm-mips/kvm_para.h b/linux-headers/asm-mips/kvm_para.h
deleted file mode 100644
index dbb2464..0000000
--- a/linux-headers/asm-mips/kvm_para.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _ASM_MIPS_KVM_PARA_H
-#define _ASM_MIPS_KVM_PARA_H
-
-
-#endif /* _ASM_MIPS_KVM_PARA_H */
diff --git a/linux-headers/asm-powerpc/epapr_hcalls.h b/linux-headers/asm-powerpc/epapr_hcalls.h
deleted file mode 100644
index 6cca559..0000000
--- a/linux-headers/asm-powerpc/epapr_hcalls.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
-/*
- * ePAPR hcall interface
- *
- * Copyright 2008-2011 Freescale Semiconductor, Inc.
- *
- * Author: Timur Tabi <timur@freescale.com>
- *
- * This file is provided under a dual BSD/GPL license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of Freescale Semiconductor nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ASM_POWERPC_EPAPR_HCALLS_H
-#define _ASM_POWERPC_EPAPR_HCALLS_H
-
-#define EV_BYTE_CHANNEL_SEND		1
-#define EV_BYTE_CHANNEL_RECEIVE		2
-#define EV_BYTE_CHANNEL_POLL		3
-#define EV_INT_SET_CONFIG		4
-#define EV_INT_GET_CONFIG		5
-#define EV_INT_SET_MASK			6
-#define EV_INT_GET_MASK			7
-#define EV_INT_IACK			9
-#define EV_INT_EOI			10
-#define EV_INT_SEND_IPI			11
-#define EV_INT_SET_TASK_PRIORITY	12
-#define EV_INT_GET_TASK_PRIORITY	13
-#define EV_DOORBELL_SEND		14
-#define EV_MSGSND			15
-#define EV_IDLE				16
-
-/* vendor ID: epapr */
-#define EV_LOCAL_VENDOR_ID		0	/* for private use */
-#define EV_EPAPR_VENDOR_ID		1
-#define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
-#define EV_IBM_VENDOR_ID		3	/* IBM */
-#define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
-#define EV_ENEA_VENDOR_ID		5	/* Enea */
-#define EV_WR_VENDOR_ID			6	/* Wind River Systems */
-#define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
-#define EV_KVM_VENDOR_ID		42	/* KVM */
-
-/* The max number of bytes that a byte channel can send or receive per call */
-#define EV_BYTE_CHANNEL_MAX_BYTES	16
-
-
-#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
-#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
-
-/* epapr return codes */
-#define EV_SUCCESS		0
-#define EV_EPERM		1	/* Operation not permitted */
-#define EV_ENOENT		2	/*  Entry Not Found */
-#define EV_EIO			3	/* I/O error occurred */
-#define EV_EAGAIN		4	/* The operation had insufficient
-					 * resources to complete and should be
-					 * retried
-					 */
-#define EV_ENOMEM		5	/* There was insufficient memory to
-					 * complete the operation */
-#define EV_EFAULT		6	/* Bad guest address */
-#define EV_ENODEV		7	/* No such device */
-#define EV_EINVAL		8	/* An argument supplied to the hcall
-					   was out of range or invalid */
-#define EV_INTERNAL		9	/* An internal error occurred */
-#define EV_CONFIG		10	/* A configuration error was detected */
-#define EV_INVALID_STATE	11	/* The object is in an invalid state */
-#define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
-#define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
-
-#endif /* _ASM_POWERPC_EPAPR_HCALLS_H */
diff --git a/linux-headers/asm-powerpc/kvm_para.h b/linux-headers/asm-powerpc/kvm_para.h
deleted file mode 100644
index 9beb49c..0000000
--- a/linux-headers/asm-powerpc/kvm_para.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef __POWERPC_KVM_PARA_H__
-#define __POWERPC_KVM_PARA_H__
-
-#include <linux/types.h>
-
-/*
- * Additions to this struct must only occur at the end, and should be
- * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present
- * (albeit not necessarily relevant to the current target hardware platform).
- *
- * Struct fields are always 32 or 64 bit aligned, depending on them being 32
- * or 64 bit wide respectively.
- *
- * See Documentation/virtual/kvm/ppc-pv.txt
- */
-struct kvm_vcpu_arch_shared {
-	__u64 scratch1;
-	__u64 scratch2;
-	__u64 scratch3;
-	__u64 critical;		/* Guest may not get interrupts if == r1 */
-	__u64 sprg0;
-	__u64 sprg1;
-	__u64 sprg2;
-	__u64 sprg3;
-	__u64 srr0;
-	__u64 srr1;
-	__u64 dar;		/* dear on BookE */
-	__u64 msr;
-	__u32 dsisr;
-	__u32 int_pending;	/* Tells the guest if we have an interrupt */
-	__u32 sr[16];
-	__u32 mas0;
-	__u32 mas1;
-	__u64 mas7_3;
-	__u64 mas2;
-	__u32 mas4;
-	__u32 mas6;
-	__u32 esr;
-	__u32 pir;
-
-	/*
-	 * SPRG4-7 are user-readable, so we can only keep these consistent
-	 * between the shared area and the real registers when there's an
-	 * intervening exit to KVM.  This also applies to SPRG3 on some
-	 * chips.
-	 *
-	 * This suffices for access by guest userspace, since in PR-mode
-	 * KVM, an exit must occur when changing the guest's MSR[PR].
-	 * If the guest kernel writes to SPRG3-7 via the shared area, it
-	 * must also use the shared area for reading while in kernel space.
-	 */
-	__u64 sprg4;
-	__u64 sprg5;
-	__u64 sprg6;
-	__u64 sprg7;
-};
-
-#define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
-
-#define KVM_HCALL_TOKEN(num)     _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
-
-#include <asm/epapr_hcalls.h>
-
-#define KVM_FEATURE_MAGIC_PAGE	1
-
-/* Magic page flags from host to guest */
-
-#define KVM_MAGIC_FEAT_SR		(1 << 0)
-
-/* MASn, ESR, PIR, and high SPRGs */
-#define KVM_MAGIC_FEAT_MAS0_TO_SPRG7	(1 << 1)
-
-/* Magic page flags from guest to host */
-
-#define MAGIC_PAGE_FLAG_NOT_MAPPED_NX	(1 << 0)
-
-
-#endif /* __POWERPC_KVM_PARA_H__ */
diff --git a/linux-headers/asm-s390/kvm_para.h b/linux-headers/asm-s390/kvm_para.h
deleted file mode 100644
index b9ab584..0000000
--- a/linux-headers/asm-s390/kvm_para.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * User API definitions for paravirtual devices on s390
- *
- * Copyright IBM Corp. 2008
- *
- *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
- */
diff --git a/linux-headers/asm-x86/kvm_para.h b/linux-headers/asm-x86/kvm_para.h
deleted file mode 100644
index 4c58184..0000000
--- a/linux-headers/asm-x86/kvm_para.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _ASM_X86_KVM_PARA_H
-#define _ASM_X86_KVM_PARA_H
-
-#include <linux/types.h>
-#include <asm/hyperv.h>
-
-/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
- * should be used to determine that a VM is running under KVM.
- */
-#define KVM_CPUID_SIGNATURE	0x40000000
-
-/* This CPUID returns a feature bitmap in eax.  Before enabling a particular
- * paravirtualization, the appropriate feature bit should be checked.
- */
-#define KVM_CPUID_FEATURES	0x40000001
-#define KVM_FEATURE_CLOCKSOURCE		0
-#define KVM_FEATURE_NOP_IO_DELAY	1
-#define KVM_FEATURE_MMU_OP		2
-/* This indicates that the new set of kvmclock msrs
- * are available. The use of 0x11 and 0x12 is deprecated
- */
-#define KVM_FEATURE_CLOCKSOURCE2        3
-#define KVM_FEATURE_ASYNC_PF		4
-#define KVM_FEATURE_STEAL_TIME		5
-#define KVM_FEATURE_PV_EOI		6
-#define KVM_FEATURE_PV_UNHALT		7
-#define KVM_FEATURE_PV_TLB_FLUSH	9
-#define KVM_FEATURE_ASYNC_PF_VMEXIT	10
-
-/* The last 8 bits are used to indicate how to interpret the flags field
- * in pvclock structure. If no bits are set, all flags are ignored.
- */
-#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT	24
-
-#define MSR_KVM_WALL_CLOCK  0x11
-#define MSR_KVM_SYSTEM_TIME 0x12
-
-#define KVM_MSR_ENABLED 1
-/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
-#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
-#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
-#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
-#define MSR_KVM_STEAL_TIME  0x4b564d03
-#define MSR_KVM_PV_EOI_EN      0x4b564d04
-
-struct kvm_steal_time {
-	__u64 steal;
-	__u32 version;
-	__u32 flags;
-	__u8  preempted;
-	__u8  u8_pad[3];
-	__u32 pad[11];
-};
-
-#define KVM_VCPU_PREEMPTED          (1 << 0)
-#define KVM_VCPU_FLUSH_TLB          (1 << 1)
-
-#define KVM_CLOCK_PAIRING_WALLCLOCK 0
-struct kvm_clock_pairing {
-	__s64 sec;
-	__s64 nsec;
-	__u64 tsc;
-	__u32 flags;
-	__u32 pad[9];
-};
-
-#define KVM_STEAL_ALIGNMENT_BITS 5
-#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
-#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
-
-#define KVM_MAX_MMU_OP_BATCH           32
-
-#define KVM_ASYNC_PF_ENABLED			(1 << 0)
-#define KVM_ASYNC_PF_SEND_ALWAYS		(1 << 1)
-#define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT	(1 << 2)
-
-/* Operations for KVM_HC_MMU_OP */
-#define KVM_MMU_OP_WRITE_PTE            1
-#define KVM_MMU_OP_FLUSH_TLB	        2
-#define KVM_MMU_OP_RELEASE_PT	        3
-
-/* Payload for KVM_HC_MMU_OP */
-struct kvm_mmu_op_header {
-	__u32 op;
-	__u32 pad;
-};
-
-struct kvm_mmu_op_write_pte {
-	struct kvm_mmu_op_header header;
-	__u64 pte_phys;
-	__u64 pte_val;
-};
-
-struct kvm_mmu_op_flush_tlb {
-	struct kvm_mmu_op_header header;
-};
-
-struct kvm_mmu_op_release_pt {
-	struct kvm_mmu_op_header header;
-	__u64 pt_phys;
-};
-
-#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
-#define KVM_PV_REASON_PAGE_READY 2
-
-struct kvm_vcpu_pv_apf_data {
-	__u32 reason;
-	__u8 pad[60];
-	__u32 enabled;
-};
-
-#define KVM_PV_EOI_BIT 0
-#define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT)
-#define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
-#define KVM_PV_EOI_DISABLED 0x0
-
-#endif /* _ASM_X86_KVM_PARA_H */
diff --git a/linux-headers/linux/kvm_para.h b/linux-headers/linux/kvm_para.h
deleted file mode 100644
index 8bcd0aa..0000000
--- a/linux-headers/linux/kvm_para.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef __LINUX_KVM_PARA_H
-#define __LINUX_KVM_PARA_H
-
-/*
- * This header file provides a method for making a hypercall to the host
- * Architectures should define:
- * - kvm_hypercall0, kvm_hypercall1...
- * - kvm_arch_para_features
- * - kvm_para_available
- */
-
-/* Return values for hypercalls */
-#define KVM_ENOSYS		1000
-#define KVM_EFAULT		EFAULT
-#define KVM_E2BIG		E2BIG
-#define KVM_EPERM		EPERM
-#define KVM_EOPNOTSUPP		95
-
-#define KVM_HC_VAPIC_POLL_IRQ		1
-#define KVM_HC_MMU_OP			2
-#define KVM_HC_FEATURES			3
-#define KVM_HC_PPC_MAP_MAGIC_PAGE	4
-#define KVM_HC_KICK_CPU			5
-#define KVM_HC_MIPS_GET_CLOCK_FREQ	6
-#define KVM_HC_MIPS_EXIT_VM		7
-#define KVM_HC_MIPS_CONSOLE_OUTPUT	8
-#define KVM_HC_CLOCK_PAIRING		9
-
-/*
- * hypercalls use architecture specific
- */
-#include <asm/kvm_para.h>
-
-#endif /* __LINUX_KVM_PARA_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [Qemu-devel] [PATCH 4/4] linux-headers: drop kvm_para.h
@ 2018-04-17 18:58   ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-17 18:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost

Unused now and can be removed.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 linux-headers/asm-arm/kvm_para.h         |   2 -
 linux-headers/asm-arm64/kvm_para.h       |   1 -
 linux-headers/asm-generic/kvm_para.h     |   4 --
 linux-headers/asm-mips/kvm_para.h        |   5 --
 linux-headers/asm-powerpc/epapr_hcalls.h |  99 --------------------------
 linux-headers/asm-powerpc/kvm_para.h     |  98 -------------------------
 linux-headers/asm-s390/kvm_para.h        |   8 ---
 linux-headers/asm-x86/kvm_para.h         | 118 -------------------------------
 linux-headers/linux/kvm_para.h           |  35 ---------
 9 files changed, 370 deletions(-)
 delete mode 100644 linux-headers/asm-arm/kvm_para.h
 delete mode 100644 linux-headers/asm-arm64/kvm_para.h
 delete mode 100644 linux-headers/asm-generic/kvm_para.h
 delete mode 100644 linux-headers/asm-mips/kvm_para.h
 delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
 delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
 delete mode 100644 linux-headers/asm-s390/kvm_para.h
 delete mode 100644 linux-headers/asm-x86/kvm_para.h
 delete mode 100644 linux-headers/linux/kvm_para.h

diff --git a/linux-headers/asm-arm/kvm_para.h b/linux-headers/asm-arm/kvm_para.h
deleted file mode 100644
index baacc49..0000000
--- a/linux-headers/asm-arm/kvm_para.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
diff --git a/linux-headers/asm-arm64/kvm_para.h b/linux-headers/asm-arm64/kvm_para.h
deleted file mode 100644
index 14fab8f..0000000
--- a/linux-headers/asm-arm64/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/kvm_para.h>
diff --git a/linux-headers/asm-generic/kvm_para.h b/linux-headers/asm-generic/kvm_para.h
deleted file mode 100644
index 486f0af..0000000
--- a/linux-headers/asm-generic/kvm_para.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * There isn't anything here, but the file must not be empty or patch
- * will delete it.
- */
diff --git a/linux-headers/asm-mips/kvm_para.h b/linux-headers/asm-mips/kvm_para.h
deleted file mode 100644
index dbb2464..0000000
--- a/linux-headers/asm-mips/kvm_para.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _ASM_MIPS_KVM_PARA_H
-#define _ASM_MIPS_KVM_PARA_H
-
-
-#endif /* _ASM_MIPS_KVM_PARA_H */
diff --git a/linux-headers/asm-powerpc/epapr_hcalls.h b/linux-headers/asm-powerpc/epapr_hcalls.h
deleted file mode 100644
index 6cca559..0000000
--- a/linux-headers/asm-powerpc/epapr_hcalls.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
-/*
- * ePAPR hcall interface
- *
- * Copyright 2008-2011 Freescale Semiconductor, Inc.
- *
- * Author: Timur Tabi <timur@freescale.com>
- *
- * This file is provided under a dual BSD/GPL license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of Freescale Semiconductor nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ASM_POWERPC_EPAPR_HCALLS_H
-#define _ASM_POWERPC_EPAPR_HCALLS_H
-
-#define EV_BYTE_CHANNEL_SEND		1
-#define EV_BYTE_CHANNEL_RECEIVE		2
-#define EV_BYTE_CHANNEL_POLL		3
-#define EV_INT_SET_CONFIG		4
-#define EV_INT_GET_CONFIG		5
-#define EV_INT_SET_MASK			6
-#define EV_INT_GET_MASK			7
-#define EV_INT_IACK			9
-#define EV_INT_EOI			10
-#define EV_INT_SEND_IPI			11
-#define EV_INT_SET_TASK_PRIORITY	12
-#define EV_INT_GET_TASK_PRIORITY	13
-#define EV_DOORBELL_SEND		14
-#define EV_MSGSND			15
-#define EV_IDLE				16
-
-/* vendor ID: epapr */
-#define EV_LOCAL_VENDOR_ID		0	/* for private use */
-#define EV_EPAPR_VENDOR_ID		1
-#define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
-#define EV_IBM_VENDOR_ID		3	/* IBM */
-#define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
-#define EV_ENEA_VENDOR_ID		5	/* Enea */
-#define EV_WR_VENDOR_ID			6	/* Wind River Systems */
-#define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
-#define EV_KVM_VENDOR_ID		42	/* KVM */
-
-/* The max number of bytes that a byte channel can send or receive per call */
-#define EV_BYTE_CHANNEL_MAX_BYTES	16
-
-
-#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
-#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
-
-/* epapr return codes */
-#define EV_SUCCESS		0
-#define EV_EPERM		1	/* Operation not permitted */
-#define EV_ENOENT		2	/*  Entry Not Found */
-#define EV_EIO			3	/* I/O error occurred */
-#define EV_EAGAIN		4	/* The operation had insufficient
-					 * resources to complete and should be
-					 * retried
-					 */
-#define EV_ENOMEM		5	/* There was insufficient memory to
-					 * complete the operation */
-#define EV_EFAULT		6	/* Bad guest address */
-#define EV_ENODEV		7	/* No such device */
-#define EV_EINVAL		8	/* An argument supplied to the hcall
-					   was out of range or invalid */
-#define EV_INTERNAL		9	/* An internal error occurred */
-#define EV_CONFIG		10	/* A configuration error was detected */
-#define EV_INVALID_STATE	11	/* The object is in an invalid state */
-#define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
-#define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
-
-#endif /* _ASM_POWERPC_EPAPR_HCALLS_H */
diff --git a/linux-headers/asm-powerpc/kvm_para.h b/linux-headers/asm-powerpc/kvm_para.h
deleted file mode 100644
index 9beb49c..0000000
--- a/linux-headers/asm-powerpc/kvm_para.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef __POWERPC_KVM_PARA_H__
-#define __POWERPC_KVM_PARA_H__
-
-#include <linux/types.h>
-
-/*
- * Additions to this struct must only occur at the end, and should be
- * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present
- * (albeit not necessarily relevant to the current target hardware platform).
- *
- * Struct fields are always 32 or 64 bit aligned, depending on them being 32
- * or 64 bit wide respectively.
- *
- * See Documentation/virtual/kvm/ppc-pv.txt
- */
-struct kvm_vcpu_arch_shared {
-	__u64 scratch1;
-	__u64 scratch2;
-	__u64 scratch3;
-	__u64 critical;		/* Guest may not get interrupts if == r1 */
-	__u64 sprg0;
-	__u64 sprg1;
-	__u64 sprg2;
-	__u64 sprg3;
-	__u64 srr0;
-	__u64 srr1;
-	__u64 dar;		/* dear on BookE */
-	__u64 msr;
-	__u32 dsisr;
-	__u32 int_pending;	/* Tells the guest if we have an interrupt */
-	__u32 sr[16];
-	__u32 mas0;
-	__u32 mas1;
-	__u64 mas7_3;
-	__u64 mas2;
-	__u32 mas4;
-	__u32 mas6;
-	__u32 esr;
-	__u32 pir;
-
-	/*
-	 * SPRG4-7 are user-readable, so we can only keep these consistent
-	 * between the shared area and the real registers when there's an
-	 * intervening exit to KVM.  This also applies to SPRG3 on some
-	 * chips.
-	 *
-	 * This suffices for access by guest userspace, since in PR-mode
-	 * KVM, an exit must occur when changing the guest's MSR[PR].
-	 * If the guest kernel writes to SPRG3-7 via the shared area, it
-	 * must also use the shared area for reading while in kernel space.
-	 */
-	__u64 sprg4;
-	__u64 sprg5;
-	__u64 sprg6;
-	__u64 sprg7;
-};
-
-#define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
-
-#define KVM_HCALL_TOKEN(num)     _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
-
-#include <asm/epapr_hcalls.h>
-
-#define KVM_FEATURE_MAGIC_PAGE	1
-
-/* Magic page flags from host to guest */
-
-#define KVM_MAGIC_FEAT_SR		(1 << 0)
-
-/* MASn, ESR, PIR, and high SPRGs */
-#define KVM_MAGIC_FEAT_MAS0_TO_SPRG7	(1 << 1)
-
-/* Magic page flags from guest to host */
-
-#define MAGIC_PAGE_FLAG_NOT_MAPPED_NX	(1 << 0)
-
-
-#endif /* __POWERPC_KVM_PARA_H__ */
diff --git a/linux-headers/asm-s390/kvm_para.h b/linux-headers/asm-s390/kvm_para.h
deleted file mode 100644
index b9ab584..0000000
--- a/linux-headers/asm-s390/kvm_para.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-/*
- * User API definitions for paravirtual devices on s390
- *
- * Copyright IBM Corp. 2008
- *
- *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
- */
diff --git a/linux-headers/asm-x86/kvm_para.h b/linux-headers/asm-x86/kvm_para.h
deleted file mode 100644
index 4c58184..0000000
--- a/linux-headers/asm-x86/kvm_para.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _ASM_X86_KVM_PARA_H
-#define _ASM_X86_KVM_PARA_H
-
-#include <linux/types.h>
-#include <asm/hyperv.h>
-
-/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
- * should be used to determine that a VM is running under KVM.
- */
-#define KVM_CPUID_SIGNATURE	0x40000000
-
-/* This CPUID returns a feature bitmap in eax.  Before enabling a particular
- * paravirtualization, the appropriate feature bit should be checked.
- */
-#define KVM_CPUID_FEATURES	0x40000001
-#define KVM_FEATURE_CLOCKSOURCE		0
-#define KVM_FEATURE_NOP_IO_DELAY	1
-#define KVM_FEATURE_MMU_OP		2
-/* This indicates that the new set of kvmclock msrs
- * are available. The use of 0x11 and 0x12 is deprecated
- */
-#define KVM_FEATURE_CLOCKSOURCE2        3
-#define KVM_FEATURE_ASYNC_PF		4
-#define KVM_FEATURE_STEAL_TIME		5
-#define KVM_FEATURE_PV_EOI		6
-#define KVM_FEATURE_PV_UNHALT		7
-#define KVM_FEATURE_PV_TLB_FLUSH	9
-#define KVM_FEATURE_ASYNC_PF_VMEXIT	10
-
-/* The last 8 bits are used to indicate how to interpret the flags field
- * in pvclock structure. If no bits are set, all flags are ignored.
- */
-#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT	24
-
-#define MSR_KVM_WALL_CLOCK  0x11
-#define MSR_KVM_SYSTEM_TIME 0x12
-
-#define KVM_MSR_ENABLED 1
-/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
-#define MSR_KVM_WALL_CLOCK_NEW  0x4b564d00
-#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
-#define MSR_KVM_ASYNC_PF_EN 0x4b564d02
-#define MSR_KVM_STEAL_TIME  0x4b564d03
-#define MSR_KVM_PV_EOI_EN      0x4b564d04
-
-struct kvm_steal_time {
-	__u64 steal;
-	__u32 version;
-	__u32 flags;
-	__u8  preempted;
-	__u8  u8_pad[3];
-	__u32 pad[11];
-};
-
-#define KVM_VCPU_PREEMPTED          (1 << 0)
-#define KVM_VCPU_FLUSH_TLB          (1 << 1)
-
-#define KVM_CLOCK_PAIRING_WALLCLOCK 0
-struct kvm_clock_pairing {
-	__s64 sec;
-	__s64 nsec;
-	__u64 tsc;
-	__u32 flags;
-	__u32 pad[9];
-};
-
-#define KVM_STEAL_ALIGNMENT_BITS 5
-#define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
-#define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
-
-#define KVM_MAX_MMU_OP_BATCH           32
-
-#define KVM_ASYNC_PF_ENABLED			(1 << 0)
-#define KVM_ASYNC_PF_SEND_ALWAYS		(1 << 1)
-#define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT	(1 << 2)
-
-/* Operations for KVM_HC_MMU_OP */
-#define KVM_MMU_OP_WRITE_PTE            1
-#define KVM_MMU_OP_FLUSH_TLB	        2
-#define KVM_MMU_OP_RELEASE_PT	        3
-
-/* Payload for KVM_HC_MMU_OP */
-struct kvm_mmu_op_header {
-	__u32 op;
-	__u32 pad;
-};
-
-struct kvm_mmu_op_write_pte {
-	struct kvm_mmu_op_header header;
-	__u64 pte_phys;
-	__u64 pte_val;
-};
-
-struct kvm_mmu_op_flush_tlb {
-	struct kvm_mmu_op_header header;
-};
-
-struct kvm_mmu_op_release_pt {
-	struct kvm_mmu_op_header header;
-	__u64 pt_phys;
-};
-
-#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
-#define KVM_PV_REASON_PAGE_READY 2
-
-struct kvm_vcpu_pv_apf_data {
-	__u32 reason;
-	__u8 pad[60];
-	__u32 enabled;
-};
-
-#define KVM_PV_EOI_BIT 0
-#define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT)
-#define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
-#define KVM_PV_EOI_DISABLED 0x0
-
-#endif /* _ASM_X86_KVM_PARA_H */
diff --git a/linux-headers/linux/kvm_para.h b/linux-headers/linux/kvm_para.h
deleted file mode 100644
index 8bcd0aa..0000000
--- a/linux-headers/linux/kvm_para.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef __LINUX_KVM_PARA_H
-#define __LINUX_KVM_PARA_H
-
-/*
- * This header file provides a method for making a hypercall to the host
- * Architectures should define:
- * - kvm_hypercall0, kvm_hypercall1...
- * - kvm_arch_para_features
- * - kvm_para_available
- */
-
-/* Return values for hypercalls */
-#define KVM_ENOSYS		1000
-#define KVM_EFAULT		EFAULT
-#define KVM_E2BIG		E2BIG
-#define KVM_EPERM		EPERM
-#define KVM_EOPNOTSUPP		95
-
-#define KVM_HC_VAPIC_POLL_IRQ		1
-#define KVM_HC_MMU_OP			2
-#define KVM_HC_FEATURES			3
-#define KVM_HC_PPC_MAP_MAGIC_PAGE	4
-#define KVM_HC_KICK_CPU			5
-#define KVM_HC_MIPS_GET_CLOCK_FREQ	6
-#define KVM_HC_MIPS_EXIT_VM		7
-#define KVM_HC_MIPS_CONSOLE_OUTPUT	8
-#define KVM_HC_CLOCK_PAIRING		9
-
-/*
- * hypercalls use architecture specific
- */
-#include <asm/kvm_para.h>
-
-#endif /* __LINUX_KVM_PARA_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/4] move kvm_para.h to standard-headers
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 19:05   ` no-reply
  -1 siblings, 0 replies; 32+ messages in thread
From: no-reply @ 2018-04-17 19:05 UTC (permalink / raw)
  To: mst; +Cc: kernellwp, famz, ehabkost, kvm, rkrcmar, qemu-devel, pbonzini

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1523991487-241006-1-git-send-email-mst@redhat.com
Subject: [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1523991487-241006-1-git-send-email-mst@redhat.com -> patchew/1523991487-241006-1-git-send-email-mst@redhat.com
 t [tag update]            patchew/20180417133602.23832-1-marcandre.lureau@redhat.com -> patchew/20180417133602.23832-1-marcandre.lureau@redhat.com
 t [tag update]            patchew/cover.1523968389.git.berto@igalia.com -> patchew/cover.1523968389.git.berto@igalia.com
Switched to a new branch 'test'
6c8133c47c linux-headers: drop kvm_para.h
ce5d4ce607 x86/cpu: use standard-headers/asm-x86.kvm_para.h
124799b55a include/standard-headers: add asm-x86/kvm_para.h
cd93f5f702 update-linux-headers.sh: drop kvm_para.h hacks

=== OUTPUT BEGIN ===
Checking PATCH 1/4: update-linux-headers.sh: drop kvm_para.h hacks...
ERROR: line over 90 characters
#48: FILE: scripts/update-linux-headers.sh:124:
+        cp_portable "$tmpdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch"

total: 1 errors, 0 warnings, 44 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/4: include/standard-headers: add asm-x86/kvm_para.h...
Checking PATCH 3/4: x86/cpu: use standard-headers/asm-x86.kvm_para.h...
Checking PATCH 4/4: linux-headers: drop kvm_para.h...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers
@ 2018-04-17 19:05   ` no-reply
  0 siblings, 0 replies; 32+ messages in thread
From: no-reply @ 2018-04-17 19:05 UTC (permalink / raw)
  To: mst; +Cc: famz, qemu-devel, kernellwp, pbonzini, ehabkost, kvm, rkrcmar

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1523991487-241006-1-git-send-email-mst@redhat.com
Subject: [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1523991487-241006-1-git-send-email-mst@redhat.com -> patchew/1523991487-241006-1-git-send-email-mst@redhat.com
 t [tag update]            patchew/20180417133602.23832-1-marcandre.lureau@redhat.com -> patchew/20180417133602.23832-1-marcandre.lureau@redhat.com
 t [tag update]            patchew/cover.1523968389.git.berto@igalia.com -> patchew/cover.1523968389.git.berto@igalia.com
Switched to a new branch 'test'
6c8133c47c linux-headers: drop kvm_para.h
ce5d4ce607 x86/cpu: use standard-headers/asm-x86.kvm_para.h
124799b55a include/standard-headers: add asm-x86/kvm_para.h
cd93f5f702 update-linux-headers.sh: drop kvm_para.h hacks

=== OUTPUT BEGIN ===
Checking PATCH 1/4: update-linux-headers.sh: drop kvm_para.h hacks...
ERROR: line over 90 characters
#48: FILE: scripts/update-linux-headers.sh:124:
+        cp_portable "$tmpdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch"

total: 1 errors, 0 warnings, 44 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/4: include/standard-headers: add asm-x86/kvm_para.h...
Checking PATCH 3/4: x86/cpu: use standard-headers/asm-x86.kvm_para.h...
Checking PATCH 4/4: linux-headers: drop kvm_para.h...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 3/4] x86/cpu: use standard-headers/asm-x86.kvm_para.h
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 20:05     ` Eduardo Habkost
  -1 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 20:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, kvm, Radim Krčmář,
	Marcelo Tosatti, qemu-devel, Marcel Apfelbaum, Paolo Bonzini,
	Richard Henderson

On Tue, Apr 17, 2018 at 09:58:25PM +0300, Michael S. Tsirkin wrote:
> Switch to the header we imported from Linux,
> this allows us to drop a hack in kvm_i386.h.
> More code will be dropped in the next patch.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/sysemu/kvm.h   | 1 -
>  target/i386/cpu.h      | 2 --
>  target/i386/kvm_i386.h | 6 ------
>  hw/i386/kvm/clock.c    | 2 +-
>  target/i386/cpu.c      | 4 +---
>  target/i386/kvm.c      | 4 ++--
>  6 files changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 23669c4..0b64b8e 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -22,7 +22,6 @@
>  #ifdef NEED_CPU_H
>  # ifdef CONFIG_KVM
>  #  include <linux/kvm.h>
> -#  include <linux/kvm_para.h>
>  #  define CONFIG_KVM_IS_POSSIBLE
>  # endif
>  #else
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 1b219fa..9aaab70 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -685,8 +685,6 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
>  #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
>  #define CPUID_7_0_EDX_SPEC_CTRL     (1U << 26) /* Speculation Control */
>  
> -#define KVM_HINTS_DEDICATED (1U << 0)

include/standard-headers/asm-x86/kvm_para.h defines it as 0, but
the only user is fixed below, so this is OK.

> -
>  #define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
>  
>  #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
> diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
> index 1de9876..e5df24c 100644
> --- a/target/i386/kvm_i386.h
> +++ b/target/i386/kvm_i386.h
> @@ -30,12 +30,6 @@
>  #define kvm_pic_in_kernel()      0
>  #define kvm_ioapic_in_kernel()   0
>  
> -/* These constants must never be used at runtime if kvm_enabled() is false.
> - * They exist so we don't need #ifdefs around KVM-specific code that already
> - * checks kvm_enabled() properly.
> - */
> -#define KVM_CPUID_FEATURES       0

The only usage of this macro without CONFIG_KVM is in
feature_word_info, so this change isn't just harmless: it's
necessary to make feature_word_info accurate.


> -
>  #endif  /* CONFIG_KVM */
>  
>  bool kvm_allows_irq0_override(void);
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 7dac319..0bf1c60 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -26,7 +26,7 @@
>  #include "qapi/error.h"
>  
>  #include <linux/kvm.h>
> -#include <linux/kvm_para.h>
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #define TYPE_KVM_CLOCK "kvmclock"
>  #define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1a6b082..efdca33 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -40,9 +40,7 @@
>  #include "qom/qom-qobject.h"
>  #include "sysemu/arch_init.h"
>  
> -#if defined(CONFIG_KVM)
> -#include <linux/kvm_para.h>
> -#endif
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #include "sysemu/sysemu.h"
>  #include "hw/qdev-properties.h"
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 6c49954..44f8584 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -18,7 +18,7 @@
>  #include <sys/utsname.h>
>  
>  #include <linux/kvm.h>
> -#include <linux/kvm_para.h>
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #include "qemu-common.h"
>  #include "cpu.h"
> @@ -385,7 +385,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
>              ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
>          }
>      } else if (function == KVM_CPUID_FEATURES && reg == R_EDX) {
> -        ret |= KVM_HINTS_DEDICATED;
> +        ret |= 1U << KVM_HINTS_DEDICATED;
>          found = 1;

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] x86/cpu: use standard-headers/asm-x86.kvm_para.h
@ 2018-04-17 20:05     ` Eduardo Habkost
  0 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 20:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Richard Henderson, Marcel Apfelbaum, Marcelo Tosatti

On Tue, Apr 17, 2018 at 09:58:25PM +0300, Michael S. Tsirkin wrote:
> Switch to the header we imported from Linux,
> this allows us to drop a hack in kvm_i386.h.
> More code will be dropped in the next patch.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/sysemu/kvm.h   | 1 -
>  target/i386/cpu.h      | 2 --
>  target/i386/kvm_i386.h | 6 ------
>  hw/i386/kvm/clock.c    | 2 +-
>  target/i386/cpu.c      | 4 +---
>  target/i386/kvm.c      | 4 ++--
>  6 files changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 23669c4..0b64b8e 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -22,7 +22,6 @@
>  #ifdef NEED_CPU_H
>  # ifdef CONFIG_KVM
>  #  include <linux/kvm.h>
> -#  include <linux/kvm_para.h>
>  #  define CONFIG_KVM_IS_POSSIBLE
>  # endif
>  #else
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 1b219fa..9aaab70 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -685,8 +685,6 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
>  #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
>  #define CPUID_7_0_EDX_SPEC_CTRL     (1U << 26) /* Speculation Control */
>  
> -#define KVM_HINTS_DEDICATED (1U << 0)

include/standard-headers/asm-x86/kvm_para.h defines it as 0, but
the only user is fixed below, so this is OK.

> -
>  #define CPUID_8000_0008_EBX_IBPB    (1U << 12) /* Indirect Branch Prediction Barrier */
>  
>  #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
> diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
> index 1de9876..e5df24c 100644
> --- a/target/i386/kvm_i386.h
> +++ b/target/i386/kvm_i386.h
> @@ -30,12 +30,6 @@
>  #define kvm_pic_in_kernel()      0
>  #define kvm_ioapic_in_kernel()   0
>  
> -/* These constants must never be used at runtime if kvm_enabled() is false.
> - * They exist so we don't need #ifdefs around KVM-specific code that already
> - * checks kvm_enabled() properly.
> - */
> -#define KVM_CPUID_FEATURES       0

The only usage of this macro without CONFIG_KVM is in
feature_word_info, so this change isn't just harmless: it's
necessary to make feature_word_info accurate.


> -
>  #endif  /* CONFIG_KVM */
>  
>  bool kvm_allows_irq0_override(void);
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 7dac319..0bf1c60 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -26,7 +26,7 @@
>  #include "qapi/error.h"
>  
>  #include <linux/kvm.h>
> -#include <linux/kvm_para.h>
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #define TYPE_KVM_CLOCK "kvmclock"
>  #define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1a6b082..efdca33 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -40,9 +40,7 @@
>  #include "qom/qom-qobject.h"
>  #include "sysemu/arch_init.h"
>  
> -#if defined(CONFIG_KVM)
> -#include <linux/kvm_para.h>
> -#endif
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #include "sysemu/sysemu.h"
>  #include "hw/qdev-properties.h"
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 6c49954..44f8584 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -18,7 +18,7 @@
>  #include <sys/utsname.h>
>  
>  #include <linux/kvm.h>
> -#include <linux/kvm_para.h>
> +#include "standard-headers/asm-x86/kvm_para.h"
>  
>  #include "qemu-common.h"
>  #include "cpu.h"
> @@ -385,7 +385,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
>              ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
>          }
>      } else if (function == KVM_CPUID_FEATURES && reg == R_EDX) {
> -        ret |= KVM_HINTS_DEDICATED;
> +        ret |= 1U << KVM_HINTS_DEDICATED;
>          found = 1;

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 21:12     ` Eduardo Habkost
  -1 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 21:12 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Brijesh Singh, kvm, Radim Krčmář,
	Cornelia Huck, qemu-devel, Roman Kagan, Paolo Bonzini,
	Gerd Hoffmann

On Tue, Apr 17, 2018 at 09:58:21PM +0300, Michael S. Tsirkin wrote:
> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

I didn't review the code yet but I agree it's a good change, so:

Acked-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-17 21:12     ` Eduardo Habkost
  0 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 21:12 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Roman Kagan, Brijesh Singh, Gerd Hoffmann, Cornelia Huck

On Tue, Apr 17, 2018 at 09:58:21PM +0300, Michael S. Tsirkin wrote:
> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

I didn't review the code yet but I agree it's a good change, so:

Acked-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 2/4] include/standard-headers: add asm-x86/kvm_para.h
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 21:12     ` Eduardo Habkost
  -1 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 21:12 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Peter Maydell, kvm, Radim Krčmář,
	qemu-devel, Christian Borntraeger, Eric Auger, Paolo Bonzini

On Tue, Apr 17, 2018 at 09:58:25PM +0300, Michael S. Tsirkin wrote:
> Import asm-x86/kvm_para.h from linux where it can
> be easily used on Linux and non-Linux platforms.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] include/standard-headers: add asm-x86/kvm_para.h
@ 2018-04-17 21:12     ` Eduardo Habkost
  0 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 21:12 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Christian Borntraeger, Peter Maydell, Eric Auger

On Tue, Apr 17, 2018 at 09:58:25PM +0300, Michael S. Tsirkin wrote:
> Import asm-x86/kvm_para.h from linux where it can
> be easily used on Linux and non-Linux platforms.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 4/4] linux-headers: drop kvm_para.h
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-17 22:05     ` Eduardo Habkost
  -1 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 22:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Paolo Bonzini, qemu-devel, kvm, Radim Krčmář

On Tue, Apr 17, 2018 at 09:58:37PM +0300, Michael S. Tsirkin wrote:
> Unused now and can be removed.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] linux-headers: drop kvm_para.h
@ 2018-04-17 22:05     ` Eduardo Habkost
  0 siblings, 0 replies; 32+ messages in thread
From: Eduardo Habkost @ 2018-04-17 22:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář

On Tue, Apr 17, 2018 at 09:58:37PM +0300, Michael S. Tsirkin wrote:
> Unused now and can be removed.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

-- 
Eduardo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-18  7:54     ` Cornelia Huck
  -1 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18  7:54 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Brijesh Singh, Eduardo Habkost, kvm,
	Radim Krčmář,
	qemu-devel, Roman Kagan, Paolo Bonzini, Gerd Hoffmann

On Tue, 17 Apr 2018 21:58:21 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  scripts/update-linux-headers.sh | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 5b1d8dc..a017b53 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -43,6 +43,7 @@ cp_portable() {
>                                       -e 'limits' \
>                                       -e 'linux/kernel' \
>                                       -e 'linux/sysinfo' \
> +                                     -e 'asm-generic/kvm_para' \
>                                       > /dev/null  
>      then
>          echo "Unexpected #include in input file $f".
> @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
>  
>      rm -rf "$output/linux-headers/asm-$arch"
>      mkdir -p "$output/linux-headers/asm-$arch"
> -    for header in kvm.h kvm_para.h unistd.h; do
> +    for header in kvm.h unistd.h; do
>          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
>      done
> -    if [ $arch = powerpc ]; then
> -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> -    fi

Hm, why are you dropping this one?

(The other changes look sane.)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-18  7:54     ` Cornelia Huck
  0 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18  7:54 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Eduardo Habkost, Roman Kagan, Brijesh Singh, Gerd Hoffmann

On Tue, 17 Apr 2018 21:58:21 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  scripts/update-linux-headers.sh | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 5b1d8dc..a017b53 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -43,6 +43,7 @@ cp_portable() {
>                                       -e 'limits' \
>                                       -e 'linux/kernel' \
>                                       -e 'linux/sysinfo' \
> +                                     -e 'asm-generic/kvm_para' \
>                                       > /dev/null  
>      then
>          echo "Unexpected #include in input file $f".
> @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
>  
>      rm -rf "$output/linux-headers/asm-$arch"
>      mkdir -p "$output/linux-headers/asm-$arch"
> -    for header in kvm.h kvm_para.h unistd.h; do
> +    for header in kvm.h unistd.h; do
>          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
>      done
> -    if [ $arch = powerpc ]; then
> -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> -    fi

Hm, why are you dropping this one?

(The other changes look sane.)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-18  7:54     ` [Qemu-devel] " Cornelia Huck
@ 2018-04-18 16:05       ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-18 16:05 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: Wanpeng Li, Brijesh Singh, Eduardo Habkost, kvm,
	Radim Krčmář,
	qemu-devel, Roman Kagan, Paolo Bonzini, Gerd Hoffmann

On Wed, Apr 18, 2018 at 09:54:26AM +0200, Cornelia Huck wrote:
> On Tue, 17 Apr 2018 21:58:21 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > It turns out (as will be clear from follow-up patches)
> > we do not really need any kvm para macros host side
> > for now, except on x86, and there we need it
> > unconditionally whether we run on kvm or we don't.
> > 
> > Import the x86 asm/kvm_para.h into standard-headers,
> > follow-up patches remove a bunch of code using this.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  scripts/update-linux-headers.sh | 16 +++++-----------
> >  1 file changed, 5 insertions(+), 11 deletions(-)
> > 
> > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> > index 5b1d8dc..a017b53 100755
> > --- a/scripts/update-linux-headers.sh
> > +++ b/scripts/update-linux-headers.sh
> > @@ -43,6 +43,7 @@ cp_portable() {
> >                                       -e 'limits' \
> >                                       -e 'linux/kernel' \
> >                                       -e 'linux/sysinfo' \
> > +                                     -e 'asm-generic/kvm_para' \
> >                                       > /dev/null  
> >      then
> >          echo "Unexpected #include in input file $f".
> > @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
> >  
> >      rm -rf "$output/linux-headers/asm-$arch"
> >      mkdir -p "$output/linux-headers/asm-$arch"
> > -    for header in kvm.h kvm_para.h unistd.h; do
> > +    for header in kvm.h unistd.h; do
> >          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
> >      done
> > -    if [ $arch = powerpc ]; then
> > -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> > -    fi
> 
> Hm, why are you dropping this one?
> 
> (The other changes look sane.)

Because it's only used by kvm_para.h. Isn't it?

-- 
MST

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-18 16:05       ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-04-18 16:05 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Eduardo Habkost, Roman Kagan, Brijesh Singh, Gerd Hoffmann

On Wed, Apr 18, 2018 at 09:54:26AM +0200, Cornelia Huck wrote:
> On Tue, 17 Apr 2018 21:58:21 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > It turns out (as will be clear from follow-up patches)
> > we do not really need any kvm para macros host side
> > for now, except on x86, and there we need it
> > unconditionally whether we run on kvm or we don't.
> > 
> > Import the x86 asm/kvm_para.h into standard-headers,
> > follow-up patches remove a bunch of code using this.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  scripts/update-linux-headers.sh | 16 +++++-----------
> >  1 file changed, 5 insertions(+), 11 deletions(-)
> > 
> > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> > index 5b1d8dc..a017b53 100755
> > --- a/scripts/update-linux-headers.sh
> > +++ b/scripts/update-linux-headers.sh
> > @@ -43,6 +43,7 @@ cp_portable() {
> >                                       -e 'limits' \
> >                                       -e 'linux/kernel' \
> >                                       -e 'linux/sysinfo' \
> > +                                     -e 'asm-generic/kvm_para' \
> >                                       > /dev/null  
> >      then
> >          echo "Unexpected #include in input file $f".
> > @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
> >  
> >      rm -rf "$output/linux-headers/asm-$arch"
> >      mkdir -p "$output/linux-headers/asm-$arch"
> > -    for header in kvm.h kvm_para.h unistd.h; do
> > +    for header in kvm.h unistd.h; do
> >          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
> >      done
> > -    if [ $arch = powerpc ]; then
> > -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> > -    fi
> 
> Hm, why are you dropping this one?
> 
> (The other changes look sane.)

Because it's only used by kvm_para.h. Isn't it?

-- 
MST

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-18 16:05       ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-18 17:41         ` Cornelia Huck
  -1 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18 17:41 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Brijesh Singh, Eduardo Habkost, kvm,
	Radim Krčmář,
	qemu-devel, Roman Kagan, Paolo Bonzini, Gerd Hoffmann

On Wed, 18 Apr 2018 19:05:15 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Apr 18, 2018 at 09:54:26AM +0200, Cornelia Huck wrote:
> > On Tue, 17 Apr 2018 21:58:21 +0300
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >   
> > > It turns out (as will be clear from follow-up patches)
> > > we do not really need any kvm para macros host side
> > > for now, except on x86, and there we need it
> > > unconditionally whether we run on kvm or we don't.
> > > 
> > > Import the x86 asm/kvm_para.h into standard-headers,
> > > follow-up patches remove a bunch of code using this.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > >  scripts/update-linux-headers.sh | 16 +++++-----------
> > >  1 file changed, 5 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> > > index 5b1d8dc..a017b53 100755
> > > --- a/scripts/update-linux-headers.sh
> > > +++ b/scripts/update-linux-headers.sh
> > > @@ -43,6 +43,7 @@ cp_portable() {
> > >                                       -e 'limits' \
> > >                                       -e 'linux/kernel' \
> > >                                       -e 'linux/sysinfo' \
> > > +                                     -e 'asm-generic/kvm_para' \  
> > >                                       > /dev/null    
> > >      then
> > >          echo "Unexpected #include in input file $f".
> > > @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
> > >  
> > >      rm -rf "$output/linux-headers/asm-$arch"
> > >      mkdir -p "$output/linux-headers/asm-$arch"
> > > -    for header in kvm.h kvm_para.h unistd.h; do
> > > +    for header in kvm.h unistd.h; do
> > >          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
> > >      done
> > > -    if [ $arch = powerpc ]; then
> > > -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> > > -    fi  
> > 
> > Hm, why are you dropping this one?
> > 
> > (The other changes look sane.)  
> 
> Because it's only used by kvm_para.h. Isn't it?
> 

Ok, I did not look into it in detail, sorry. (It's not obvious from the
file name :)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-18 17:41         ` Cornelia Huck
  0 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18 17:41 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Eduardo Habkost, Roman Kagan, Brijesh Singh, Gerd Hoffmann

On Wed, 18 Apr 2018 19:05:15 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Apr 18, 2018 at 09:54:26AM +0200, Cornelia Huck wrote:
> > On Tue, 17 Apr 2018 21:58:21 +0300
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >   
> > > It turns out (as will be clear from follow-up patches)
> > > we do not really need any kvm para macros host side
> > > for now, except on x86, and there we need it
> > > unconditionally whether we run on kvm or we don't.
> > > 
> > > Import the x86 asm/kvm_para.h into standard-headers,
> > > follow-up patches remove a bunch of code using this.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > ---
> > >  scripts/update-linux-headers.sh | 16 +++++-----------
> > >  1 file changed, 5 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> > > index 5b1d8dc..a017b53 100755
> > > --- a/scripts/update-linux-headers.sh
> > > +++ b/scripts/update-linux-headers.sh
> > > @@ -43,6 +43,7 @@ cp_portable() {
> > >                                       -e 'limits' \
> > >                                       -e 'linux/kernel' \
> > >                                       -e 'linux/sysinfo' \
> > > +                                     -e 'asm-generic/kvm_para' \  
> > >                                       > /dev/null    
> > >      then
> > >          echo "Unexpected #include in input file $f".
> > > @@ -98,13 +99,9 @@ for arch in $ARCHLIST; do
> > >  
> > >      rm -rf "$output/linux-headers/asm-$arch"
> > >      mkdir -p "$output/linux-headers/asm-$arch"
> > > -    for header in kvm.h kvm_para.h unistd.h; do
> > > +    for header in kvm.h unistd.h; do
> > >          cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
> > >      done
> > > -    if [ $arch = powerpc ]; then
> > > -        cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
> > > -    fi  
> > 
> > Hm, why are you dropping this one?
> > 
> > (The other changes look sane.)  
> 
> Because it's only used by kvm_para.h. Isn't it?
> 

Ok, I did not look into it in detail, sorry. (It's not obvious from the
file name :)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
  2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-04-18 17:42     ` Cornelia Huck
  -1 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18 17:42 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Wanpeng Li, Brijesh Singh, Eduardo Habkost, kvm,
	Radim Krčmář,
	qemu-devel, Roman Kagan, Paolo Bonzini, Gerd Hoffmann

On Tue, 17 Apr 2018 21:58:21 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  scripts/update-linux-headers.sh | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)

Acked-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks
@ 2018-04-18 17:42     ` Cornelia Huck
  0 siblings, 0 replies; 32+ messages in thread
From: Cornelia Huck @ 2018-04-18 17:42 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Wanpeng Li, kvm, Paolo Bonzini,
	Radim Krčmář,
	Eduardo Habkost, Roman Kagan, Brijesh Singh, Gerd Hoffmann

On Tue, 17 Apr 2018 21:58:21 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> It turns out (as will be clear from follow-up patches)
> we do not really need any kvm para macros host side
> for now, except on x86, and there we need it
> unconditionally whether we run on kvm or we don't.
> 
> Import the x86 asm/kvm_para.h into standard-headers,
> follow-up patches remove a bunch of code using this.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  scripts/update-linux-headers.sh | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)

Acked-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/4] move kvm_para.h to standard-headers
  2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-05-15 12:33   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-05-15 12:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, Paolo Bonzini, Eduardo Habkost, kvm,
	Radim Krčmář

On Tue, Apr 17, 2018 at 09:58:16PM +0300, Michael S. Tsirkin wrote:
> kvm_para.h is normally an interface for guest.  It's natural to need the
> header in host to emulate that in qemu.
> 
> ATM it does not actually work on non-kvm systems, which allowed us to
> get by sticking it in linux-headers and only pulling it in on Linux, but
> that turns out to be more pain than it's worth.
> 
> The result seems to be that we are forced to duplicate
> more and more code from there when we are in portable code.
> Not nice.
> 
> Let's just pull it into standard-headers instead, and use
> on all platforms unconditionally.
> 
> It turns out we only need the x86 version, so that is
> and extra a plus - drop the rest.

Ping kvm maintainers - any comments?
Should I merge this one?

> Michael S. Tsirkin (4):
>   update-linux-headers.sh: drop kvm_para.h hacks
>   include/standard-headers: add asm-x86/kvm_para.h
>   x86/cpu: use standard-headers/asm-x86.kvm_para.h
>   linux-headers: drop kvm_para.h
> 
>  .../standard-headers}/asm-x86/kvm_para.h           | 49 ++++++-----
>  include/sysemu/kvm.h                               |  1 -
>  linux-headers/asm-arm/kvm_para.h                   |  2 -
>  linux-headers/asm-arm64/kvm_para.h                 |  1 -
>  linux-headers/asm-generic/kvm_para.h               |  4 -
>  linux-headers/asm-mips/kvm_para.h                  |  5 --
>  linux-headers/asm-powerpc/epapr_hcalls.h           | 99 ----------------------
>  linux-headers/asm-powerpc/kvm_para.h               | 98 ---------------------
>  linux-headers/asm-s390/kvm_para.h                  |  8 --
>  linux-headers/linux/kvm_para.h                     | 35 --------
>  target/i386/cpu.h                                  |  2 -
>  target/i386/kvm_i386.h                             |  6 --
>  hw/i386/kvm/clock.c                                |  2 +-
>  target/i386/cpu.c                                  |  4 +-
>  target/i386/kvm.c                                  |  4 +-
>  scripts/update-linux-headers.sh                    | 16 ++--
>  16 files changed, 35 insertions(+), 301 deletions(-)
>  rename {linux-headers => include/standard-headers}/asm-x86/kvm_para.h (80%)
>  delete mode 100644 linux-headers/asm-arm/kvm_para.h
>  delete mode 100644 linux-headers/asm-arm64/kvm_para.h
>  delete mode 100644 linux-headers/asm-generic/kvm_para.h
>  delete mode 100644 linux-headers/asm-mips/kvm_para.h
>  delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
>  delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
>  delete mode 100644 linux-headers/asm-s390/kvm_para.h
>  delete mode 100644 linux-headers/linux/kvm_para.h
> 
> -- 
> MST
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers
@ 2018-05-15 12:33   ` Michael S. Tsirkin
  0 siblings, 0 replies; 32+ messages in thread
From: Michael S. Tsirkin @ 2018-05-15 12:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wanpeng Li, kvm, Paolo Bonzini, Radim Krčmář,
	Eduardo Habkost

On Tue, Apr 17, 2018 at 09:58:16PM +0300, Michael S. Tsirkin wrote:
> kvm_para.h is normally an interface for guest.  It's natural to need the
> header in host to emulate that in qemu.
> 
> ATM it does not actually work on non-kvm systems, which allowed us to
> get by sticking it in linux-headers and only pulling it in on Linux, but
> that turns out to be more pain than it's worth.
> 
> The result seems to be that we are forced to duplicate
> more and more code from there when we are in portable code.
> Not nice.
> 
> Let's just pull it into standard-headers instead, and use
> on all platforms unconditionally.
> 
> It turns out we only need the x86 version, so that is
> and extra a plus - drop the rest.

Ping kvm maintainers - any comments?
Should I merge this one?

> Michael S. Tsirkin (4):
>   update-linux-headers.sh: drop kvm_para.h hacks
>   include/standard-headers: add asm-x86/kvm_para.h
>   x86/cpu: use standard-headers/asm-x86.kvm_para.h
>   linux-headers: drop kvm_para.h
> 
>  .../standard-headers}/asm-x86/kvm_para.h           | 49 ++++++-----
>  include/sysemu/kvm.h                               |  1 -
>  linux-headers/asm-arm/kvm_para.h                   |  2 -
>  linux-headers/asm-arm64/kvm_para.h                 |  1 -
>  linux-headers/asm-generic/kvm_para.h               |  4 -
>  linux-headers/asm-mips/kvm_para.h                  |  5 --
>  linux-headers/asm-powerpc/epapr_hcalls.h           | 99 ----------------------
>  linux-headers/asm-powerpc/kvm_para.h               | 98 ---------------------
>  linux-headers/asm-s390/kvm_para.h                  |  8 --
>  linux-headers/linux/kvm_para.h                     | 35 --------
>  target/i386/cpu.h                                  |  2 -
>  target/i386/kvm_i386.h                             |  6 --
>  hw/i386/kvm/clock.c                                |  2 +-
>  target/i386/cpu.c                                  |  4 +-
>  target/i386/kvm.c                                  |  4 +-
>  scripts/update-linux-headers.sh                    | 16 ++--
>  16 files changed, 35 insertions(+), 301 deletions(-)
>  rename {linux-headers => include/standard-headers}/asm-x86/kvm_para.h (80%)
>  delete mode 100644 linux-headers/asm-arm/kvm_para.h
>  delete mode 100644 linux-headers/asm-arm64/kvm_para.h
>  delete mode 100644 linux-headers/asm-generic/kvm_para.h
>  delete mode 100644 linux-headers/asm-mips/kvm_para.h
>  delete mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
>  delete mode 100644 linux-headers/asm-powerpc/kvm_para.h
>  delete mode 100644 linux-headers/asm-s390/kvm_para.h
>  delete mode 100644 linux-headers/linux/kvm_para.h
> 
> -- 
> MST
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/4] move kvm_para.h to standard-headers
  2018-05-15 12:33   ` [Qemu-devel] " Michael S. Tsirkin
@ 2018-05-15 12:56     ` Paolo Bonzini
  -1 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2018-05-15 12:56 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Wanpeng Li, Eduardo Habkost, kvm, Radim Krčmář

On 15/05/2018 14:33, Michael S. Tsirkin wrote:
>> Let's just pull it into standard-headers instead, and use
>> on all platforms unconditionally.
>>
>> It turns out we only need the x86 version, so that is
>> and extra a plus - drop the rest.
>
> Ping kvm maintainers - any comments?
> Should I merge this one?

Yes, go ahead!

Paolo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] move kvm_para.h to standard-headers
@ 2018-05-15 12:56     ` Paolo Bonzini
  0 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2018-05-15 12:56 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Wanpeng Li, kvm, Radim Krčmář, Eduardo Habkost

On 15/05/2018 14:33, Michael S. Tsirkin wrote:
>> Let's just pull it into standard-headers instead, and use
>> on all platforms unconditionally.
>>
>> It turns out we only need the x86 version, so that is
>> and extra a plus - drop the rest.
>
> Ping kvm maintainers - any comments?
> Should I merge this one?

Yes, go ahead!

Paolo

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2018-05-15 12:56 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 18:58 [PATCH 0/4] move kvm_para.h to standard-headers Michael S. Tsirkin
2018-04-17 18:58 ` [Qemu-devel] " Michael S. Tsirkin
2018-04-17 18:58 ` [PATCH 1/4] update-linux-headers.sh: drop kvm_para.h hacks Michael S. Tsirkin
2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
2018-04-17 21:12   ` Eduardo Habkost
2018-04-17 21:12     ` [Qemu-devel] " Eduardo Habkost
2018-04-18  7:54   ` Cornelia Huck
2018-04-18  7:54     ` [Qemu-devel] " Cornelia Huck
2018-04-18 16:05     ` Michael S. Tsirkin
2018-04-18 16:05       ` [Qemu-devel] " Michael S. Tsirkin
2018-04-18 17:41       ` Cornelia Huck
2018-04-18 17:41         ` [Qemu-devel] " Cornelia Huck
2018-04-18 17:42   ` Cornelia Huck
2018-04-18 17:42     ` [Qemu-devel] " Cornelia Huck
2018-04-17 18:58 ` [PATCH 3/4] x86/cpu: use standard-headers/asm-x86.kvm_para.h Michael S. Tsirkin
2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
2018-04-17 20:05   ` Eduardo Habkost
2018-04-17 20:05     ` [Qemu-devel] " Eduardo Habkost
2018-04-17 18:58 ` [PATCH 2/4] include/standard-headers: add asm-x86/kvm_para.h Michael S. Tsirkin
2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
2018-04-17 21:12   ` Eduardo Habkost
2018-04-17 21:12     ` [Qemu-devel] " Eduardo Habkost
2018-04-17 18:58 ` [PATCH 4/4] linux-headers: drop kvm_para.h Michael S. Tsirkin
2018-04-17 18:58   ` [Qemu-devel] " Michael S. Tsirkin
2018-04-17 22:05   ` Eduardo Habkost
2018-04-17 22:05     ` [Qemu-devel] " Eduardo Habkost
2018-04-17 19:05 ` [PATCH 0/4] move kvm_para.h to standard-headers no-reply
2018-04-17 19:05   ` [Qemu-devel] " no-reply
2018-05-15 12:33 ` Michael S. Tsirkin
2018-05-15 12:33   ` [Qemu-devel] " Michael S. Tsirkin
2018-05-15 12:56   ` Paolo Bonzini
2018-05-15 12:56     ` [Qemu-devel] " Paolo Bonzini

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.