From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tksnu-0003sY-Tc for qemu-devel@nongnu.org; Tue, 18 Dec 2012 03:45:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tksnt-0008Si-Qh for qemu-devel@nongnu.org; Tue, 18 Dec 2012 03:45:34 -0500 Received: from mail-wg0-f42.google.com ([74.125.82.42]:52894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tksnt-0008Sc-Kf for qemu-devel@nongnu.org; Tue, 18 Dec 2012 03:45:33 -0500 Received: by mail-wg0-f42.google.com with SMTP id dr1so2121301wgb.5 for ; Tue, 18 Dec 2012 00:45:32 -0800 (PST) Sender: Paolo Bonzini Message-ID: <50D02D27.6070604@redhat.com> Date: Tue, 18 Dec 2012 09:45:27 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1346771633-53081-1-git-send-email-cornelia.huck@de.ibm.com> <1346771633-53081-4-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1346771633-53081-4-git-send-email-cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/5] s390: Add new channel I/O based virtio transport. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: linux-s390 , Anthony Liguori , Rusty Russell , KVM , Carsten Otte , Sebastian Ott , Marcelo Tosatti , Heiko Carstens , qemu-devel , Alexander Graf , Christian Borntraeger , Avi Kivity , Martin Schwidefsky Il 04/09/2012 17:13, Cornelia Huck ha scritto: > +VirtioCcwBus *virtio_ccw_bus_init(void) > +{ > + VirtioCcwBus *cbus; > + BusState *bus; > + DeviceState *dev; > + > + /* Create bridge device */ > + dev = qdev_create(NULL, "virtio-ccw-bridge"); > + qdev_init_nofail(dev); > + > + /* Create bus on bridge device */ > + bus = qbus_create(TYPE_VIRTIO_CCW_BUS, dev, "virtio-ccw"); > + cbus = DO_UPCAST(VirtioCcwBus, bus, bus); > + > + /* Enable hotplugging */ > + bus->allow_hotplug = 1; > + > + qemu_register_reset(virtio_ccw_reset_subchannels, cbus); Please use qdev device-reset and bus-reset callbacks instead of this. In particular, when writing the status you should call qdev_reset_all(DEVICE(sch)), and whatever state should be reset will have to be cleared by the device-reset callback of SubchDev, including calling virtio_reset. Everything else will be cleared instead by the bus-reset callback of virtio-ccw-bus, similar to what you are doing in virtio_ccw_reset_subchannels. Paolo > + return cbus; > +}