Pierrick Bouvier <pierrick.bouv...@linaro.org> writes: > "linux/kvm.h" is not included for code compiled without > COMPILING_PER_TARGET, and headers are different depending architecture > (arm, arm64). > Thus we need to manually expose some definitions that will > be used by target/arm, ensuring they are the same for arm amd aarch64. > > As well, we must but prudent to not redefine things if code is already > including linux/kvm.h, thus the #ifndef COMPILING_PER_TARGET guard. > > Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org> > --- > target/arm/kvm_arm.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h > index c8ddf8beb2e..eedd081064c 100644 > --- a/target/arm/kvm_arm.h > +++ b/target/arm/kvm_arm.h > @@ -16,6 +16,21 @@ > #define KVM_ARM_VGIC_V2 (1 << 0) > #define KVM_ARM_VGIC_V3 (1 << 1) > > +#ifndef COMPILING_PER_TARGET > + > +/* we copy those definitions from asm-arm and asm-aarch64, as they are the > same > + * for both architectures */ > +#define KVM_ARM_IRQ_CPU_IRQ 0 > +#define KVM_ARM_IRQ_CPU_FIQ 1 > +#define KVM_ARM_IRQ_TYPE_CPU 0 > +typedef unsigned int __u32; > +struct kvm_vcpu_init { > + __u32 target; > + __u32 features[7]; > +}; > + > +#endif /* COMPILING_PER_TARGET */ > +
I'm not keen on the duplication. It seems to be the only reason we have struct kvm_vcpu_init is for kvm_arm_create_scratch_host_vcpu() where the only *external* user passes in a NULL. If kvm_arm_create_scratch_host_vcpu() is made internal static to target/arm/kvm.c which will should always include the real linux headers you just need a QMP helper. For the IRQ types is this just a sign of target/arm/cpu.c needing splitting into TCG and KVM bits? > /** > * kvm_arm_register_device: > * @mr: memory region for this device -- Alex Bennée Virtualisation Tech Lead @ Linaro