Skip to content
Snippets Groups Projects
Commit cc96ebf7 authored by Patrick Daly's avatar Patrick Daly Committed by Chris Goldsworthy
Browse files

lrdp: iommulib: Find iommu domains via devices_kset

Add another method of finding iommu domains. This approach does not require
any specific debug kconfig options to be enabled. However, it will not be
able to locate non-active iommu domains.

Change-Id: I84dfde76ae78ccc7cb9aa04eb7535773b9918d08
parent 5de3c5f0
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,8 @@ class IommuLib(object):
pass
elif self.find_iommu_domains_debug_attachments():
pass
elif self.find_iommu_domains_device_core():
pass
else:
print_out_str("Unable to find any iommu domains")
......@@ -108,6 +110,43 @@ class IommuLib(object):
return True
"""
will only find active iommu domains. This means it will exclude most gpu domains.
"""
def find_iommu_domains_device_core(self):
domains = set()
devices_kset = self.ramdump.read_pointer('devices_kset')
if not devices_kset:
return False
list_head = devices_kset + self.ramdump.field_offset('struct kset',
'list')
offset = self.ramdump.field_offset('struct device', 'kobj.entry')
list_walker = llist.ListWalker(self.ramdump, list_head, offset)
for dev in list_walker:
iommu_group = self.ramdump.read_structure_field(dev, 'struct device', 'iommu_group')
if not iommu_group:
continue
domain_ptr = self.ramdump.read_structure_field(iommu_group, 'struct iommu_group', 'domain')
if not domain_ptr:
continue
if domain_ptr in domains:
continue
domains.add(domain_ptr)
client_name_addr = self.ramdump.read_structure_field(dev, 'struct device', 'kobj.name')
client_name = self.ramdump.read_cstring(client_name_addr)
self._find_iommu_domains_arm_smmu(domain_ptr, client_name, self.domain_list)
return True
def _find_iommu_domains_arm_smmu(self, domain_ptr, client_name, domain_list):
if self.ramdump.field_offset('struct iommu_domain', 'priv') \
is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment