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. 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. Alexandre Courbot (2): gpu: nova-core: implement BinaryWriter for LogBuffer gpu: nova-core: create loginit debugfs entry Timur Tabi (5): rust: pci: add PCI device name method gpu: nova-core: Replace module_pci_driver! with explicit module init gpu: nova-core: create debugfs root in PCI init closure 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 | 50 +++++++++++++++++++++++++----- drivers/gpu/nova-core/gsp/boot.rs | 15 ++++----- drivers/gpu/nova-core/nova_core.rs | 41 ++++++++++++++++++++++-- rust/helpers/pci.c | 5 +++ rust/kernel/pci.rs | 37 ++++++++++++++++++++++ 5 files changed, 131 insertions(+), 17 deletions(-) base-commit: 187d0801404f415f22c0b31531982c7ea97fa341 -- 2.52.0
