amd-debug-tools 0.2.13__tar.gz → 0.2.14__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.13/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.14}/PKG-INFO +1 -1
  2. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/kernel.py +22 -0
  3. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/prerequisites.py +19 -0
  4. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/wake.py +25 -7
  5. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
  6. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_prerequisites.py +68 -1
  7. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/.github/workflows/ci.yml +0 -0
  8. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/.github/workflows/mirror.yml +0 -0
  9. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/.gitignore +0 -0
  10. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/.pre-commit-config.yaml +0 -0
  11. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/.vscode/settings.json +0 -0
  12. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/LICENSE +0 -0
  13. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/Makefile +0 -0
  14. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/README.md +0 -0
  15. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/amd_bios.py +0 -0
  16. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/amd_pstate.py +0 -0
  17. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/amd_s2idle.py +0 -0
  18. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/amd_ttm.py +0 -0
  19. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/docs/amd-bios.md +0 -0
  20. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/docs/amd-pstate.md +0 -0
  21. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/docs/amd-s2idle.md +0 -0
  22. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/docs/amd-ttm.md +0 -0
  23. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/docs/in-tree.md +0 -0
  24. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/install_deps.py +0 -0
  25. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/psr.py +0 -0
  26. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/pyproject.toml +0 -0
  27. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/setup.cfg +0 -0
  28. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/__init__.py +0 -0
  29. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/acpi.py +0 -0
  30. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/bash/amd-s2idle +0 -0
  31. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/battery.py +0 -0
  32. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/bios.py +0 -0
  33. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/common.py +0 -0
  34. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/database.py +0 -0
  35. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/display.py +0 -0
  36. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/failures.py +0 -0
  37. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/installer.py +0 -0
  38. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/pstate.py +0 -0
  39. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/s2idle-hook +0 -0
  40. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/s2idle.py +0 -0
  41. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/sleep_report.py +0 -0
  42. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/templates/html +0 -0
  43. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/templates/md +0 -0
  44. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/templates/stdout +0 -0
  45. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/templates/txt +0 -0
  46. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/ttm.py +0 -0
  47. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug/validator.py +0 -0
  48. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
  49. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
  50. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
  51. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug_tools.egg-info/requires.txt +0 -0
  52. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
  53. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/launcher.py +0 -0
  54. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_acpi.py +0 -0
  55. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_batteries.py +0 -0
  56. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_bios.py +0 -0
  57. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_common.py +0 -0
  58. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_database.py +0 -0
  59. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_display.py +0 -0
  60. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_failures.py +0 -0
  61. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_installer.py +0 -0
  62. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_kernel.py +0 -0
  63. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_launcher.py +0 -0
  64. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_pstate.py +0 -0
  65. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_s2idle.py +0 -0
  66. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_sleep_report.py +0 -0
  67. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_ttm.py +0 -0
  68. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/src/test_validator.py +0 -0
  69. {amd_debug_tools-0.2.13 → amd_debug_tools-0.2.14}/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.13
3
+ Version: 0.2.14
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -168,6 +168,10 @@ class KernelLogger:
168
168
  """Find lines that match a pattern"""
169
169
  return ""
170
170
 
171
+ def get_full_log(self) -> str:
172
+ """Get the full log as a string"""
173
+ return ""
174
+
171
175
 
172
176
  class InputFile(KernelLogger):
173
177
  """Class for input file parsing"""
@@ -183,6 +187,10 @@ class InputFile(KernelLogger):
183
187
  for entry in self.buffer.split("\n"):
184
188
  callback(entry, priority)
185
189
 
190
+ def get_full_log(self):
191
+ """Get the full log as a string"""
192
+ return self.buffer
193
+
186
194
 
187
195
  class DmesgLogger(KernelLogger):
188
196
  """Class for dmesg logging"""
@@ -256,6 +264,10 @@ class DmesgLogger(KernelLogger):
256
264
  """Capture the header of the log"""
257
265
  return self.buffer.split("\n")[0]
258
266
 
267
+ def get_full_log(self):
268
+ """Get the full log as a string"""
269
+ return self.buffer
270
+
259
271
 
260
272
  class CySystemdLogger(KernelLogger):
261
273
  """Class for logging using systemd journal using cython"""
@@ -319,6 +331,11 @@ class CySystemdLogger(KernelLogger):
319
331
  return entry["MESSAGE"]
320
332
  return None
321
333
 
334
+ def get_full_log(self):
335
+ """Get the full log as a string"""
336
+ self.seek()
337
+ return "\n".join([entry["MESSAGE"] for entry in self.journal])
338
+
322
339
 
