GSP-RM writes its printf message to "logging buffers", which are blocks
memory allocated by the driver.  The messages are encoded, so exposing
the buffers as debugfs entries allows the buffers to be extracted and
decoded by a special application.

When the driver loads, a /sys/kernel/debug/nova_core root entry is
created.  To do this, the normal module_pci_driver! macro call is
replaced with an explicit initialization function, as this allows
that debugfs entry to be created once for all GPUs.

Then in each GPU's initialization, a subdirectory based on the PCI
BDF name is created, and the logging buffer entries are created under
that.

Note: the debugfs entry has a file size of 0, because debugfs defaults
a 0 size and the Rust abstractions do not adjust it for the same of
the object.  Nouveau makes this adjustment manually in the driver.

Based on Linus' repository, not drm-rust-next.

Summary of changes:

1. Replace module_pci_driver! with explicit init function.
2. Creates root, per-gpu, and individual buffer debugfs entries.
3. Adds a pci::name() method to generate a PCI device name string.
4. Adds a lookup() method to debugfs, so that the root debugfs entry
   doesn't need to be a global variable like it is in Nouveau.
5. Makes some updates to debugfs core code.

Alexandre Courbot (1):
  gpu: nova-core: implement BinaryWriter for LogBuffer

Timur Tabi (8):
  rust: pci: add PCI device name method
  rust: debugfs: add lookup contructor
  rust: debugfs: add Dir::empty() for no-op directory handle
  rust: debugfs: fix Dir::scope() to not borrow self for returned
    lifetime
  gpu: nova-core: Replace module_pci_driver! with explicit module init
  gpu: nova-core: create debugfs root when driver loads
  gpu: nova-core: use pin projection in method boot()
  gpu: nova-core: create GSP-RM logging buffers debugfs entries

 drivers/gpu/nova-core/gsp.rs       |  66 +++++++++++++++---
 drivers/gpu/nova-core/gsp/boot.rs  |  15 ++--
 drivers/gpu/nova-core/nova_core.rs |  29 +++++++-
 rust/kernel/debugfs.rs             | 108 ++++++++++++++++++++++-------
 rust/kernel/debugfs/entry.rs       |  49 ++++++++++++-
 rust/kernel/pci.rs                 |  37 ++++++++++
 6 files changed, 259 insertions(+), 45 deletions(-)


base-commit: ea1013c1539270e372fc99854bc6e4d94eaeff66
-- 
2.52.0

Reply via email to