Lines Matching full:devid
120 return p->devid; in get_acpihid_device_id()
159 u32 devid = get_acpihid_device_id(dev, NULL); in get_device_segment() local
161 seg = PCI_SBDF_TO_SEGID(devid); in get_device_segment()
168 void amd_iommu_set_rlookup_table(struct amd_iommu *iommu, u16 devid) in amd_iommu_set_rlookup_table() argument
172 pci_seg->rlookup_table[devid] = iommu; in amd_iommu_set_rlookup_table()
175 static struct amd_iommu *__rlookup_amd_iommu(u16 seg, u16 devid) in __rlookup_amd_iommu() argument
181 return pci_seg->rlookup_table[devid]; in __rlookup_amd_iommu()
189 int devid = get_device_sbdf_id(dev); in rlookup_amd_iommu() local
191 if (devid < 0) in rlookup_amd_iommu()
193 return __rlookup_amd_iommu(seg, PCI_SBDF_TO_DEVID(devid)); in rlookup_amd_iommu()
196 static struct iommu_dev_data *alloc_dev_data(struct amd_iommu *iommu, u16 devid) in alloc_dev_data() argument
206 dev_data->devid = devid; in alloc_dev_data()
213 static struct iommu_dev_data *search_dev_data(struct amd_iommu *iommu, u16 devid) in search_dev_data() argument
224 if (dev_data->devid == devid) in search_dev_data()
235 u16 devid = pci_dev_id(pdev); in clone_alias() local
237 if (devid == alias) in clone_alias()
247 dev_table[devid].data, in clone_alias()
293 static struct iommu_dev_data *find_dev_data(struct amd_iommu *iommu, u16 devid) in find_dev_data() argument
297 dev_data = search_dev_data(iommu, devid); in find_dev_data()
300 dev_data = alloc_dev_data(iommu, devid); in find_dev_data()
317 int devid; in acpihid_device_group() local
319 devid = get_acpihid_device_id(dev, &entry); in acpihid_device_group()
320 if (devid < 0) in acpihid_device_group()
321 return ERR_PTR(devid); in acpihid_device_group()
324 if ((devid == p->devid) && p->group) in acpihid_device_group()
483 int devid, sbdf; in check_device() local
491 devid = PCI_SBDF_TO_DEVID(sbdf); in check_device()
499 if (devid > pci_seg->last_bdf) in check_device()
508 int devid, sbdf; in iommu_init_device() local
517 devid = PCI_SBDF_TO_DEVID(sbdf); in iommu_init_device()
518 dev_data = find_dev_data(iommu, devid); in iommu_init_device()
545 int devid, sbdf; in iommu_ignore_device() local
551 devid = PCI_SBDF_TO_DEVID(sbdf); in iommu_ignore_device()
552 pci_seg->rlookup_table[devid] = NULL; in iommu_ignore_device()
553 memset(&dev_table[devid], 0, sizeof(struct dev_table_entry)); in iommu_ignore_device()
581 static void dump_dte_entry(struct amd_iommu *iommu, u16 devid) in dump_dte_entry() argument
587 pr_err("DTE[%d]: %016llx\n", i, dev_table[devid].data[i]); in dump_dte_entry()
602 int devid, vmg_tag, flags; in amd_iommu_report_rmp_hw_error() local
606 devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; in amd_iommu_report_rmp_hw_error()
611 pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid), in amd_iommu_report_rmp_hw_error()
612 devid & 0xff); in amd_iommu_report_rmp_hw_error()
623 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in amd_iommu_report_rmp_hw_error()
634 int devid, flags_rmp, vmg_tag, flags; in amd_iommu_report_rmp_fault() local
638 devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; in amd_iommu_report_rmp_fault()
644 pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid), in amd_iommu_report_rmp_fault()
645 devid & 0xff); in amd_iommu_report_rmp_fault()
656 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in amd_iommu_report_rmp_fault()
671 u16 devid, u16 domain_id, in amd_iommu_report_page_fault() argument
677 pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid), in amd_iommu_report_page_fault()
678 devid & 0xff); in amd_iommu_report_page_fault()
693 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), in amd_iommu_report_page_fault()
694 PCI_FUNC(devid), domain_id); in amd_iommu_report_page_fault()
712 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in amd_iommu_report_page_fault()
724 int type, devid, flags, tag; in iommu_print_event() local
732 devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; in iommu_print_event()
749 amd_iommu_report_page_fault(iommu, devid, pasid, address, flags); in iommu_print_event()
756 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
758 dump_dte_entry(iommu, devid); in iommu_print_event()
763 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
768 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
781 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
786 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
799 iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), in iommu_print_event()
874 pr_debug("%s: devid=%#x, ga_tag=%#x\n", in iommu_poll_ga_log()
1039 static void build_inv_dte(struct iommu_cmd *cmd, u16 devid) in build_inv_dte() argument
1042 cmd->data[0] = devid; in build_inv_dte()
1108 static void build_inv_iotlb_pages(struct iommu_cmd *cmd, u16 devid, int qdep, in build_inv_iotlb_pages() argument
1116 cmd->data[0] = devid; in build_inv_iotlb_pages()
1118 cmd->data[1] = devid; in build_inv_iotlb_pages()
1130 static void build_complete_ppr(struct iommu_cmd *cmd, u16 devid, u32 pasid, in build_complete_ppr() argument
1135 cmd->data[0] = devid; in build_complete_ppr()
1152 static void build_inv_irt(struct iommu_cmd *cmd, u16 devid) in build_inv_irt() argument
1155 cmd->data[0] = devid; in build_inv_irt()
1266 static int iommu_flush_dte(struct amd_iommu *iommu, u16 devid) in iommu_flush_dte() argument
1270 build_inv_dte(&cmd, devid); in iommu_flush_dte()
1277 u32 devid; in amd_iommu_flush_dte_all() local
1280 for (devid = 0; devid <= last_bdf; ++devid) in amd_iommu_flush_dte_all()
1281 iommu_flush_dte(iommu, devid); in amd_iommu_flush_dte_all()
1326 static void iommu_flush_irt(struct amd_iommu *iommu, u16 devid) in iommu_flush_irt() argument
1330 build_inv_irt(&cmd, devid); in iommu_flush_irt()
1337 u32 devid; in amd_iommu_flush_irt_all() local
1343 for (devid = 0; devid <= last_bdf; devid++) in amd_iommu_flush_irt_all()
1344 iommu_flush_irt(iommu, devid); in amd_iommu_flush_irt_all()
1370 build_inv_iotlb_pages(&cmd, dev_data->devid, qdep, address, in device_flush_iotlb()
1401 ret = iommu_flush_dte(iommu, dev_data->devid); in device_flush_dte()
1406 alias = pci_seg->alias_table[dev_data->devid]; in device_flush_dte()
1407 if (alias != dev_data->devid) { in device_flush_dte()
1627 build_complete_ppr(&cmd, dev_data->devid, pasid, status, in amd_iommu_complete_ppr()
1851 u16 devid = dev_data->devid; in set_dte_entry() local
1877 flags = dev_table[devid].data[1]; in set_dte_entry()
1914 dev_table[devid].data[2] |= in set_dte_entry()
1926 old_domid = dev_table[devid].data[1] & DEV_DOMID_MASK; in set_dte_entry()
1927 dev_table[devid].data[1] = flags; in set_dte_entry()
1928 dev_table[devid].data[0] = pte_root; in set_dte_entry()
1940 static void clear_dte_entry(struct amd_iommu *iommu, u16 devid) in clear_dte_entry() argument
1945 dev_table[devid].data[0] = DTE_FLAG_V; in clear_dte_entry()
1948 dev_table[devid].data[0] |= DTE_FLAG_TV; in clear_dte_entry()
1950 dev_table[devid].data[1] &= DTE_FLAG_MASK; in clear_dte_entry()
1952 amd_iommu_apply_erratum_63(iommu, devid); in clear_dte_entry()
1963 clear_dte_entry(iommu, dev_data->devid); in dev_update_dte()
2640 pte_root = dev_table[dev_data->devid].data[0]; in amd_iommu_set_dirty_tracking()
2646 dev_table[dev_data->devid].data[0] = pte_root; in amd_iommu_set_dirty_tracking()
2690 int devid, sbdf; in amd_iommu_get_resv_regions() local
2696 devid = PCI_SBDF_TO_DEVID(sbdf); in amd_iommu_get_resv_regions()
2704 if (devid < entry->devid_start || devid > entry->devid_end) in amd_iommu_get_resv_regions()
2882 static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid) in iommu_flush_irt_and_complete() argument
2892 build_inv_irt(&cmd, devid); in iommu_flush_irt_and_complete()
2908 static void set_dte_irq_entry(struct amd_iommu *iommu, u16 devid, in set_dte_irq_entry() argument
2914 dte = dev_table[devid].data[2]; in set_dte_irq_entry()
2921 dev_table[devid].data[2] = dte; in set_dte_irq_entry()
2924 static struct irq_remap_table *get_irq_table(struct amd_iommu *iommu, u16 devid) in get_irq_table() argument
2929 if (WARN_ONCE(!pci_seg->rlookup_table[devid], in get_irq_table()
2930 "%s: no iommu for devid %x:%x\n", in get_irq_table()
2931 __func__, pci_seg->id, devid)) in get_irq_table()
2934 table = pci_seg->irq_lookup_table[devid]; in get_irq_table()
2935 if (WARN_ONCE(!table, "%s: no table for devid %x:%x\n", in get_irq_table()
2936 __func__, pci_seg->id, devid)) in get_irq_table()
2966 static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid, in set_remap_table_entry() argument
2971 pci_seg->irq_lookup_table[devid] = table; in set_remap_table_entry()
2972 set_dte_irq_entry(iommu, devid, table); in set_remap_table_entry()
2973 iommu_flush_dte(iommu, devid); in set_remap_table_entry()
2995 u16 devid, struct pci_dev *pdev) in alloc_irq_table() argument
3006 table = pci_seg->irq_lookup_table[devid]; in alloc_irq_table()
3010 alias = pci_seg->alias_table[devid]; in alloc_irq_table()
3013 set_remap_table_entry(iommu, devid, table); in alloc_irq_table()
3025 table = pci_seg->irq_lookup_table[devid]; in alloc_irq_table()
3031 set_remap_table_entry(iommu, devid, table); in alloc_irq_table()
3042 set_remap_table_entry(iommu, devid, table); in alloc_irq_table()
3044 if (devid != alias) in alloc_irq_table()
3060 static int alloc_irq_index(struct amd_iommu *iommu, u16 devid, int count, in alloc_irq_index() argument
3067 table = alloc_irq_table(iommu, devid, pdev); in alloc_irq_index()
3106 static int __modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index, in __modify_irte_ga() argument
3114 table = get_irq_table(iommu, devid); in __modify_irte_ga()
3137 static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index, in modify_irte_ga() argument
3142 ret = __modify_irte_ga(iommu, devid, index, irte); in modify_irte_ga()
3146 iommu_flush_irt_and_complete(iommu, devid); in modify_irte_ga()
3152 u16 devid, int index, union irte *irte) in modify_irte() argument
3157 table = get_irq_table(iommu, devid); in modify_irte()
3165 iommu_flush_irt_and_complete(iommu, devid); in modify_irte()
3170 static void free_irte(struct amd_iommu *iommu, u16 devid, int index) in free_irte() argument
3175 table = get_irq_table(iommu, devid); in free_irte()
3183 iommu_flush_irt_and_complete(iommu, devid); in free_irte()
3188 u8 vector, u32 dest_apicid, int devid) in irte_prepare() argument
3202 u8 vector, u32 dest_apicid, int devid) in irte_ga_prepare() argument
3216 static void irte_activate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index) in irte_activate() argument
3221 modify_irte(iommu, devid, index, irte); in irte_activate()
3224 static void irte_ga_activate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index) in irte_ga_activate() argument
3229 modify_irte_ga(iommu, devid, index, irte); in irte_ga_activate()
3232 static void irte_deactivate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index) in irte_deactivate() argument
3237 modify_irte(iommu, devid, index, irte); in irte_deactivate()
3240 static void irte_ga_deactivate(struct amd_iommu *iommu, void *entry, u16 devid, u16 index) in irte_ga_deactivate() argument
3245 modify_irte_ga(iommu, devid, index, irte); in irte_ga_deactivate()
3248 static void irte_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid, u16 index, in irte_set_affinity() argument
3255 modify_irte(iommu, devid, index, irte); in irte_set_affinity()
3258 static void irte_ga_set_affinity(struct amd_iommu *iommu, void *entry, u16 devid, u16 index, in irte_ga_set_affinity() argument
3269 modify_irte_ga(iommu, devid, index, irte); in irte_ga_set_affinity()
3323 return get_ioapic_devid(info->devid); in get_devid()
3325 return get_hpet_devid(info->devid); in get_devid()
3354 int devid, int index, int sub_handle) in irq_remapping_prepare_irte() argument
3362 data->irq_2_irte.devid = devid; in irq_remapping_prepare_irte()
3366 irq_cfg->dest_apicid, devid); in irq_remapping_prepare_irte()
3410 int i, ret, devid, seg, sbdf; in irq_remapping_alloc() local
3423 devid = PCI_SBDF_TO_DEVID(sbdf); in irq_remapping_alloc()
3424 iommu = __rlookup_amd_iommu(seg, devid); in irq_remapping_alloc()
3435 table = alloc_irq_table(iommu, devid, NULL); in irq_remapping_alloc()
3455 index = alloc_irq_index(iommu, devid, nr_irqs, align, in irq_remapping_alloc()
3458 index = alloc_irq_index(iommu, devid, nr_irqs, false, NULL); in irq_remapping_alloc()
3491 irq_data->hwirq = (devid << 16) + i; in irq_remapping_alloc()
3494 irq_remapping_prepare_irte(data, cfg, info, devid, index, i); in irq_remapping_alloc()
3507 free_irte(iommu, devid, index + i); in irq_remapping_alloc()
3526 free_irte(data->iommu, irte_info->devid, irte_info->index); in irq_remapping_free()
3550 iommu->irte_ops->activate(iommu, data->entry, irte_info->devid, in irq_remapping_activate()
3564 iommu->irte_ops->deactivate(iommu, data->entry, irte_info->devid, in irq_remapping_deactivate()
3572 int devid = -1; in irq_remapping_select() local
3578 devid = get_ioapic_devid(fwspec->param[0]); in irq_remapping_select()
3580 devid = get_hpet_devid(fwspec->param[0]); in irq_remapping_select()
3582 if (devid < 0) in irq_remapping_select()
3584 iommu = __rlookup_amd_iommu((devid >> 16), (devid & 0xffff)); in irq_remapping_select()
3618 return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid, in amd_iommu_activate_guest_mode()
3648 return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid, in amd_iommu_deactivate_guest_mode()
3665 dev_data = search_dev_data(ir_data->iommu, irte_info->devid); in amd_ir_set_vcpu_affinity()
3720 iommu->irte_ops->set_affinity(iommu, ir_data->entry, irte_info->devid, in amd_ir_update_irte()
3816 return __modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid, in amd_iommu_update_ga()