qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 0/8] include qdev core in *-user, make CPU child o


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [RFC 0/8] include qdev core in *-user, make CPU child of DeviceState
Date: Wed, 22 Aug 2012 10:08:48 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Aug 22, 2012 at 12:05:44PM +0300, Avi Kivity wrote:
> On 08/21/2012 06:42 PM, Eduardo Habkost wrote:
> > So, here's a third suggestion to the CPU/DeviceState problem. Basically I 
> > split
> > the qdev code into a core (that can be easily compiled into *-user), and a 
> > part
> > specific to qemu-system-*.
> > 
> 
> I'm barging in late here, so sorry if this has been suggested and shot
> down: is it not possible to use composition here?
> 
>   typedef ... CPU;
> 
>   typedef struct CPUState {
>       DeviceState qdev;
>       CPU cpu;
>   } CPUState;
> 
> But I guess bringing qdev to -user is inevitable.

I guess it would be OK, and almost equivalent to the suggestion by
Anthony (use a different parent class for the CPU class on system-* and
*-user), as most state today is in the arch-specific classes.

The only problem I see is when some part of the CPU code starts using a
DeviceState feature (e.g. calling x86_cpu_realize() only at
qdev_init()-time). Then we have to duplicate some code to make *-user
work differently (not much code, I guess, but it would still make it
easier to break it if we have two implementations).

-- 
Eduardo



reply via email to

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