Lines Matching refs:pdev

87     uint8_t devfn, struct pci_dev *pdev)  in amd_iommu_setup_domain_device()  argument
92 u8 bus = pdev->bus; in amd_iommu_setup_domain_device()
128 if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && in amd_iommu_setup_domain_device()
137 req_id, pdev->type, in amd_iommu_setup_domain_device()
146 if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && in amd_iommu_setup_domain_device()
147 !pci_ats_enabled(iommu->seg, bus, pdev->devfn) ) in amd_iommu_setup_domain_device()
149 if ( devfn == pdev->devfn ) in amd_iommu_setup_domain_device()
150 enable_ats_device(pdev, &iommu->ats_devices); in amd_iommu_setup_domain_device()
152 amd_iommu_flush_iotlb(devfn, pdev, INV_IOMMU_ALL_PAGES_ADDRESS, 0); in amd_iommu_setup_domain_device()
254 static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev);
276 uint8_t devfn, struct pci_dev *pdev) in amd_iommu_disable_domain_device() argument
281 u8 bus = pdev->bus; in amd_iommu_disable_domain_device()
318 if ( devfn == pdev->devfn && in amd_iommu_disable_domain_device()
321 disable_ats_device(pdev); in amd_iommu_disable_domain_device()
325 u8 devfn, struct pci_dev *pdev) in reassign_device() argument
331 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in reassign_device()
332 iommu = find_iommu_for_device(pdev->seg, bdf); in reassign_device()
337 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in reassign_device()
342 amd_iommu_disable_domain_device(source, iommu, devfn, pdev); in reassign_device()
344 if ( devfn == pdev->devfn ) in reassign_device()
346 list_move(&pdev->domain_list, &target->pdev_list); in reassign_device()
347 pdev->domain = target; in reassign_device()
354 amd_iommu_setup_domain_device(target, iommu, devfn, pdev); in reassign_device()
356 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in reassign_device()
363 struct pci_dev *pdev, in amd_iommu_assign_device() argument
366 struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(pdev->seg); in amd_iommu_assign_device()
367 int bdf = PCI_BDF2(pdev->bus, devfn); in amd_iommu_assign_device()
368 int req_id = get_dma_requestor_id(pdev->seg, bdf); in amd_iommu_assign_device()
380 return reassign_device(pdev->domain, d, devfn, pdev); in amd_iommu_assign_device()
443 static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev) in amd_iommu_add_device() argument
449 if ( !pdev->domain ) in amd_iommu_add_device()
452 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in amd_iommu_add_device()
455 if ( pdev->seg == iommu->seg && bdf == iommu->bdf ) in amd_iommu_add_device()
456 return is_hardware_domain(pdev->domain) ? 0 : -ENODEV; in amd_iommu_add_device()
458 iommu = find_iommu_for_device(pdev->seg, bdf); in amd_iommu_add_device()
462 if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE && in amd_iommu_add_device()
463 is_hardware_domain(pdev->domain) ) in amd_iommu_add_device()
466 pdev->seg, pdev->bus, PCI_SLOT(devfn), in amd_iommu_add_device()
472 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in amd_iommu_add_device()
473 pdev->domain->domain_id); in amd_iommu_add_device()
477 ivrs_mappings = get_ivrs_mappings(pdev->seg); in amd_iommu_add_device()
478 bdf = PCI_BDF2(pdev->bus, devfn); in amd_iommu_add_device()
489 if ( pdev->msix || pdev->msi_maxvec ) in amd_iommu_add_device()
494 pdev->msix ? pdev->msix->nr_entries in amd_iommu_add_device()
495 : pdev->msi_maxvec); in amd_iommu_add_device()
511 amd_iommu_setup_domain_device(pdev->domain, iommu, devfn, pdev); in amd_iommu_add_device()
515 static int amd_iommu_remove_device(u8 devfn, struct pci_dev *pdev) in amd_iommu_remove_device() argument
521 if ( !pdev->domain ) in amd_iommu_remove_device()
524 bdf = PCI_BDF2(pdev->bus, pdev->devfn); in amd_iommu_remove_device()
525 iommu = find_iommu_for_device(pdev->seg, bdf); in amd_iommu_remove_device()
530 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in amd_iommu_remove_device()
531 pdev->domain->domain_id); in amd_iommu_remove_device()
535 amd_iommu_disable_domain_device(pdev->domain, iommu, devfn, pdev); in amd_iommu_remove_device()
537 ivrs_mappings = get_ivrs_mappings(pdev->seg); in amd_iommu_remove_device()
538 bdf = PCI_BDF2(pdev->bus, devfn); in amd_iommu_remove_device()