|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM |
Date: | Tue, 27 Mar 2012 08:52:26 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120310 Thunderbird/11.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |