From patchwork Thu Aug 4 13:05:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 108486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E2800B6F68 for ; Fri, 5 Aug 2011 00:20:12 +1000 (EST) Received: from localhost ([::1]:44523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qoxe4-0002O7-Lh for incoming@patchwork.ozlabs.org; Thu, 04 Aug 2011 09:07:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoxdK-0000gg-48 for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoxdJ-0007Lb-80 for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoxdI-0007LN-Vn for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:41 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p74D6dRO003513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Aug 2011 09:06:39 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p74D6cwj012262; Thu, 4 Aug 2011 09:06:38 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id A092D250B3A; Thu, 4 Aug 2011 16:06:37 +0300 (IDT) From: Avi Kivity To: Anthony Liguori , qemu-devel@nongnu.org Date: Thu, 4 Aug 2011 16:05:57 +0300 Message-Id: <1312463195-13605-2-git-send-email-avi@redhat.com> In-Reply-To: <1312463195-13605-1-git-send-email-avi@redhat.com> References: <1312463195-13605-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v3 01/39] virtio-pci: get config on init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Michael S. Tsirkin" We originally did get config on map, so that following write accesses are done on an updated config. New memory API doesn't give us a callback on map, and arguably, devices don't know when cpu really can access there. So updating on init seems cleaner. Signed-off-by: Michael S. Tsirkin Signed-off-by: Avi Kivity --- hw/virtio-pci.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index d685243..ca1f12f 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -506,9 +506,6 @@ static void virtio_map(PCIDevice *pci_dev, int region_num, register_ioport_read(addr, config_len, 1, virtio_pci_config_readb, proxy); register_ioport_read(addr, config_len, 2, virtio_pci_config_readw, proxy); register_ioport_read(addr, config_len, 4, virtio_pci_config_readl, proxy); - - if (vdev->config_len) - vdev->get_config(vdev, vdev->config); } static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, @@ -689,6 +686,10 @@ void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev) proxy->host_features |= 0x1 << VIRTIO_F_NOTIFY_ON_EMPTY; proxy->host_features |= 0x1 << VIRTIO_F_BAD_FEATURE; proxy->host_features = vdev->get_features(vdev, proxy->host_features); + + if (vdev->config_len) { + vdev->get_config(vdev, vdev->config); + } } static int virtio_blk_init_pci(PCIDevice *pci_dev)