linux-headers: arch fixups
v6 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 v5:
rebase to master
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 | 781 ++++++++++++++++++++++++++++++++ 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-s390/unistd_32.h | 1 + linux-headers/asm-s390/unistd_64.h | 1 + linux-headers/asm-x86/bitsperlong.h | 14 + scripts/update-linux-headers.sh | 18 +- 14 files changed, 991 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 v6 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
@@ -129,6 +129,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
PATCH v6 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 v6 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 8 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").
Quoted 6 lines
Tested on x86 only.
Pls consider merging this through the ARM tree.
Changes from v5:
rebase to master
Still doesn't apply:
e104462:xenial:qemu$ patches apply -s id:[email protected]
Applying: update-linux-headers.sh: unistd.h, kvm consistency
error: sha1 information is lacking or useless (scripts/update-linux-headers.sh).
error: could not build fake ancestor
Patch failed at 0001 update-linux-headers.sh: unistd.h, kvm consistency Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort". e104462:xenial:qemu$ patch --dry-run -p1 <.git/rebase-apply/patch checking file scripts/update-linux-headers.sh
Hunk #1 succeeded at 83 (offset -1 lines).
Hunk #2 FAILED at 94.
Hunk #3 FAILED at 124.
2 out of 3 hunks FAILED
The copy of this script in master has code relating to kvm_para.h, and whatever you've based this patchset on apparently does not, hence the conflicts.
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 8 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").
Quoted 8 lines
Quoted 6 lines
Tested on x86 only.
Pls consider merging this through the ARM tree.
Changes from v5:
rebase to masterStill doesn't apply:
Against which commit?
Quoted 23 lines
e104462:xenial:qemu$ patches apply -s id:[email protected]
Applying:update-linux-headers.sh:unistd.h, kvm consistency
error: sha1 information is lacking or useless (scripts/update-linux-headers.sh).
error: could not build fake ancestor
Patch failed at 0001update-linux-headers.sh:unistd.h, kvm consistency Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort". e104462:xenial:qemu$ patch --dry-run -p1 <.git/rebase-apply/patch checking filescripts/update-linux-headers.sh
Hunk #1 succeeded at 83 (offset -1 lines).
Hunk #2 FAILED at 94.
Hunk #3 FAILED at 124.
2 out of 3 hunks FAILEDThe copy of this script in master has code relating to
kvm_para.h, and whatever you've based this patchset on apparently does not, hence the conflicts.thanks
-- PMM
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Peter Maydell
Quoted 10 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.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Pls consider merging this through the ARM tree.
Changes from v5:
rebase to masterStill doesn't apply:
Against which commit?
bbd87423ea0c436c55bb, but the last change in master to scripts/update-linux-headers.sh is 7afcfd32a65688 a month ago, so this won't apply to anything since then and wouldn't have applied before that either. I think you have based your patchset on some other changes to the script which are not in master (at a guess, your "move kvm_para.h to standard-headers" series).
thanks
-- PMM
Quoted 30 lines · Peter Maydell
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Peter Maydell
Quoted 10 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.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Pls consider merging this through the ARM tree.
Changes from v5:
rebase to masterStill doesn't apply:
Against which commit?
bbd87423ea0c436c55bb, but the last change in master toscripts/update-linux-headers.shis7afcfd32a65688a month ago, so this won't apply to anything since then and wouldn't have applied before that either. I think you have based your patchset on some other changes to the script which are not in master (at a guess, your "movekvm_para.hto standard-headers" series).
Quoted 2 lines
thanks
-- PMM
Oh. That's right. I forgot about that, sorry. These patches are supposed to be in the kvm tree now. So need to wait for kvm to be merged, and this can go on top.
Signature · 1 line
MST
Quoted 30 lines · Peter Maydell
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Peter Maydell
Quoted 10 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.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Pls consider merging this through the ARM tree.
Changes from v5:
rebase to masterStill doesn't apply:
Against which commit?
bbd87423ea0c436c55bb, but the last change in master toscripts/update-linux-headers.shis7afcfd32a65688a month ago, so this won't apply to anything since then and wouldn't have applied before that either. I think you have based your patchset on some other changes to the script which are not in master (at a guess, your "movekvm_para.hto standard-headers" series).
Quoted 2 lines
thanks
-- PMM
OK I will just do a pull with these + kvm headers since it was approved by Paolo.
Signature · 1 line
MST