Skip to contentSkip to conversation

KVM: Remove include/kvm, standardize includes

PATCH In review Sean Christopherson 7 participants 15 messages Jun 11, 2025 – Jun 16, 2025

Subsystems (15)
x86 KVM PowerPC MIPS +11 more subsystems
lore
Share & tools
lore

Sean Christopherson

author maintainer
#0 lore raw

cover KVM: Remove include/kvm, standardize includes

Kill off include/kvm (through file moves/renames), and standardize the set of KVM includes across all architectures.

This conflicts with Colton's partioned PMU series[1], but this should work as a nice prepatory cleanup for the partitioned PMU work (and hopefully can land sooner).

Note, these patches were originally posted as part of a much larger and more agressive RFC[1]. We've effectively abandoned upstreaming the multi-KVM idea, but I'm trying to (slowly) upstream the bits and pieces that I think/hope are generally beneficial.

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]

Anish Ghulati (1):
KVM: arm64: Move arm_{psci,hypercalls}.h to an internal KVM path

Sean Christopherson (7):
KVM: arm64: Include KVM headers to get forward declarations
KVM: arm64: Move ARM specific headers in include/kvm to arch directory
KVM: Move include/kvm/iodev.h to include/linux as kvm_iodev.h
KVM: MIPS: Stop adding virt/kvm to the arch include path
KVM: PPC: Stop adding virt/kvm to the arch include path
KVM: s390: Stop adding virt/kvm to the arch include path
KVM: Standardize include paths across all architectures

 MAINTAINERS                                                | 1 -
 .../arm64/include/asm/kvm_arch_timer.h                     | 2 ++
 arch/arm64/include/asm/kvm_host.h                          | 7 +++----
 include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h  | 2 ++
 .../kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h    | 2 +-
 arch/arm64/kvm/Makefile                                    | 2 --
 arch/arm64/kvm/arch_timer.c                                | 5 ++---
 arch/arm64/kvm/arm.c                                       | 6 +++---
 {include => arch/arm64}/kvm/arm_hypercalls.h               | 0
 {include => arch/arm64}/kvm/arm_psci.h                     | 0
 arch/arm64/kvm/guest.c                                     | 2 +-
 arch/arm64/kvm/handle_exit.c                               | 2 +-
 arch/arm64/kvm/hyp/Makefile                                | 6 +++---
 arch/arm64/kvm/hyp/include/hyp/switch.h                    | 4 ++--
 arch/arm64/kvm/hyp/nvhe/switch.c                           | 4 ++--
 arch/arm64/kvm/hyp/vhe/switch.c                            | 4 ++--
 arch/arm64/kvm/hypercalls.c                                | 4 ++--
 arch/arm64/kvm/pmu-emul.c                                  | 4 ++--
 arch/arm64/kvm/psci.c                                      | 4 ++--
 arch/arm64/kvm/pvtime.c                                    | 2 +-
 arch/arm64/kvm/reset.c                                     | 3 +--
 arch/arm64/kvm/trace_arm.h                                 | 2 +-
 arch/arm64/kvm/trng.c                                      | 2 +-
 arch/arm64/kvm/vgic/vgic-debug.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-init.c                            | 2 +-
 arch/arm64/kvm/vgic/vgic-irqfd.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-kvm-device.c                      | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v2.c                         | 4 ++--
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                         | 4 ++--
 arch/arm64/kvm/vgic/vgic-mmio.c                            | 6 +++---
 arch/arm64/kvm/vgic/vgic-v2.c                              | 2 +-
 arch/arm64/kvm/vgic/vgic-v3-nested.c                       | 3 +--
 arch/arm64/kvm/vgic/vgic-v3.c                              | 2 +-
 arch/loongarch/include/asm/kvm_eiointc.h                   | 2 +-
 arch/loongarch/include/asm/kvm_ipi.h                       | 2 +-
 arch/loongarch/include/asm/kvm_pch_pic.h                   | 2 +-
 arch/mips/include/asm/kvm_host.h                           | 3 +--
 arch/mips/kvm/Makefile                                     | 2 --
 arch/powerpc/kvm/Makefile                                  | 2 --
 arch/powerpc/kvm/mpic.c                                    | 2 +-
 arch/riscv/kvm/Makefile                                    | 2 --
 arch/riscv/kvm/aia_aplic.c                                 | 2 +-
 arch/riscv/kvm/aia_imsic.c                                 | 2 +-
 arch/s390/kvm/Makefile                                     | 2 --
 arch/x86/kvm/Makefile                                      | 1 -
 arch/x86/kvm/i8254.h                                       | 2 +-
 arch/x86/kvm/ioapic.h                                      | 2 +-
 arch/x86/kvm/irq.h                                         | 2 +-
 arch/x86/kvm/lapic.h                                       | 2 +-
 include/{kvm/iodev.h => linux/kvm_iodev.h}                 | 0
 virt/kvm/Makefile.kvm                                      | 2 ++
 virt/kvm/coalesced_mmio.c                                  | 3 +--
 virt/kvm/eventfd.c                                         | 2 +-
 virt/kvm/kvm_main.c                                        | 3 +--
 54 files changed, 64 insertions(+), 77 deletions(-)
 rename include/kvm/arm_arch_timer.h => arch/arm64/include/asm/kvm_arch_timer.h (98%)
 rename include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h (99%)
 rename include/kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h (99%)
 rename {include => arch/arm64}/kvm/arm_hypercalls.h (100%)
 rename {include => arch/arm64}/kvm/arm_psci.h (100%)
 rename include/{kvm/iodev.h => linux/kvm_iodev.h} (100%)

base-commit: 61374cc145f4a56377eaf87c7409a97ec7a34041

Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
author maintainer
#1 lore raw

PATCH 1/8 KVM: arm64: Move arm_{psci,hypercalls}.h to an internal KVM path

From: Anish Ghulati <[email protected]>

Move arm_hypercalls.h and arm_psci.h into arch/arm64/kvm now that KVM no longer supports 32-bit ARM, i.e. now that there's no reason to make the hypercall and PSCI APIs "public".

[sean: squash into one patch, write changelog]
---
 arch/arm64/kvm/arm.c                         | 5 +++--
 {include => arch/arm64}/kvm/arm_hypercalls.h | 0
 {include => arch/arm64}/kvm/arm_psci.h       | 0
 arch/arm64/kvm/guest.c                       | 2 +-
 arch/arm64/kvm/handle_exit.c                 | 2 +-
 arch/arm64/kvm/hyp/Makefile                  | 6 +++---
 arch/arm64/kvm/hyp/include/hyp/switch.h      | 4 ++--
 arch/arm64/kvm/hyp/nvhe/switch.c             | 4 ++--
 arch/arm64/kvm/hyp/vhe/switch.c              | 4 ++--
 arch/arm64/kvm/hypercalls.c                  | 4 ++--
 arch/arm64/kvm/psci.c                        | 4 ++--
 arch/arm64/kvm/pvtime.c                      | 2 +-
 arch/arm64/kvm/trng.c                        | 2 +-
 13 files changed, 20 insertions(+), 19 deletions(-)
 rename {include => arch/arm64}/kvm/arm_hypercalls.h (100%)
 rename {include => arch/arm64}/kvm/arm_psci.h (100%)
