amd-debug-tools 0.2.16__tar.gz → 0.2.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {amd_debug_tools-0.2.16/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.17}/PKG-INFO +1 -1
  2. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/common.py +18 -5
  3. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/failures.py +13 -0
  4. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/prerequisites.py +16 -3
  5. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/s2idle.py +1 -1
  6. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
  7. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_common.py +53 -0
  8. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/.github/workflows/ci.yml +0 -0
  9. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/.github/workflows/mirror.yml +0 -0
  10. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/.gitignore +0 -0
  11. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/.pre-commit-config.yaml +0 -0
  12. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/.vscode/settings.json +0 -0
  13. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/LICENSE +0 -0
  14. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/Makefile +0 -0
  15. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/README.md +0 -0
  16. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/amd_bios.py +0 -0
  17. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/amd_pstate.py +0 -0
  18. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/amd_s2idle.py +0 -0
  19. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/amd_ttm.py +0 -0
  20. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/docs/amd-bios.md +0 -0
  21. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/docs/amd-pstate.md +0 -0
  22. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/docs/amd-s2idle.md +0 -0
  23. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/docs/amd-ttm.md +0 -0
  24. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/docs/in-tree.md +0 -0
  25. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/install_deps.py +0 -0
  26. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/psr.py +0 -0
  27. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/pyproject.toml +0 -0
  28. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/setup.cfg +0 -0
  29. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/__init__.py +0 -0
  30. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/acpi.py +0 -0
  31. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/bash/amd-s2idle +0 -0
  32. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/battery.py +0 -0
  33. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/bios.py +0 -0
  34. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/database.py +0 -0
  35. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/display.py +0 -0
  36. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/installer.py +0 -0
  37. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/kernel.py +0 -0
  38. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/pstate.py +0 -0
  39. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/s2idle-hook +0 -0
  40. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/sleep_report.py +0 -0
  41. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/templates/html +0 -0
  42. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/templates/md +0 -0
  43. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/templates/stdout +0 -0
  44. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/templates/txt +0 -0
  45. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/ttm.py +0 -0
  46. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/validator.py +0 -0
  47. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug/wake.py +0 -0
  48. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
  49. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
  50. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
  51. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug_tools.egg-info/requires.txt +0 -0
  52. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
  53. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/launcher.py +0 -0
  54. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_acpi.py +0 -0
  55. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_batteries.py +0 -0
  56. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_bios.py +0 -0
  57. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_database.py +0 -0
  58. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_display.py +0 -0
  59. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_failures.py +0 -0
  60. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_installer.py +0 -0
  61. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_kernel.py +0 -0
  62. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_launcher.py +0 -0
  63. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_prerequisites.py +0 -0
  64. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_pstate.py +0 -0
  65. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_s2idle.py +0 -0
  66. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_sleep_report.py +0 -0
  67. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_ttm.py +0 -0
  68. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_validator.py +0 -0
  69. {amd_debug_tools-0.2.16 → amd_debug_tools-0.2.17}/src/test_wake.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.16
3
+ Version: 0.2.17
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -321,9 +321,11 @@ def get_log_priority(num):
321
321
 
322
322
  def minimum_kernel(major, minor) -> bool:
323
323
  """Checks if the kernel version is at least major.minor"""
324
+ import re
325
+
324
326
  ver = platform.uname().release.split(".")
325
- kmajor = int(ver[0])
326
- kminor = int(ver[1])
327
+ kmajor = int(re.match(r"\d+", ver[0]).group())
328
+ kminor = int(re.match(r"\d+", ver[1]).group())
327
329
  if kmajor > int(major):
328
330
  return True
329
331
  if kmajor < int(major):
@@ -383,14 +385,25 @@ def relaunch_sudo() -> None:
383
385
  if not is_root():
384
386
  logging.debug("Relaunching with sudo")
385
387
  env_vars = []
386
- for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
387
- "DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
388
+ for var in [
389
+ "DISPLAY",
390
+ "WAYLAND_DISPLAY",
391
+ "XAUTHORITY",
392
+ "XDG_RUNTIME_DIR",
393
+ "DBUS_SESSION_BUS_ADDRESS",
394
+ "XDG_SESSION_TYPE",
395
+ "XDG_DATA_DIRS"
396
+ ]:
388
397
  value = os.environ.get(var)
389
398
  if value:
390
399
  env_vars.append(f"{var}={value}")
391
400
 
392
401
  if env_vars:
393
- sudo_cmd = ["sudo"] + [f"--preserve-env={var.split('=')[0]}" for var in env_vars] + sys.argv
402
+ sudo_cmd = (
403
+ ["sudo"]
404
+ + [f"--preserve-env={var.split('=')[0]}" for var in env_vars]
405
+ + sys.argv
406
+ )
394
407
  else:
395
408
  sudo_cmd = ["sudo"] + sys.argv
396
409
 
@@ -146,6 +146,19 @@ class MissingXhciHcd(S0i3Failure):
146
146
  )
147
147
 
148
148
 
149
+ class MissingPcieHotplug(S0i3Failure):
150
+ """PCIe hotplug driver is missing"""
151
+
152
+ def __init__(self):
153
+ super().__init__()
154
+ self.description = "PCIe hotplug driver is missing"
155
+ self.explanation = (
156
+ "The pciehp driver is required for PCIe hotplug support. "
157
+ "Without this driver, PCIe devices may not be able to enter proper power states. "
158
+ "Be sure that you have enabled CONFIG_HOTPLUG_PCI_PCIE in your kernel."
159
+ )
160
+
161
+
149
162
  class MissingDriver(S0i3Failure):
150
163
  """driver is missing"""
151
164
 
