On 4/2/10, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 04/02/2010 05:22 PM, Anthony Liguori wrote: > > > > hw/* should never access CPUState. > > > > Can you give examples of when qemu-kvm needs this? > > > > Indirectly via header files. The problem is that GCC poisoning complains > on prototypes too. > > qemu-kvm.h references CPUState and includes cpu.h, so with the latest > changes all files that include qemu-kvm.h break, even if they don't require > qemu-kvm.h. With this patch they instead get the opaque definition via > hw/hw.h (which includes cpu-common.h), and qemu-kvm.h can avoid including > cpu.h.
This is why I added #ifndef NEED_CPU_H to kvm.h. > Another example is the new apic.h file created by Blue Swirl. It > references CPUState. It includes apic_get_irq_delivered, so I placed > apic_set_irq_delivered there too. But apic_set_irq_delivered is used by > i8259.c which is compiled once. But i8259.c is compiled per target, grep Makefile.target? > There are other similar cases. Without something like this patch as a > stopgap measure, you have to make everything compile again per-target which > is a huge mess of conflicts. This is wrong. There are lot of other ways to handle the need without resorting to per-target build.