From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uju0z-0006MK-HL for qemu-devel@nongnu.org; Tue, 04 Jun 2013 12:23:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uju0x-0006DP-2X for qemu-devel@nongnu.org; Tue, 04 Jun 2013 12:23:17 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:56494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uju0w-0006Cz-TN for qemu-devel@nongnu.org; Tue, 04 Jun 2013 12:23:14 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Jun 2013 12:23:14 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 718A638C8074 for ; Tue, 4 Jun 2013 12:23:08 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r54GN9K1343490 for ; Tue, 4 Jun 2013 12:23:09 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r54GN8cF032463 for ; Tue, 4 Jun 2013 13:23:08 -0300 From: Jesse Larrew Date: Tue, 4 Jun 2013 11:22:42 -0500 Message-Id: <1370362965-3937-1-git-send-email-jlarrew@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 0/3] Notify devices when a bus is attached List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jasowang@redhat.com, mdroth@linux.vnet.ibm.com, fred.konrad@greensocs.com The virtio-net driver can determine the required size of the config struct dynamically by inspecting the feature bits in host_features. The natural place to perform this calculation is within the driver's init routine. However, host_features isn't set until later when the device is plugged into a bus. VirtioBusClass includes a callback method, device_plugged(), that allows the bus to perform additional setup tasks when a device is plugged into the bus. This patch set similarly extends VirtioDeviceClass to add a callback, bus_plugged(), to allow devices the same setup opportunity. This allows virtio-net to defer the config size calculation until host_features is available, which I think will be a better long-term fix to the problem addressed in e9016ee2bda1b7757072b856b2196f691aee3388. [PATCH 1/3] virtio: add bus_plugged() callback to VirtioDeviceClass [PATCH 2/3] virtio-net: implement bus_plugged() [PATCH 3/3] virtio-net: revert MAC address workaround hw/net/virtio-net.c | 20 +++++++++++++++++++- hw/virtio/virtio.c | 3 +++ include/hw/virtio/virtio.h | 1 + 3 files changed, 23 insertions(+), 1 deletion(-)