Lines Matching refs:pdev
112 u8 devfn, struct pci_dev *pdev) in amd_iommu_setup_domain_device() argument
118 u8 bus = pdev->bus; in amd_iommu_setup_domain_device()
143 if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && in amd_iommu_setup_domain_device()
152 req_id, pdev->type, in amd_iommu_setup_domain_device()
161 if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && in amd_iommu_setup_domain_device()
162 !pci_ats_enabled(iommu->seg, bus, pdev->devfn) ) in amd_iommu_setup_domain_device()
164 if ( devfn == pdev->devfn ) in amd_iommu_setup_domain_device()
165 enable_ats_device(pdev, &iommu->ats_devices); in amd_iommu_setup_domain_device()
167 amd_iommu_flush_iotlb(devfn, pdev, INV_IOMMU_ALL_PAGES_ADDRESS, 0); in amd_iommu_setup_domain_device()
249 static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev);
301 u8 devfn, struct pci_dev *pdev) in amd_iommu_disable_domain_device() argument
306 u8 bus = pdev->bus; in amd_iommu_disable_domain_device()
317 if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && in amd_iommu_disable_domain_device()
332 if ( devfn == pdev->devfn && in amd_iommu_disable_domain_device()
335 disable_ats_device(pdev); in amd_iommu_disable_domain_device()
339 u8 devfn, struct pci_dev *pdev) in reassign_device() argument
345 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in reassign_device()
346 iommu = find_iommu_for_device(pdev->seg, bdf); in reassign_device()
351 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in reassign_device()
356 amd_iommu_disable_domain_device(source, iommu, devfn, pdev); in reassign_device()
358 if ( devfn == pdev->devfn ) in reassign_device()
360 list_move(&pdev->domain_list, &target->arch.pdev_list); in reassign_device()
361 pdev->domain = target; in reassign_device()
368 amd_iommu_setup_domain_device(target, iommu, devfn, pdev); in reassign_device()
370 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in reassign_device()
377 struct pci_dev *pdev, in amd_iommu_assign_device() argument
380 struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(pdev->seg); in amd_iommu_assign_device()
381 int bdf = PCI_BDF2(pdev->bus, devfn); in amd_iommu_assign_device()
382 int req_id = get_dma_requestor_id(pdev->seg, bdf); in amd_iommu_assign_device()
394 return reassign_device(hardware_domain, d, devfn, pdev); in amd_iommu_assign_device()
464 static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev) in amd_iommu_add_device() argument
469 if ( !pdev->domain ) in amd_iommu_add_device()
472 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in amd_iommu_add_device()
473 iommu = find_iommu_for_device(pdev->seg, bdf); in amd_iommu_add_device()
477 if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE && in amd_iommu_add_device()
478 is_hardware_domain(pdev->domain) ) in amd_iommu_add_device()
481 pdev->seg, pdev->bus, PCI_SLOT(devfn), in amd_iommu_add_device()
487 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in amd_iommu_add_device()
488 pdev->domain->domain_id); in amd_iommu_add_device()
492 amd_iommu_setup_domain_device(pdev->domain, iommu, devfn, pdev); in amd_iommu_add_device()
496 static int amd_iommu_remove_device(u8 devfn, struct pci_dev *pdev) in amd_iommu_remove_device() argument
500 if ( !pdev->domain ) in amd_iommu_remove_device()
503 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in amd_iommu_remove_device()
504 iommu = find_iommu_for_device(pdev->seg, bdf); in amd_iommu_remove_device()
509 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in amd_iommu_remove_device()
510 pdev->domain->domain_id); in amd_iommu_remove_device()
514 amd_iommu_disable_domain_device(pdev->domain, iommu, devfn, pdev); in amd_iommu_remove_device()