[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v11 12/23] UAPI: x86: Move pvclock-abi to UAPI for x86 platforms



From: Jack Allister <jalliste@xxxxxxxxxx>

A subsequent commit will provide a new KVM interface for performing a
fixup/correction of the KVM clock against the reference TSC. The
KVM_[GS]ET_CLOCK_GUEST API requires a pvclock_vcpu_time_info, as such
the caller must know about this definition.

Move the definition to the UAPI folder so that it is exported to
usermode, change the type definitions to use the standard for UAPI
exports, and add the Linux-syscall-note exception to the SPDX licence
identifier as is conventional for exported headers.

Define __KERNEL__ in scripts/xen-hypercalls.sh: the UAPI header now
pulls in linux/types.h, and the script's raw $CPP invocation with
$LINUXINCLUDE does not define it, which would trigger the "attempt to
use kernel headers from user space" warning from the UAPI type
headers.

Signed-off-by: Jack Allister <jalliste@xxxxxxxxxx>
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
Reviewed-by: Paul Durrant <paul@xxxxxxx>
Tested-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
---
 MAINTAINERS                                   |  4 +--
 arch/x86/include/{ => uapi}/asm/pvclock-abi.h | 27 ++++++++++---------
 scripts/xen-hypercalls.sh                     |  2 +-
 3 files changed, 18 insertions(+), 15 deletions(-)
 rename arch/x86/include/{ => uapi}/asm/pvclock-abi.h (82%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9fadc98d3c49..773f7c800f6a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14663,8 +14663,8 @@ S:      Supported
 T:     git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
 F:     arch/um/include/asm/kvm_para.h
 F:     arch/x86/include/asm/kvm_para.h
-F:     arch/x86/include/asm/pvclock-abi.h
 F:     arch/x86/include/uapi/asm/kvm_para.h
+F:     arch/x86/include/uapi/asm/pvclock-abi.h
 F:     arch/x86/kernel/kvm.c
 F:     arch/x86/kernel/kvmclock.c
 F:     include/asm-generic/kvm_para.h
@@ -29780,8 +29780,8 @@ R:      Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
 L:     xen-devel@xxxxxxxxxxxxxxxxxxxx (moderated for non-subscribers)
 S:     Supported
 F:     arch/x86/configs/xen.config
-F:     arch/x86/include/asm/pvclock-abi.h
 F:     arch/x86/include/asm/xen/
+F:     arch/x86/include/uapi/asm/pvclock-abi.h
 F:     arch/x86/platform/pvh/
 F:     arch/x86/xen/
 
diff --git a/arch/x86/include/asm/pvclock-abi.h 
b/arch/x86/include/uapi/asm/pvclock-abi.h
similarity index 82%
rename from arch/x86/include/asm/pvclock-abi.h
rename to arch/x86/include/uapi/asm/pvclock-abi.h
index b9fece5fc96d..6d70cf640362 100644
--- a/arch/x86/include/asm/pvclock-abi.h
+++ b/arch/x86/include/uapi/asm/pvclock-abi.h
@@ -1,6 +1,9 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 #ifndef _ASM_X86_PVCLOCK_ABI_H
 #define _ASM_X86_PVCLOCK_ABI_H
+
+#include <linux/types.h>
+
 #ifndef __ASSEMBLER__
 
 /*
@@ -24,20 +27,20 @@
  */
 
 struct pvclock_vcpu_time_info {
-       u32   version;
-       u32   pad0;
-       u64   tsc_timestamp;
-       u64   system_time;
-       u32   tsc_to_system_mul;
-       s8    tsc_shift;
-       u8    flags;
-       u8    pad[2];
+       __u32   version;
+       __u32   pad0;
+       __u64   tsc_timestamp;
+       __u64   system_time;
+       __u32   tsc_to_system_mul;
+       __s8    tsc_shift;
+       __u8    flags;
+       __u8    pad[2];
 } __attribute__((__packed__)); /* 32 bytes */
 
 struct pvclock_wall_clock {
-       u32   version;
-       u32   sec;
-       u32   nsec;
+       __u32   version;
+       __u32   sec;
+       __u32   nsec;
 } __attribute__((__packed__));
 
 #define PVCLOCK_TSC_STABLE_BIT (1 << 0)
diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh
index f18b00843df3..51a722198997 100755
--- a/scripts/xen-hypercalls.sh
+++ b/scripts/xen-hypercalls.sh
@@ -5,7 +5,7 @@ shift
 in="$@"
 
 for i in $in; do
-       eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
+       eval $CPP -D__KERNEL__ $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null
 done | \
 awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 }
        END {   print "/* auto-generated by scripts/xen-hypercall.sh */"
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.