diff mbox series

[1/9] x86/HVM: reduce domain.h include dependencies

Message ID 22a7eb01-deb6-4b05-28b4-6e24a3869636@suse.com (mailing list archive)
State Superseded
Headers show
Series x86: reduce include dependencies | expand

Commit Message

Jan Beulich March 9, 2020, 12:06 p.m. UTC
Drop #include-s not needed by the header itself. Put the ones needed
into whichever other files actually need them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper March 9, 2020, 1:33 p.m. UTC | #1
On 09/03/2020 12:06, Jan Beulich wrote:
> Drop #include-s not needed by the header itself. Put the ones needed
> into whichever other files actually need them.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Having attempted to compile this myself, you're at a minimum missing
Flask, viridian, general HVM (because I can't spot any other way dm.c
wouldn't be compiled), xen guest and shim.

The vm_event failures I presume is due to a dependency on your singleton
patches.  OTOH,

> --- a/xen/arch/x86/msr.c
> +++ b/xen/arch/x86/msr.c
> @@ -28,6 +28,8 @@
>  #include <asm/msr.h>
>  #include <asm/setup.h>
>  
> +#include <public/hvm/params.h>

What failed to compile here?  I can't spot anything in msr.c which uses
the params.

~Andrew
Jan Beulich March 9, 2020, 1:52 p.m. UTC | #2
On 09.03.2020 14:33, Andrew Cooper wrote:
> On 09/03/2020 12:06, Jan Beulich wrote:
>> Drop #include-s not needed by the header itself. Put the ones needed
>> into whichever other files actually need them.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Having attempted to compile this myself, you're at a minimum missing
> Flask, viridian, general HVM (because I can't spot any other way dm.c
> wouldn't be compiled), xen guest and shim.

I admit I forgot to try an XSM/Flask build, but I'm pretty puzzled by
the other items you list. In fact before submitting I tried the series
on a plain staging tree to exclude there being dependencies on other
patches I have in my try. (I now realize I also meant to check the
clang build before sending.)

> The vm_event failures I presume is due to a dependency on your singleton
> patches.

As per above, things do build fine for me without these. In fact the
order the patches got created was such that the mem-access and vm-event
ones got added last.

>  OTOH,
> 
>> --- a/xen/arch/x86/msr.c
>> +++ b/xen/arch/x86/msr.c
>> @@ -28,6 +28,8 @@
>>  #include <asm/msr.h>
>>  #include <asm/setup.h>
>>  
>> +#include <public/hvm/params.h>
> 
> What failed to compile here?  I can't spot anything in msr.c which uses
> the params.

#define viridian_feature_mask(d) \
    (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)

#define is_viridian_domain(d) \
    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))

Jan
Jan Beulich March 9, 2020, 2:22 p.m. UTC | #3
On 09.03.2020 14:33, Andrew Cooper wrote:
> On 09/03/2020 12:06, Jan Beulich wrote:
>> Drop #include-s not needed by the header itself. Put the ones needed
>> into whichever other files actually need them.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Having attempted to compile this myself, you're at a minimum missing
> Flask, viridian, general HVM (because I can't spot any other way dm.c
> wouldn't be compiled), xen guest and shim.

So other than I first understood (in particular because you
specifically mention dm.c and it potentially not getting built in
whatever [strange] config you may have suspect I did use) this
looks to be fallout from all the same (XSM-enabled) build, as I
can see that too. The issues, afaics for now, all stem from the
fact that dummy.h include public/hvm/params.h, but with XSM
enabled there's no other place this inclusion would now come from.
Pretty fragile, but fixable.

Jan
diff mbox series

Patch

--- a/xen/arch/x86/cpu/mcheck/vmce.c
+++ b/xen/arch/x86/cpu/mcheck/vmce.c
@@ -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>
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -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
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -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))
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -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)
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -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)
 {
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -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
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -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)
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -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,
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -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 {
--- a/xen/include/asm-x86/hvm/nestedhvm.h
+++ b/xen/include/asm-x86/hvm/nestedhvm.h
@@ -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 */
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -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