Lines Matching refs:dmaru

295 	struct dmar_drhd_unit *dmaru;  in dmar_pci_bus_add_dev()  local
298 for_each_drhd_unit(dmaru) { in dmar_pci_bus_add_dev()
299 if (dmaru->include_all) in dmar_pci_bus_add_dev()
302 drhd = container_of(dmaru->hdr, in dmar_pci_bus_add_dev()
306 dmaru->segment, in dmar_pci_bus_add_dev()
307 dmaru->devices, dmaru->devices_cnt); in dmar_pci_bus_add_dev()
324 struct dmar_drhd_unit *dmaru; in dmar_pci_bus_del_dev() local
326 for_each_drhd_unit(dmaru) in dmar_pci_bus_del_dev()
327 if (dmar_remove_dev_scope(info, dmaru->segment, in dmar_pci_bus_del_dev()
328 dmaru->devices, dmaru->devices_cnt)) in dmar_pci_bus_del_dev()
391 struct dmar_drhd_unit *dmaru; in dmar_find_dmaru() local
393 list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list, in dmar_find_dmaru()
395 if (dmaru->segment == drhd->segment && in dmar_find_dmaru()
396 dmaru->reg_base_addr == drhd->address) in dmar_find_dmaru()
397 return dmaru; in dmar_find_dmaru()
410 struct dmar_drhd_unit *dmaru; in dmar_parse_one_drhd() local
414 dmaru = dmar_find_dmaru(drhd); in dmar_parse_one_drhd()
415 if (dmaru) in dmar_parse_one_drhd()
418 dmaru = kzalloc(sizeof(*dmaru) + header->length, GFP_KERNEL); in dmar_parse_one_drhd()
419 if (!dmaru) in dmar_parse_one_drhd()
426 dmaru->hdr = (void *)(dmaru + 1); in dmar_parse_one_drhd()
427 memcpy(dmaru->hdr, header, header->length); in dmar_parse_one_drhd()
428 dmaru->reg_base_addr = drhd->address; in dmar_parse_one_drhd()
429 dmaru->segment = drhd->segment; in dmar_parse_one_drhd()
430 dmaru->include_all = drhd->flags & 0x1; /* BIT0: INCLUDE_ALL */ in dmar_parse_one_drhd()
431 dmaru->devices = dmar_alloc_dev_scope((void *)(drhd + 1), in dmar_parse_one_drhd()
433 &dmaru->devices_cnt); in dmar_parse_one_drhd()
434 if (dmaru->devices_cnt && dmaru->devices == NULL) { in dmar_parse_one_drhd()
435 kfree(dmaru); in dmar_parse_one_drhd()
439 ret = alloc_iommu(dmaru); in dmar_parse_one_drhd()
441 dmar_free_dev_scope(&dmaru->devices, in dmar_parse_one_drhd()
442 &dmaru->devices_cnt); in dmar_parse_one_drhd()
443 kfree(dmaru); in dmar_parse_one_drhd()
446 dmar_register_drhd_unit(dmaru); in dmar_parse_one_drhd()
455 static void dmar_free_drhd(struct dmar_drhd_unit *dmaru) in dmar_free_drhd() argument
457 if (dmaru->devices && dmaru->devices_cnt) in dmar_free_drhd()
458 dmar_free_dev_scope(&dmaru->devices, &dmaru->devices_cnt); in dmar_free_drhd()
459 if (dmaru->iommu) in dmar_free_drhd()
460 free_iommu(dmaru->iommu); in dmar_free_drhd()
461 kfree(dmaru); in dmar_free_drhd()
699 struct dmar_drhd_unit *dmaru; in dmar_find_matched_drhd_unit() local
705 for_each_drhd_unit(dmaru) { in dmar_find_matched_drhd_unit()
706 drhd = container_of(dmaru->hdr, in dmar_find_matched_drhd_unit()
710 if (dmaru->include_all && in dmar_find_matched_drhd_unit()
714 if (dmar_pci_device_match(dmaru->devices, in dmar_find_matched_drhd_unit()
715 dmaru->devices_cnt, dev)) in dmar_find_matched_drhd_unit()
718 dmaru = NULL; in dmar_find_matched_drhd_unit()
722 return dmaru; in dmar_find_matched_drhd_unit()
728 struct dmar_drhd_unit *dmaru; in dmar_acpi_insert_dev_scope() local
735 for_each_drhd_unit(dmaru) { in dmar_acpi_insert_dev_scope()
736 drhd = container_of(dmaru->hdr, in dmar_acpi_insert_dev_scope()
750 dev_name(&adev->dev), dmaru->reg_base_addr, in dmar_acpi_insert_dev_scope()
752 for_each_dev_scope(dmaru->devices, dmaru->devices_cnt, i, tmp) in dmar_acpi_insert_dev_scope()
754 dmaru->devices[i].bus = scope->bus; in dmar_acpi_insert_dev_scope()
755 dmaru->devices[i].devfn = PCI_DEVFN(path->device, in dmar_acpi_insert_dev_scope()
757 rcu_assign_pointer(dmaru->devices[i].dev, in dmar_acpi_insert_dev_scope()
761 BUG_ON(i >= dmaru->devices_cnt); in dmar_acpi_insert_dev_scope()
2127 struct dmar_drhd_unit *dmaru, *dmaru_n; in dmar_free_unused_resources() local
2136 list_for_each_entry_safe(dmaru, dmaru_n, &dmar_drhd_units, list) { in dmar_free_unused_resources()
2137 list_del(&dmaru->list); in dmar_free_unused_resources()
2138 dmar_free_drhd(dmaru); in dmar_free_unused_resources()
2208 struct dmar_drhd_unit *dmaru; in dmar_hp_add_drhd() local
2210 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_add_drhd()
2211 if (!dmaru) in dmar_hp_add_drhd()
2214 ret = dmar_ir_hotplug(dmaru, true); in dmar_hp_add_drhd()
2216 ret = dmar_iommu_hotplug(dmaru, true); in dmar_hp_add_drhd()
2225 struct dmar_drhd_unit *dmaru; in dmar_hp_remove_drhd() local
2227 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_remove_drhd()
2228 if (!dmaru) in dmar_hp_remove_drhd()
2234 if (!dmaru->include_all && dmaru->devices && dmaru->devices_cnt) { in dmar_hp_remove_drhd()
2235 for_each_active_dev_scope(dmaru->devices, in dmar_hp_remove_drhd()
2236 dmaru->devices_cnt, i, dev) in dmar_hp_remove_drhd()
2240 ret = dmar_ir_hotplug(dmaru, false); in dmar_hp_remove_drhd()
2242 ret = dmar_iommu_hotplug(dmaru, false); in dmar_hp_remove_drhd()
2249 struct dmar_drhd_unit *dmaru; in dmar_hp_release_drhd() local
2251 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_release_drhd()
2252 if (dmaru) { in dmar_hp_release_drhd()
2253 list_del_rcu(&dmaru->list); in dmar_hp_release_drhd()
2255 dmar_free_drhd(dmaru); in dmar_hp_release_drhd()