Lines Matching refs:dmaru

298 	struct dmar_drhd_unit *dmaru;  in dmar_pci_bus_add_dev()  local
301 for_each_drhd_unit(dmaru) { in dmar_pci_bus_add_dev()
302 if (dmaru->include_all) in dmar_pci_bus_add_dev()
305 drhd = container_of(dmaru->hdr, in dmar_pci_bus_add_dev()
309 dmaru->segment, in dmar_pci_bus_add_dev()
310 dmaru->devices, dmaru->devices_cnt); in dmar_pci_bus_add_dev()
327 struct dmar_drhd_unit *dmaru; in dmar_pci_bus_del_dev() local
329 for_each_drhd_unit(dmaru) in dmar_pci_bus_del_dev()
330 if (dmar_remove_dev_scope(info, dmaru->segment, in dmar_pci_bus_del_dev()
331 dmaru->devices, dmaru->devices_cnt)) in dmar_pci_bus_del_dev()
394 struct dmar_drhd_unit *dmaru; in dmar_find_dmaru() local
396 list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list, in dmar_find_dmaru()
398 if (dmaru->segment == drhd->segment && in dmar_find_dmaru()
399 dmaru->reg_base_addr == drhd->address) in dmar_find_dmaru()
400 return dmaru; in dmar_find_dmaru()
413 struct dmar_drhd_unit *dmaru; in dmar_parse_one_drhd() local
417 dmaru = dmar_find_dmaru(drhd); in dmar_parse_one_drhd()
418 if (dmaru) in dmar_parse_one_drhd()
421 dmaru = kzalloc(sizeof(*dmaru) + header->length, GFP_KERNEL); in dmar_parse_one_drhd()
422 if (!dmaru) in dmar_parse_one_drhd()
429 dmaru->hdr = (void *)(dmaru + 1); in dmar_parse_one_drhd()
430 memcpy(dmaru->hdr, header, header->length); in dmar_parse_one_drhd()
431 dmaru->reg_base_addr = drhd->address; in dmar_parse_one_drhd()
432 dmaru->segment = drhd->segment; in dmar_parse_one_drhd()
433 dmaru->include_all = drhd->flags & 0x1; /* BIT0: INCLUDE_ALL */ in dmar_parse_one_drhd()
434 dmaru->devices = dmar_alloc_dev_scope((void *)(drhd + 1), in dmar_parse_one_drhd()
436 &dmaru->devices_cnt); in dmar_parse_one_drhd()
437 if (dmaru->devices_cnt && dmaru->devices == NULL) { in dmar_parse_one_drhd()
438 kfree(dmaru); in dmar_parse_one_drhd()
442 ret = alloc_iommu(dmaru); in dmar_parse_one_drhd()
444 dmar_free_dev_scope(&dmaru->devices, in dmar_parse_one_drhd()
445 &dmaru->devices_cnt); in dmar_parse_one_drhd()
446 kfree(dmaru); in dmar_parse_one_drhd()
449 dmar_register_drhd_unit(dmaru); in dmar_parse_one_drhd()
458 static void dmar_free_drhd(struct dmar_drhd_unit *dmaru) in dmar_free_drhd() argument
460 if (dmaru->devices && dmaru->devices_cnt) in dmar_free_drhd()
461 dmar_free_dev_scope(&dmaru->devices, &dmaru->devices_cnt); in dmar_free_drhd()
462 if (dmaru->iommu) in dmar_free_drhd()
463 free_iommu(dmaru->iommu); in dmar_free_drhd()
464 kfree(dmaru); in dmar_free_drhd()
696 struct dmar_drhd_unit *dmaru; in dmar_find_matched_drhd_unit() local
702 for_each_drhd_unit(dmaru) { in dmar_find_matched_drhd_unit()
703 drhd = container_of(dmaru->hdr, in dmar_find_matched_drhd_unit()
707 if (dmaru->include_all && in dmar_find_matched_drhd_unit()
711 if (dmar_pci_device_match(dmaru->devices, in dmar_find_matched_drhd_unit()
712 dmaru->devices_cnt, dev)) in dmar_find_matched_drhd_unit()
715 dmaru = NULL; in dmar_find_matched_drhd_unit()
719 return dmaru; in dmar_find_matched_drhd_unit()
725 struct dmar_drhd_unit *dmaru; in dmar_acpi_insert_dev_scope() local
732 for_each_drhd_unit(dmaru) { in dmar_acpi_insert_dev_scope()
733 drhd = container_of(dmaru->hdr, in dmar_acpi_insert_dev_scope()
747 dev_name(&adev->dev), dmaru->reg_base_addr, in dmar_acpi_insert_dev_scope()
749 for_each_dev_scope(dmaru->devices, dmaru->devices_cnt, i, tmp) in dmar_acpi_insert_dev_scope()
751 dmaru->devices[i].bus = scope->bus; in dmar_acpi_insert_dev_scope()
752 dmaru->devices[i].devfn = PCI_DEVFN(path->device, in dmar_acpi_insert_dev_scope()
754 rcu_assign_pointer(dmaru->devices[i].dev, in dmar_acpi_insert_dev_scope()
758 BUG_ON(i >= dmaru->devices_cnt); in dmar_acpi_insert_dev_scope()
2041 struct dmar_drhd_unit *dmaru, *dmaru_n; in dmar_free_unused_resources() local
2050 list_for_each_entry_safe(dmaru, dmaru_n, &dmar_drhd_units, list) { in dmar_free_unused_resources()
2051 list_del(&dmaru->list); in dmar_free_unused_resources()
2052 dmar_free_drhd(dmaru); in dmar_free_unused_resources()
2121 struct dmar_drhd_unit *dmaru; in dmar_hp_add_drhd() local
2123 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_add_drhd()
2124 if (!dmaru) in dmar_hp_add_drhd()
2127 ret = dmar_ir_hotplug(dmaru, true); in dmar_hp_add_drhd()
2129 ret = dmar_iommu_hotplug(dmaru, true); in dmar_hp_add_drhd()
2138 struct dmar_drhd_unit *dmaru; in dmar_hp_remove_drhd() local
2140 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_remove_drhd()
2141 if (!dmaru) in dmar_hp_remove_drhd()
2147 if (!dmaru->include_all && dmaru->devices && dmaru->devices_cnt) { in dmar_hp_remove_drhd()
2148 for_each_active_dev_scope(dmaru->devices, in dmar_hp_remove_drhd()
2149 dmaru->devices_cnt, i, dev) in dmar_hp_remove_drhd()
2153 ret = dmar_ir_hotplug(dmaru, false); in dmar_hp_remove_drhd()
2155 ret = dmar_iommu_hotplug(dmaru, false); in dmar_hp_remove_drhd()
2162 struct dmar_drhd_unit *dmaru; in dmar_hp_release_drhd() local
2164 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_release_drhd()
2165 if (dmaru) { in dmar_hp_release_drhd()
2166 list_del_rcu(&dmaru->list); in dmar_hp_release_drhd()
2168 dmar_free_drhd(dmaru); in dmar_hp_release_drhd()