323
340
  class SystemdLogger(KernelLogger):
324
341
  """Class for logging using systemd journal"""
@@ -363,6 +380,11 @@ class SystemdLogger(KernelLogger):
363
380
  return entry["MESSAGE"]
364
381
  return ""
365
382
 
383
+ def get_full_log(self):
384
+ """Get the full log as a string"""
385
+ self.seek()
386
+ return "\n".join([entry["MESSAGE"] for entry in self.journal])
387
+
366
388
 
367
389
  def get_kernel_log(input_file=None) -> KernelLogger:
368
390
  """Get the kernel log provider"""
@@ -340,6 +340,23 @@ class PrerequisiteValidator(AmdTool):
340
340
  and (valid_ahci or not has_sata)
341
341
  )
342
342
 
343
+ def check_amd_xdna(self):
344
+ """Check for AMD XDNA driver"""
345
+ for device in self.pyudev.list_devices(subsystem="pci", PCI_CLASS="118000"):
346
+ slot = device.properties["PCI_SLOT_NAME"]
347
+ driver = device.properties.get("DRIVER")
348
+ pci_id = device.properties.get("PCI_ID")
349
+ if not pci_id.startswith("1022"):
350
+ continue
351
+ if not driver:
352
+ self.db.record_prereq(f"NPU device in {slot} missing driver", "🚦")
353
+ self.failures += [MissingDriver(slot)]
354
+ return False
355
+ p = os.path.join(device.sys_path, "fw_version")
356
+ xdna_fw_version = read_file(p)
357
+ self.db.record_prereq(f"NPU loaded with firmware {xdna_fw_version}", "✅")
358
+ return True
359
+
343
360
  def check_amd_hsmp(self):
344
361
  """Check for AMD HSMP driver"""
345
362
  # not needed to check in newer kernels
@@ -1356,6 +1373,7 @@ class PrerequisiteValidator(AmdTool):
1356
1373
  self.check_i2c_hid,
1357
1374
  self.check_pinctrl_amd,
1358
1375
  self.check_amd_hsmp,
1376
+ self.check_amd_xdna,
1359
1377
  self.check_amd_pmc,
1360
1378
  self.check_amd_cpu_hpet_wa,
1361
1379
  self.check_port_pm_override,
@@ -1397,6 +1415,7 @@ class PrerequisiteValidator(AmdTool):
1397
1415
  result = False
1398
1416
  if not result:
1399
1417
  self.db.record_prereq(Headers.BrokenPrerequisites, "🚫")
1418
+ self.db.record_debug(self.kernel_log.get_full_log())
1400
1419
  self.db.sync()
1401
1420
  clear_temporary_message(len(msg))
1402
1421
  return result
@@ -25,16 +25,28 @@ class WakeIRQ:
25
25
  def __init__(self, num, context=Context()):
26
26
  self.num = num
27
27
  p = os.path.join("/", "sys", "kernel", "irq", str(num))
28
- self.chip_name = read_file(os.path.join(p, "chip_name"))
29
- self.actions = read_file(os.path.join(p, "actions"))
28
+ try:
29
+ self.chip_name = read_file(os.path.join(p, "chip_name"))
30
+ except (PermissionError, FileNotFoundError):
31
+ self.chip_name = ""
32
+ try:
33
+ self.actions = read_file(os.path.join(p, "actions"))
34
+ except (PermissionError, FileNotFoundError):
35
+ self.actions = ""
30
36
  self.driver = ""
31
37
  self.name = ""
32
- wakeup = read_file(os.path.join(p, "wakeup"))
38
+ try:
39
+ wakeup = read_file(os.path.join(p, "wakeup"))
40
+ except (PermissionError, FileNotFoundError):
41
+ wakeup = ""
33
42
 
34
43
  # This is an IRQ tied to _AEI
35
44
  if self.chip_name == "amd_gpio":
36
- hw_gpio = read_file(os.path.join(p, "hwirq"))
37
- self.name = f"GPIO {hw_gpio}"
45
+ try:
46
+ hw_gpio = read_file(os.path.join(p, "hwirq"))
47
+ self.name = f"GPIO {hw_gpio}"
48
+ except (PermissionError, FileNotFoundError):
49
+ self.name = "GPIO (unknown)"
38
50
  # legacy IRQs
39
51
  elif "IR-IO-APIC" in self.chip_name:
40
52
  if self.actions == "acpi":
@@ -73,10 +85,16 @@ class WakeIRQ:
73
85
  os.path.join(p, directory), followlinks=True
74
86
  ):
75
87
  if "name" in files:
