qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] provide opaque CPUState to files that are comp


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] provide opaque CPUState to files that are compiled once
Date: Fri, 2 Apr 2010 19:18:04 +0300

On 4/2/10, Paolo Bonzini <address@hidden> wrote:
>
>
> >
> > >  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.
> >
>
>  Yes, but adding NEED_CPU_H everywhere is just as bad, or worse.

I fully agree that devices should not use NEED_CPU_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?
> >
>
>  Hmm, that was something else, but apic.h was it. :-)

As a concrete example, qemu-kvm's apic.c and ours differ w.r.t.
CPUState use only in kvm_save/load_lapic. But these functions could
just as easily take APICState* as their parameter and the need to pass
CPUState is gone.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]