arch/arm64/kvm/arm.c +3 -2
index de2b4e9c9f9f..017c95c7bd03 100644
@@ -42,9 +42,10 @@
 #include <asm/kvm_ptrauth.h>
 #include <asm/sections.h>
 
-#include <kvm/arm_hypercalls.h>
 #include <kvm/arm_pmu.h>
-#include <kvm/arm_psci.h>
+
+#include "arm_hypercalls.h"
+#include "arm_psci.h"
 
 #include "sys_regs.h"
 
arch/arm64/kvm/arm_hypercalls.h renamed from include/kvm/arm_hypercalls.h +0 -0
similarity index 100%
rename from include/kvm/arm_hypercalls.h
rename to arch/arm64/kvm/arm_hypercalls.h
arch/arm64/kvm/arm_psci.h renamed from include/kvm/arm_psci.h +0 -0
similarity index 100%
rename from include/kvm/arm_psci.h
rename to arch/arm64/kvm/arm_psci.h
arch/arm64/kvm/guest.c +1 -1
index 2196979a24a3..699a2f975350 100644
@@ -18,7 +18,6 @@
 #include <linux/string.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
-#include <kvm/arm_hypercalls.h>
 #include <asm/cputype.h>
 #include <linux/uaccess.h>
 #include <asm/fpsimd.h>
@@ -27,6 +26,7 @@
 #include <asm/kvm_nested.h>
 #include <asm/sigcontext.h>
 
+#include "arm_hypercalls.h"
 #include "trace.h"
 
 const struct _kvm_stats_desc kvm_vm_stats_desc[] = {
arch/arm64/kvm/handle_exit.c +1 -1
index 453266c96481..32a7b7c22924 100644
@@ -22,7 +22,7 @@
 #include <asm/stacktrace/nvhe.h>
 #include <asm/traps.h>
 
-#include <kvm/arm_hypercalls.h>
+#include "arm_hypercalls.h"
 
 #define CREATE_TRACE_POINTS
 #include "trace_handle_exit.h"
arch/arm64/kvm/hyp/Makefile +3 -3
index d61e44642f98..b1a4884446c6 100644
@@ -3,8 +3,8 @@
 # Makefile for Kernel-based Virtual Machine module, HYP part
 #
 
-incdir := $(src)/include
-subdir-asflags-y := -I$(incdir)
-subdir-ccflags-y := -I$(incdir)
+hyp_includes := -I$(src)/include -I$(srctree)/arch/arm64/kvm
+subdir-asflags-y := $(hyp_includes)
+subdir-ccflags-y := $(hyp_includes)
 
 obj-$(CONFIG_KVM) += vhe/ nvhe/ pgtable.o
arch/arm64/kvm/hyp/include/hyp/switch.h +2 -2
index bb9f2eecfb67..340a57e0ed7c 100644
@@ -16,8 +16,6 @@
 #include <linux/jump_label.h>
 #include <uapi/linux/psci.h>
 
-#include <kvm/arm_psci.h>
-
 #include <asm/barrier.h>
 #include <asm/cpufeature.h>
 #include <asm/extable.h>
@@ -32,6 +30,8 @@
 #include <asm/processor.h>
 #include <asm/traps.h>
 
+#include "arm_psci.h"
+
 struct kvm_exception_table_entry {
 	int insn, fixup;
 };
arch/arm64/kvm/hyp/nvhe/switch.c +2 -2
index 73affe1333a4..e0610cf683ab 100644
@@ -13,8 +13,6 @@
 #include <linux/jump_label.h>
 #include <uapi/linux/psci.h>
 
-#include <kvm/arm_psci.h>
-
 #include <asm/barrier.h>
 #include <asm/cpufeature.h>
 #include <asm/kprobes.h>
@@ -28,6 +26,8 @@
 
 #include <nvhe/mem_protect.h>
 
+#include "arm_psci.h"
+
 /* Non-VHE specific context */
 DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data);
 DEFINE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);
arch/arm64/kvm/hyp/vhe/switch.c +2 -2
index c9b330dc2066..96be652caf3a 100644
@@ -13,8 +13,6 @@
 #include <linux/percpu.h>
 #include <uapi/linux/psci.h>
 
-#include <kvm/arm_psci.h>
-
 #include <asm/barrier.h>
 #include <asm/cpufeature.h>
 #include <asm/kprobes.h>
@@ -28,6 +26,8 @@
 #include <asm/thread_info.h>
 #include <asm/vectors.h>
 
+#include "arm_psci.h"
+
 /* VHE specific context */
 DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data);
 DEFINE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);
arch/arm64/kvm/hypercalls.c +2 -2
index 569941eeb3fe..002f4c593e90 100644
@@ -6,8 +6,8 @@
 
 #include <asm/kvm_emulate.h>
 
-#include <kvm/arm_hypercalls.h>
-#include <kvm/arm_psci.h>
+#include "arm_hypercalls.h"
+#include "arm_psci.h"
 
 #define KVM_ARM_SMCCC_STD_FEATURES				\
 	GENMASK(KVM_REG_ARM_STD_BMAP_BIT_COUNT - 1, 0)
arch/arm64/kvm/psci.c +2 -2
index 3b5dbe9a0a0e..0566b5907497 100644
@@ -13,8 +13,8 @@
 #include <asm/cputype.h>
 #include <asm/kvm_emulate.h>
 
