KVM: Remove unecessary asm/kvm_host.h includes
Subsystems (10)
PATCH 1/1 KVM: Remove unecessary asm/kvm_host.h includes
linux/kvm_host.h and asm/kvm_host.h have a dependency in that the asm header should be included first, then we can define arch-specific macros in asm/ header and use "#ifndef" in linux/ header to define the generic value of the macro. One example is KVM_MAX_VCPU_ID.
Now in many C files we've got both the headers included, and linux/kvm_host.h is included even earlier. It's working only because in linux/kvm_host.h we also included asm/kvm_host.h anyway so the explicit inclusion of asm/kvm_host.h in the C files are meaningless.
To avoid the confusion, remove the asm/ header if the linux/ header is included.
--- arch/arm/kvm/coproc.c | 1 - arch/arm64/kvm/fpsimd.c | 1 - arch/arm64/kvm/guest.c | 1 - arch/arm64/kvm/hyp/switch.c | 1 - arch/arm64/kvm/sys_regs.c | 1 - arch/arm64/kvm/sys_regs_generic_v8.c | 1 - arch/powerpc/kvm/book3s_64_vio.c | 1 - arch/powerpc/kvm/book3s_64_vio_hv.c | 1 - arch/powerpc/kvm/book3s_hv.c | 1 - arch/powerpc/kvm/mpic.c | 1 - arch/powerpc/kvm/powerpc.c | 1 - arch/powerpc/kvm/timing.h | 1 - arch/s390/kvm/intercept.c | 1 - arch/x86/kvm/mmu/page_track.c | 1 - virt/kvm/arm/psci.c | 1 - 15 files changed, 15 deletions(-)
arch/arm/kvm/coproc.c +0 -1
@@ -10,7 +10,6 @@#include <linux/kvm_host.h> #include <linux/uaccess.h> #include <asm/kvm_arm.h> -#include <asm/kvm_host.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> #include <asm/kvm_mmu.h>
arch/arm64/kvm/fpsimd.c +0 -1
@@ -11,7 +11,6 @@#include <linux/kvm_host.h> #include <asm/fpsimd.h> #include <asm/kvm_asm.h> -#include <asm/kvm_host.h> #include <asm/kvm_mmu.h> #include <asm/sysreg.h>
arch/arm64/kvm/guest.c +0 -1
@@ -25,7 +25,6 @@#include <asm/kvm.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> -#include <asm/kvm_host.h> #include <asm/sigcontext.h> #include "trace.h"
arch/arm64/kvm/hyp/switch.c +0 -1
@@ -17,7 +17,6 @@#include <asm/kprobes.h> #include <asm/kvm_asm.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <asm/kvm_hyp.h> #include <asm/kvm_mmu.h> #include <asm/fpsimd.h>
arch/arm64/kvm/sys_regs.c +0 -1
@@ -22,7 +22,6 @@#include <asm/kvm_arm.h> #include <asm/kvm_coproc.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <asm/kvm_hyp.h> #include <asm/kvm_mmu.h> #include <asm/perf_event.h>
arch/arm64/kvm/sys_regs_generic_v8.c +0 -1
@@ -12,7 +12,6 @@#include <asm/cputype.h> #include <asm/kvm_arm.h> #include <asm/kvm_asm.h> -#include <asm/kvm_host.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> #include <asm/sysreg.h>
arch/powerpc/kvm/book3s_64_vio.c +0 -1
@@ -27,7 +27,6 @@#include <asm/hvcall.h> #include <asm/synch.h> #include <asm/ppc-opcode.h> -#include <asm/kvm_host.h> #include <asm/udbg.h> #include <asm/iommu.h> #include <asm/tce.h>
arch/powerpc/kvm/book3s_64_vio_hv.c +0 -1
@@ -24,7 +24,6 @@#include <asm/hvcall.h> #include <asm/synch.h> #include <asm/ppc-opcode.h> -#include <asm/kvm_host.h> #include <asm/udbg.h> #include <asm/iommu.h> #include <asm/tce.h>
arch/powerpc/kvm/book3s_hv.c +0 -1
@@ -72,7 +72,6 @@#include <asm/xics.h> #include <asm/xive.h> #include <asm/hw_breakpoint.h> -#include <asm/kvm_host.h> #include <asm/kvm_book3s_uvmem.h> #include <asm/ultravisor.h>
arch/powerpc/kvm/mpic.c +0 -1
@@ -32,7 +32,6 @@#include <linux/uaccess.h> #include <asm/mpic.h> #include <asm/kvm_para.h> -#include <asm/kvm_host.h> #include <asm/kvm_ppc.h> #include <kvm/iodev.h>
arch/powerpc/kvm/powerpc.c +0 -1
@@ -32,7 +32,6 @@#include <asm/plpar_wrappers.h> #endif #include <asm/ultravisor.h> -#include <asm/kvm_host.h> #include "timing.h" #include "irq.h"
arch/powerpc/kvm/timing.h +0 -1
@@ -10,7 +10,6 @@#define __POWERPC_KVM_EXITTIMING_H__#include <linux/kvm_host.h> -#include <asm/kvm_host.h> #ifdef CONFIG_KVM_EXIT_TIMING void kvmppc_init_timing_stats (struct kvm_vcpu *vcpu);
arch/s390/kvm/intercept.c +0 -1
@@ -12,7 +12,6 @@#include <linux/errno.h> #include <linux/pagemap.h> -#include <asm/kvm_host.h> #include <asm/asm-offsets.h> #include <asm/irq.h> #include <asm/sysinfo.h>
arch/x86/kvm/mmu/page_track.c +0 -1
@@ -14,7 +14,6 @@#include <linux/kvm_host.h> #include <linux/rculist.h> -#include <asm/kvm_host.h> #include <asm/kvm_page_track.h> #include "mmu.h"
virt/kvm/arm/psci.c +0 -1
@@ -12,7 +12,6 @@#include <asm/cputype.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <kvm/arm_psci.h> #include <kvm/arm_hypercalls.h>
Signature · 1 line
2.24.1
s/unecessary/unnecessary
Quoted 9 lines · Peter Xu
linux/kvm_host.handasm/kvm_host.hhave a dependency in that the asm header should be included first, then we can define arch-specific macros in asm/ header and use "#ifndef" in linux/ header to define the generic value of the macro. One example isKVM_MAX_VCPU_ID.Now in many C files we've got both the headers included, and
linux/kvm_host.his included even earlier. It's working only because inlinux/kvm_host.hwe also includedasm/kvm_host.hanyway so the explicit inclusion ofasm/kvm_host.hin the C files are meaningless.
I'd prefer to word this much more strongly, i.e. there is no "should" about it, including asm/kvm_host.h in linux/kvm_host.h is deliberate, it's not serendipitous.
``` Remove includes of asm/kvm_host.h from files that already include linux/kvm_host.h to make it more obvious that there is no ordering issue between the two headers. linux/kvm_host.h includes asm/kvm_host.h to pick up architecture specific settings, and this will never change, i.e. including asm/kvm_host.h after linux/kvm_host.h may seem problematic, but in practice is simply redundant. ```
As for the change itself, I'm indifferent.
Quoted 205 lines
To avoid the confusion, remove the asm/ header if the linux/ header is included.
Signed-off-by Peter Xu <[email protected]>--- arch/arm/kvm/coproc.c | 1 - arch/arm64/kvm/fpsimd.c | 1 - arch/arm64/kvm/guest.c | 1 - arch/arm64/kvm/hyp/switch.c | 1 - arch/arm64/kvm/sys_regs.c | 1 - arch/arm64/kvm/sys_regs_generic_v8.c | 1 - arch/powerpc/kvm/book3s_64_vio.c | 1 - arch/powerpc/kvm/book3s_64_vio_hv.c | 1 - arch/powerpc/kvm/book3s_hv.c | 1 - arch/powerpc/kvm/mpic.c | 1 - arch/powerpc/kvm/powerpc.c | 1 - arch/powerpc/kvm/timing.h | 1 - arch/s390/kvm/intercept.c | 1 - arch/x86/kvm/mmu/page_track.c | 1 - virt/kvm/arm/psci.c | 1 - 15 files changed, 15 deletions(-)arch/arm/kvm/coproc.c +0
-1@@ -10,7 +10,6 @@#include <linux/kvm_host.h> #include <linux/uaccess.h> #include <asm/kvm_arm.h> -#include <asm/kvm_host.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> #include <asm/kvm_mmu.h> arch/arm64/kvm/fpsimd.c +0
-1@@ -11,7 +11,6 @@#include <linux/kvm_host.h> #include <asm/fpsimd.h> #include <asm/kvm_asm.h> -#include <asm/kvm_host.h> #include <asm/kvm_mmu.h> #include <asm/sysreg.h> arch/arm64/kvm/guest.c +0
-1@@ -25,7 +25,6 @@#include <asm/kvm.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> -#include <asm/kvm_host.h> #include <asm/sigcontext.h> #include "trace.h" arch/arm64/kvm/hyp/switch.c +0
-1@@ -17,7 +17,6 @@#include <asm/kprobes.h> #include <asm/kvm_asm.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <asm/kvm_hyp.h> #include <asm/kvm_mmu.h> #include <asm/fpsimd.h> arch/arm64/kvm/sys_regs.c +0
-1@@ -22,7 +22,6 @@#include <asm/kvm_arm.h> #include <asm/kvm_coproc.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <asm/kvm_hyp.h> #include <asm/kvm_mmu.h> #include <asm/perf_event.h> arch/arm64/kvm/sys_regs_generic_v8.c +0
-1@@ -12,7 +12,6 @@#include <asm/cputype.h> #include <asm/kvm_arm.h> #include <asm/kvm_asm.h> -#include <asm/kvm_host.h> #include <asm/kvm_emulate.h> #include <asm/kvm_coproc.h> #include <asm/sysreg.h> arch/powerpc/kvm/book3s_64_vio.c +0
-1@@ -27,7 +27,6 @@#include <asm/hvcall.h> #include <asm/synch.h> #include <asm/ppc-opcode.h> -#include <asm/kvm_host.h> #include <asm/udbg.h> #include <asm/iommu.h> #include <asm/tce.h> arch/powerpc/kvm/book3s_64_vio_hv.c +0
-1@@ -24,7 +24,6 @@#include <asm/hvcall.h> #include <asm/synch.h> #include <asm/ppc-opcode.h> -#include <asm/kvm_host.h> #include <asm/udbg.h> #include <asm/iommu.h> #include <asm/tce.h> arch/powerpc/kvm/book3s_hv.c +0
-1@@ -72,7 +72,6 @@#include <asm/xics.h> #include <asm/xive.h> #include <asm/hw_breakpoint.h> -#include <asm/kvm_host.h> #include <asm/kvm_book3s_uvmem.h> #include <asm/ultravisor.h> arch/powerpc/kvm/mpic.c +0
-1@@ -32,7 +32,6 @@#include <linux/uaccess.h> #include <asm/mpic.h> #include <asm/kvm_para.h> -#include <asm/kvm_host.h> #include <asm/kvm_ppc.h> #include <kvm/iodev.h> arch/powerpc/kvm/powerpc.c +0
-1@@ -32,7 +32,6 @@#include <asm/plpar_wrappers.h> #endif #include <asm/ultravisor.h> -#include <asm/kvm_host.h> #include "timing.h" #include "irq.h" arch/powerpc/kvm/timing.h +0
-1@@ -10,7 +10,6 @@#define __POWERPC_KVM_EXITTIMING_H__#include <linux/kvm_host.h> -#include <asm/kvm_host.h> #ifdef CONFIG_KVM_EXIT_TIMING void kvmppc_init_timing_stats (struct kvm_vcpu *vcpu);arch/s390/kvm/intercept.c +0
-1@@ -12,7 +12,6 @@#include <linux/errno.h> #include <linux/pagemap.h> -#include <asm/kvm_host.h> #include <asm/asm-offsets.h> #include <asm/irq.h> #include <asm/sysinfo.h> arch/x86/kvm/mmu/page_track.c +0
-1@@ -14,7 +14,6 @@#include <linux/kvm_host.h> #include <linux/rculist.h> -#include <asm/kvm_host.h> #include <asm/kvm_page_track.h> #include "mmu.h" virt/kvm/arm/psci.c +0
-1@@ -12,7 +12,6 @@#include <asm/cputype.h> #include <asm/kvm_emulate.h> -#include <asm/kvm_host.h> #include <kvm/arm_psci.h> #include <kvm/arm_hypercalls.h> Signature · 1 line
2.24.1
Quoted 26 lines · Sean Christopherson
s/unecessary/unnecessary
Quoted 9 lines · Peter Xu
linux/kvm_host.handasm/kvm_host.hhave a dependency in that the asm header should be included first, then we can define arch-specific macros in asm/ header and use "#ifndef" in linux/ header to define the generic value of the macro. One example isKVM_MAX_VCPU_ID.Now in many C files we've got both the headers included, and
linux/kvm_host.his included even earlier. It's working only because inlinux/kvm_host.hwe also includedasm/kvm_host.hanyway so the explicit inclusion ofasm/kvm_host.hin the C files are meaningless.I'd prefer to word this much more strongly, i.e. there is no "should" about it, including
asm/kvm_host.hinlinux/kvm_host.his deliberate, it's not serendipitous.``` Remove includes of asm/kvm_host.h from files that already include linux/kvm_host.h to make it more obvious that there is no ordering issue between the two headers. linux/kvm_host.h includes asm/kvm_host.h to pick up architecture specific settings, and this will never change, i.e. including asm/kvm_host.h after linux/kvm_host.h may seem problematic, but in practice is simply redundant. ```
Quoted 1 line
As for the change itself, I'm indifferent.
Sure, I'll fix up these and repost. Thanks,
Signature · 1 line
Peter Xu