From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Subject: Re: [Qemu-devel] KVM call minutes 2013-01-29 - Port I/O Date: Wed, 30 Jan 2013 21:19:35 +0100 Message-ID: <51098057.3020208@suse.de> References: <871ud4gfoa.fsf@elfo.elfo> <5109065B.4060803@suse.de> <51094024.20803@redhat.com> <87vcae8wbk.fsf@codemonkey.ws> <51095049.7090407@suse.de> <87r4l260kp.fsf@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Gerd Hoffmann , Juan Quintela , KVM devel mailing list , qemu-devel , Alexander Graf , Benjamin Herrenschmidt , qemu-ppc , =?UTF-8?B?SGVydsOpIFBvdXNzaW5lYXU=?= , David Gibson , Alon Levy , "Michael S. Tsirkin" To: Anthony Liguori Return-path: Received: from cantor2.suse.de ([195.135.220.15]:37557 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750908Ab3A3UTu (ORCPT ); Wed, 30 Jan 2013 15:19:50 -0500 In-Reply-To: <87r4l260kp.fsf@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: Am 30.01.2013 18:29, schrieb Anthony Liguori: > Andreas F=C3=A4rber writes: >=20 >> Am 30.01.2013 17:33, schrieb Anthony Liguori: >>> Gerd Hoffmann writes: >>> >>>>> hw/qxl.c: portio_list_add(qxl_vga_port_list, >>>>> pci_address_space_io(dev), 0x3b0); >>>>> hw/vga.c: portio_list_add(vga_port_list, address_space_io,= 0x3b0); >>>> >>>> That reminds me I should solve this in a more elegant way. >>>> >>>> qxl takes over the vga io ports. The reason it does this is becau= se qxl >>>> switches into vga mode in case the vga ports are accessed while no= t in >>>> vga mode. After doing the check (and possibly switching mode) the= vga >>>> handler is called to actually handle it. >>> >>> The best way to handle this would be to remodel how we do VGA. >>> >>> Make VGACommonState a proper QOM object and use it as the base clas= s for >>> QXL, CirrusVGA, QEMUVGA (std-vga), and VMwareVGA. >> >> That would require polymorphism since we already need to derive from >> PCIDevice or ISADevice respectively for interfacing with the bus... >=20 > Nope. You can use composition: >=20 > QXLDevice is-a VGACommonState >=20 > QXLPCI is-a PCIDevice > has-a QXLDevice >=20 >> Modern object-oriented languages have tried to avoid multi-inheriten= ce >> due to arising complications, I thought. Wouldn't object if someone >> wanted to do the dirty implementation work though. ;) >=20 > There is no need for MI. >=20 >> Another such example is EHCI, with PCIDevice and SysBusDevice fronte= nds, >> sharing an EHCIState struct and having helper functions operating on >> that core state only. Quite a few device share such a pattern today >> actually (serial, m48t59, ...). >=20 > Yes, this is all about chipset modelling. Chipsets should derive fro= m > device and then be embedded in the appropriate bus device. >=20 > For instance. >=20 > SerialState is-a DeviceState >=20 > ISASerialState is-a ISADevice, has-a SerialState > MMIOSerialState is-a SysbusDevice, has-a SerialState Okay, but I don't like that both are transitively DeviceState then. It's much too easy to add / hot-add the wrong device then, especially when dropping no_user. Andreas > This is what we're doing in practice, we just aren't modeling the > chipsets and we're open coding the relationships (often in subtley > different ways). >=20 > Regards, >=20 > Anthony Liguori --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg