Skip to contentSkip to conversation

linux-headers: unistd.h fixups

PATCH Superseded Michael S. Tsirkin 3 participants 6 messages Mar 20, 2018 – Mar 23, 2018

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover linux-headers: unistd.h fixups

It turns out that we have unistd.h for some architectures but not others. We are thus unable to use e.g. usefaultfd on these systems.

Fix up update-linux-headers.sh to make sure we
get it for 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 migration tree.

Michael S. Tsirkin (2):
update-linux-headers.sh: add unistd.h
linux-headers: add asm-generic/unistd.h

 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/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         |  20 +-
 10 files changed, 1086 insertions(+), 13 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-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
#1 lore raw

PATCH v3 1/2 update-linux-headers.sh: add unistd.h

Rework the update script slightly, add the unistd.h header and its dependencies on all architectures.

This also removes the IA64 from a KVM blacklist (Linux dropped this architecture for KVM), and adds a comment so we remember to try and un-blacklist KVM on MIPS.

---
 scripts/update-linux-headers.sh | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
scripts/update-linux-headers.sh +13 -7
index d18e2f1..0999ccf 100755
@@ -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,20 @@ 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
+
+    # Below blacklists KVM on MIPS since we did this historically, even though
+    # KVM on MIPS is supposed to be properly supported these days.
+    # TODO: we should not be blacklisting it, but instead sorting out whatever
+    # issues it has that made us exclude it.
+    if [ "$arch" != "mips" ]; then
+        for header in kvm.h kvm_para.h; do
+            cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
+        done
+    fi
+
     if [ $arch = powerpc ]; then
         cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/"
     fi
@@ -130,7 +136,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
#2 lore raw

PATCH v3 2/2 linux-headers: add asm-generic/unistd.h

In reply to Michael S. Tsirkin

ARM64 and MIPS depend on asm-generic/unistd.h for syscall numbers. This adds asm-generic/unistd.h and it's 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/unistd.h         |  44 +-
 linux-headers/asm-powerpc/bitsperlong.h |  13 +
 linux-headers/asm-s390/bitsperlong.h    |  14 +
 linux-headers/asm-x86/bitsperlong.h     |  14 +
 9 files changed, 1073 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-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
new file mode 100644
index 0000000..6dc0bb0
@@ -0,0 +1 @@
+#include <asm-generic/bitsperlong.h>
linux-headers/asm-arm64/bitsperlong.h new file +24 -0
new file mode 100644
index 0000000..485d60b
@@ -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
new file mode 100644
index 0000000..0aac245
@@ -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
new file mode 100644
index 0000000..7268380
@@ -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/unistd.h +38 -6

88 lines not on this page · raw message

linux-headers/asm-powerpc/bitsperlong.h new file +13 -0
new file mode 100644
index 0000000..46ece3e
@@ -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
new file mode 100644
index 0000000..cceaf47
@@ -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
new file mode 100644
index 0000000..5d72c84
@@ -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
#3 lore raw
In reply to Michael S. Tsirkin

Cc MIPS maintainers.
Can we drop the MIPS blacklist for kvm?
Could you guys pls check?

Quoted 38 lines · Michael S. Tsirkin

It turns out that we have unistd.h for some architectures but not others. We are thus unable to use e.g. usefaultfd on these systems.

Fix up update-linux-headers.sh to make sure we
get it for 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 migration tree.

Michael S. Tsirkin (2):
update-linux-headers.sh: add unistd.h
linux-headers: add asm-generic/unistd.h

 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/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         |  20 +-
 10 files changed, 1086 insertions(+), 13 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-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
#4 lore raw
Quoted 3 lines · Michael S. Tsirkin

Cc MIPS maintainers.
Can we drop the MIPS blacklist for kvm?
Could you guys pls check?

My guess is that MIPS got blacklisted in 1842bdfdbac2ec4 because Marc-André didn't want to deal with the fact that the mips unistd.h includes another header that would also need to be synced. Marc-André, I don't suppose you can remember your reasoning from three years back? :-)

thanks
-- PMM

Reviewed-by on the v3 series
#5 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · * Michael S. Tsirkin ([email protected]) wrote:

It turns out that we have unistd.h for some architectures but not others. We are thus unable to use e.g. usefaultfd on these systems.

Fix up update-linux-headers.sh to make sure we
get it for 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 migration tree.

and queued for migration; I'll test build Power and aarch64 as well.

Dave

Quoted 15 lines

Michael S. Tsirkin (2):
update-linux-headers.sh: add unistd.h
linux-headers: add asm-generic/unistd.h

 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/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         |  20 +-
 10 files changed, 1086 insertions(+), 13 deletions(-)
Quoted 12 lines
 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-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

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK