linux-headers: arch fixups
v4 cover linux-headers: arch fixups
It turns out that we have unistd.h and kvm headers for some architectures but not others. We are thus unable to use e.g. usefaultfd on these systems unless system headers have been updated.
Fix up update-linux-headers.sh to make sure we auto-updates all architectures which have linux-headers/ (unfortunately this still does not mean "all linux systems").
Tested on x86 only.
Pls consider merging this through the ARM tree.
Michael S. Tsirkin (3):
update-linux-headers.sh: add unistd.h and kvm on MIPS
linux-headers: add unistd.h on all arches
linux-headers: add kvm header for mips
linux-headers/asm-arm/bitsperlong.h | 1 + linux-headers/asm-arm64/bitsperlong.h | 24 + linux-headers/asm-generic/bitsperlong.h | 16 + linux-headers/asm-generic/unistd.h | 944 ++++++++++++++++++++++++++++++++ linux-headers/asm-mips/bitsperlong.h | 9 + linux-headers/asm-mips/kvm.h | 25 +- linux-headers/asm-mips/sgidefs.h | 45 ++ linux-headers/asm-mips/unistd.h | 44 +- linux-headers/asm-powerpc/bitsperlong.h | 13 + linux-headers/asm-s390/bitsperlong.h | 14 + linux-headers/asm-x86/bitsperlong.h | 14 + scripts/update-linux-headers.sh | 22 +- 12 files changed, 1155 insertions(+), 16 deletions(-) create mode 100644 linux-headers/asm-arm/bitsperlong.h create mode 100644 linux-headers/asm-arm64/bitsperlong.h create mode 100644 linux-headers/asm-generic/bitsperlong.h create mode 100644 linux-headers/asm-generic/unistd.h create mode 100644 linux-headers/asm-mips/bitsperlong.h create mode 100644 linux-headers/asm-mips/sgidefs.h create mode 100644 linux-headers/asm-powerpc/bitsperlong.h create mode 100644 linux-headers/asm-s390/bitsperlong.h create mode 100644 linux-headers/asm-x86/bitsperlong.h
Signature · 1 line
MST
PATCH v4 1/3 update-linux-headers.sh: add unistd.h and kvm on MIPS
Rework the update script slightly, add the unistd.h header and its dependencies on all architectures.
This also removes the IA64 and MIPS from a KVM blacklist:
Linux dropped IA64, and there was never a reason to exclude MIPS from kvm specifically - it was excluded due to dependency of its unistd.h on sgidefs.h, which we also import.
--- scripts/update-linux-headers.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
scripts/update-linux-headers.sh +15 -7
@@ -80,11 +80,6 @@ for arch in $ARCHLIST; do continue fi - # Blacklist architectures which have KVM headers but are actually dead - if [ "$arch" = "ia64" -o "$arch" = "mips" ]; then - continue - fi - if [ "$arch" = x86 ]; then arch_var=SRCARCH else
@@ -95,9 +90,18 @@ 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 unistd.h bitsperlong.h; do + cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" + done + + for header in kvm.h kvm_para.h; do cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" done + + if [ $arch = mips ]; then + cp "$tmpdir/include/asm/sgidefs.h" "$output/linux-headers/asm-mips/" + fi + if [ $arch = powerpc ]; then cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/" fi
@@ -120,6 +124,10 @@ EOF cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" fi + if [ $arch = s390 ]; then + cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-arm/" + cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-arm/" + fi done rm -rf "$output/linux-headers/linux"
@@ -130,7 +138,7 @@ for header in kvm.h kvm_para.h vfio.h vfio_ccw.h vhost.h \ done rm -rf "$output/linux-headers/asm-generic" mkdir -p "$output/linux-headers/asm-generic" -for header in kvm_para.h; do +for header in kvm_para.h bitsperlong.h unistd.h; do cp "$tmpdir/include/asm-generic/$header" "$output/linux-headers/asm-generic" done if [ -L "$linux/source" ]; then
Signature · 1 line
MST
PATCH v4 3/3 linux-headers: add kvm header for mips
In reply to Michael S. Tsirkinkvm header for MIPS was manually excluded from auto-updates.
Update it now to 4.16-rc5.
--- linux-headers/asm-mips/kvm.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
linux-headers/asm-mips/kvm.h +22 -3
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive
@@ -19,6 +20,10 @@* Some parts derived from the x86 version of this file. */ +#define __KVM_HAVE_READONLY_MEM + +#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 +/* * for KVM_GET_REGS and KVM_SET_REGS *
@@ -52,9 +57,14 @@ struct kvm_fpu {* Register set = 0: GP registers from kvm_regs (see definitions below). * * Register set = 1: CP0 registers. -* bits[15..8] - Must be zero. -* bits[7..3] - Register 'rd' index. -* bits[2..0] - Register 'sel' index. +* bits[15..8] - COP0 register set. +* +* COP0 register set = 0: Main CP0 registers. +* bits[7..3] - Register 'rd' index. +* bits[2..0] - Register 'sel' index. +* +* COP0 register set = 1: MAARs. +* bits[7..0] - MAAR index. * * Register set = 2: KVM specific registers (see definitions below). *
@@ -113,6 +123,15 @@ struct kvm_fpu {/* +* KVM_REG_MIPS_CP0 - Coprocessor 0 registers. +*/ + +#define KVM_REG_MIPS_MAAR (KVM_REG_MIPS_CP0 | (1 << 8)) +#define KVM_REG_MIPS_CP0_MAAR (n) (KVM_REG_MIPS_MAAR | \ + KVM_REG_SIZE_U64 | (n)) + + +/* * KVM_REG_MIPS_KVM - KVM specific control registers. */
Signature · 1 line
MST
PATCH v4 2/3 linux-headers: add unistd.h on all arches
In reply to Michael S. TsirkinThis adds unistd.h on ARM64 and MIPS and their dependencies.
--- linux-headers/asm-arm/bitsperlong.h | 1 + linux-headers/asm-arm64/bitsperlong.h | 24 + linux-headers/asm-generic/bitsperlong.h | 16 + linux-headers/asm-generic/unistd.h | 944 ++++++++++++++++++++++++++++++++ linux-headers/asm-mips/bitsperlong.h | 9 + linux-headers/asm-mips/sgidefs.h | 45 ++ linux-headers/asm-mips/unistd.h | 44 +- linux-headers/asm-powerpc/bitsperlong.h | 13 + linux-headers/asm-s390/bitsperlong.h | 14 + linux-headers/asm-x86/bitsperlong.h | 14 + 10 files changed, 1118 insertions(+), 6 deletions(-) create mode 100644 linux-headers/asm-arm/bitsperlong.h create mode 100644 linux-headers/asm-arm64/bitsperlong.h create mode 100644 linux-headers/asm-generic/bitsperlong.h create mode 100644 linux-headers/asm-generic/unistd.h create mode 100644 linux-headers/asm-mips/bitsperlong.h create mode 100644 linux-headers/asm-mips/sgidefs.h create mode 100644 linux-headers/asm-powerpc/bitsperlong.h create mode 100644 linux-headers/asm-s390/bitsperlong.h create mode 100644 linux-headers/asm-x86/bitsperlong.h
linux-headers/asm-arm/bitsperlong.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/bitsperlong.h>
linux-headers/asm-arm64/bitsperlong.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* Copyright (C) 2012 ARM Ltd. +* +* 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, see <http://www.gnu.org/licenses/>. +*/ +#ifndef __ASM_BITSPERLONG_H +#define __ASM_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_BITSPERLONG_H */
linux-headers/asm-generic/bitsperlong.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_BITS_PER_LONG +#define __ASM_GENERIC_BITS_PER_LONG + +/* +* There seems to be no way of detecting this automatically from user +* space, so 64 bit architectures should override this in their +* bitsperlong.h. In particular, an architecture that supports +* both 32 and 64 bit user space must not rely on CONFIG_64BIT +* to decide it, but rather check a compiler provided macro. +*/ +#ifndef __BITS_PER_LONG +#define __BITS_PER_LONG 32 +#endif + +#endif /* __ASM_GENERIC_BITS_PER_LONG */
linux-headers/asm-generic/unistd.h new file +944 -0
944 lines not on this page · raw message
linux-headers/asm-mips/bitsperlong.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_MIPS_BITSPERLONG_H +#define __ASM_MIPS_BITSPERLONG_H + +#define __BITS_PER_LONG _MIPS_SZLONG + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_MIPS_BITSPERLONG_H */
linux-headers/asm-mips/sgidefs.h new file +45 -0
45 lines not on this page · raw message
linux-headers/asm-mips/unistd.h +38 -6
88 lines not on this page · raw message
linux-headers/asm-powerpc/bitsperlong.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_POWERPC_BITSPERLONG_H +#define __ASM_POWERPC_BITSPERLONG_H + +#if defined(__powerpc64__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_POWERPC_BITSPERLONG_H */
linux-headers/asm-s390/bitsperlong.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_S390_BITSPERLONG_H +#define __ASM_S390_BITSPERLONG_H + +#ifndef __s390x__ +#define __BITS_PER_LONG 32 +#else +#define __BITS_PER_LONG 64 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_S390_BITSPERLONG_H */ +
linux-headers/asm-x86/bitsperlong.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_X86_BITSPERLONG_H +#define __ASM_X86_BITSPERLONG_H + +#if defined(__x86_64__) && !defined(__ILP32__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include <asm-generic/bitsperlong.h> + +#endif /* __ASM_X86_BITSPERLONG_H */ +
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH v4 1/3] update-linux-headers.sh: add unistd.h and kvm on MIPS
In reply to Michael S. TsirkinQuoted 51 lines · * Michael S. Tsirkin ([email protected]) wrote:
Rework the update script slightly, add the
unistd.hheader and its dependencies on all architectures.This also removes the IA64 and MIPS from a KVM blacklist:
Linux dropped IA64, and there was never a reason to exclude MIPS from kvm specifically - it was excluded due to dependency of itsunistd.honsgidefs.h, which we also import.Signed-off-by Michael S. Tsirkin <[email protected]>--- scripts/update-linux-headers.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)scripts/update-linux-headers.sh +10
-6@@ -80,11 +80,6 @@ for arch in $ARCHLIST; do continue fi - # Blacklist architectures which have KVM headers but are actually dead - if [ "$arch" = "ia64" -o "$arch" = "mips" ]; then - continue - fi - if [ "$arch" = x86 ]; then arch_var=SRCARCH else@@ -95,9 +90,18 @@ 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 unistd.h bitsperlong.h; do + cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" + done + + for header in kvm.h kvm_para.h; do cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" done + + if [ $arch = mips ]; then + cp "$tmpdir/include/asm/sgidefs.h" "$output/linux-headers/asm-mips/" + fi + if [ $arch = powerpc ]; then cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/" fi
scripts/update-linux-headers.sh EOF · line 129
Quoted 6 lines
scripts/update-linux-headers.sh +3
-0@@ -120,6 +124,10 @@ EOF cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" fi + if [ $arch = s390 ]; then + cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-arm/" + cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-arm/"
That doesn't look right - I'm guessing that should be copying into asm-s390 ?
Dave
Quoted 17 lines
scripts/update-linux-headers.sh +2
-1+ fi done rm -rf "$output/linux-headers/linux"@@ -130,7 +138,7 @@ for header in kvm.h kvm_para.h vfio.h vfio_ccw.h vhost.h \ done rm -rf "$output/linux-headers/asm-generic" mkdir -p "$output/linux-headers/asm-generic" -for header in kvm_para.h; do +for header in kvm_para.h bitsperlong.h unistd.h; do cp "$tmpdir/include/asm-generic/$header" "$output/linux-headers/asm-generic" done if [ -L "$linux/source" ]; thenSignature · 1 line
MST
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH v4 1/3] update-linux-headers.sh: add unistd.h and kvm on MIPS
Quoted 12 lines · On Fri, 23 Mar 2018 17:38:24 +0000 "Dr. David Alan Gilbert"…
scripts/update-linux-headers.sh EOF · line 129
Quoted 7 lines · * Michael S. Tsirkin ([email protected]) wrote:
scripts/update-linux-headers.sh +3
-0@@ -120,6 +124,10 @@ EOF cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" fi + if [ $arch = s390 ]; then + cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-arm/" + cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-arm/"That doesn't look right - I'm guessing that should be copying into asm-s390 ?
I think we rather need "$arch = arm" or so here (s390 only has unistd.h, which is already handled).