On 2014-07-01 14:55, Le Tan wrote: > 2014-07-01 20:52 GMT+08:00 Le Tan <tamlokv...@gmail.com>: >> Hi Jan, >> >> 2014-07-01 15:34 GMT+08:00 Jan Kiszka <jan.kis...@web.de>: >>> Hi Le, >>> >>> On 2014-07-01 04:34, Le Tan wrote: >>>> Hi Jan, >>>> I use pci_setup_iommu() to setup a PCIIOMMUFunc for the q35 pci bus. >>>> In the iommu_fn, I print out the devfn parameter and find out that it >>>> sometimes will be -1. So what does it mean? >>>> The detail code is here: >>>> >>>> In mch_init() function, I write like this: >>>> PCIBus *pci_bus = PCI_BUS(qdev_get_parent_bus(DEVICE(mch))); >>>> pci_setup_iommu(pci_bus, q35_host_dma_iommu, mch->iommu); >>>> >>>> And in q35_host_dma_iommu(PCIBus *bus, void *opaque, int devfn), I >>>> print out the devfn parameter, sometimes it will be -1. >>> >>> Hmm, I have no idea about the reason and would suggest to set a >>> conditional breakpoint on this function, then print the backtrace to see >>> where this comes from and analyze the device structure from where that >>> -1 was most probably taken. > > I think maybe this is a bug? In the function do_pci_register_device(), > maybe these two sentence should be reorder? > dma_as = pci_device_iommu_address_space(pci_dev); > pci_dev->devfn = devfn;
Looks like. Give it a try, then possibly send a patch :) Jan
signature.asc
Description: OpenPGP digital signature