Remove unnecessary asm/hvm/support.h includes
cover Remove unnecessary asm/hvm/support.h includes
While working on the separation between AMD and Intel code, I noticed that the header asm/hvm/support.h is included in many files even if none of its declarations and macro definitions is referred in those files.
This patch series aims to remove any redundant includes of asm/hvm/support.h. The changes are sent as 2 patches to aid review (especially the change in asm/spec_ctrl.h).
Xenia Ragiadakou (2):
x86: do not include asm/hvm/support.h when not used x86/hygon: do not include asm/hvm/support.h when not used
xen/arch/x86/cpu/amd.c | 2 +- xen/arch/x86/cpu/hygon.c | 1 - xen/arch/x86/cpu/intel.c | 2 +- xen/arch/x86/cpu/vpmu.c | 1 - xen/arch/x86/cpu/vpmu_intel.c | 1 - xen/arch/x86/crash.c | 1 - xen/arch/x86/domain.c | 1 - xen/arch/x86/domctl.c | 1 - xen/arch/x86/emul-i8254.c | 2 +- xen/arch/x86/hvm/hpet.c | 2 +- xen/arch/x86/hvm/io.c | 1 - xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/pmtimer.c | 3 ++- xen/arch/x86/hvm/rtc.c | 3 ++- xen/arch/x86/hvm/save.c | 2 -- xen/arch/x86/hvm/stdvga.c | 1 - xen/arch/x86/hvm/svm/emulate.c | 1 - xen/arch/x86/hvm/svm/intr.c | 1 - xen/arch/x86/hvm/svm/vmcb.c | 1 - xen/arch/x86/hvm/viridian/synic.c | 1 - xen/arch/x86/hvm/viridian/time.c | 1 - xen/arch/x86/hvm/viridian/viridian.c | 1 - xen/arch/x86/hvm/vmx/intr.c | 1 - xen/arch/x86/hvm/vmx/vmcs.c | 1 - xen/arch/x86/hvm/vmx/vvmx.c | 1 + xen/arch/x86/hvm/vpic.c | 2 +- xen/arch/x86/hvm/vpt.c | 2 +- xen/arch/x86/i387.c | 1 - xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +- xen/arch/x86/include/asm/spec_ctrl.h | 2 +- xen/arch/x86/mm/altp2m.c | 1 - xen/arch/x86/mm/hap/nested_ept.c | 1 - xen/arch/x86/mm/hap/nested_hap.c | 1 - xen/arch/x86/oprofile/op_model_athlon.c | 2 +- xen/arch/x86/oprofile/xenoprof.c | 1 - xen/arch/x86/smp.c | 1 - xen/arch/x86/sysctl.c | 1 - xen/arch/x86/x86_64/traps.c | 1 - xen/arch/x86/xstate.c | 1 - xen/drivers/passthrough/x86/hvm.c | 1 - 40 files changed, 15 insertions(+), 40 deletions(-)
Signature · 1 line
2.37.2
PATCH 1/2 x86: do not include asm/hvm/support.h when not used
When none of the declarations and macro definitions in asm/hvm/support.h is referred in the file, do not include the header.
To fix subsequent build errors, which were not triggered before due to the indirect inclusion of the missing headers by asm/hvm/support.h, include any missing headers.
No functional change intended.
--- xen/arch/x86/cpu/amd.c | 2 +- xen/arch/x86/cpu/intel.c | 2 +- xen/arch/x86/cpu/vpmu.c | 1 - xen/arch/x86/cpu/vpmu_intel.c | 1 - xen/arch/x86/crash.c | 1 - xen/arch/x86/domain.c | 1 - xen/arch/x86/domctl.c | 1 - xen/arch/x86/emul-i8254.c | 2 +- xen/arch/x86/hvm/hpet.c | 2 +- xen/arch/x86/hvm/io.c | 1 - xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/pmtimer.c | 3 ++- xen/arch/x86/hvm/rtc.c | 3 ++- xen/arch/x86/hvm/save.c | 2 -- xen/arch/x86/hvm/stdvga.c | 1 - xen/arch/x86/hvm/svm/emulate.c | 1 - xen/arch/x86/hvm/svm/intr.c | 1 - xen/arch/x86/hvm/svm/vmcb.c | 1 - xen/arch/x86/hvm/viridian/synic.c | 1 - xen/arch/x86/hvm/viridian/time.c | 1 - xen/arch/x86/hvm/viridian/viridian.c | 1 - xen/arch/x86/hvm/vmx/intr.c | 1 - xen/arch/x86/hvm/vmx/vmcs.c | 1 - xen/arch/x86/hvm/vmx/vvmx.c | 1 + xen/arch/x86/hvm/vpic.c | 2 +- xen/arch/x86/hvm/vpt.c | 2 +- xen/arch/x86/i387.c | 1 - xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +- xen/arch/x86/mm/altp2m.c | 1 - xen/arch/x86/mm/hap/nested_ept.c | 1 - xen/arch/x86/mm/hap/nested_hap.c | 1 - xen/arch/x86/oprofile/op_model_athlon.c | 2 +- xen/arch/x86/oprofile/xenoprof.c | 1 - xen/arch/x86/smp.c | 1 - xen/arch/x86/sysctl.c | 1 - xen/arch/x86/x86_64/traps.c | 1 - xen/arch/x86/xstate.c | 1 - xen/drivers/passthrough/x86/hvm.c | 1 - 38 files changed, 14 insertions(+), 38 deletions(-)
xen/arch/x86/cpu/amd.c +1 -1
@@ -4,12 +4,12 @@#include <xen/param.h> #include <xen/smp.h> #include <xen/pci.h> +#include <xen/sched.h> #include <xen/warning.h> #include <asm/io.h> #include <asm/msr.h> #include <asm/processor.h> #include <asm/amd.h> -#include <asm/hvm/support.h> #include <asm/spec_ctrl.h> #include <asm/acpi.h> #include <asm/apic.h>
xen/arch/x86/cpu/intel.c +1 -1
@@ -1,5 +1,6 @@#include <xen/init.h> #include <xen/kernel.h> +#include <xen/sched.h> #include <xen/string.h> #include <xen/bitops.h> #include <xen/smp.h>
@@ -10,7 +11,6 @@#include <asm/apic.h> #include <asm/i387.h> #include <mach_apic.h> -#include <asm/hvm/support.h> #include "cpu.h"
xen/arch/x86/cpu/vpmu.c +0 -1
@@ -30,7 +30,6 @@#include <asm/nmi.h> #include <asm/p2m.h> #include <asm/vpmu.h> -#include <asm/hvm/support.h> #include <asm/apic.h> #include <irq_vectors.h> #include <public/pmu.h>
xen/arch/x86/cpu/vpmu_intel.c +0 -1
@@ -29,7 +29,6 @@#include <asm/msr.h> #include <asm/msr-index.h> #include <asm/vpmu.h> -#include <asm/hvm/support.h> #include <asm/hvm/vlapic.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vmcs.h>
xen/arch/x86/crash.c +0 -1
@@ -24,7 +24,6 @@#include <xen/keyhandler.h> #include <public/xen.h> #include <asm/shared.h> -#include <asm/hvm/support.h> #include <asm/apic.h> #include <asm/io_apic.h> #include <xen/iommu.h>
xen/arch/x86/domain.c +0 -1
@@ -51,7 +51,6 @@#include <asm/ldt.h> #include <asm/hvm/hvm.h> #include <asm/hvm/nestedhvm.h> -#include <asm/hvm/support.h> #include <asm/hvm/svm/svm.h> #include <asm/hvm/viridian.h> #include <asm/debugreg.h>
xen/arch/x86/domctl.c +0 -1
@@ -25,7 +25,6 @@#include <asm/irq.h> #include <asm/hvm/emulate.h> #include <asm/hvm/hvm.h> -#include <asm/hvm/support.h> #include <asm/processor.h> #include <asm/acpi.h> /* for hvm_acpi_power_button */ #include <xen/hypercall.h> /* for arch_do_domctl */
xen/arch/x86/emul-i8254.c +1 -1
@@ -34,7 +34,7 @@#include <asm/time.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/vpt.h> #include <asm/current.h>
xen/arch/x86/hvm/hpet.c +1 -1
@@ -18,7 +18,7 @@#include <asm/hvm/vpt.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/trace.h> #include <asm/current.h> #include <asm/hpet.h>
xen/arch/x86/hvm/io.c +0 -1
@@ -36,7 +36,6 @@#include <asm/shadow.h> #include <asm/p2m.h> #include <asm/hvm/hvm.h> -#include <asm/hvm/support.h> #include <asm/hvm/vpt.h> #include <asm/hvm/vpic.h> #include <asm/hvm/vlapic.h>
xen/arch/x86/hvm/irq.c +1 -1
@@ -24,7 +24,7 @@#include <xen/irq.h> #include <xen/keyhandler.h> #include <asm/hvm/domain.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/msi.h> #include <public/hvm/params.h>
xen/arch/x86/hvm/pmtimer.c +2 -1
@@ -17,9 +17,10 @@* this program; If not, see <http://www.gnu.org/licenses/>. */ +#include <xen/sched.h> #include <asm/hvm/vpt.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/acpi.h> /* for hvm_acpi_power_button prototype */ #include <public/hvm/params.h>
xen/arch/x86/hvm/rtc.c +2 -1
@@ -22,10 +22,11 @@* IN THE SOFTWARE. */ +#include <xen/sched.h> #include <asm/mc146818rtc.h> #include <asm/hvm/vpt.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/current.h> #include <xen/trace.h> #include <public/hvm/params.h>
xen/arch/x86/hvm/save.c +0 -2
@@ -24,8 +24,6 @@#include <xen/softirq.h> #include <xen/version.h> -#include <asm/hvm/support.h> -#include <public/hvm/save.h> void arch_hvm_save (struct domain *d,struct hvm_save_header *hdr)
xen/arch/x86/hvm/stdvga.c +0 -1
@@ -31,7 +31,6 @@#include <xen/types.h> #include <xen/sched.h> #include <xen/domain_page.h> -#include <asm/hvm/support.h> #include <xen/numa.h> #include <xen/paging.h>
xen/arch/x86/hvm/svm/emulate.c +0 -1
@@ -22,7 +22,6 @@#include <asm/msr.h> #include <asm/hvm/emulate.h> #include <asm/hvm/hvm.h> -#include <asm/hvm/support.h> #include <asm/hvm/svm/svm.h> #include <asm/hvm/svm/vmcb.h> #include <asm/hvm/svm/emulate.h>
xen/arch/x86/hvm/svm/intr.c +0 -1
@@ -27,7 +27,6 @@#include <asm/paging.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> #include <asm/hvm/vlapic.h> #include <asm/hvm/svm/svm.h> #include <asm/hvm/svm/intr.h>
xen/arch/x86/hvm/svm/vmcb.c +0 -1
@@ -26,7 +26,6 @@#include <asm/hvm/svm/vmcb.h> #include <asm/msr-index.h> #include <asm/p2m.h> -#include <asm/hvm/support.h> #include <asm/hvm/svm/svm.h> #include <asm/hvm/svm/svmdebug.h> #include <asm/spec_ctrl.h>
xen/arch/x86/hvm/viridian/synic.c +0 -1
@@ -13,7 +13,6 @@#include <asm/apic.h> #include <asm/guest/hyperv-tlfs.h> -#include <asm/hvm/support.h> #include <asm/hvm/vlapic.h> #include "private.h"
xen/arch/x86/hvm/viridian/time.c +0 -1
@@ -15,7 +15,6 @@#include <asm/event.h> #include <asm/guest/hyperv.h> #include <asm/guest/hyperv-tlfs.h> -#include <asm/hvm/support.h> #include "private.h"
xen/arch/x86/hvm/viridian/viridian.c +0 -1
@@ -16,7 +16,6 @@#include <asm/paging.h> #include <asm/p2m.h> #include <asm/apic.h> -#include <asm/hvm/support.h> #include <public/sched.h> #include <public/hvm/hvm_op.h>
xen/arch/x86/hvm/vmx/intr.c +0 -1
@@ -29,7 +29,6 @@#include <asm/msr.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vmcs.h> #include <asm/hvm/vpic.h>
xen/arch/x86/hvm/vmx/vmcs.c +0 -1
@@ -33,7 +33,6 @@#include <asm/hvm/hvm.h> #include <asm/hvm/io.h> #include <asm/hvm/nestedhvm.h> -#include <asm/hvm/support.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vvmx.h> #include <asm/hvm/vmx/vmcs.h>
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
@@ -24,6 +24,7 @@#include <asm/types.h> #include <asm/mtrr.h> #include <asm/p2m.h> +#include <asm/hvm/support.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vvmx.h> #include <asm/hvm/nestedhvm.h>
xen/arch/x86/hvm/vpic.c +1 -1
@@ -32,7 +32,7 @@#include <xen/trace.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #define vpic_domain (v) (container_of((v), struct domain, \ arch.hvm.vpic[!vpic->is_master]))
xen/arch/x86/hvm/vpt.c +1 -1
@@ -16,8 +16,8 @@* this program; If not, see <http://www.gnu.org/licenses/>. */ +#include <xen/sched.h> #include <xen/time.h> -#include <asm/hvm/support.h> #include <asm/hvm/vpt.h> #include <asm/event.h> #include <asm/apic.h>
xen/arch/x86/i387.c +0 -1
@@ -11,7 +11,6 @@#include <xen/sched.h> #include <asm/current.h> #include <asm/processor.h> -#include <asm/hvm/support.h> #include <asm/i387.h> #include <asm/xstate.h> #include <asm/asm_defns.h>
xen/arch/x86/include/asm/hvm/vmx/vmx.h +1 -1
@@ -23,8 +23,8 @@#include <asm/regs.h> #include <asm/asm_defns.h> #include <asm/processor.h> +#include <asm/p2m.h> #include <asm/i387.h> -#include <asm/hvm/support.h> #include <asm/hvm/trace.h> #include <asm/hvm/vmx/vmcs.h>
xen/arch/x86/mm/altp2m.c +0 -1
@@ -15,7 +15,6 @@* this program; If not, see <http://www.gnu.org/licenses/>. */ -#include <asm/hvm/support.h> #include <asm/hvm/hvm.h> #include <asm/p2m.h> #include <asm/altp2m.h>
xen/arch/x86/mm/hap/nested_ept.c +0 -1
@@ -25,7 +25,6 @@#include <asm/p2m.h> #include <asm/mem_sharing.h> #include <asm/hap.h> -#include <asm/hvm/support.h> #include <asm/hvm/nestedhvm.h>
xen/arch/x86/mm/hap/nested_hap.c +0 -1
@@ -27,7 +27,6 @@#include <asm/p2m.h> #include <asm/mem_sharing.h> #include <asm/hap.h> -#include <asm/hvm/support.h> #include <asm/hvm/nestedhvm.h>
xen/arch/x86/oprofile/op_model_athlon.c +1 -1
@@ -10,6 +10,7 @@* @author Graydon Hoare */ +#include <xen/sched.h> #include <xen/types.h> #include <asm/msr.h> #include <asm/io.h>
@@ -18,7 +19,6 @@#include <xen/xenoprof.h> #include <asm/regs.h> #include <asm/current.h> -#include <asm/hvm/support.h> #include <xen/pci_regs.h> #include <xen/pci_ids.h>
xen/arch/x86/oprofile/xenoprof.c +0 -1
@@ -12,7 +12,6 @@#include <xen/sched.h> #include <xen/xenoprof.h> #include <public/xenoprof.h> -#include <asm/hvm/support.h> #include "op_counter.h"
xen/arch/x86/smp.c +0 -1
@@ -21,7 +21,6 @@#include <asm/flushtlb.h> #include <asm/hardirq.h> #include <asm/hpet.h> -#include <asm/hvm/support.h> #include <asm/setup.h> #include <irq_vectors.h> #include <mach_apic.h>
xen/arch/x86/sysctl.c +0 -1
@@ -22,7 +22,6 @@#include <xen/iocap.h> #include <asm/irq.h> #include <asm/hvm/hvm.h> -#include <asm/hvm/support.h> #include <asm/processor.h> #include <asm/setup.h> #include <asm/smp.h>
xen/arch/x86/x86_64/traps.c +0 -1
@@ -23,7 +23,6 @@#include <asm/page.h> #include <asm/shared.h> #include <asm/hvm/hvm.h> -#include <asm/hvm/support.h> static void print_xen_info (void )
xen/arch/x86/xstate.c +0 -1
@@ -10,7 +10,6 @@#include <xen/sched.h> #include <asm/current.h> #include <asm/processor.h> -#include <asm/hvm/support.h> #include <asm/i387.h> #include <asm/xstate.h> #include <asm/asm_defns.h>
xen/drivers/passthrough/x86/hvm.c +0 -1
@@ -23,7 +23,6 @@#include <xen/cpu.h> #include <xen/irq.h> #include <asm/hvm/irq.h> -#include <asm/hvm/support.h> #include <asm/io_apic.h> /*
Signature · 1 line
2.37.2
Re: [PATCH 1/2] x86: do not include asm/hvm/support.h when not used
xen/arch/x86/emul-i8254.c line 39
Quoted 10 lines · Xenia Ragiadakou
xen/arch/x86/emul-i8254.c +1
-1@@ -34,7 +34,7 @@#include <asm/time.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/vpt.h> #include <asm/current.h>
To be honest I'd prefer if only the HVM-specific part of this file had this new #include (and ideally the other hvm/ ones would move there as well, but I can see this being beyond the scope of what you're wanting to do).
Jan
Re: [PATCH 1/2] x86: do not include asm/hvm/support.h when not used
Quoted 16 lines · Jan Beulich
xen/arch/x86/emul-i8254.c line 39
Quoted 10 lines · Xenia Ragiadakou
xen/arch/x86/emul-i8254.c +1
-1@@ -34,7 +34,7 @@#include <asm/time.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/vpt.h> #include <asm/current.h> To be honest I'd prefer if only the HVM-specific part of this file had this new #include (and ideally the other hvm/ ones would move there as well, but I can see this being beyond the scope of what you're wanting to do).
Ah I see. That's ok. I ll move it in v2.
Quoted 2 lines
Jan
Signature · 1 line
Xenia
Re: [PATCH 1/2] x86: do not include asm/hvm/support.h when not used
Quoted 19 lines · Xenia Ragiadakou
Quoted 16 lines · Jan Beulich
xen/arch/x86/emul-i8254.c line 39
Quoted 10 lines · Xenia Ragiadakou
xen/arch/x86/emul-i8254.c +1
-1@@ -34,7 +34,7 @@ #include <asm/time.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/vpt.h> #include <asm/current.h>To be honest I'd prefer if only the HVM-specific part of this file had this new #include (and ideally the other hvm/ ones would move there as well, but I can see this being beyond the scope of what you're wanting to do).
Quoted 1 line
Ah I see. That's ok. I ll move it in v2.
After having a closer look at the code, I think it would be better to leave it as is in this patch because the struct hvm_hw_pit_channel (declared in puplic/hvm/save.h) and the function hvm_get_guest_time() (declared in asm/hvm/hvm.h) are used by the common part of this file. And I can send another patch to cleanup the headers in this file. Unless you insist.
Quoted 4 lines
Quoted 3 lines
Jan
Signature · 1 line
Xenia
Jan Beulich
Acked-byRe: [PATCH 1/2] x86: do not include asm/hvm/support.h when not used
Quoted 19 lines · Xenia Ragiadakou
Quoted 18 lines · Xenia Ragiadakou
Quoted 16 lines · Jan Beulich
xen/arch/x86/emul-i8254.c line 39
Quoted 10 lines · Xenia Ragiadakou
xen/arch/x86/emul-i8254.c +1
-1@@ -34,7 +34,7 @@ #include <asm/time.h> #include <asm/hvm/hvm.h> #include <asm/hvm/io.h> -#include <asm/hvm/support.h> +#include <asm/hvm/save.h> #include <asm/hvm/vpt.h> #include <asm/current.h>To be honest I'd prefer if only the HVM-specific part of this file had this new #include (and ideally the other hvm/ ones would move there as well, but I can see this being beyond the scope of what you're wanting to do).
Quoted 8 lines
Quoted 1 line
Ah I see. That's ok. I ll move it in v2.
After having a closer look at the code, I think it would be better to leave it as is in this patch because the struct
hvm_hw_pit_channel(declared inpuplic/hvm/save.h) and the functionhvm_get_guest_time()(declared inasm/hvm/hvm.h) are used by the common part of this file. And I can send another patch to cleanup the headers in this file. Unless you insist.
Oh, I didn't recall it's this ugly. We're indeed using a HVM-only struct for PV here as well. Your change is okay then as is:
Jan
PATCH 2/2 x86/hygon: do not include asm/hvm/support.h when not used
In reply to Xenia RagiadakouSince none of the declarations and macro definitions in asm/hvm/support.h is referred in x86/cpu/hygon.c, remove the unnecessary include.
To resolve the subsequent build error for implicit declaration of wrmsrl() and rdmsrl() triggered in asm/spec_ctrl.h, replace asm/msr-index.h with asm/msr.h in asm/spec_ctrl.h's included headers.
No functional change intended.
--- xen/arch/x86/cpu/hygon.c | 1 - xen/arch/x86/include/asm/spec_ctrl.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
xen/arch/x86/cpu/hygon.c +0 -1
@@ -1,6 +1,5 @@#include <xen/init.h> #include <asm/processor.h> -#include <asm/hvm/support.h> #include <asm/spec_ctrl.h> #include "cpu.h"
xen/arch/x86/include/asm/spec_ctrl.h +1 -1
@@ -60,7 +60,7 @@#include <asm/alternative.h> #include <asm/current.h> -#include <asm/msr-index.h> +#include <asm/msr.h> void init_speculation_mitigations (void );void spec_ctrl_init_domain (struct domain *d);
Signature · 1 line
2.37.2
Re: [PATCH 2/2] x86/hygon: do not include asm/hvm/support.h when not used
Quoted 10 lines · Xenia Ragiadakou
Since none of the declarations and macro definitions in
asm/hvm/support.his referred inx86/cpu/hygon.c, remove the unnecessary include.To resolve the subsequent build error for implicit declaration of
wrmsrl()andrdmsrl()triggered inasm/spec_ctrl.h, replaceasm/msr-index.hwithasm/msr.hin asm/spec_ctrl.h's included headers.No functional change intended.
Signed-off-by Xenia Ragiadakou <[email protected]>