-#include <kvm/arm_psci.h>
-#include <kvm/arm_hypercalls.h>
+#include "arm_hypercalls.h"
+#include "arm_psci.h"
 
 /*
  * This is an implementation of the Power State Coordination Interface
arch/arm64/kvm/pvtime.c +1 -1
index 4ceabaa4c30b..b07d250d223c 100644
@@ -8,7 +8,7 @@
 #include <asm/kvm_mmu.h>
 #include <asm/pvclock-abi.h>
 
-#include <kvm/arm_hypercalls.h>
+#include "arm_hypercalls.h"
 
 void kvm_update_stolen_time(struct kvm_vcpu *vcpu)
 {
arch/arm64/kvm/trng.c +1 -1
index 99bdd7103c9c..b5dc0f09797a 100644
@@ -6,7 +6,7 @@
 
 #include <asm/kvm_emulate.h>
 
-#include <kvm/arm_hypercalls.h>
+#include "arm_hypercalls.h"
 
 #define ARM_SMCCC_TRNG_VERSION_1_0	0x10000UL
 
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
author maintainer
#2 lore raw

PATCH 2/8 KVM: arm64: Include KVM headers to get forward declarations

In reply to Sean Christopherson

Include include/uapi/linux/kvm.h and include/linux/kvm_types.h in ARM's public arm_arch_timer.h and arm_pmu.h headers to get forward declarations of things like "struct kvm_vcpu" and "struct kvm_device_attr", which are referenced but never declared (neither file includes *any* KVM headers).

The missing includes don't currently cause problems because of the order of includes in parent files, but that order is largely arbitrary and is subject to change, e.g. a future commit will move the ARM specific headers to arch/arm64/include/asm and reorder parent includes to maintain alphabetic ordering.

---
 include/kvm/arm_arch_timer.h | 2 ++
 include/kvm/arm_pmu.h        | 2 ++
 2 files changed, 4 insertions(+)
include/kvm/arm_arch_timer.h +2 -0
index 681cf0c8b9df..22cce6843e9a 100644
@@ -7,6 +7,8 @@
 #ifndef __ASM_ARM_KVM_ARCH_TIMER_H
 #define __ASM_ARM_KVM_ARCH_TIMER_H
 
+#include <linux/kvm.h>
+#include <linux/kvm_types.h>
 #include <linux/clocksource.h>
 #include <linux/hrtimer.h>
 
include/kvm/arm_pmu.h +2 -0
index 96754b51b411..baf028d19dfc 100644
@@ -7,6 +7,8 @@
 #ifndef __ASM_ARM_KVM_PMU_H
 #define __ASM_ARM_KVM_PMU_H
 
+#include <linux/kvm.h>
+#include <linux/kvm_types.h>
 #include <linux/perf_event.h>
 #include <linux/perf/arm_pmuv3.h>
 
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
author maintainer
#3 lore raw

PATCH 3/8 KVM: arm64: Move ARM specific headers in include/kvm to arch directory

In reply to Sean Christopherson

Move kvm/arm_{arch_timer,pmu,vgic}.h to arch/arm64/include/asm and drop the "arm" prefix from all file names. Now that KVM no longer supports 32-bit ARM, there is no reason to expose ARM specific headers to other architectures beyond arm64.

---
 .../arm64/include/asm/kvm_arch_timer.h                     | 0
 arch/arm64/include/asm/kvm_host.h                          | 7 +++----
 include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h  | 0
 .../kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h    | 0
 arch/arm64/kvm/arch_timer.c                                | 5 ++---
 arch/arm64/kvm/arm.c                                       | 3 +--
 arch/arm64/kvm/pmu-emul.c                                  | 4 ++--
 arch/arm64/kvm/reset.c                                     | 3 +--
 arch/arm64/kvm/trace_arm.h                                 | 2 +-
 arch/arm64/kvm/vgic/vgic-debug.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-init.c                            | 2 +-
 arch/arm64/kvm/vgic/vgic-irqfd.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-kvm-device.c                      | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v2.c                         | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                         | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio.c                            | 4 ++--
 arch/arm64/kvm/vgic/vgic-v2.c                              | 2 +-
 arch/arm64/kvm/vgic/vgic-v3-nested.c                       | 3 +--
 arch/arm64/kvm/vgic/vgic-v3.c                              | 2 +-
 19 files changed, 21 insertions(+), 26 deletions(-)
 rename include/kvm/arm_arch_timer.h => arch/arm64/include/asm/kvm_arch_timer.h (100%)
 rename include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h (100%)
 rename include/kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h (100%)
arch/arm64/include/asm/kvm_arch_timer.h renamed from include/kvm/arm_arch_timer.h +0 -0
similarity index 100%
rename from include/kvm/arm_arch_timer.h
rename to arch/arm64/include/asm/kvm_arch_timer.h
arch/arm64/include/asm/kvm_host.h +3 -4
index 6ce2c5173482..b8f910d5bdfa 100644
@@ -26,17 +26,16 @@
 #include <asm/daifflags.h>
 #include <asm/fpsimd.h>
 #include <asm/kvm.h>
+#include <asm/kvm_arch_timer.h>
 #include <asm/kvm_asm.h>
+#include <asm/kvm_pmu.h>
+#include <asm/kvm_vgic.h>
 #include <asm/vncr_mapping.h>
 
 #define __KVM_HAVE_ARCH_INTC_INITIALIZED
 
 #define KVM_HALT_POLL_NS_DEFAULT 500000
 
-#include <kvm/arm_vgic.h>
-#include <kvm/arm_arch_timer.h>
-#include <kvm/arm_pmu.h>
-
 #define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS
 
 #define KVM_VCPU_MAX_FEATURES 9
arch/arm64/include/asm/kvm_pmu.h renamed from include/kvm/arm_pmu.h +0 -0
similarity index 100%
rename from include/kvm/arm_pmu.h
rename to arch/arm64/include/asm/kvm_pmu.h
arch/arm64/include/asm/kvm_vgic.h renamed from include/kvm/arm_vgic.h +0 -0
similarity index 100%
rename from include/kvm/arm_vgic.h
rename to arch/arm64/include/asm/kvm_vgic.h
arch/arm64/kvm/arch_timer.c +2 -3
index fdbc8beec930..d61b0450cbf9 100644
@@ -14,12 +14,11 @@
 
 #include <clocksource/arm_arch_timer.h>
 #include <asm/arch_timer.h>
+#include <asm/kvm_arch_timer.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_hyp.h>
 #include <asm/kvm_nested.h>
-
-#include <kvm/arm_vgic.h>
-#include <kvm/arm_arch_timer.h>
+#include <asm/kvm_vgic.h>
 
 #include "trace.h"
 
arch/arm64/kvm/arm.c +1 -2
index 017c95c7bd03..e452aba1a3b2 100644
@@ -39,11 +39,10 @@
 #include <asm/kvm_mmu.h>
 #include <asm/kvm_nested.h>
 #include <asm/kvm_pkvm.h>
+#include <asm/kvm_pmu.h>
 #include <asm/kvm_ptrauth.h>
 #include <asm/sections.h>
 
-#include <kvm/arm_pmu.h>
-
 #include "arm_hypercalls.h"
 #include "arm_psci.h"
 
arch/arm64/kvm/pmu-emul.c +2 -2
index 25c29107f13f..47a518f6a393 100644
@@ -12,8 +12,8 @@
 #include <linux/perf/arm_pmu.h>
 #include <linux/uaccess.h>
 #include <asm/kvm_emulate.h>
-#include <kvm/arm_pmu.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_pmu.h>
+#include <asm/kvm_vgic.h>
 
 #define PERF_ATTR_CFG1_COUNTER_64BIT	BIT(0)
 
arch/arm64/kvm/reset.c +1 -2
index 959532422d3a..bae367638741 100644
@@ -17,12 +17,11 @@
 #include <linux/string.h>
 #include <linux/types.h>
 
-#include <kvm/arm_arch_timer.h>
-
 #include <asm/cpufeature.h>
 #include <asm/cputype.h>
 #include <asm/fpsimd.h>
 #include <asm/ptrace.h>
+#include <asm/kvm_arch_timer.h>
 #include <asm/kvm_arm.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_emulate.h>
arch/arm64/kvm/trace_arm.h +1 -1
index 9c60f6465c78..8fc8178e21a7 100644
@@ -3,7 +3,7 @@
 #define _TRACE_ARM_ARM64_KVM_H
 
 #include <asm/kvm_emulate.h>
-#include <kvm/arm_arch_timer.h>
+#include <asm/kvm_arch_timer.h>
 #include <linux/tracepoint.h>
 
 #undef TRACE_SYSTEM
arch/arm64/kvm/vgic/vgic-debug.c +1 -1
index 2684f273d9e1..0eba9dc78e6f 100644
@@ -9,7 +9,7 @@
 #include <linux/interrupt.h>
 #include <linux/kvm_host.h>
 #include <linux/seq_file.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 #include <asm/kvm_mmu.h>
 #include "vgic.h"
 
arch/arm64/kvm/vgic/vgic-init.c +1 -1
index eb1205654ac8..5a4205fd78b2 100644
@@ -7,7 +7,7 @@
 #include <linux/interrupt.h>
 #include <linux/cpu.h>
 #include <linux/kvm_host.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_mmu.h>
 #include "vgic.h"
arch/arm64/kvm/vgic/vgic-irqfd.c +1 -1
index c314c016659a..b73401c34f29 100644
@@ -6,7 +6,7 @@
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
 #include <trace/events/kvm.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 #include "vgic.h"
 
 /*
arch/arm64/kvm/vgic/vgic-kvm-device.c +1 -1
index f9ae790163fb..f542479ceb11 100644
@@ -6,7 +6,7 @@
  * Author: Marc Zyngier <[email protected]>
  */
 #include <linux/kvm_host.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 #include <linux/uaccess.h>
 #include <asm/kvm_mmu.h>
 #include <asm/cputype.h>
