Skip to contentSkip to conversation

x86: reduce include dependencies

PATCH In review Jan Beulich 2 participants 12 messages Mar 13, 2020 – Mar 16, 2020

lore
Share & tools
lore
#0 lore raw

v3 cover x86: reduce include dependencies

In a number of cases I've noticed the x86 emulator, which is quite slow to build especially with not very new gcc, to re-build when having changed headers which I wouldn't have expected to be included there in the first place. Hence I've gone through the dependencies of that object file and tried to get rid of at least some of the very odd dependencies there. (Some are being addressed also be the separately sent mem-access and vm-event patches with a similar subject.)

1: HVM: reduce domain.h include dependencies
2: HVM: reduce vcpu.h include dependencies
3: HVM: reduce vpt.h include dependencies
4: HVM: reduce vpic.h include dependencies
5: HVM: reduce vioapic.h include dependencies
6: HVM: reduce vlapic.h include dependencies
7: HVM: reduce io.h include dependencies
8: HVM: reduce hvm.h include dependencies
9: reduce mce.h include dependencies

v3: Address build issues in particular with XSM=y + PV_SHIM=y (patch

    1 only).

v2: Address build issues in particular with XSM=y.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw

PATCH v3 1/9 x86/HVM: reduce domain.h include dependencies

Drop #include-s not needed by the header itself. Put the ones needed into whichever other files actually need them.

---
v3: Also make things build with all{yes,no}config.
v2: Also make things build with XSM=y.

xen/arch/x86/cpu/mcheck/vmce.c +1 -0
@@ -28,6 +28,7 @@
 #include <xen/mm.h>
 #include <asm/hvm/save.h>
 #include <asm/processor.h>
+#include <public/hvm/params.h>
 #include <public/sysctl.h>
 #include <asm/system.h>
 #include <asm/msr.h>
xen/arch/x86/hvm/dm.c +2 -0
@@ -27,6 +27,8 @@
 
 #include <xsm/xsm.h>
 
