From: Jan Kiszka <[email protected]>

Newer kernels and/or certain platforms (seen on AMD R1505G) list a all
PCI resources and some ACPI resources behind a top-level reserved
region. Skipping it leaves the config fairly incomplete.

Also fix up a trivial flake8 reporting at this chance.

Signed-off-by: Jan Kiszka <[email protected]>
---
 pyjailhouse/sysfs_parser.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py
index 7c93b58e..b9e40f65 100644
--- a/pyjailhouse/sysfs_parser.py
+++ b/pyjailhouse/sysfs_parser.py
@@ -33,6 +33,7 @@ def set_root_dir(dir):
     global root_dir
     root_dir = dir
 
+
 inputs = {
     'files': set(),
     'files_opt': set(),
@@ -150,18 +151,16 @@ def parse_iomem_tree(tree):
         if s.find('PCI MMCONFIG') >= 0 or s.find('APIC') >= 0:
             continue
 
-        # generally blacklisted, with a few exceptions
-        if s.lower() == 'reserved':
-            regions.extend(tree.find_regions_by_name('HPET'))
-            dmar_regions.extend(tree.find_regions_by_name('dmar'))
-            continue
-
         # if the tree continues recurse further down ...
         if tree.children:
             (temp_regions, temp_dmar_regions) = parse_iomem_tree(tree)
             regions.extend(temp_regions)
             dmar_regions.extend(temp_dmar_regions)
             continue
+        else:
+            # blacklisted if it has no children
+            if s.lower() == 'reserved':
+                continue
 
         # add all remaining leaves
         regions.append(r)
-- 
2.26.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/231c39f4b31e25d8ef413533e875ad3193a54e97.1599473999.git.jan.kiszka%40siemens.com.

Reply via email to