qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to ta


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM
Date: Tue, 27 Mar 2012 16:18:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120316 Thunderbird/11.0

On 03/27/2012 03:52 PM, Anthony Liguori wrote:
> 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.
>

Sounds about right.

> We really need to push forward with the refactoring to find the right
> model here.
>

Yes.  This is opportunistic reuse - we find some sections of both specs
that are identical, and we reuse the code there.

In fact code duplication is also justified here.  The specs are
duplicated, why not the code.  Not against deduplication of course, but
we need not go out of our way here.

-- 
error compiling committee.c: too many arguments to function




reply via email to

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