Skip to content

Commit

Permalink
KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported
Browse files Browse the repository at this point in the history
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 0add537 ("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 <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
masahir0y authored and bonzini committed Mar 28, 2019
1 parent 4d66623 commit 3d9683c
Show file tree
Hide file tree
Showing 33 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions arch/alpha/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions arch/alpha/include/uapi/asm/kvm_para.h

This file was deleted.

1 change: 1 addition & 0 deletions arch/arc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/arc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/arm/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
generated-y += unistd-common.h
generated-y += unistd-oabi.h
generated-y += unistd-eabi.h
generic-y += kvm_para.h
2 changes: 0 additions & 2 deletions arch/arm/include/uapi/asm/kvm_para.h

This file was deleted.

1 change: 1 addition & 0 deletions arch/c6x/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/c6x/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/h8300/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions arch/hexagon/include/uapi/asm/kvm_para.h

This file was deleted.

1 change: 1 addition & 0 deletions arch/ia64/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generated-y += unistd_64.h
generic-y += kvm_para.h
1 change: 1 addition & 0 deletions arch/m68k/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generated-y += unistd_32.h
generic-y += kvm_para.h
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
generated-y += unistd_32.h
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/nios2/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/nios2/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/parisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
generated-y += unistd_32.h
generated-y += unistd_64.h
generic-y += kvm_para.h
1 change: 1 addition & 0 deletions arch/sh/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/sh/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# SPDX-License-Identifier: GPL-2.0

generated-y += unistd_32.h
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/sparc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/include/uapi/asm/kvm_para.h

This file was deleted.

1 change: 1 addition & 0 deletions arch/unicore32/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/unicore32/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generic-y += kvm_para.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/xtensa/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generated-y += unistd_32.h
generic-y += kvm_para.h
2 changes: 2 additions & 0 deletions include/uapi/linux/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d9683c

Please sign in to comment.