From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCWpB-0002TI-WA for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCWp6-0000kS-L9 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:52:37 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:48880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCWp6-0000iP-G8 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 09:52:32 -0400 Received: by obbwd20 with SMTP id wd20so7539010obb.4 for ; Tue, 27 Mar 2012 06:52:30 -0700 (PDT) Message-ID: <4F71C61A.2020900@codemonkey.ws> Date: Tue, 27 Mar 2012 08:52:26 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1332727608-26523-1-git-send-email-liwp@linux.vnet.ibm.com> <4F705F08.4010002@siemens.com> <20120326155444.GJ6016@valinux.co.jp> <4F70A77D.3020204@codemonkey.ws> <4F71970D.7060802@redhat.com> In-Reply-To: <4F71970D.7060802@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; 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: Avi Kivity Cc: Anthony Liguori , Wanpeng Li , Jan Kiszka , qemu-devel@nongnu.org, Isaku Yamahata , Paolo Bonzini , Gavin Shan On 03/27/2012 05:31 AM, Avi Kivity wrote: >> >> I think the better approach is to have a PCNorthBridge base-class that >> contains functionality like PAM/SRAM that both I440FX and Q35 inherit >> from. > > I hate to transform this into a languagey discussion, but I don't think > inheritance is the right thing here. While both 440fx and q35 are north > bridges, the similar implementation of PAM/SMRAM is not part of that. > It's just a random result of the chips' evolution. I think the code for > PAM/SMRAM can be reused if the specs match, but using a has-a instead of > an is-a relationship. The direction I was heading with the i440fx, the i440fx has-a i440fx-pmc and it was the pmc that actually did PAM/SMRAM. I don't recall there being significant i440fx specific logic in the i440fx-pmc so it's entirely possible the the i440fx-pmc could be renamed to PCNorthBridge and then both the i440fx and q35 could has-a the same PCNorthBridge (possible with some properties to control certain behaviors. We really need to push forward with the refactoring to find the right model here. Regards, Anthony Liguori > > As a counterexample, consider a northbridge that implements PAM/SMRAM > differently. You'd have to refactor PCNorthBridge into two separate > classes. With the other approach the new northbridge simply doesn't > include the existing PAM/SMRAM implementation and instead implements its > own. >