+#include <public/hvm/hvm_op.h>
+
 struct dmop_args {
     domid_t domid;
     unsigned int nr_bufs;
xen/arch/x86/hvm/dom0_build.c +1 -0
@@ -38,6 +38,7 @@
 #include <public/arch-x86/hvm/start_info.h>
 #include <public/hvm/hvm_info_table.h>
 #include <public/hvm/hvm_vcpu.h>
+#include <public/hvm/params.h>
 
 /*
  * Have the TSS cover the ISA port range, which makes it
xen/arch/x86/hvm/hpet.c +1 -0
@@ -26,6 +26,7 @@
 #include <xen/event.h>
 #include <xen/trace.h>
 #include <xen/nospec.h>
+#include <public/hvm/params.h>
 
 #define domain_vhpet(x) (&(x)->arch.hvm.pl_time->vhpet)
 #define vcpu_vhpet(x)   (domain_vhpet((x)->domain))
xen/arch/x86/hvm/hypercall.c +3 -0
@@ -24,6 +24,9 @@
 
 #include <asm/hvm/support.h>
 
+#include <public/hvm/hvm_op.h>
+#include <public/hvm/params.h>
+
 static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     const struct vcpu *curr = current;
xen/arch/x86/hvm/ioreq.c +1 -0
@@ -34,6 +34,7 @@
 #include <asm/hvm/vmx/vmx.h>
 
 #include <public/hvm/ioreq.h>
+#include <public/hvm/params.h>
 
 static void set_ioreq_server(struct domain *d, unsigned int id,
                              struct hvm_ioreq_server *s)
xen/arch/x86/hvm/irq.c +1 -0
@@ -26,6 +26,7 @@
 #include <asm/hvm/domain.h>
 #include <asm/hvm/support.h>
 #include <asm/msi.h>
+#include <public/hvm/params.h>
 
 bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
 {
xen/arch/x86/hvm/rtc.c +1 -0
@@ -28,6 +28,7 @@
 #include <asm/hvm/support.h>
 #include <asm/current.h>
 #include <xen/trace.h>
+#include <public/hvm/params.h>
 
 #define USEC_PER_SEC    1000000UL
 #define NS_PER_USEC     1000UL
xen/arch/x86/hvm/viridian/private.h +1 -0
@@ -4,6 +4,7 @@
 #define X86_HVM_VIRIDIAN_PRIVATE_H
 
 #include <asm/hvm/save.h>
+#include <public/hvm/params.h>
 
 int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val);
 int viridian_synic_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val);
xen/arch/x86/hvm/vpt.c +1 -0
@@ -22,6 +22,7 @@
 #include <asm/event.h>
 #include <asm/apic.h>
 #include <asm/mc146818rtc.h>
+#include <public/hvm/params.h>
 
 #define mode_is(d, name) \
     ((d)->arch.hvm.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
xen/arch/x86/msr.c +2 -0
@@ -28,6 +28,8 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 
+#include <public/hvm/params.h>
+
 DEFINE_PER_CPU(uint32_t, tsc_aux);
 
 struct msr_policy __read_mostly     raw_msr_policy,
xen/arch/x86/pv/shim.c +1 -0
@@ -35,6 +35,7 @@
 #include <asm/pv/mm.h>
 
 #include <public/arch-x86/cpuid.h>
+#include <public/hvm/params.h>
 
 #include <compat/grant_table.h>
 
xen/arch/x86/traps.c +1 -0
@@ -76,6 +76,7 @@
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
 #include <public/arch-x86/cpuid.h>
+#include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
 #include <asm/pv/traps.h>
xen/common/vm_event.c +1 -0
@@ -29,6 +29,7 @@
 #include <asm/monitor.h>
 #include <asm/vm_event.h>
 #include <xsm/xsm.h>
+#include <public/hvm/params.h>
 
 /* for public/io/ring.h macros */
 #define xen_mb()   smp_mb()
xen/drivers/char/xen_pv_console.c +1 -0
@@ -28,6 +28,7 @@
 #include <asm/fixmap.h>
 #include <asm/guest.h>
 
+#include <public/hvm/params.h>
 #include <public/io/console.h>
 
 static struct xencons_interface *cons_ring;
xen/include/asm-x86/hvm/domain.h +5 -11
@@ -20,20 +20,14 @@
 #ifndef __ASM_X86_HVM_DOMAIN_H__
 #define __ASM_X86_HVM_DOMAIN_H__
 
-#include <xen/iommu.h>
-#include <asm/hvm/irq.h>
-#include <asm/hvm/vpt.h>
-#include <asm/hvm/vlapic.h>
-#include <asm/hvm/vioapic.h>
+#include <xen/list.h>
+#include <xen/mm.h>
+#include <xen/radix-tree.h>
+
 #include <asm/hvm/io.h>
-#include <asm/hvm/viridian.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/svm/vmcb.h>
-#include <asm/mem_sharing.h>
-#include <public/grant_table.h>
-#include <public/hvm/params.h>
-#include <public/hvm/save.h>
-#include <public/hvm/hvm_op.h>
+
 #include <public/hvm/dm_op.h>
 
 struct hvm_ioreq_page {
xen/include/asm-x86/hvm/nestedhvm.h +1 -0
@@ -22,6 +22,7 @@
 #include <xen/types.h>         /* for uintNN_t */
 #include <xen/sched.h>         /* for struct vcpu, struct domain */
 #include <asm/hvm/vcpu.h>      /* for vcpu_nestedhvm */
+#include <public/hvm/params.h>
 
 enum nestedhvm_vmexits {
     NESTEDHVM_VMEXIT_ERROR = 0, /* inject VMEXIT w/ invalid VMCB */
xen/include/xsm/dummy.h +1 -0
@@ -17,6 +17,7 @@
 
 #include <xen/sched.h>
 #include <xsm/xsm.h>
+#include <public/hvm/params.h>
 
 /* Cannot use BUILD_BUG_ON here because the expressions we check are not
  * considered constant at compile time. Instead, rely on constant propagation to
xen/xsm/flask/hooks.c +1 -1
@@ -28,7 +28,7 @@
 #include <public/physdev.h>
 #include <public/platform.h>
 #include <public/version.h>
-
+#include <public/hvm/params.h>
 #include <public/xsm/flask_op.h>
 
 #include <avc.h>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Re: [Xen-devel] [PATCH v3 1/9] x86/HVM: reduce domain.h include dependencies

Quoted 8 lines · Jan Beulich

Drop #include-s not needed by the header itself. Put the ones needed into whichever other files actually need them.

---
v3: Also make things build with all{yes,no}config.
v2: Also make things build with XSM=y.

Just FYI: Because of the fair risk of this patch (or later ones in the series) going stale in perhaps subtle ways I'm intending to time out waiting for further acks tomorrow. The changes made, after all, are largely mechanical.

Jan

Quoted 206 lines
xen/arch/x86/cpu/mcheck/vmce.c +1 -0
@@ -28,6 +28,7 @@
 #include <xen/mm.h>
 #include <asm/hvm/save.h>
 #include <asm/processor.h>
+#include <public/hvm/params.h>
 #include <public/sysctl.h>
 #include <asm/system.h>
 #include <asm/msr.h>
xen/arch/x86/hvm/dm.c +2 -0
@@ -27,6 +27,8 @@
 
 #include <xsm/xsm.h>
 
+#include <public/hvm/hvm_op.h>
+
 struct dmop_args {
     domid_t domid;
     unsigned int nr_bufs;
xen/arch/x86/hvm/dom0_build.c +1 -0
@@ -38,6 +38,7 @@
 #include <public/arch-x86/hvm/start_info.h>
 #include <public/hvm/hvm_info_table.h>
 #include <public/hvm/hvm_vcpu.h>
+#include <public/hvm/params.h>
 
 /*
  * Have the TSS cover the ISA port range, which makes it
xen/arch/x86/hvm/hpet.c +1 -0
@@ -26,6 +26,7 @@
 #include <xen/event.h>
 #include <xen/trace.h>
 #include <xen/nospec.h>
+#include <public/hvm/params.h>
 
 #define domain_vhpet(x) (&(x)->arch.hvm.pl_time->vhpet)
 #define vcpu_vhpet(x)   (domain_vhpet((x)->domain))
xen/arch/x86/hvm/hypercall.c +3 -0
@@ -24,6 +24,9 @@
 
 #include <asm/hvm/support.h>
 
+#include <public/hvm/hvm_op.h>
+#include <public/hvm/params.h>
+
 static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     const struct vcpu *curr = current;
xen/arch/x86/hvm/ioreq.c +1 -0
@@ -34,6 +34,7 @@
 #include <asm/hvm/vmx/vmx.h>
 
 #include <public/hvm/ioreq.h>
+#include <public/hvm/params.h>
 
 static void set_ioreq_server(struct domain *d, unsigned int id,
                              struct hvm_ioreq_server *s)
xen/arch/x86/hvm/irq.c +1 -0
@@ -26,6 +26,7 @@
 #include <asm/hvm/domain.h>
 #include <asm/hvm/support.h>
 #include <asm/msi.h>
+#include <public/hvm/params.h>
 
 bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
 {
xen/arch/x86/hvm/rtc.c +1 -0
@@ -28,6 +28,7 @@
 #include <asm/hvm/support.h>
 #include <asm/current.h>
 #include <xen/trace.h>
+#include <public/hvm/params.h>
 
 #define USEC_PER_SEC    1000000UL
 #define NS_PER_USEC     1000UL
xen/arch/x86/hvm/viridian/private.h +1 -0
@@ -4,6 +4,7 @@
 #define X86_HVM_VIRIDIAN_PRIVATE_H
 
 #include <asm/hvm/save.h>
+#include <public/hvm/params.h>
 
 int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val);
 int viridian_synic_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val);
xen/arch/x86/hvm/vpt.c +1 -0
@@ -22,6 +22,7 @@
 #include <asm/event.h>
 #include <asm/apic.h>
 #include <asm/mc146818rtc.h>
+#include <public/hvm/params.h>
 
 #define mode_is(d, name) \
     ((d)->arch.hvm.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
xen/arch/x86/msr.c +2 -0
@@ -28,6 +28,8 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 
+#include <public/hvm/params.h>
+
 DEFINE_PER_CPU(uint32_t, tsc_aux);
 
 struct msr_policy __read_mostly     raw_msr_policy,
xen/arch/x86/pv/shim.c +1 -0
@@ -35,6 +35,7 @@
 #include <asm/pv/mm.h>
 
 #include <public/arch-x86/cpuid.h>
+#include <public/hvm/params.h>
 
 #include <compat/grant_table.h>
 
xen/arch/x86/traps.c +1 -0
@@ -76,6 +76,7 @@
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
 #include <public/arch-x86/cpuid.h>
+#include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
 #include <asm/pv/traps.h>
xen/common/vm_event.c +1 -0
@@ -29,6 +29,7 @@
 #include <asm/monitor.h>
 #include <asm/vm_event.h>
 #include <xsm/xsm.h>
+#include <public/hvm/params.h>
 
 /* for public/io/ring.h macros */
 #define xen_mb()   smp_mb()
xen/drivers/char/xen_pv_console.c +1 -0
@@ -28,6 +28,7 @@
 #include <asm/fixmap.h>
 #include <asm/guest.h>
 
+#include <public/hvm/params.h>
 #include <public/io/console.h>
 
 static struct xencons_interface *cons_ring;
xen/include/asm-x86/hvm/domain.h +5 -11
@@ -20,20 +20,14 @@
 #ifndef __ASM_X86_HVM_DOMAIN_H__
 #define __ASM_X86_HVM_DOMAIN_H__
 
-#include <xen/iommu.h>
-#include <asm/hvm/irq.h>
-#include <asm/hvm/vpt.h>
-#include <asm/hvm/vlapic.h>
-#include <asm/hvm/vioapic.h>
+#include <xen/list.h>
+#include <xen/mm.h>
+#include <xen/radix-tree.h>
+
 #include <asm/hvm/io.h>
-#include <asm/hvm/viridian.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/svm/vmcb.h>
-#include <asm/mem_sharing.h>
-#include <public/grant_table.h>
-#include <public/hvm/params.h>
-#include <public/hvm/save.h>
-#include <public/hvm/hvm_op.h>
+
 #include <public/hvm/dm_op.h>
 
 struct hvm_ioreq_page {
xen/include/asm-x86/hvm/nestedhvm.h +1 -0
@@ -22,6 +22,7 @@
 #include <xen/types.h>         /* for uintNN_t */
 #include <xen/sched.h>         /* for struct vcpu, struct domain */
 #include <asm/hvm/vcpu.h>      /* for vcpu_nestedhvm */
+#include <public/hvm/params.h>
 
 enum nestedhvm_vmexits {
     NESTEDHVM_VMEXIT_ERROR = 0, /* inject VMEXIT w/ invalid VMCB */
xen/include/xsm/dummy.h +1 -0
@@ -17,6 +17,7 @@
 
 #include <xen/sched.h>
 #include <xsm/xsm.h>
+#include <public/hvm/params.h>
 
 /* Cannot use BUILD_BUG_ON here because the expressions we check are not
  * considered constant at compile time. Instead, rely on constant propagation to

xen/xsm/flask/hooks.c line 34

Quoted 8 lines
xen/xsm/flask/hooks.c +1 -1
@@ -28,7 +28,7 @@
 #include <public/physdev.h>
 #include <public/platform.h>
 #include <public/version.h>
-
+#include <public/hvm/params.h>
 #include <public/xsm/flask_op.h>
 
 #include <avc.h>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

PATCH v3 2/9 x86/HVM: reduce vcpu.h include dependencies

In reply to Jan Beulich

Drop #include-s not needed by the header itself. Put the ones needed into whichever other files actually need them.

---
v2: Re-base over changes to previous patch.

xen/arch/x86/cpuid.c +1 -0
@@ -7,6 +7,7 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/svm/svm.h>
+#include <asm/hvm/viridian.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/paging.h>
 #include <asm/processor.h>
xen/arch/x86/hvm/hvm.c +1 -0
@@ -65,6 +65,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/monitor.h>
 #include <asm/hvm/ioreq.h>
+#include <asm/hvm/viridian.h>
 #include <asm/hvm/vm_event.h>
 #include <asm/altp2m.h>
 #include <asm/mtrr.h>
xen/arch/x86/hvm/hypercall.c +1 -0
@@ -23,6 +23,7 @@
 #include <xen/nospec.h>
 
 #include <asm/hvm/support.h>
+#include <asm/hvm/viridian.h>
 
 #include <public/hvm/hvm_op.h>
 #include <public/hvm/params.h>
xen/arch/x86/hvm/viridian/private.h +1 -0
@@ -4,6 +4,7 @@
 #define X86_HVM_VIRIDIAN_PRIVATE_H
 
 #include <asm/hvm/save.h>
+#include <asm/hvm/viridian.h>
 #include <public/hvm/params.h>
 
 int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val);
xen/arch/x86/msr.c +1 -0
@@ -25,6 +25,7 @@
 #include <xen/sched.h>
 
 #include <asm/debugreg.h>
+#include <asm/hvm/viridian.h>
 #include <asm/msr.h>
 #include <asm/setup.h>
 
xen/include/asm-x86/hvm/vcpu.h +0 -2
@@ -20,9 +20,7 @@
 #define __ASM_X86_HVM_VCPU_H__
 
 #include <xen/tasklet.h>
-#include <asm/hvm/io.h>
 #include <asm/hvm/vlapic.h>
-#include <asm/hvm/viridian.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vvmx.h>
 #include <asm/hvm/svm/vmcb.h>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

PATCH v3 3/9 x86/HVM: reduce vpt.h include dependencies

In reply to Jan Beulich

Drop #include-s not needed by the header itself.

xen/include/asm-x86/hvm/vpt.h +2 -8
@@ -19,16 +19,9 @@
 #ifndef __ASM_X86_HVM_VPT_H__
 #define __ASM_X86_HVM_VPT_H__
 
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/time.h>
-#include <xen/errno.h>
-#include <xen/time.h>
 #include <xen/timer.h>
 #include <xen/list.h>
-#include <asm/hvm/vpic.h>
-#include <asm/hvm/irq.h>
-#include <public/hvm/save.h>
+#include <asm/hvm/hvm.h>
 
 /*
  * Abstract layer of periodic time, one short time.
@@ -145,6 +138,7 @@ struct pl_time {    /* platform time */
 void pt_save_timer(struct vcpu *v);
 void pt_restore_timer(struct vcpu *v);
 int pt_update_irq(struct vcpu *v);
+struct hvm_intack;
 void pt_intr_post(struct vcpu *v, struct hvm_intack intack);
 void pt_migrate(struct vcpu *v);
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

PATCH v3 4/9 x86/HVM: reduce vpic.h include dependencies

In reply to Jan Beulich

Drop an #include not needed by the header itself.

xen/include/asm-x86/hvm/vpic.h +2 -1
@@ -27,7 +27,8 @@
 #ifndef __ASM_X86_HVM_VPIC_H__
 #define __ASM_X86_HVM_VPIC_H__
 
-#include <public/hvm/save.h>
+struct domain;
+struct vcpu;
 
 void vpic_irq_positive_edge(struct domain *d, int irq);
 void vpic_irq_negative_edge(struct domain *d, int irq);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

PATCH v3 5/9 x86/HVM: reduce vioapic.h include dependencies

In reply to Jan Beulich

Drop an #include not needed by the header itself. While verifying the header (now) builds standalone, I noticed an omission in a public header which gets taken care of here as well.

xen/include/asm-x86/hvm/vioapic.h +0 -1
@@ -25,7 +25,6 @@
 #define __ASM_X86_HVM_VIOAPIC_H__
 
 #include <xen/types.h>
-#include <xen/smp.h>
 #include <public/hvm/save.h>
 
 #define VIOAPIC_VERSION_ID 0x11 /* IOAPIC version */
xen/include/public/arch-x86/hvm/save.h +2 -0
@@ -26,6 +26,8 @@
 #ifndef __XEN_PUBLIC_HVM_SAVE_X86_H__
 #define __XEN_PUBLIC_HVM_SAVE_X86_H__
 
+#include "../../xen.h"
+
 /*
  * Save/restore header: general info about the save file.
  */

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

PATCH v3 6/9 x86/HVM: reduce vlapic.h include dependencies

In reply to Jan Beulich

Drop #include-s not needed by the header itself.

xen/include/asm-x86/hvm/vlapic.h +0 -2
@@ -21,8 +21,6 @@
 #define __ASM_X86_HVM_VLAPIC_H__
 
 #include <xen/tasklet.h>
-#include <asm/msr.h>
-#include <public/hvm/ioreq.h>
 #include <asm/hvm/vpt.h>
 
 #define vcpu_vlapic(x)   (&(x)->arch.hvm.vlapic)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

PATCH v3 7/9 x86/HVM: reduce io.h include dependencies

In reply to Jan Beulich

Drop #include-s not needed by the header itself as well as one include of the header which isn't needed. Put the one needed into the file actually requiring it.

xen/include/asm-x86/hvm/io.h +0 -4
@@ -19,12 +19,8 @@
 #ifndef __ASM_X86_HVM_IO_H__
 #define __ASM_X86_HVM_IO_H__
 
-#include <xen/mm.h>
 #include <xen/pci.h>
-#include <asm/hvm/vpic.h>
-#include <asm/hvm/vioapic.h>
 #include <public/hvm/ioreq.h>
-#include <public/event_channel.h>
 
 #define NR_IO_HANDLERS 32
 
xen/include/asm-x86/hvm/vcpu.h +1 -0
@@ -26,6 +26,7 @@
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/mtrr.h>
+#include <public/hvm/ioreq.h>
 
 enum hvm_io_completion {
     HVMIO_no_completion,
xen/include/asm-x86/hvm/vmx/vmcs.h +0 -2
@@ -18,8 +18,6 @@
 #ifndef __ASM_X86_HVM_VMX_VMCS_H__
 #define __ASM_X86_HVM_VMX_VMCS_H__
 
-#include <asm/hvm/io.h>
-
 extern void vmcs_dump_vcpu(struct vcpu *v);
 extern void setup_vmcs_dump(void);
 extern int  vmx_cpu_up_prepare(unsigned int cpu);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

PATCH v3 8/9 x86/HVM: reduce hvm.h include dependencies

In reply to Jan Beulich

Drop #include-s not needed by the header itself, and add smaller scope ones instead. Put the ones needed into whichever other files actually need them.

---
v2: Also make things build with PV_SHIM_EXCLUSIVE=y.

xen/include/asm-x86/hvm/emulate.h +1 -0
@@ -13,6 +13,7 @@
 #define __ASM_X86_HVM_EMULATE_H__
 
 #include <xen/err.h>
+#include <xen/mm.h>
 #include <asm/hvm/hvm.h>
 #include <asm/x86_emulate.h>
 
xen/include/asm-x86/hvm/hvm.h +3 -3
@@ -20,12 +20,11 @@
 #ifndef __ASM_X86_HVM_HVM_H__
 #define __ASM_X86_HVM_HVM_H__
 
+#include <asm/alternative.h>
+#include <asm/asm_defns.h>
 #include <asm/current.h>
 #include <asm/x86_emulate.h>
 #include <asm/hvm/asid.h>
-#include <public/domctl.h>
-#include <public/hvm/save.h>
-#include <xen/mm.h>
 
 #ifdef CONFIG_HVM_FEP
 /* Permit use of the Forced Emulation Prefix in HVM guests */
@@ -326,6 +325,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
 void hvm_toggle_singlestep(struct vcpu *v);
 void hvm_fast_singlestep(struct vcpu *v, uint16_t p2midx);
 
+struct npfec;
 int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
                               struct npfec npfec);
 
xen/include/asm-x86/hvm/vmx/vmcs.h +2 -0
@@ -18,6 +18,8 @@
 #ifndef __ASM_X86_HVM_VMX_VMCS_H__
 #define __ASM_X86_HVM_VMX_VMCS_H__
 
+#include <xen/mm.h>
+
 extern void vmcs_dump_vcpu(struct vcpu *v);
 extern void setup_vmcs_dump(void);
 extern int  vmx_cpu_up_prepare(unsigned int cpu);
xen/include/asm-x86/hvm/vpt.h +1 -0
@@ -21,6 +21,7 @@
 
 #include <xen/timer.h>
 #include <xen/list.h>
+#include <xen/rwlock.h>
 #include <asm/hvm/hvm.h>
 
 /*

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

PATCH v3 9/9 x86: reduce mce.h include dependencies

In reply to Jan Beulich

Drop the public header #include as not needed by the header itself. Add one that was missing, and move all inside the inclusion guard.

xen/include/asm-x86/mce.h +6 -2
@@ -1,8 +1,9 @@
-#include <xen/types.h>
-#include <public/arch-x86/xen-mca.h>
 #ifndef _XEN_X86_MCE_H
 #define _XEN_X86_MCE_H
 
+#include <xen/spinlock.h>
+#include <xen/types.h>
+
 /*
  * Emulate 2 banks for guest
  * Bank0: reserved for 'bank0 quirk' occur at some very old processors:
@@ -32,6 +33,9 @@ struct vmce {
     struct vmce_bank bank[GUEST_MC_BANK_NUM];
 };
 
+struct domain;
+struct vcpu;
+
 /* Guest vMCE MSRs virtualization */
 extern void vmce_init_vcpu(struct vcpu *);
 extern int vmce_restore_vcpu(struct vcpu *, const struct hvm_vmce_vcpu *);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on the v3 series
#11 lore raw
In reply to Jan Beulich
Quoted 19 lines · Jan Beulich

In a number of cases I've noticed the x86 emulator, which is quite slow to build especially with not very new gcc, to re-build when having changed headers which I wouldn't have expected to be included there in the first place. Hence I've gone through the dependencies of that object file and tried to get rid of at least some of the very odd dependencies there. (Some are being addressed also be the separately sent mem-access and vm-event patches with a similar subject.)

1: HVM: reduce domain.h include dependencies
2: HVM: reduce vcpu.h include dependencies
3: HVM: reduce vpt.h include dependencies
4: HVM: reduce vpic.h include dependencies
5: HVM: reduce vioapic.h include dependencies
6: HVM: reduce vlapic.h include dependencies
7: HVM: reduce io.h include dependencies
8: HVM: reduce hvm.h include dependencies
9: reduce mce.h include dependencies

Quoted 3 lines

v3: Address build issues in particular with XSM=y + PV_SHIM=y (patch

    1 only).

v2: Address build issues in particular with XSM=y.

I've tried a variety of configs and everything LGTM now.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel