Lines Matching refs:dmaru
288 struct dmar_drhd_unit *dmaru; in dmar_pci_bus_add_dev() local
291 for_each_drhd_unit(dmaru) { in dmar_pci_bus_add_dev()
292 if (dmaru->include_all) in dmar_pci_bus_add_dev()
295 drhd = container_of(dmaru->hdr, in dmar_pci_bus_add_dev()
299 dmaru->segment, in dmar_pci_bus_add_dev()
300 dmaru->devices, dmaru->devices_cnt); in dmar_pci_bus_add_dev()
314 struct dmar_drhd_unit *dmaru; in dmar_pci_bus_del_dev() local
316 for_each_drhd_unit(dmaru) in dmar_pci_bus_del_dev()
317 if (dmar_remove_dev_scope(info, dmaru->segment, in dmar_pci_bus_del_dev()
318 dmaru->devices, dmaru->devices_cnt)) in dmar_pci_bus_del_dev()
359 struct dmar_drhd_unit *dmaru; in dmar_find_dmaru() local
361 list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list) in dmar_find_dmaru()
362 if (dmaru->segment == drhd->segment && in dmar_find_dmaru()
363 dmaru->reg_base_addr == drhd->address) in dmar_find_dmaru()
364 return dmaru; in dmar_find_dmaru()
377 struct dmar_drhd_unit *dmaru; in dmar_parse_one_drhd() local
381 dmaru = dmar_find_dmaru(drhd); in dmar_parse_one_drhd()
382 if (dmaru) in dmar_parse_one_drhd()
385 dmaru = kzalloc(sizeof(*dmaru) + header->length, GFP_KERNEL); in dmar_parse_one_drhd()
386 if (!dmaru) in dmar_parse_one_drhd()
393 dmaru->hdr = (void *)(dmaru + 1); in dmar_parse_one_drhd()
394 memcpy(dmaru->hdr, header, header->length); in dmar_parse_one_drhd()
395 dmaru->reg_base_addr = drhd->address; in dmar_parse_one_drhd()
396 dmaru->segment = drhd->segment; in dmar_parse_one_drhd()
397 dmaru->include_all = drhd->flags & 0x1; /* BIT0: INCLUDE_ALL */ in dmar_parse_one_drhd()
398 dmaru->devices = dmar_alloc_dev_scope((void *)(drhd + 1), in dmar_parse_one_drhd()
400 &dmaru->devices_cnt); in dmar_parse_one_drhd()
401 if (dmaru->devices_cnt && dmaru->devices == NULL) { in dmar_parse_one_drhd()
402 kfree(dmaru); in dmar_parse_one_drhd()
406 ret = alloc_iommu(dmaru); in dmar_parse_one_drhd()
408 dmar_free_dev_scope(&dmaru->devices, in dmar_parse_one_drhd()
409 &dmaru->devices_cnt); in dmar_parse_one_drhd()
410 kfree(dmaru); in dmar_parse_one_drhd()
413 dmar_register_drhd_unit(dmaru); in dmar_parse_one_drhd()
422 static void dmar_free_drhd(struct dmar_drhd_unit *dmaru) in dmar_free_drhd() argument
424 if (dmaru->devices && dmaru->devices_cnt) in dmar_free_drhd()
425 dmar_free_dev_scope(&dmaru->devices, &dmaru->devices_cnt); in dmar_free_drhd()
426 if (dmaru->iommu) in dmar_free_drhd()
427 free_iommu(dmaru->iommu); in dmar_free_drhd()
428 kfree(dmaru); in dmar_free_drhd()
659 struct dmar_drhd_unit *dmaru; in dmar_find_matched_drhd_unit() local
665 for_each_drhd_unit(dmaru) { in dmar_find_matched_drhd_unit()
666 drhd = container_of(dmaru->hdr, in dmar_find_matched_drhd_unit()
670 if (dmaru->include_all && in dmar_find_matched_drhd_unit()
674 if (dmar_pci_device_match(dmaru->devices, in dmar_find_matched_drhd_unit()
675 dmaru->devices_cnt, dev)) in dmar_find_matched_drhd_unit()
678 dmaru = NULL; in dmar_find_matched_drhd_unit()
682 return dmaru; in dmar_find_matched_drhd_unit()
688 struct dmar_drhd_unit *dmaru; in dmar_acpi_insert_dev_scope() local
695 for_each_drhd_unit(dmaru) { in dmar_acpi_insert_dev_scope()
696 drhd = container_of(dmaru->hdr, in dmar_acpi_insert_dev_scope()
710 dev_name(&adev->dev), dmaru->reg_base_addr, in dmar_acpi_insert_dev_scope()
712 for_each_dev_scope(dmaru->devices, dmaru->devices_cnt, i, tmp) in dmar_acpi_insert_dev_scope()
714 dmaru->devices[i].bus = scope->bus; in dmar_acpi_insert_dev_scope()
715 dmaru->devices[i].devfn = PCI_DEVFN(path->device, in dmar_acpi_insert_dev_scope()
717 rcu_assign_pointer(dmaru->devices[i].dev, in dmar_acpi_insert_dev_scope()
721 BUG_ON(i >= dmaru->devices_cnt); in dmar_acpi_insert_dev_scope()
1742 struct dmar_drhd_unit *dmaru, *dmaru_n; in dmar_free_unused_resources() local
1751 list_for_each_entry_safe(dmaru, dmaru_n, &dmar_drhd_units, list) { in dmar_free_unused_resources()
1752 list_del(&dmaru->list); in dmar_free_unused_resources()
1753 dmar_free_drhd(dmaru); in dmar_free_unused_resources()
1823 struct dmar_drhd_unit *dmaru; in dmar_hp_add_drhd() local
1825 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_add_drhd()
1826 if (!dmaru) in dmar_hp_add_drhd()
1829 ret = dmar_ir_hotplug(dmaru, true); in dmar_hp_add_drhd()
1831 ret = dmar_iommu_hotplug(dmaru, true); in dmar_hp_add_drhd()
1840 struct dmar_drhd_unit *dmaru; in dmar_hp_remove_drhd() local
1842 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_remove_drhd()
1843 if (!dmaru) in dmar_hp_remove_drhd()
1849 if (!dmaru->include_all && dmaru->devices && dmaru->devices_cnt) in dmar_hp_remove_drhd()
1850 for_each_active_dev_scope(dmaru->devices, in dmar_hp_remove_drhd()
1851 dmaru->devices_cnt, i, dev) in dmar_hp_remove_drhd()
1854 ret = dmar_ir_hotplug(dmaru, false); in dmar_hp_remove_drhd()
1856 ret = dmar_iommu_hotplug(dmaru, false); in dmar_hp_remove_drhd()
1863 struct dmar_drhd_unit *dmaru; in dmar_hp_release_drhd() local
1865 dmaru = dmar_find_dmaru((struct acpi_dmar_hardware_unit *)header); in dmar_hp_release_drhd()
1866 if (dmaru) { in dmar_hp_release_drhd()
1867 list_del_rcu(&dmaru->list); in dmar_hp_release_drhd()
1869 dmar_free_drhd(dmaru); in dmar_hp_release_drhd()