arch/arm64/kvm/vgic/vgic-mmio-v2.c +1 -1
index f25fccb1f8e6..d00c8a74fad6 100644
@@ -9,7 +9,7 @@
 #include <linux/nospec.h>
 
 #include <kvm/iodev.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 
 #include "vgic.h"
 #include "vgic-mmio.h"
arch/arm64/kvm/vgic/vgic-mmio-v3.c +1 -1
index ae4c0593d114..505d4e389885 100644
@@ -9,11 +9,11 @@
 #include <linux/kvm_host.h>
 #include <linux/interrupt.h>
 #include <kvm/iodev.h>
-#include <kvm/arm_vgic.h>
 
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_arm.h>
 #include <asm/kvm_mmu.h>
+#include <asm/kvm_vgic.h>
 
 #include "vgic.h"
 #include "vgic-mmio.h"
arch/arm64/kvm/vgic/vgic-mmio.c +2 -2
index e416e433baff..ec1b13abc728 100644
@@ -10,8 +10,8 @@
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
 #include <kvm/iodev.h>
-#include <kvm/arm_arch_timer.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_arch_timer.h>
+#include <asm/kvm_vgic.h>
 
 #include "vgic.h"
 #include "vgic-mmio.h"
arch/arm64/kvm/vgic/vgic-v2.c +1 -1
index 381673f03c39..780afb7aad06 100644
@@ -6,7 +6,7 @@
 #include <linux/irqchip/arm-gic.h>
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
-#include <kvm/arm_vgic.h>
+#include <asm/kvm_vgic.h>
 #include <asm/kvm_mmu.h>
 
 #include "vgic.h"
arch/arm64/kvm/vgic/vgic-v3-nested.c +1 -2
index 4f6954c30674..bdee42a8be17 100644
@@ -7,11 +7,10 @@
 #include <linux/io.h>
 #include <linux/uaccess.h>
 
-#include <kvm/arm_vgic.h>
-
 #include <asm/kvm_arm.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_nested.h>
+#include <asm/kvm_vgic.h>
 
 #include "vgic.h"
 
arch/arm64/kvm/vgic/vgic-v3.c +1 -1
index b9ad7c42c5b0..a22fe73ca538 100644
@@ -7,10 +7,10 @@
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
 #include <linux/string_choices.h>
-#include <kvm/arm_vgic.h>
 #include <asm/kvm_hyp.h>
 #include <asm/kvm_mmu.h>
 #include <asm/kvm_asm.h>
+#include <asm/kvm_vgic.h>
 
 #include "vgic.h"
 
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
reviewer
#4 lore raw

Re: [PATCH 3/8] KVM: arm64: Move ARM specific headers in include/kvm to arch directory

Quoted 23 lines · Sean Christopherson

Move kvm/arm_{arch_timer,pmu,vgic}.h to arch/arm64/include/asm and drop the "arm" prefix from all file names. Now that KVM no longer supports 32-bit ARM, there is no reason to expose ARM specific headers to other architectures beyond arm64.

---
 .../arm64/include/asm/kvm_arch_timer.h                     | 0
 arch/arm64/include/asm/kvm_host.h                          | 7 +++----
 include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h  | 0
 .../kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h    | 0
 arch/arm64/kvm/arch_timer.c                                | 5 ++---
 arch/arm64/kvm/arm.c                                       | 3 +--
 arch/arm64/kvm/pmu-emul.c                                  | 4 ++--
 arch/arm64/kvm/reset.c                                     | 3 +--
 arch/arm64/kvm/trace_arm.h                                 | 2 +-
 arch/arm64/kvm/vgic/vgic-debug.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-init.c                            | 2 +-
 arch/arm64/kvm/vgic/vgic-irqfd.c                           | 2 +-
 arch/arm64/kvm/vgic/vgic-kvm-device.c                      | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v2.c                         | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                         | 2 +-
Quoted 8 lines
 arch/arm64/kvm/vgic/vgic-mmio.c                            | 4 ++--
 arch/arm64/kvm/vgic/vgic-v2.c                              | 2 +-
 arch/arm64/kvm/vgic/vgic-v3-nested.c                       | 3 +--
 arch/arm64/kvm/vgic/vgic-v3.c                              | 2 +-
 19 files changed, 21 insertions(+), 26 deletions(-)
 rename include/kvm/arm_arch_timer.h => arch/arm64/include/asm/kvm_arch_timer.h (100%)
 rename include/kvm/arm_pmu.h => arch/arm64/include/asm/kvm_pmu.h (100%)
 rename include/kvm/arm_vgic.h => arch/arm64/include/asm/kvm_vgic.h (100%)

Nitpick:

|F: include/kvm/arm_*

can be deleted from the KVM/arm64 MAINTAINERS entry now.

Thanks,
Zenghui

author maintainer
#5 lore raw

PATCH 4/8 KVM: Move include/kvm/iodev.h to include/linux as kvm_iodev.h

In reply to Sean Christopherson

Move iodev.h, the last remaining holdout in include/kvm, to the standard include/linux directory as kvm_iodev.h and delete include/kvm.