@@ -63,6 +63,7 @@ from amd_debug.failures import (
63
63
  MissingIommuACPI,
64
64
  MissingIommuPolicy,
65
65
  MissingIsp4PlatformDriver,
66
+ MissingPcieHotplug,
66
67
  MissingThunderbolt,
67
68
  MissingXhciHcd,
68
69
  MSRFailure,
@@ -351,7 +352,6 @@ class PrerequisiteValidator(AmdTool):
351
352
  if not driver:
352
353
  self.db.record_prereq(f"NPU device in {slot} missing driver", "🚦")
353
354
  self.failures += [MissingDriver(slot)]
354
- return False
355
355
  p = os.path.join(device.sys_path, "fw_version")
356
356
  if os.path.exists(p):
357
357
  xdna_fw_version = read_file(p)
@@ -509,6 +509,15 @@ class PrerequisiteValidator(AmdTool):
509
509
  )
510
510
  return True
511
511
 
512
+ def check_pcie_hotplug(self):
513
+ """Check if PCIe hotplug support is enabled"""
514
+ if not os.path.exists("/sys/module/pciehp"):
515
+ self.db.record_prereq("PCIe hotplug driver `pciehp` missing", "❌")
516
+ self.failures += [MissingPcieHotplug()]
517
+ return False
518
+ self.db.record_prereq("PCIe hotplug driver `pciehp` loaded", "✅")
519
+ return True
520
+
512
521
  def check_sleep_mode(self):
513
522
  """Check if the system is configured for s2idle"""
514
523
  fn = os.path.join("/", "sys", "power", "mem_sleep")
@@ -1033,11 +1042,14 @@ class PrerequisiteValidator(AmdTool):
1033
1042
  p2 = os.path.join("/", "sys", "module", "amd_isp4_capture")
1034
1043
  if not os.path.exists(p1) and not os.path.exists(p2):
1035
1044
  self.db.record_prereq(
1036
- "Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded", "❌"
1045
+ "Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded",
1046
+ "❌",
1037
1047
  )
1038
1048
  self.failures += [MissingAmdCaptureModule()]
1039
1049
  return False
1040
- self.db.record_prereq("Camera driver module 'amd_capture'/'amd_isp4_capture' loaded", "✅")
1050
+ self.db.record_prereq(
1051
+ "Camera driver module 'amd_capture'/'amd_isp4_capture' loaded", "✅"
1052
+ )
1041
1053
  return True
1042
1054
 
1043
1055
  def map_acpi_path(self):
@@ -1381,6 +1393,7 @@ class PrerequisiteValidator(AmdTool):
1381
1393
  self.check_amd_pmc,
1382
1394
  self.check_amd_cpu_hpet_wa,
1383
1395
  self.check_port_pm_override,
1396
+ self.check_pcie_hotplug,
1384
1397
  self.check_usb3,
1385
1398
  self.check_usb4,
1386
1399
  self.check_sleep_mode,
@@ -62,7 +62,7 @@ def display_report_file(fname, fmt) -> None:
62
62
  if user:
63
63
  env_vars = []
64
64
  for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
65
- "DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
65
+ "DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE", "XDG_DATA_DIRS"]:
66
66
  value = os.environ.get(var)
67
67
  if value:
68
68
  env_vars.append(f"{var}={value}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.16
3
+ Version: 0.2.17
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -265,6 +265,59 @@ class TestCommon(unittest.TestCase):
265
265
  with self.assertRaises(TypeError):
266
266
  minimum_kernel(None, None)
267
267
 
268
+ def test_minimum_kernel_with_suffix(self):
269
+ """Test minimum_kernel function with version strings containing suffixes"""
270
+ with patch("platform.uname") as mock_uname:
271
+ # Test with +unreleased suffix (the bug case)
272
+ mock_uname.return_value = uname_result(
273
+ system="Linux",
274
+ node="foo",
275
+ release="7.18+unreleased-amd64",
276
+ version="baz",
277
+ machine="x86_64",
278
+ )
279
+ self.assertTrue(minimum_kernel(7, 18))
280
+ self.assertTrue(minimum_kernel(7, 17))
281
+ self.assertFalse(minimum_kernel(7, 19))
282
+ self.assertTrue(minimum_kernel(6, 10))
283
+ self.assertFalse(minimum_kernel(8, 0))
284
+
285
+ # Test with -rc suffix
286
+ mock_uname.return_value = uname_result(
287
+ system="Linux",
288
+ node="foo",
289
+ release="6.10-rc1-amd64",
290
+ version="baz",
291
+ machine="x86_64",
292
+ )
293
+ self.assertTrue(minimum_kernel(6, 10))
294
+ self.assertTrue(minimum_kernel(6, 9))
295
+ self.assertFalse(minimum_kernel(6, 11))
296
+
297
+ # Test with custom build suffix
298
+ mock_uname.return_value = uname_result(
299
+ system="Linux",
300
+ node="foo",
301
+ release="5.15+custom-build",
302
+ version="baz",
303
+ machine="x86_64",
304
+ )
305
+ self.assertTrue(minimum_kernel(5, 15))
306
+ self.assertTrue(minimum_kernel(5, 14))
307
+ self.assertFalse(minimum_kernel(5, 16))
308
+
309
+ # Test with -generic suffix (Ubuntu-style)
310
+ mock_uname.return_value = uname_result(
311
+ system="Linux",
312
+ node="foo",
313
+ release="5.4.0-generic",
314
+ version="baz",
315
+ machine="x86_64",
316
+ )
317
+ self.assertTrue(minimum_kernel(5, 4))
318
+ self.assertTrue(minimum_kernel(5, 3))
319
+ self.assertFalse(minimum_kernel(5, 5))
320
+
268
321
  def test_systemd_in_use(self):
269
322
  """Test systemd_in_use function"""
270
323
  with patch(