linux-headers: arch fixups
v5 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.
changes from v4:
dropped s390 chunks - already upstream
Michael S. Tsirkin (3):
update-linux-headers.sh: unistd.h, kvm consistency
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, 1156 insertions(+), 15 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 v5 1/3 update-linux-headers.sh: unistd.h, kvm consistency
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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
scripts/update-linux-headers.sh +12 -6
@@ -84,11 +84,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
@@ -99,9 +94,14 @@ for arch in $ARCHLIST; do rm -rf "$output/linux-headers/asm-$arch" mkdir -p "$output/linux-headers/asm-$arch" - for header in kvm.h unistd.h; do + for header in kvm.h unistd.h bitsperlong.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 + rm -rf "$output/include/standard-headers/asm-$arch" mkdir -p "$output/include/standard-headers/asm-$arch" if [ $arch = s390 ]; then
@@ -132,6 +132,12 @@ for header in kvm.h vfio.h vfio_ccw.h vhost.h \ 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 unistd.h bitsperlong.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
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH v5 1/3] update-linux-headers.sh: unistd.h, kvm consistency
Quoted 11 lines · Michael S. Tsirkin
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.Cc Dr. David Alan Gilbert <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Quoted 50 lines
--- scripts/update-linux-headers.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)scripts/update-linux-headers.sh +12
-6@@ -84,11 +84,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@@ -99,9 +94,14 @@ for arch in $ARCHLIST; do rm -rf "$output/linux-headers/asm-$arch" mkdir -p "$output/linux-headers/asm-$arch" - for header in kvm.h unistd.h; do + for header in kvm.h unistd.h bitsperlong.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 + rm -rf "$output/include/standard-headers/asm-$arch" mkdir -p "$output/include/standard-headers/asm-$arch" if [ $arch = s390 ]; then@@ -132,6 +132,12 @@ for header in kvm.h vfio.h vfio_ccw.h vhost.h \ 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 unistd.h bitsperlong.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
PATCH v5 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.
Updated to Linux 4.17-rc2.
--- 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 | 781 ++++++++++++++++++++++++++++++++ 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-s390/unistd_32.h | 1 + linux-headers/asm-s390/unistd_64.h | 1 + linux-headers/asm-x86/bitsperlong.h | 14 + 12 files changed, 957 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 +781 -0
781 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-s390/unistd_32.h +1 -0
@@ -360,5 +360,6 @@#define __NR_s390_guarded_storage 378#define __NR_statx 379#define __NR_s390_sthyi 380 +#define __NR_kexec_file_load 381#endif /* _ASM_S390_UNISTD_32_H */
linux-headers/asm-s390/unistd_64.h +1 -0
@@ -327,5 +327,6 @@#define __NR_s390_guarded_storage 378#define __NR_statx 379#define __NR_s390_sthyi 380 +#define __NR_kexec_file_load 381#endif /* _ASM_S390_UNISTD_64_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
PATCH v5 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.17-rc2.
--- 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
Quoted 12 lines · Michael S. Tsirkin
It turns out that we have
unistd.hand 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.shto 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.
Quoted 7 lines
changes from v4:
dropped s390 chunks - already upstreamMichael S. Tsirkin (3):
update-linux-headers.sh:unistd.h, kvm consistency
linux-headers: addunistd.hon all arches
linux-headers: add kvm header for mips
Hi. Patch 1 doesn't seem to apply to current master -- could you rebase and resend, please?
thanks
-- PMM
Quoted 21 lines · Peter Maydell
Quoted 12 lines · Michael S. Tsirkin
It turns out that we have
unistd.hand 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.shto 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.
Quoted 7 lines
changes from v4:
dropped s390 chunks - already upstreamMichael S. Tsirkin (3):
update-linux-headers.sh:unistd.h, kvm consistency
linux-headers: addunistd.hon all arches
linux-headers: add kvm header for mips
Quoted 5 lines
Hi. Patch 1 doesn't seem to apply to current master -- could you rebase and resend, please?
thanks
-- PMM
Done, v6 posted.