---
 MAINTAINERS                                | 1 -
 arch/arm64/include/asm/kvm_vgic.h          | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v2.c         | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c         | 2 +-
 arch/arm64/kvm/vgic/vgic-mmio.c            | 2 +-
 arch/loongarch/include/asm/kvm_eiointc.h   | 2 +-
 arch/loongarch/include/asm/kvm_ipi.h       | 2 +-
 arch/loongarch/include/asm/kvm_pch_pic.h   | 2 +-
 arch/mips/include/asm/kvm_host.h           | 3 +--
 arch/powerpc/kvm/mpic.c                    | 2 +-
 arch/riscv/kvm/aia_aplic.c                 | 2 +-
 arch/riscv/kvm/aia_imsic.c                 | 2 +-
 arch/x86/kvm/i8254.h                       | 2 +-
 arch/x86/kvm/ioapic.h                      | 2 +-
 arch/x86/kvm/irq.h                         | 2 +-
 arch/x86/kvm/lapic.h                       | 2 +-
 include/{kvm/iodev.h => linux/kvm_iodev.h} | 0
 virt/kvm/coalesced_mmio.c                  | 3 +--
 virt/kvm/eventfd.c                         | 2 +-
 virt/kvm/kvm_main.c                        | 3 +--
 20 files changed, 18 insertions(+), 22 deletions(-)
 rename include/{kvm/iodev.h => linux/kvm_iodev.h} (100%)
MAINTAINERS +0 -1
index 10cf54c8f727..a2cd432273e5 100644
@@ -13011,7 +13011,6 @@ W:	http://www.linux-kvm.org
 T:	git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
 F:	Documentation/virt/kvm/
 F:	include/asm-generic/kvm*
-F:	include/kvm/iodev.h
 F:	include/linux/kvm*
 F:	include/trace/events/kvm.h
 F:	include/uapi/asm-generic/kvm*
arch/arm64/include/asm/kvm_vgic.h +1 -1
index 4a34f7f0a864..09d7f628fa3b 100644
@@ -14,7 +14,7 @@
 #include <linux/static_key.h>
 #include <linux/types.h>
 #include <linux/xarray.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 #include <linux/list.h>
 #include <linux/jump_label.h>
 
arch/arm64/kvm/vgic/vgic-mmio-v2.c +1 -1
index d00c8a74fad6..889440a8b129 100644
@@ -6,9 +6,9 @@
 #include <linux/irqchip/arm-gic.h>
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/nospec.h>
 
-#include <kvm/iodev.h>
 #include <asm/kvm_vgic.h>
 
 #include "vgic.h"
arch/arm64/kvm/vgic/vgic-mmio-v3.c +1 -1
index 505d4e389885..db95d3ccbd14 100644
@@ -7,8 +7,8 @@
 #include <linux/irqchip/arm-gic-v3.h>
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/interrupt.h>
-#include <kvm/iodev.h>
 
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_arm.h>
arch/arm64/kvm/vgic/vgic-mmio.c +1 -1
index ec1b13abc728..de689e0e881f 100644
@@ -9,7 +9,7 @@
 #include <linux/irq.h>
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 #include <asm/kvm_arch_timer.h>
 #include <asm/kvm_vgic.h>
 
arch/loongarch/include/asm/kvm_eiointc.h +1 -1
index a3a40aba8acf..0049b0b79477 100644
@@ -6,7 +6,7 @@
 #ifndef __ASM_KVM_EIOINTC_H
 #define __ASM_KVM_EIOINTC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 #define EIOINTC_IRQS			256
 #define EIOINTC_ROUTE_MAX_VCPUS		256
arch/loongarch/include/asm/kvm_ipi.h +1 -1
index 060163dfb4a3..3956b230f087 100644
@@ -6,7 +6,7 @@
 #ifndef __ASM_KVM_IPI_H
 #define __ASM_KVM_IPI_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 #define LARCH_INT_IPI			12
 
arch/loongarch/include/asm/kvm_pch_pic.h +1 -1
index e6df6a4c1c70..4b37e3134e52 100644
@@ -6,7 +6,7 @@
 #ifndef __ASM_KVM_PCH_PIC_H
 #define __ASM_KVM_PCH_PIC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 #define PCH_PIC_SIZE			0x3e8
 
arch/mips/include/asm/kvm_host.h +1 -2
index c14b10821817..0d7dd89ca5bf 100644
@@ -16,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/kvm.h>
+#include <linux/kvm_iodev.h>
 #include <linux/kvm_types.h>
 #include <linux/threads.h>
 #include <linux/spinlock.h>
@@ -24,8 +25,6 @@
 #include <asm/inst.h>
 #include <asm/mipsregs.h>
 
-#include <kvm/iodev.h>
-
 /* MIPS KVM register ids */
 #define MIPS_CP0_32(_R, _S)					\
 	(KVM_REG_MIPS_CP0 | KVM_REG_SIZE_U32 | (8 * (_R) + (_S)))
arch/powerpc/kvm/mpic.c +1 -1
index 23e9c2bd9f27..b25a03251544 100644
@@ -26,6 +26,7 @@
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/anon_inodes.h>
@@ -33,7 +34,6 @@
 #include <asm/mpic.h>
 #include <asm/kvm_para.h>
 #include <asm/kvm_ppc.h>
-#include <kvm/iodev.h>
 
 #define MAX_CPU     32
 #define MAX_SRC     256
arch/riscv/kvm/aia_aplic.c +1 -1
index f59d1c0c8c43..bf163724aec5 100644
@@ -9,10 +9,10 @@
 
 #include <linux/irqchip/riscv-aplic.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/math.h>
 #include <linux/spinlock.h>
 #include <linux/swab.h>
