From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxjfH-0006JC-9z for qemu-devel@nongnu.org; Fri, 02 Apr 2010 12:24:11 -0400 Received: from [140.186.70.92] (port=51184 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxjfF-0006Is-2X for qemu-devel@nongnu.org; Fri, 02 Apr 2010 12:24:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxjfD-0005aX-I6 for qemu-devel@nongnu.org; Fri, 02 Apr 2010 12:24:08 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:57751) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxjfD-0005aQ-F4 for qemu-devel@nongnu.org; Fri, 02 Apr 2010 12:24:07 -0400 Received: by gyd5 with SMTP id 5so1051310gyd.4 for ; Fri, 02 Apr 2010 09:24:06 -0700 (PDT) Message-ID: <4BB61A21.20008@codemonkey.ws> Date: Fri, 02 Apr 2010 11:24:01 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] provide opaque CPUState to files that are compiled once References: <1270219540-30027-1-git-send-email-pbonzini@redhat.com> <4BB60BB9.2050301@codemonkey.ws> <4BB610A7.8010006@redhat.com> In-Reply-To: <4BB610A7.8010006@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 04/02/2010 10:43 AM, Paolo Bonzini 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. > > 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. > > 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. I'd rather things be compiled per-target than adding a bunch of crud everywhere. Wouldn't it be easier to split up qemu-kvm.h into qemu-kvm-cpu.h and add the later include where it's needed (which should be very few places)? Regards, Anthony Liguori > Paolo