Received: from eggs.gnu.org ([2001:4830:134:3::10]:52013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X283v-0002Vq-0g for qemu-devel@nongnu.org; Tue, 01 Jul 2014 20:06:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X283l-000629-SO for qemu-devel@nongnu.org; Tue, 01 Jul 2014 20:06:10 -0400 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:39539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X283l-00061z-LR for qemu-devel@nongnu.org; Tue, 01 Jul 2014 20:06:01 -0400 Received: by mail-pd0-f174.google.com with SMTP id y10so10960086pdj.33 for ; Tue, 01 Jul 2014 17:06:00 -0700 (PDT) From: Le Tan Date: Wed, 2 Jul 2014 08:06:35 +0800 Message-Id: <1404259595-21680-1-git-send-email-tamlokveer@gmail.com> Subject: [Qemu-devel] [PATCH] pci: assign devfn to pci_dev before calling pci_device_iommu_address_space() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jan.kiszka@web.de, Le Tan , mst@redhat.com In function do_pci_register_device() in file hw/pci/pci.c, move the assignment of pci_dev->devfn to the position before the call to pci_device_iommu_address_space(pci_dev) which will use the value of pci_dev->devfn. Signed-off-by: Le Tan --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 17ed510..351d320 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -827,6 +827,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, } pci_dev->bus = bus; + pci_dev->devfn = devfn; dma_as = pci_device_iommu_address_space(pci_dev); memory_region_init_alias(&pci_dev->bus_master_enable_region, @@ -836,7 +837,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_enable_region, name); - pci_dev->devfn = devfn; pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state = 0; pci_config_alloc(pci_dev); -- 1.7.9.5