-#include <kvm/iodev.h>
 
 struct aplic_irq {
 	raw_spinlock_t lock;
arch/riscv/kvm/aia_imsic.c +1 -1
index 29ef9c2133a9..ae3c0807baa9 100644
@@ -11,10 +11,10 @@
 #include <linux/bitmap.h>
 #include <linux/irqchip/riscv-imsic.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/math.h>
 #include <linux/spinlock.h>
 #include <linux/swab.h>
-#include <kvm/iodev.h>
 #include <asm/csr.h>
 
 #define IMSIC_MAX_EIX	(IMSIC_MAX_ID / BITS_PER_TYPE(u64))
arch/x86/kvm/i8254.h +1 -1
index a768212ba821..4de7a0b88e4f 100644
@@ -4,7 +4,7 @@
 
 #include <linux/kthread.h>
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 struct kvm_kpit_channel_state {
 	u32 count; /* can be 65536 */
arch/x86/kvm/ioapic.h +1 -1
index aa8cb4ac0479..cb36c36affd3 100644
@@ -3,7 +3,7 @@
 #define __KVM_IO_APIC_H
 
 #include <linux/kvm_host.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 #include "irq.h"
 
 struct kvm;
arch/x86/kvm/irq.h +1 -1
index 76d46b2f41dd..b21b03aa2ee7 100644
@@ -13,9 +13,9 @@
 #include <linux/mm_types.h>
 #include <linux/hrtimer.h>
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/spinlock.h>
 
-#include <kvm/iodev.h>
 #include "lapic.h"
 
 #define PIC_NUM_PINS 16
arch/x86/kvm/lapic.h +1 -1
index 4ce30db65828..43ffbded5f72 100644
@@ -2,7 +2,7 @@
 #ifndef __KVM_X86_LAPIC_H
 #define __KVM_X86_LAPIC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 #include <linux/kvm_host.h>
 
include/linux/kvm_iodev.h renamed from include/kvm/iodev.h +0 -0
similarity index 100%
rename from include/kvm/iodev.h
rename to include/linux/kvm_iodev.h
virt/kvm/coalesced_mmio.c +1 -2
index 375d6285475e..d0f84e3611da 100644
@@ -9,8 +9,7 @@
  *
  */
 
-#include <kvm/iodev.h>
-
+#include <linux/kvm_iodev.h>
 #include <linux/kvm_host.h>
 #include <linux/slab.h>
 #include <linux/kvm.h>
virt/kvm/eventfd.c +1 -1
index 11e5d1e3f12e..35786d59b233 100644
@@ -26,7 +26,7 @@
 #include <linux/irqbypass.h>
 #include <trace/events/kvm.h>
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
 #ifdef CONFIG_HAVE_KVM_IRQCHIP
 
virt/kvm/kvm_main.c +1 -2
index eec82775c5bf..a401ba32ecaa 100644
@@ -10,9 +10,8 @@
  *   Yaniv Kamay  <[email protected]>
  */
 
-#include <kvm/iodev.h>
-
 #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
 #include <linux/kvm.h>
 #include <linux/module.h>
 #include <linux/errno.h>
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
maintainer Reviewed-by on v1 4/8
#6 lore raw

Re: [PATCH 4/8] KVM: Move include/kvm/iodev.h to include/linux as kvm_iodev.h

Quoted 299 lines · Sean Christopherson

Move iodev.h, the last remaining holdout in include/kvm, to the standard include/linux directory as kvm_iodev.h and delete include/kvm.

---
  MAINTAINERS                                | 1 -
  arch/arm64/include/asm/kvm_vgic.h          | 2 +-
  arch/arm64/kvm/vgic/vgic-mmio-v2.c         | 2 +-
  arch/arm64/kvm/vgic/vgic-mmio-v3.c         | 2 +-
  arch/arm64/kvm/vgic/vgic-mmio.c            | 2 +-
  arch/loongarch/include/asm/kvm_eiointc.h   | 2 +-
  arch/loongarch/include/asm/kvm_ipi.h       | 2 +-
  arch/loongarch/include/asm/kvm_pch_pic.h   | 2 +-
  arch/mips/include/asm/kvm_host.h           | 3 +--
  arch/powerpc/kvm/mpic.c                    | 2 +-
  arch/riscv/kvm/aia_aplic.c                 | 2 +-
  arch/riscv/kvm/aia_imsic.c                 | 2 +-
  arch/x86/kvm/i8254.h                       | 2 +-
  arch/x86/kvm/ioapic.h                      | 2 +-
  arch/x86/kvm/irq.h                         | 2 +-
  arch/x86/kvm/lapic.h                       | 2 +-
  include/{kvm/iodev.h => linux/kvm_iodev.h} | 0
  virt/kvm/coalesced_mmio.c                  | 3 +--
  virt/kvm/eventfd.c                         | 2 +-
  virt/kvm/kvm_main.c                        | 3 +--
  20 files changed, 18 insertions(+), 22 deletions(-)

rename include/{kvm/iodev.h => linux/kvm_iodev.h} (100%)

MAINTAINERS +0 -1
index 10cf54c8f727..a2cd432273e5 100644
@@ -13011,7 +13011,6 @@ W:	http://www.linux-kvm.org
  T:	git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
  F:	Documentation/virt/kvm/
  F:	include/asm-generic/kvm*
-F:	include/kvm/iodev.h
  F:	include/linux/kvm*
  F:	include/trace/events/kvm.h
  F:	include/uapi/asm-generic/kvm*
arch/arm64/include/asm/kvm_vgic.h +1 -1
index 4a34f7f0a864..09d7f628fa3b 100644
@@ -14,7 +14,7 @@
  #include <linux/static_key.h>
  #include <linux/types.h>
  #include <linux/xarray.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
  #include <linux/list.h>
  #include <linux/jump_label.h>
 
arch/arm64/kvm/vgic/vgic-mmio-v2.c +1 -1
index d00c8a74fad6..889440a8b129 100644
@@ -6,9 +6,9 @@
  #include <linux/irqchip/arm-gic.h>
  #include <linux/kvm.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/nospec.h>
 
-#include <kvm/iodev.h>
  #include <asm/kvm_vgic.h>
 
  #include "vgic.h"
arch/arm64/kvm/vgic/vgic-mmio-v3.c +1 -1
index 505d4e389885..db95d3ccbd14 100644
@@ -7,8 +7,8 @@
  #include <linux/irqchip/arm-gic-v3.h>
  #include <linux/kvm.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/interrupt.h>
-#include <kvm/iodev.h>
 
  #include <asm/kvm_emulate.h>
  #include <asm/kvm_arm.h>
arch/arm64/kvm/vgic/vgic-mmio.c +1 -1
index ec1b13abc728..de689e0e881f 100644
@@ -9,7 +9,7 @@
  #include <linux/irq.h>
  #include <linux/kvm.h>
  #include <linux/kvm_host.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
  #include <asm/kvm_arch_timer.h>
  #include <asm/kvm_vgic.h>
 
arch/loongarch/include/asm/kvm_eiointc.h +1 -1
index a3a40aba8acf..0049b0b79477 100644
@@ -6,7 +6,7 @@
  #ifndef __ASM_KVM_EIOINTC_H
  #define __ASM_KVM_EIOINTC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  #define EIOINTC_IRQS			256
  #define EIOINTC_ROUTE_MAX_VCPUS		256
arch/loongarch/include/asm/kvm_ipi.h +1 -1
index 060163dfb4a3..3956b230f087 100644
@@ -6,7 +6,7 @@
  #ifndef __ASM_KVM_IPI_H
  #define __ASM_KVM_IPI_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  #define LARCH_INT_IPI			12
 
arch/loongarch/include/asm/kvm_pch_pic.h +1 -1
index e6df6a4c1c70..4b37e3134e52 100644
@@ -6,7 +6,7 @@
  #ifndef __ASM_KVM_PCH_PIC_H
  #define __ASM_KVM_PCH_PIC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  #define PCH_PIC_SIZE			0x3e8
 
arch/mips/include/asm/kvm_host.h +1 -2
index c14b10821817..0d7dd89ca5bf 100644
@@ -16,6 +16,7 @@
  #include <linux/interrupt.h>
  #include <linux/types.h>
  #include <linux/kvm.h>
+#include <linux/kvm_iodev.h>
  #include <linux/kvm_types.h>
  #include <linux/threads.h>
  #include <linux/spinlock.h>
@@ -24,8 +25,6 @@
  #include <asm/inst.h>
  #include <asm/mipsregs.h>
 
-#include <kvm/iodev.h>
-
  /* MIPS KVM register ids */
  #define MIPS_CP0_32(_R, _S)					\
  	(KVM_REG_MIPS_CP0 | KVM_REG_SIZE_U32 | (8 * (_R) + (_S)))
arch/powerpc/kvm/mpic.c +1 -1
index 23e9c2bd9f27..b25a03251544 100644
@@ -26,6 +26,7 @@
  #include <linux/slab.h>
  #include <linux/mutex.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/errno.h>
  #include <linux/fs.h>
  #include <linux/anon_inodes.h>
@@ -33,7 +34,6 @@
  #include <asm/mpic.h>
  #include <asm/kvm_para.h>
  #include <asm/kvm_ppc.h>
-#include <kvm/iodev.h>
 
  #define MAX_CPU     32
  #define MAX_SRC     256
arch/riscv/kvm/aia_aplic.c +1 -1
index f59d1c0c8c43..bf163724aec5 100644
@@ -9,10 +9,10 @@
 
  #include <linux/irqchip/riscv-aplic.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/math.h>
  #include <linux/spinlock.h>
  #include <linux/swab.h>
-#include <kvm/iodev.h>
 
  struct aplic_irq {
  	raw_spinlock_t lock;
arch/riscv/kvm/aia_imsic.c +1 -1
index 29ef9c2133a9..ae3c0807baa9 100644
@@ -11,10 +11,10 @@
  #include <linux/bitmap.h>
  #include <linux/irqchip/riscv-imsic.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/math.h>
  #include <linux/spinlock.h>
  #include <linux/swab.h>
-#include <kvm/iodev.h>
  #include <asm/csr.h>
 
  #define IMSIC_MAX_EIX	(IMSIC_MAX_ID / BITS_PER_TYPE(u64))
arch/x86/kvm/i8254.h +1 -1
index a768212ba821..4de7a0b88e4f 100644
@@ -4,7 +4,7 @@
 
  #include <linux/kthread.h>
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  struct kvm_kpit_channel_state {
  	u32 count; /* can be 65536 */
arch/x86/kvm/ioapic.h +1 -1
index aa8cb4ac0479..cb36c36affd3 100644
@@ -3,7 +3,7 @@
  #define __KVM_IO_APIC_H
 
  #include <linux/kvm_host.h>
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
  #include "irq.h"
 
  struct kvm;
arch/x86/kvm/irq.h +1 -1
index 76d46b2f41dd..b21b03aa2ee7 100644
@@ -13,9 +13,9 @@
  #include <linux/mm_types.h>
  #include <linux/hrtimer.h>
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/spinlock.h>
 
-#include <kvm/iodev.h>
  #include "lapic.h"
 
  #define PIC_NUM_PINS 16
arch/x86/kvm/lapic.h +1 -1
index 4ce30db65828..43ffbded5f72 100644
@@ -2,7 +2,7 @@
  #ifndef __KVM_X86_LAPIC_H
  #define __KVM_X86_LAPIC_H
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  #include <linux/kvm_host.h>
 
include/linux/kvm_iodev.h renamed from include/kvm/iodev.h +0 -0
similarity index 100%
rename from include/kvm/iodev.h
rename to include/linux/kvm_iodev.h
virt/kvm/coalesced_mmio.c +1 -2
index 375d6285475e..d0f84e3611da 100644
@@ -9,8 +9,7 @@
   *
   */
 
-#include <kvm/iodev.h>
-
+#include <linux/kvm_iodev.h>
  #include <linux/kvm_host.h>
  #include <linux/slab.h>
  #include <linux/kvm.h>
virt/kvm/eventfd.c +1 -1
index 11e5d1e3f12e..35786d59b233 100644
@@ -26,7 +26,7 @@
  #include <linux/irqbypass.h>
  #include <trace/events/kvm.h>
 
-#include <kvm/iodev.h>
+#include <linux/kvm_iodev.h>
 
  #ifdef CONFIG_HAVE_KVM_IRQCHIP
 
virt/kvm/kvm_main.c +0 -0
index eec82775c5bf..a401ba32ecaa 100644

virt/kvm/kvm_main.c line 17

Quoted 10 lines
virt/kvm/kvm_main.c +1 -2
@@ -10,9 +10,8 @@
   *   Yaniv Kamay  <[email protected]>
   */
 
-#include <kvm/iodev.h>
-
  #include <linux/kvm_host.h>
+#include <linux/kvm_iodev.h>
  #include <linux/kvm.h>
  #include <linux/module.h>
  #include <linux/errno.h>

About modification with LoongArch specific.

author maintainer
#7 lore raw

PATCH 5/8 KVM: MIPS: Stop adding virt/kvm to the arch include path

In reply to Sean Christopherson

Don't add virt/kvm to KVM MIPS' include path, the headers in virt/kvm are intended to be used only by other code in virt/kvm, i.e. are "private" to the core KVM code. It's not clear that MIPS *ever* included a header from virt/kvm, i.e. odds are good the "-Ivirt/kvm" was copied from a different architecture's Makefile when MIPS support was first added.

---
 arch/mips/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kvm/Makefile +1 -1
index 805aeea2166e..96a7cd21b140 100644
@@ -4,7 +4,7 @@
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
-ccflags-y += -Ivirt/kvm -Iarch/mips/kvm
+ccflags-y += -Iarch/mips/kvm
 
 kvm-$(CONFIG_CPU_HAS_MSA) += msa.o
 
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
author maintainer
#8 lore raw

PATCH 6/8 KVM: PPC: Stop adding virt/kvm to the arch include path

In reply to Sean Christopherson

Don't add virt/kvm to KVM PPC's include path, the headers in virt/kvm are intended to be used only by other code in virt/kvm, i.e. are "private" to the core KVM code. It's not clear that PPC *ever* included a header from virt/kvm, i.e. odds are good the "-Ivirt/kvm" was copied from a different architecture's Makefile when PPC support was first added.

---
 arch/powerpc/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/Makefile +1 -1
index 4bd9d1230869..1a575db2666e 100644
@@ -3,7 +3,7 @@
 # Makefile for Kernel-based Virtual Machine module
 #
 
-ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
+ccflags-y := -Iarch/powerpc/kvm
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
author maintainer
#10 lore raw

PATCH 7/8 KVM: s390: Stop adding virt/kvm to the arch include path

In reply to Sean Christopherson

Don't add virt/kvm to KVM s390's include path, the headers in virt/kvm are intended to be used only by other code in virt/kvm, i.e. are "private" to the core KVM code. It's not clear that s390 *ever* included a header from virt/kvm, i.e. odds are good the "-Ivirt/kvm" was copied from a x86's Makefile when s390 support was first added.

The only headers in virt/kvm at the time were the x86 specific ioapic.h, and iodev.h, neither of which shows up as an #include in the diff for the commit range 37817f2982d0f..e976a2b997fc4.

---
 arch/s390/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/Makefile +1 -1
index 9a723c48b05a..b742e08c036b 100644
@@ -5,7 +5,7 @@
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
-ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
+ccflags-y := -Iarch/s390/kvm
 
 kvm-y += kvm-s390.o intercept.o interrupt.o priv.o sigp.o
 kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o gmap-vsie.o
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
maintainer Reviewed-by on v1 7/8
#11 lore raw

Re: [PATCH 7/8] KVM: s390: Stop adding virt/kvm to the arch include path

Quoted 6 lines · Sean Christopherson

Don't add virt/kvm to KVM s390's include path, the headers in virt/kvm are intended to be used only by other code in virt/kvm, i.e. are "private" to the core KVM code. It's not clear that s390 *ever* included a header from virt/kvm, i.e. odds are good the "-Ivirt/kvm" was copied from a x86's Makefile when s390 support was first added.

Quoted 7 lines

The only headers in virt/kvm at the time were the x86 specific ioapic.h, and iodev.h, neither of which shows up as an #include in the diff for the commit range 37817f2982d0f..e976a2b997fc4.

author maintainer
#12 lore raw

PATCH 8/8 KVM: Standardize include paths across all architectures

In reply to Sean Christopherson

Standardize KVM's include paths across all architectures by declaring the KVM-specific includes in the common Makefile.kvm. Having common KVM "own" the included paths reduces the temptation to unnecessarily add virt/kvm to arch include paths, and conversely if allowing arch code to grab headers from virt/kvm becomes desirable, virt/kvm can be added to all architecture's include path with a single line update.

Having the common KVM makefile append to ccflags also provides a convenient location to append other things, e.g. KVM-specific #defines.

Note, this changes the behavior of s390 and PPC, as s390 and PPC previously overwrote ccflags-y instead of adding on. There is no evidence that overwriting ccflags-y was necessary or even deliberate, as both s390 and PPC switched to the overwrite behavior without so much as a passing mention when EXTRA_CFLAGS was replaced with ccflags-y (commit c73028a02887 ("s390: change to new flag variable") and commit 4108d9ba9091 ("powerpc/Makefiles: Change to new flag variables")).

---
 arch/arm64/kvm/Makefile   | 2 --
 arch/mips/kvm/Makefile    | 2 --
 arch/powerpc/kvm/Makefile | 2 --
 arch/riscv/kvm/Makefile   | 2 --
 arch/s390/kvm/Makefile    | 2 --
 arch/x86/kvm/Makefile     | 1 -
 virt/kvm/Makefile.kvm     | 2 ++
 7 files changed, 2 insertions(+), 11 deletions(-)
arch/arm64/kvm/Makefile +0 -2
index 7c329e01c557..86035b311269 100644
@@ -3,8 +3,6 @@
 # Makefile for Kernel-based Virtual Machine module
 #
 
-ccflags-y += -I $(src)
-
 include $(srctree)/virt/kvm/Makefile.kvm
 
 obj-$(CONFIG_KVM) += kvm.o
arch/mips/kvm/Makefile +0 -2
index 96a7cd21b140..d198e1addea7 100644
@@ -4,8 +4,6 @@
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
-ccflags-y += -Iarch/mips/kvm
-
 kvm-$(CONFIG_CPU_HAS_MSA) += msa.o
 
 kvm-y +=    mips.o emulate.o entry.o \
arch/powerpc/kvm/Makefile +0 -2
index 1a575db2666e..6f12edd465df 100644
@@ -3,8 +3,6 @@
 # Makefile for Kernel-based Virtual Machine module
 #
 
-ccflags-y := -Iarch/powerpc/kvm
-
 include $(srctree)/virt/kvm/Makefile.kvm
 
 common-objs-y += powerpc.o emulate_loadstore.o
arch/riscv/kvm/Makefile +0 -2
index 4e0bba91d284..dbe61a398cc8 100644
@@ -3,8 +3,6 @@
 # Makefile for RISC-V KVM support
 #
 
-ccflags-y += -I $(src)
-
 include $(srctree)/virt/kvm/Makefile.kvm
 
 obj-$(CONFIG_KVM) += kvm.o
arch/s390/kvm/Makefile +0 -2
index b742e08c036b..5cbcaa7f241a 100644
@@ -5,8 +5,6 @@
 
 include $(srctree)/virt/kvm/Makefile.kvm
 
-ccflags-y := -Iarch/s390/kvm
-
 kvm-y += kvm-s390.o intercept.o interrupt.o priv.o sigp.o
 kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o gmap-vsie.o
 
arch/x86/kvm/Makefile +0 -1
index a5d362c7b504..f78f11b582d2 100644
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-ccflags-y += -I $(srctree)/arch/x86/kvm
 ccflags-$(CONFIG_KVM_WERROR) += -Werror
 
 include $(srctree)/virt/kvm/Makefile.kvm
virt/kvm/Makefile.kvm +2 -0
index 724c89af78af..0e7ba49026fc 100644
@@ -3,6 +3,8 @@
 # Makefile for Kernel-based Virtual Machine module
 #
 
+ccflags-y += -I$(src)
+
 KVM ?= ../../../virt/kvm
 
 kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
maintainer
#13 lore raw
In reply to Sean Christopherson
Quoted 7 lines · Sean Christopherson

Kill off include/kvm (through file moves/renames), and standardize the set of KVM includes across all architectures.

This conflicts with Colton's partioned PMU series[1], but this should work as a nice prepatory cleanup for the partitioned PMU work (and hopefully can land sooner).

Quoted 7 lines

Note, these patches were originally posted as part of a much larger and more agressive RFC[1]. We've effectively abandoned upstreaming the multi-KVM idea, but I'm trying to (slowly) upstream the bits and pieces that I think/hope are generally beneficial.

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]

Marc, Oliver, I'd like to commit this to kvm/next sometime soon; I'll wait for your ack since most of the meat here is in arch/arm64.

Thanks,

Paolo

Acked-by
#14 lore raw
Quoted 13 lines · Paolo Bonzini
Quoted 12 lines · Sean Christopherson

Kill off include/kvm (through file moves/renames), and standardize the set of KVM includes across all architectures.

This conflicts with Colton's partioned PMU series[1], but this should work as a nice prepatory cleanup for the partitioned PMU work (and hopefully can land sooner).

Note, these patches were originally posted as part of a much larger and more agressive RFC[1]. We've effectively abandoned upstreaming the multi-KVM idea, but I'm trying to (slowly) upstream the bits and pieces that I think/hope are generally beneficial.

Quoted 5 lines
Quoted 2 lines

[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]

Marc, Oliver, I'd like to commit this to kvm/next sometime soon; I'll wait for your ack since most of the meat here is in arch/arm64.

Let it rip, just to get ahead of potential conflicts can you push out a topic branch?

Thanks,
Oliver