KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 18 Mar 2019 09:08:12 +0000 (18:08 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 28 Mar 2019 16:27:42 +0000 (17:27 +0100)
I do not see any consistency about headers_install of <linux/kvm_para.h>
and <asm/kvm_para.h>.

According to my analysis of Linux 5.1-rc1, there are 3 groups:

 [1] Both <linux/kvm_para.h> and <asm/kvm_para.h> are exported

    alpha, arm, hexagon, mips, powerpc, s390, sparc, x86

 [2] <asm/kvm_para.h> is exported, but <linux/kvm_para.h> is not

    arc, arm64, c6x, h8300, ia64, m68k, microblaze, nios2, openrisc,
    parisc, sh, unicore32, xtensa

 [3] Neither <linux/kvm_para.h> nor <asm/kvm_para.h> is exported

    csky, nds32, riscv

This does not match to the actual KVM support. At least, [2] is
half-baked.

Nor do arch maintainers look like they care about this. For example,
commit 0add53713b1c ("microblaze: Add missing kvm_para.h to Kbuild")
exported <asm/kvm_para.h> to user-space in order to fix an in-kernel
build error.

We have two ways to make this consistent:

 [A] export both <linux/kvm_para.h> and <asm/kvm_para.h> for all
     architectures, irrespective of the KVM support

 [B] Match the header export of <linux/kvm_para.h> and <asm/kvm_para.h>
     to the KVM support

My first attempt was [A] because the code looks cleaner, but Paolo
suggested [B].

So, this commit goes with [B].

For most architectures, <asm/kvm_para.h> was moved to the kernel-space.
I changed include/uapi/linux/Kbuild so that it checks generated
asm/kvm_para.h as well as check-in ones.

After this commit, there will be two groups:

 [1] Both <linux/kvm_para.h> and <asm/kvm_para.h> are exported

    arm, arm64, mips, powerpc, s390, x86

 [2] Neither <linux/kvm_para.h> nor <asm/kvm_para.h> is exported

    alpha, arc, c6x, csky, h8300, hexagon, ia64, m68k, microblaze,
    nds32, nios2, openrisc, parisc, riscv, sh, sparc, unicore32, xtensa

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
33 files changed:
arch/alpha/include/asm/Kbuild
arch/alpha/include/uapi/asm/kvm_para.h [deleted file]
arch/arc/include/asm/Kbuild
arch/arc/include/uapi/asm/Kbuild
arch/arm/include/uapi/asm/Kbuild
arch/arm/include/uapi/asm/kvm_para.h [deleted file]
arch/c6x/include/asm/Kbuild
arch/c6x/include/uapi/asm/Kbuild
arch/h8300/include/asm/Kbuild
arch/h8300/include/uapi/asm/Kbuild
arch/hexagon/include/asm/Kbuild
arch/hexagon/include/uapi/asm/kvm_para.h [deleted file]
arch/ia64/include/asm/Kbuild
arch/ia64/include/uapi/asm/Kbuild
arch/m68k/include/asm/Kbuild
arch/m68k/include/uapi/asm/Kbuild
arch/microblaze/include/asm/Kbuild
arch/microblaze/include/uapi/asm/Kbuild
arch/nios2/include/asm/Kbuild
arch/nios2/include/uapi/asm/Kbuild
arch/openrisc/include/asm/Kbuild
arch/openrisc/include/uapi/asm/Kbuild
arch/parisc/include/asm/Kbuild
arch/parisc/include/uapi/asm/Kbuild
arch/sh/include/asm/Kbuild
arch/sh/include/uapi/asm/Kbuild
arch/sparc/include/asm/Kbuild
arch/sparc/include/uapi/asm/kvm_para.h [deleted file]
arch/unicore32/include/asm/Kbuild
arch/unicore32/include/uapi/asm/Kbuild
arch/xtensa/include/asm/Kbuild
arch/xtensa/include/uapi/asm/Kbuild
include/uapi/linux/Kbuild

index dc0ab28baca14b5a2eb0aa0064255d023421612c..70b783333965e875a7cb4f0a110327cea46cd663 100644 (file)
@@ -6,6 +6,7 @@ generic-y += exec.h
 generic-y += export.h
 generic-y += fb.h
 generic-y += irq_work.h
+generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
 generic-y += preempt.h
diff --git a/arch/alpha/include/uapi/asm/kvm_para.h b/arch/alpha/include/uapi/asm/kvm_para.h
deleted file mode 100644 (file)
index baacc49..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
index b41f8881ecc811f2005b763958e779a42da15c36..decc306a3b52c2b96c2e7af7108e7aa171c51c31 100644 (file)
@@ -11,6 +11,7 @@ generic-y += hardirq.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 23b4464c0995ab3ed1673f7aa36e16a3554e296a..ce8573157774dc078e49a5a2d5ccecc3ad54986d 100644 (file)
@@ -3,3 +3,4 @@
 generated-y += unistd-common.h
 generated-y += unistd-oabi.h
 generated-y += unistd-eabi.h
+generic-y += kvm_para.h
diff --git a/arch/arm/include/uapi/asm/kvm_para.h b/arch/arm/include/uapi/asm/kvm_para.h
deleted file mode 100644 (file)
index baacc49..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
index 63b4a170518220397d22ec86cf9911f470139b97..249c9f6f26dce7c2dd2a43f9a9f20bd0d29478f3 100644 (file)
@@ -19,6 +19,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 3e7c8ecf151e13841d0c3e491f3927aa1586434c..e3dead402e5fbe94ebe53063968801c8f51360b5 100644 (file)
@@ -23,6 +23,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index b25fd42aa0f47372162decdff321f3cca2e1a4d8..d046e8ccdf786be5029237ad722d819de88d6124 100644 (file)
@@ -19,6 +19,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
diff --git a/arch/hexagon/include/uapi/asm/kvm_para.h b/arch/hexagon/include/uapi/asm/kvm_para.h
deleted file mode 100644 (file)
index baacc49..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
index 43e21fe3499c43451f2915ff1274afa76059f16b..11f191689c9e8445a77ede3555452fb8d008a3d7 100644 (file)
@@ -2,6 +2,7 @@ generated-y += syscall_table.h
 generic-y += compat.h
 generic-y += exec.h
 generic-y += irq_work.h
+generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
 generic-y += preempt.h
index 20018cb883a90981565284ac1d5d9df51c38e987..62a9522af51e6651f560e06f8d3c3e2602b63f20 100644 (file)
@@ -1,2 +1 @@
 generated-y += unistd_64.h
-generic-y += kvm_para.h
index 95f8f631c4df08aebc71b25d878fc29e0f89a1ba..2c359d9e80f63fe44468c29b7a48bb4033a9c31a 100644 (file)
@@ -13,6 +13,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
index 8a7ad40be463656854310b85dbba06d5f9b8e189..7417847dc438e5ff6aff14f04094a1323d6b933f 100644 (file)
@@ -1,2 +1 @@
 generated-y += unistd_32.h
-generic-y += kvm_para.h
index 791cc8d54d0a9eff79b5264a74b507fc3233699c..1a8285c3f693990c8a8f3f7d5d37d240b17c4a80 100644 (file)
@@ -17,6 +17,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
index 3ce84fbb2678f2194de4e81504494045a00915ed..13f59631c576c6bcd4c50357269fa42c0525e62a 100644 (file)
@@ -1,3 +1,2 @@
 generated-y += unistd_32.h
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 8fde4fa2c34f758df132e659eb69b4331c84172f..88a667d12aaa9cefafad5260f03e073fefeb1fed 100644 (file)
@@ -23,6 +23,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 5a73e2956ac46953ac9e1cf2404c3d0996617602..22aa97136c0195ae2b687c0793c42e43f22888ec 100644 (file)
@@ -20,6 +20,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 6f49e77d82a2a48673356355e38a411794ff51bb..9bcd0c903dbbef2aee61ade11844c5091e4bfd0c 100644 (file)
@@ -11,6 +11,7 @@ generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
index 22fdbd08cdc8551777459efe75c49bbfa1e3f95a..2bd5b392277c2cf5c4a52f3d0b7d9aaed7382f44 100644 (file)
@@ -1,3 +1,2 @@
 generated-y += unistd_32.h
 generated-y += unistd_64.h
-generic-y += kvm_para.h
index a6ef3fee5f85714f69e6692e563491960372ab75..7bf2cb680d328462c4e621eae24005f1c9f35afc 100644 (file)
@@ -9,6 +9,7 @@ generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
index ecfbd40924dd948f97985e65daa18216c123c424..b8812c74c1dee1ec8dc80bac7ec4f80a4cc454a4 100644 (file)
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 
 generated-y += unistd_32.h
-generic-y += kvm_para.h
 generic-y += ucontext.h
index b82f64e28f55c12fc36f56897bcb5e80f44c9e2d..a22cfd5c0ee8665d96f40dcdfacd2c784a2fad62 100644 (file)
@@ -9,6 +9,7 @@ generic-y += exec.h
 generic-y += export.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
+generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
diff --git a/arch/sparc/include/uapi/asm/kvm_para.h b/arch/sparc/include/uapi/asm/kvm_para.h
deleted file mode 100644 (file)
index baacc49..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm-generic/kvm_para.h>
index 1d1544b6ca74ce96e765c68cfa2f1a86a7ef7ac8..d77d953c04c1cfbe039bf207fa4db8b362e65f22 100644 (file)
@@ -18,6 +18,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
index 755bb11323d8feb92d12349bf444f151cd8acc29..1c72f04ff75da1a7f6918f00b14116a183a79313 100644 (file)
@@ -1,2 +1 @@
-generic-y += kvm_para.h
 generic-y += ucontext.h
index 42b6cb3d16f7b9666baf44daf0a63757786d729b..3843198e03d4ba1b8772caeada4897d2cc1fbad1 100644 (file)
@@ -15,6 +15,7 @@ generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
+generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
index 8a7ad40be463656854310b85dbba06d5f9b8e189..7417847dc438e5ff6aff14f04094a1323d6b933f 100644 (file)
@@ -1,2 +1 @@
 generated-y += unistd_32.h
-generic-y += kvm_para.h
index 5f24b50c9e88eb72dd2a396d8af5dc193e6bd782..059dc2bedaf6e895d30fab48c637e87471049920 100644 (file)
@@ -7,5 +7,7 @@ no-export-headers += kvm.h
 endif
 
 ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
+ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.h),)
 no-export-headers += kvm_para.h
 endif
+endif