From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCDni-0007HH-BZ for qemu-devel@nongnu.org; Mon, 26 Mar 2012 13:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCDng-0003Hp-8e for qemu-devel@nongnu.org; Mon, 26 Mar 2012 13:33:49 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:41498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCDng-0003HL-3z for qemu-devel@nongnu.org; Mon, 26 Mar 2012 13:33:48 -0400 Received: by obbwd20 with SMTP id wd20so6263591obb.4 for ; Mon, 26 Mar 2012 10:33:46 -0700 (PDT) Message-ID: <4F70A877.3060809@codemonkey.ws> Date: Mon, 26 Mar 2012 12:33:43 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1332727608-26523-1-git-send-email-liwp@linux.vnet.ibm.com> <4F705F08.4010002@siemens.com> In-Reply-To: <4F705F08.4010002@siemens.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , Wanpeng Li , qemu-devel@nongnu.org, Isaku Yamahata , Avi Kivity , Paolo Bonzini , Gavin Shan On 03/26/2012 07:20 AM, Jan Kiszka wrote: > On 2012-03-26 04:06, Wanpeng Li wrote: >> From: Anthony Liguori >> >> >> This series aggressively refactors the PC machine initialization to be more >> modelled and less ad-hoc. The highlights of this series are: >> >> 1) Things like -m and -bios-name are now device model properties >> >> 2) The i440fx and piix3 are now modelled in a thorough fashion >> >> 3) Most of the chipset features of the piix3 are modelled through composition >> >> 4) i440fx_init is trivialized to creating devices and setting properties >> >> 5) convert MemoryRegion to QOM >> >> 6) convert PCI host bridge to QOM >> >> The point (4) is the most important one. As we refactor in this fashion, >> we should quickly get to the point where machine->init disappears completely in >> favor of just creating a handful of devices. >> >> The two stage initialization of QOM is important here. instance_init() is when >> composed devices are created which means that after you've created a device, all >> of its children are visible in the device model. This lets you set properties >> of the parent and its children. >> >> realize() (which is still called DeviceState::init today) will be called right >> before the guest starts up for the first time. > > While I see the value of the overall direction, I still disagree on > making internal data structures of HPET, RTC and 8254 publicly > available. That's a wrong step back. I'm sure there are smarter > solutions, alse as there were some proposals back then in the original > thread. I'm not fully decided myself. A couple things are clear to me though: 1) We must expose type proper types in header files. We need there to be a globally accessible RTCState type and functions that operate on it. 2) We can simplify memory management by knowing the size of the type in the header files too. Since this is an easily refactorable thing to look at later, I think we should start with extracting the types. > > I'm also sure we will have to refactor the merge significantly again for > the introduction of additional chipsets and PC boards. But unless those > requirements can already be specified (Isaku?), that might be unavoidable. We cannot introduce another chipset without properly refactoring the i440fx. The previous refactorings that were oriented around moving code into functions created a nasty spaghetti of reference passing. Regards, Anthony Liguori > Jan >