Skip to content

Commit

Permalink
pci: assign devfn to pci_dev before calling pci_device_iommu_address_…
Browse files Browse the repository at this point in the history
…space()

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.

Fixes: 9eda7d3
    pci: Introduce helper to retrieve a PCI device's DMA address space

Cc: [email protected]
Signed-off-by: Le Tan <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
tamlok authored and mstsirkin committed Jul 6, 2014
1 parent 812c105 commit efc8188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit efc8188

Please sign in to comment.