From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qnz2g-00084h-PF for qemu-devel@nongnu.org; Mon, 01 Aug 2011 16:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qnz2f-0002la-Fr for qemu-devel@nongnu.org; Mon, 01 Aug 2011 16:24:50 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:34622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qnz2f-0002lS-Cq for qemu-devel@nongnu.org; Mon, 01 Aug 2011 16:24:49 -0400 Received: by yia25 with SMTP id 25so4398304yia.4 for ; Mon, 01 Aug 2011 13:24:48 -0700 (PDT) Message-ID: <4E370B8D.3030200@codemonkey.ws> Date: Mon, 01 Aug 2011 15:24:45 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1312135082-31985-1-git-send-email-avi@redhat.com> <1312135082-31985-21-git-send-email-avi@redhat.com> <20110801082600.GD5439@redhat.com> <4E367370.6070100@redhat.com> <20110801102322.GF5439@redhat.com> In-Reply-To: <20110801102322.GF5439@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 20/39] virtio-pci: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org On 08/01/2011 05:23 AM, Michael S. Tsirkin wrote: > On Mon, Aug 01, 2011 at 12:35:44PM +0300, Avi Kivity wrote: >> On 08/01/2011 11:26 AM, Michael S. Tsirkin wrote: >>>> >>>> static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, >>>> uint32_t val, int len) >>>> { >>>> VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); >>>> + VirtIODevice *vdev = proxy->vdev; >>>> >>>> if (PCI_COMMAND == address) { >>>> if (!(val& PCI_COMMAND_MASTER)) { >>>> @@ -525,6 +503,9 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, >>>> } >>>> } >>>> } >>>> + if (address == PCI_BASE_ADDRESS_0&& vdev->config_len) { >>>> + vdev->get_config(vdev, vdev->config); >>>> + } >>>> >>>> pci_default_write_config(pci_dev, address, val, len); >>>> msix_write_config(pci_dev, address, val, len); >>> >>> I'm not really sure why did we get the config on map, >>> specifically - Anthony, do you know? >>> But if we want to do that, memory space enable might >>> be a better place. Or maybe we just want a callback on >>> map. >> >> >> Just because a memory region becomes visible to the cpu is no reason >> to have a callback. From the device perspective, it can't tell that >> it happened. > > Well, the reason we have this logic here, I think, is > to make sure it runs before the guest accesses > the configuration with a write access. > > I'm not sure why we don't do this in the init > callback - Anthony? It could be done in init I think. I can't recall why it didn't start that way initially. Regards, Anthony Liguori > > >> -- >> error compiling committee.c: too many arguments to function >