76
- self.name = read_file(os.path.join(root, "name"))
88
+ try:
89
+ self.name = read_file(os.path.join(root, "name"))
90
+ except (PermissionError, FileNotFoundError):
91
+ pass
77
92
  t = os.path.join(root, "driver")
78
93
  if os.path.exists(t):
79
- self.driver = os.path.basename(os.readlink(t))
94
+ try:
95
+ self.driver = os.path.basename(os.readlink(t))
96
+ except (PermissionError, FileNotFoundError, OSError):
97
+ pass
80
98
  break
81
99
  if self.name:
82
100
  break
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amd-debug-tools
3
- Version: 0.2.13
3
+ Version: 0.2.14
4
4
  Summary: debug tools for AMD systems
5
5
  Author-email: Mario Limonciello <superm1@kernel.org>
6
6
  License-Expression: MIT
@@ -1991,11 +1991,78 @@ class TestPrerequisiteValidator(unittest.TestCase):
1991
1991
  "USB4 routers found, no need to check DMCUB version"
1992
1992
  )
1993
1993
 
1994
+ @patch("amd_debug.prerequisites.clear_temporary_message")
1995
+ def test_run_failure_records_kernel_log(self, _mock_clear):
1996
+ """Test that the whole kernel log is recorded when prerequisites fail"""
1997
+ # Mock all check and info methods to avoid system access
1998
+ check_methods = [
1999
+ "check_aspm",
2000
+ "check_i2c_hid",
2001
+ "check_pinctrl_amd",
2002
+ "check_amd_hsmp",
2003
+ "check_amd_xdna",
2004
+ "check_amd_pmc",
2005
+ "check_amd_cpu_hpet_wa",
2006
+ "check_port_pm_override",
2007
+ "check_usb3",
2008
+ "check_usb4",
2009
+ "check_sleep_mode",
2010
+ "check_storage",
2011
+ "check_wcn6855_bug",
2012
+ "check_amdgpu",
2013
+ "check_amdgpu_parameters",
2014
+ "check_cpu",
2015
+ "check_msr",
2016
+ "check_smt",
2017
+ "check_iommu",
2018
+ "check_asus_rog_ally",
2019
+ "check_dpia_pg_dmcub",
2020
+ "check_isp4",
2021
+ "check_fadt",
2022
+ "check_logger",
2023
+ "check_lps0",
2024
+ "check_permissions",
2025
+ "check_wlan",
2026
+ "check_taint",
2027
+ "capture_acpi",
2028
+ "map_acpi_path",
2029
+ "check_device_firmware",
2030
+ "check_network",
2031
+ "capture_disabled_pins",
2032
+ ]
2033
+ for method in check_methods:
2034
+ setattr(self.validator, method, MagicMock(return_value=True))
2035
+
2036
+ # Mock one check to fail
2037
+ self.validator.check_permissions.return_value = False
2038
+
2039
+ # Mock get_cpu_vendor
2040
+ self.validator.get_cpu_vendor = MagicMock(return_value="AuthenticAMD")
2041
+
2042
+ # Set a mock kernel log
2043
+ mock_log_content = "Mocked full kernel log content"
2044
+ self.mock_kernel_log.get_full_log.return_value = mock_log_content
2045
+
2046
+ # Run the validator
2047
+ with patch(
2048
+ "amd_debug.prerequisites.print_temporary_message", return_value="msg"
2049
+ ):
2050
+ result = self.validator.run()
2051
+
2052
+ self.assertFalse(result)
2053
+ # Verify Headers.BrokenPrerequisites was recorded
2054
+ from amd_debug.prerequisites import Headers
2055
+
2056
+ self.mock_db.record_prereq.assert_any_call(Headers.BrokenPrerequisites, "🚫")
2057
+ # Verify the whole kernel log was recorded to debug
2058
+ self.mock_db.record_debug.assert_called_with(mock_log_content)
2059
+
1994
2060
  @patch("amd_debug.prerequisites.find_ip_version", return_value=True)
1995
2061
  @patch("amd_debug.prerequisites.os.path.exists", return_value=True)
1996
2062
  @patch("amd_debug.prerequisites.read_file", return_value="0x90001B01")
2063
+ @patch("amd_debug.prerequisites.version.parse")
1997
2064
  def test_check_dpia_pg_dmcub_dmcub_fw_version_new_enough(
1998
- self, mock_read_file, mock_path_exists, mock_find_ip_version
2065
+ self, mock_version_parse, mock_read_file, mock_path_exists, mock_find_ip_version
1999
2066
  ):
2000
2067
  """Test check_dpia_pg_dmcub when DMCUB firmware version is new enough"""
2001
2068
  self.mock_pyudev.list_devices.side_effect = [