All of lore.kernel.org
 help / color / mirror / Atom feed
* [jfern:nova/master 72/87] Diff in drivers/gpu/nova-core/debugfs.rs at line 1:
@ 2025-07-01 16:14 kernel test robot
  2025-07-01 17:56 ` John Hubbard
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2025-07-01 16:14 UTC (permalink / raw)
  To: Joel Fernandes; +Cc: oe-kbuild-all, John Hubbard

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git nova/master
head:   dfa2b234298399a62d48d2a78ce8f3f58d21cda1
commit: 70794f2c1436933de0355b0bc0eb6faf16e968f8 [72/87] DEBUG: nova-core: debugfs support to dump logrm, logintr, loginit
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250702/202507020022.CTF71Rpm-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250702/202507020022.CTF71Rpm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507020022.CTF71Rpm-lkp@intel.com/

All errors (new ones prefixed by >>):

   PATH=/opt/cross/clang-18/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   INFO PATH=/opt/cross/rustc-1.78.0-bindgen-0.65.1/cargo/bin:/opt/cross/clang-18/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   /usr/bin/timeout -k 100 12h /usr/bin/make KCFLAGS= -fno-crash-diagnostics -Wno-error=return-type -Wreturn-type -funsigned-char -Wundef W=1 --keep-going LLVM=1 -j28 -C source O=/kbuild/obj/consumer/x86_64-rhel-9.4-rust ARCH=x86_64 SHELL=/bin/bash rustfmtcheck
   make: Entering directory '/kbuild/src/consumer'
   make[1]: Entering directory '/kbuild/obj/consumer/x86_64-rhel-9.4-rust'
   Diff in drivers/gpu/nova-core/regs.rs at line 204:
        31:0    value as u32;
    });
    
   -
    // Used to store version information about the firmware running
    // on the Falcon processor.
    register!(NV_PFALCON_FALCON_OS @ +0x00000080 {
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
    // SPDX-License-Identifier: GPL-2.0
    
   -use kernel::time::Delta;
    use kernel::prelude::*;
   +use kernel::time::Delta;
    
    use crate::{
        driver::Bar0,
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
        }
    
        /// Function to check if GSP reload/resume has completed during the boot process.
   -    pub(crate) fn check_reload_completed(
   -        &self,
   -        bar: &Bar0,
   -        timeout: Delta,
   -    ) -> Result<bool> {
   +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
            wait_on(timeout, || {
                let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
                if val.boot_stage_3_handoff() {
>> Diff in drivers/gpu/nova-core/debugfs.rs at line 1:
   -use kernel::prelude::*;
   -use kernel::{error::to_result, c_str};
   +use crate::gsp::GspSharedMemObjects;
    use core::ffi::c_void;
    use core::ptr;
   -use crate::gsp::GspSharedMemObjects;
   +use kernel::prelude::*;
   +use kernel::{c_str, error::to_result};
    
    extern "C" {
        fn nova_debugfs_create(name: *const i8) -> *mut c_void;
   Diff in drivers/gpu/nova-core/debugfs.rs at line 32:
    impl NovaDebugfs {
        pub(crate) fn new(name: &str) -> Result<Self> {
            let name_cstr = kernel::str::CString::try_from_fmt(fmt!("{}", name))?;
   -        
   +
            let ptr = unsafe { nova_debugfs_create(name_cstr.as_char_ptr() as *const i8) };
   -        
   +
            if ptr.is_null() {
                return Err(ENOMEM);
            }
   Diff in drivers/gpu/nova-core/debugfs.rs at line 41:
   -        
   -        let loginit_info = KBox::new(NovaLogBufferInfo {
   -            name: c_str!("LOGINIT").as_char_ptr() as *const i8,
   -            data: ptr::null_mut(),
   -            size: 0,
   -        }, GFP_KERNEL)?;
   -        
   -        let logintr_info = KBox::new(NovaLogBufferInfo {
   -            name: c_str!("LOGINTR").as_char_ptr() as *const i8,
   -            data: ptr::null_mut(),
   -            size: 0,
   -        }, GFP_KERNEL)?;
   -        
   -        let logrm_info = KBox::new(NovaLogBufferInfo {
   -            name: c_str!("LOGRM").as_char_ptr() as *const i8,
   -            data: ptr::null_mut(),
   -            size: 0,
   -        }, GFP_KERNEL)?;
   -        
   +
   +        let loginit_info = KBox::new(
   +            NovaLogBufferInfo {
   +                name: c_str!("LOGINIT").as_char_ptr() as *const i8,
   +                data: ptr::null_mut(),
   +                size: 0,
   +            },
   +            GFP_KERNEL,
   +        )?;
   +
   +        let logintr_info = KBox::new(
   +            NovaLogBufferInfo {
   +                name: c_str!("LOGINTR").as_char_ptr() as *const i8,
   +                data: ptr::null_mut(),
   +                size: 0,
   +            },
   +            GFP_KERNEL,
   +        )?;
   +
   +        let logrm_info = KBox::new(
   +            NovaLogBufferInfo {
   +                name: c_str!("LOGRM").as_char_ptr() as *const i8,
   +                data: ptr::null_mut(),
   +                size: 0,
   +            },
   +            GFP_KERNEL,
   +        )?;
   +
            Ok(Self {
                ptr,
                loginit_info,
   Diff in drivers/gpu/nova-core/debugfs.rs at line 64:
                logrm_info,
            })
        }
   -    
   +
        pub(crate) fn create_log_files(&mut self, gsp_mem: &GspSharedMemObjects) -> Result {
            self.loginit_info.data = gsp_mem.loginit.start_ptr() as *mut c_void;
            self.loginit_info.size = gsp_mem.loginit.size();
   Diff in drivers/gpu/nova-core/debugfs.rs at line 71:
   -        
   +
            self.logintr_info.data = gsp_mem.logintr.start_ptr() as *mut c_void;
            self.logintr_info.size = gsp_mem.logintr.size();
   -        
   +
            self.logrm_info.data = gsp_mem.logrm.start_ptr() as *mut c_void;
            self.logrm_info.size = gsp_mem.logrm.size();
   -        
   +
            let ret = unsafe {
                nova_debugfs_create_log_files(
                    self.ptr,
   Diff in drivers/gpu/nova-core/debugfs.rs at line 83:
                    &mut *self.logrm_info as *mut _,
                )
            };
   -        
   +
            to_result(ret)?;
   -        
   +
            pr_info!("Nova debugfs: Created log files\n");
            Ok(())
        }
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
    // SPDX-License-Identifier: GPL-2.0
    
   -use kernel::time::Delta;
    use kernel::prelude::*;
   +use kernel::time::Delta;
    
    use crate::{
        driver::Bar0,
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
        }
    
        /// Function to check if GSP reload/resume has completed during the boot process.
   -    pub(crate) fn check_reload_completed(
   -        &self,
   -        bar: &Bar0,
   -        timeout: Delta,
   -    ) -> Result<bool> {
   +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
            wait_on(timeout, || {
                let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
                if val.boot_stage_3_handoff() {
>> Diff in drivers/gpu/nova-core/gpu.rs at line 16:
    use crate::util;
    use crate::vbios::Vbios;
    
   -use core::fmt;
    use crate::debugfs::NovaDebugfs;
   +use core::fmt;
    use kernel::sync::{Arc, Mutex};
    
    static mut NOVA_DEBUGFS: Option<Arc<Mutex<NovaDebugfs>>> = None;
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 5:
    use core::{mem::size_of, slice, time::Duration};
    use kernel::delay::sleep;
    use kernel::devres::Devres;
   -use kernel::time::Delta;
    use kernel::prelude::*;
   +use kernel::time::Delta;
    
    use crate::driver::Bar0;
    use crate::falcon::{gsp::Gsp, sec2::Sec2, Falcon};
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 15:
    use crate::nvfw::r570_144 as fw;
    use crate::util::wait_on;
    
   -use kernel::{pr_info, pr_cont};
   +use kernel::{pr_cont, pr_info};
    
    /// Print a byte slice using pr_info, with bytes_per_line bytes on each line.
    /// Each line is formatted as [0xAA, 0xBB, ...].
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 23:
        for chunk in bytes.chunks(bytes_per_line) {
            // Print opening bracket
            pr_info!("[");
   -        
   +
            // Print each byte with comma separators
            for (i, byte) in chunk.iter().enumerate() {
                if i > 0 {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 31:
                }
                pr_cont!("0x{:02X}", byte);
            }
   -        
   +
            // Print closing bracket and newline
            pr_cont!("]\n");
        }
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 136:
    }
    
    pub(crate) trait GspSeqCmdRunner {
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result;
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_WRITE {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 143:
        // TODO: Can we return Result instead of  Result?
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
            pr_debug!("RegWrite: addr=0x{:x}, val=0x{:x}\n", self.addr, self.val);
            let addr = self.addr as usize;
            let val = self.val;
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 151:
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY {
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
            pr_info!(
                "RegModify: addr=0x{:x}, mask=0x{:x}, val=0x{:x}\n",
                self.addr,
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 161:
    
            let addr = self.addr as usize;
            if let Ok(temp) = sequencer.bar.try_read32(addr) {
   -            sequencer.bar.try_write32((temp & !self.mask) | self.val, addr);
   +            sequencer
   +                .bar
   +                .try_write32((temp & !self.mask) | self.val, addr);
            }
            Ok(())
        }
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 168:
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_POLL {
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
            pr_debug!(
                "RegPoll: addr=0x{:x}, mask=0x{:x}, val=0x{:x}, timeout=0x{:x}, error=0x{:x}\n",
                self.addr,
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 204:
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_DELAY_US {
   -    fn run(&self, _sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
            pr_info!("DelayUs: val=0x{:x}\n", self.val);
            sleep(Duration::from_micros(self.val as u64));
            Ok(())
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 212:
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_STORE {
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
            let addr = self.addr as usize;
            let index = self.index;
    
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 233:
    }
    
    impl GspSeqCmdRunner for GspSeqCmd {
   -    fn run(&self, seq: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, seq: &GspSequencer<'_>) -> Result {
            match self {
                // TODO: Can reduce the number of "impl GspSeqCmdRunner" above, if
                // moving logic into this block itself. But may not be worth it if
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 281:
                    seq.sec2_falcon.start(seq.bar)?;
    
                    // Check if GSP-RM resumed.
   -                seq.gsp_falcon.check_reload_completed(seq.bar, Delta::from_secs(2))?;
   +                seq.gsp_falcon
   +                    .check_reload_completed(seq.bar, Delta::from_secs(2))?;
    
                    // Check for any errors in the SEC2 mailbox registers.
                    let mbox0 = seq.sec2_falcon.read_mailbox0(seq.bar)?;
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 291:
                    }
    
                    // Write the OS version to the GSP falcon.
   -                seq.gsp_falcon.write_os_version(seq.bar, seq.fw.gsp_desc.app_version())?;
   +                seq.gsp_falcon
   +                    .write_os_version(seq.bar, seq.fw.gsp_desc.app_version())?;
    
                    // Check if the RISC-V core is active, return error if not
                    if !seq.gsp_falcon.is_riscv_active(seq.bar)? {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 400:
            // TODO: Replace with actual RPC header size calculation from your codebase
            // For example: let rpc_header_size = RpcMsg::ver::get_gsp_rpc_hdr_size() as usize;
            let rpc_header_size = 0; // Replace with actual size when available
   -        
   +
            // Dump RPC header
            pr_info!("RPC header ({} bytes):", rpc_header_size);
            if rpc_header_size > 0 && self.data.len() >= rpc_header_size {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 409:
            } else {
                pr_info!("(RPC header not available or size unknown)\n");
            }
   -        
   +
            // Dump run structure (seq_info)
            let run_struct_size = size_of::<fw::rpc_run_cpu_sequencer_v17_00>();
            let run_struct_start = rpc_header_size;
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 416:
   -        
   +
            pr_info!("Run structure ({} bytes):", run_struct_size);
            if self.data.len() >= run_struct_start + run_struct_size {
                let run_struct_slice = &self.data[run_struct_start..run_struct_start + run_struct_size];
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 421:
            } else {
                pr_info!("(Run structure not available or not enough data)\n");
            }
   -        
   +
            // Dump opcode data (first 200 bytes)
            let opcode_data_start = run_struct_start + run_struct_size;
   -        
   +
            pr_info!("First 200 bytes of opcode data:");
            if self.data.len() > opcode_data_start {
                let opcode_data_len = core::cmp::min(200, self.data.len() - opcode_data_start);
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 435:
            }
        }
    
   -    pub(crate) fn run(&self) ->  Result {
   +    pub(crate) fn run(&self) -> Result {
            pr_info!("Running CPU Sequencer commands\n");
            self.dump_bytes();
    
>> Diff in drivers/gpu/nova-core/nova_core.rs at line 25:
        }
    }
    
   +mod debugfs;
    mod dma;
    mod driver;
    mod falcon;
   Diff in drivers/gpu/nova-core/nova_core.rs at line 37:
    mod regs;
    mod util;
    mod vbios;
   -mod debugfs;
    
    pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
    
   Diff in drivers/gpu/nova-core/regs.rs at line 204:
        31:0    value as u32;
    });
    
   -
    // Used to store version information about the firmware running
    // on the Falcon processor.
    register!(NV_PFALCON_FALCON_OS @ +0x00000080 {
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
    // SPDX-License-Identifier: GPL-2.0
    
   -use kernel::time::Delta;
    use kernel::prelude::*;
   +use kernel::time::Delta;
    
    use crate::{
        driver::Bar0,
   Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
        }
    
        /// Function to check if GSP reload/resume has completed during the boot process.
   -    pub(crate) fn check_reload_completed(
   -        &self,
   -        bar: &Bar0,
   -        timeout: Delta,
   -    ) -> Result<bool> {
   +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
            wait_on(timeout, || {
                let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
                if val.boot_stage_3_handoff() {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 5:
    use core::{mem::size_of, slice, time::Duration};
    use kernel::delay::sleep;
    use kernel::devres::Devres;
   -use kernel::time::Delta;
    use kernel::prelude::*;
   +use kernel::time::Delta;
    
    use crate::driver::Bar0;
    use crate::falcon::{gsp::Gsp, sec2::Sec2, Falcon};
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 15:
    use crate::nvfw::r570_144 as fw;
    use crate::util::wait_on;
    
   -use kernel::{pr_info, pr_cont};
   +use kernel::{pr_cont, pr_info};
    
    /// Print a byte slice using pr_info, with bytes_per_line bytes on each line.
    /// Each line is formatted as [0xAA, 0xBB, ...].
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 23:
        for chunk in bytes.chunks(bytes_per_line) {
            // Print opening bracket
            pr_info!("[");
   -        
   +
            // Print each byte with comma separators
            for (i, byte) in chunk.iter().enumerate() {
                if i > 0 {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 31:
                }
                pr_cont!("0x{:02X}", byte);
            }
   -        
   +
            // Print closing bracket and newline
            pr_cont!("]\n");
        }
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 136:
    }
    
    pub(crate) trait GspSeqCmdRunner {
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result;
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
    }
    
    impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_WRITE {
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 143:
        // TODO: Can we return Result instead of  Result?
   -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
   +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
            pr_debug!("RegWrite: addr=0x{:x}, val=0x{:x}\n", self.addr, self.val);
            let addr = self.addr as usize;
            let val = self.val;
   Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 151:
    }
..

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [jfern:nova/master 72/87] Diff in drivers/gpu/nova-core/debugfs.rs at line 1:
  2025-07-01 16:14 [jfern:nova/master 72/87] Diff in drivers/gpu/nova-core/debugfs.rs at line 1: kernel test robot
@ 2025-07-01 17:56 ` John Hubbard
  2025-07-01 21:33   ` Joel Fernandes
  0 siblings, 1 reply; 3+ messages in thread
From: John Hubbard @ 2025-07-01 17:56 UTC (permalink / raw)
  To: kernel test robot, Joel Fernandes; +Cc: oe-kbuild-all

On 7/1/25 9:14 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git nova/master
> head:   dfa2b234298399a62d48d2a78ce8f3f58d21cda1
> commit: 70794f2c1436933de0355b0bc0eb6faf16e968f8 [72/87] DEBUG: nova-core: debugfs support to dump logrm, logintr, loginit

Hi Joel,

I've forgotten, but did you submit this and its related patches,
directly to the kernel test robot? Otherwise I'm wondering how
this was launched. Just curious.

I also noticed that the patch title (subject line) should be
tweaked, in order to have the right hierarchy, to:

     nova-core: debugfs support to dump logrm, logintr, loginit

...and if this is not a keeper, then maybe put "DEBUG" in there,
somewhere well after the "nova-core: " prefix.

thanks,
John Hubbard

> config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250702/202507020022.CTF71Rpm-lkp@intel.com/config)
> compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
> rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250702/202507020022.CTF71Rpm-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507020022.CTF71Rpm-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>     PATH=/opt/cross/clang-18/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>     INFO PATH=/opt/cross/rustc-1.78.0-bindgen-0.65.1/cargo/bin:/opt/cross/clang-18/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>     /usr/bin/timeout -k 100 12h /usr/bin/make KCFLAGS= -fno-crash-diagnostics -Wno-error=return-type -Wreturn-type -funsigned-char -Wundef W=1 --keep-going LLVM=1 -j28 -C source O=/kbuild/obj/consumer/x86_64-rhel-9.4-rust ARCH=x86_64 SHELL=/bin/bash rustfmtcheck
>     make: Entering directory '/kbuild/src/consumer'
>     make[1]: Entering directory '/kbuild/obj/consumer/x86_64-rhel-9.4-rust'
>     Diff in drivers/gpu/nova-core/regs.rs at line 204:
>          31:0    value as u32;
>      });
>      
>     -
>      // Used to store version information about the firmware running
>      // on the Falcon processor.
>      register!(NV_PFALCON_FALCON_OS @ +0x00000080 {
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
>      // SPDX-License-Identifier: GPL-2.0
>      
>     -use kernel::time::Delta;
>      use kernel::prelude::*;
>     +use kernel::time::Delta;
>      
>      use crate::{
>          driver::Bar0,
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
>          }
>      
>          /// Function to check if GSP reload/resume has completed during the boot process.
>     -    pub(crate) fn check_reload_completed(
>     -        &self,
>     -        bar: &Bar0,
>     -        timeout: Delta,
>     -    ) -> Result<bool> {
>     +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
>              wait_on(timeout, || {
>                  let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
>                  if val.boot_stage_3_handoff() {
>>> Diff in drivers/gpu/nova-core/debugfs.rs at line 1:
>     -use kernel::prelude::*;
>     -use kernel::{error::to_result, c_str};
>     +use crate::gsp::GspSharedMemObjects;
>      use core::ffi::c_void;
>      use core::ptr;
>     -use crate::gsp::GspSharedMemObjects;
>     +use kernel::prelude::*;
>     +use kernel::{c_str, error::to_result};
>      
>      extern "C" {
>          fn nova_debugfs_create(name: *const i8) -> *mut c_void;
>     Diff in drivers/gpu/nova-core/debugfs.rs at line 32:
>      impl NovaDebugfs {
>          pub(crate) fn new(name: &str) -> Result<Self> {
>              let name_cstr = kernel::str::CString::try_from_fmt(fmt!("{}", name))?;
>     -
>     +
>              let ptr = unsafe { nova_debugfs_create(name_cstr.as_char_ptr() as *const i8) };
>     -
>     +
>              if ptr.is_null() {
>                  return Err(ENOMEM);
>              }
>     Diff in drivers/gpu/nova-core/debugfs.rs at line 41:
>     -
>     -        let loginit_info = KBox::new(NovaLogBufferInfo {
>     -            name: c_str!("LOGINIT").as_char_ptr() as *const i8,
>     -            data: ptr::null_mut(),
>     -            size: 0,
>     -        }, GFP_KERNEL)?;
>     -
>     -        let logintr_info = KBox::new(NovaLogBufferInfo {
>     -            name: c_str!("LOGINTR").as_char_ptr() as *const i8,
>     -            data: ptr::null_mut(),
>     -            size: 0,
>     -        }, GFP_KERNEL)?;
>     -
>     -        let logrm_info = KBox::new(NovaLogBufferInfo {
>     -            name: c_str!("LOGRM").as_char_ptr() as *const i8,
>     -            data: ptr::null_mut(),
>     -            size: 0,
>     -        }, GFP_KERNEL)?;
>     -
>     +
>     +        let loginit_info = KBox::new(
>     +            NovaLogBufferInfo {
>     +                name: c_str!("LOGINIT").as_char_ptr() as *const i8,
>     +                data: ptr::null_mut(),
>     +                size: 0,
>     +            },
>     +            GFP_KERNEL,
>     +        )?;
>     +
>     +        let logintr_info = KBox::new(
>     +            NovaLogBufferInfo {
>     +                name: c_str!("LOGINTR").as_char_ptr() as *const i8,
>     +                data: ptr::null_mut(),
>     +                size: 0,
>     +            },
>     +            GFP_KERNEL,
>     +        )?;
>     +
>     +        let logrm_info = KBox::new(
>     +            NovaLogBufferInfo {
>     +                name: c_str!("LOGRM").as_char_ptr() as *const i8,
>     +                data: ptr::null_mut(),
>     +                size: 0,
>     +            },
>     +            GFP_KERNEL,
>     +        )?;
>     +
>              Ok(Self {
>                  ptr,
>                  loginit_info,
>     Diff in drivers/gpu/nova-core/debugfs.rs at line 64:
>                  logrm_info,
>              })
>          }
>     -
>     +
>          pub(crate) fn create_log_files(&mut self, gsp_mem: &GspSharedMemObjects) -> Result {
>              self.loginit_info.data = gsp_mem.loginit.start_ptr() as *mut c_void;
>              self.loginit_info.size = gsp_mem.loginit.size();
>     Diff in drivers/gpu/nova-core/debugfs.rs at line 71:
>     -
>     +
>              self.logintr_info.data = gsp_mem.logintr.start_ptr() as *mut c_void;
>              self.logintr_info.size = gsp_mem.logintr.size();
>     -
>     +
>              self.logrm_info.data = gsp_mem.logrm.start_ptr() as *mut c_void;
>              self.logrm_info.size = gsp_mem.logrm.size();
>     -
>     +
>              let ret = unsafe {
>                  nova_debugfs_create_log_files(
>                      self.ptr,
>     Diff in drivers/gpu/nova-core/debugfs.rs at line 83:
>                      &mut *self.logrm_info as *mut _,
>                  )
>              };
>     -
>     +
>              to_result(ret)?;
>     -
>     +
>              pr_info!("Nova debugfs: Created log files\n");
>              Ok(())
>          }
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
>      // SPDX-License-Identifier: GPL-2.0
>      
>     -use kernel::time::Delta;
>      use kernel::prelude::*;
>     +use kernel::time::Delta;
>      
>      use crate::{
>          driver::Bar0,
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
>          }
>      
>          /// Function to check if GSP reload/resume has completed during the boot process.
>     -    pub(crate) fn check_reload_completed(
>     -        &self,
>     -        bar: &Bar0,
>     -        timeout: Delta,
>     -    ) -> Result<bool> {
>     +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
>              wait_on(timeout, || {
>                  let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
>                  if val.boot_stage_3_handoff() {
>>> Diff in drivers/gpu/nova-core/gpu.rs at line 16:
>      use crate::util;
>      use crate::vbios::Vbios;
>      
>     -use core::fmt;
>      use crate::debugfs::NovaDebugfs;
>     +use core::fmt;
>      use kernel::sync::{Arc, Mutex};
>      
>      static mut NOVA_DEBUGFS: Option<Arc<Mutex<NovaDebugfs>>> = None;
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 5:
>      use core::{mem::size_of, slice, time::Duration};
>      use kernel::delay::sleep;
>      use kernel::devres::Devres;
>     -use kernel::time::Delta;
>      use kernel::prelude::*;
>     +use kernel::time::Delta;
>      
>      use crate::driver::Bar0;
>      use crate::falcon::{gsp::Gsp, sec2::Sec2, Falcon};
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 15:
>      use crate::nvfw::r570_144 as fw;
>      use crate::util::wait_on;
>      
>     -use kernel::{pr_info, pr_cont};
>     +use kernel::{pr_cont, pr_info};
>      
>      /// Print a byte slice using pr_info, with bytes_per_line bytes on each line.
>      /// Each line is formatted as [0xAA, 0xBB, ...].
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 23:
>          for chunk in bytes.chunks(bytes_per_line) {
>              // Print opening bracket
>              pr_info!("[");
>     -
>     +
>              // Print each byte with comma separators
>              for (i, byte) in chunk.iter().enumerate() {
>                  if i > 0 {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 31:
>                  }
>                  pr_cont!("0x{:02X}", byte);
>              }
>     -
>     +
>              // Print closing bracket and newline
>              pr_cont!("]\n");
>          }
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 136:
>      }
>      
>      pub(crate) trait GspSeqCmdRunner {
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result;
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_WRITE {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 143:
>          // TODO: Can we return Result instead of  Result?
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>              pr_debug!("RegWrite: addr=0x{:x}, val=0x{:x}\n", self.addr, self.val);
>              let addr = self.addr as usize;
>              let val = self.val;
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 151:
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY {
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>              pr_info!(
>                  "RegModify: addr=0x{:x}, mask=0x{:x}, val=0x{:x}\n",
>                  self.addr,
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 161:
>      
>              let addr = self.addr as usize;
>              if let Ok(temp) = sequencer.bar.try_read32(addr) {
>     -            sequencer.bar.try_write32((temp & !self.mask) | self.val, addr);
>     +            sequencer
>     +                .bar
>     +                .try_write32((temp & !self.mask) | self.val, addr);
>              }
>              Ok(())
>          }
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 168:
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_POLL {
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>              pr_debug!(
>                  "RegPoll: addr=0x{:x}, mask=0x{:x}, val=0x{:x}, timeout=0x{:x}, error=0x{:x}\n",
>                  self.addr,
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 204:
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_DELAY_US {
>     -    fn run(&self, _sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
>              pr_info!("DelayUs: val=0x{:x}\n", self.val);
>              sleep(Duration::from_micros(self.val as u64));
>              Ok(())
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 212:
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_STORE {
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>              let addr = self.addr as usize;
>              let index = self.index;
>      
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 233:
>      }
>      
>      impl GspSeqCmdRunner for GspSeqCmd {
>     -    fn run(&self, seq: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, seq: &GspSequencer<'_>) -> Result {
>              match self {
>                  // TODO: Can reduce the number of "impl GspSeqCmdRunner" above, if
>                  // moving logic into this block itself. But may not be worth it if
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 281:
>                      seq.sec2_falcon.start(seq.bar)?;
>      
>                      // Check if GSP-RM resumed.
>     -                seq.gsp_falcon.check_reload_completed(seq.bar, Delta::from_secs(2))?;
>     +                seq.gsp_falcon
>     +                    .check_reload_completed(seq.bar, Delta::from_secs(2))?;
>      
>                      // Check for any errors in the SEC2 mailbox registers.
>                      let mbox0 = seq.sec2_falcon.read_mailbox0(seq.bar)?;
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 291:
>                      }
>      
>                      // Write the OS version to the GSP falcon.
>     -                seq.gsp_falcon.write_os_version(seq.bar, seq.fw.gsp_desc.app_version())?;
>     +                seq.gsp_falcon
>     +                    .write_os_version(seq.bar, seq.fw.gsp_desc.app_version())?;
>      
>                      // Check if the RISC-V core is active, return error if not
>                      if !seq.gsp_falcon.is_riscv_active(seq.bar)? {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 400:
>              // TODO: Replace with actual RPC header size calculation from your codebase
>              // For example: let rpc_header_size = RpcMsg::ver::get_gsp_rpc_hdr_size() as usize;
>              let rpc_header_size = 0; // Replace with actual size when available
>     -
>     +
>              // Dump RPC header
>              pr_info!("RPC header ({} bytes):", rpc_header_size);
>              if rpc_header_size > 0 && self.data.len() >= rpc_header_size {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 409:
>              } else {
>                  pr_info!("(RPC header not available or size unknown)\n");
>              }
>     -
>     +
>              // Dump run structure (seq_info)
>              let run_struct_size = size_of::<fw::rpc_run_cpu_sequencer_v17_00>();
>              let run_struct_start = rpc_header_size;
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 416:
>     -
>     +
>              pr_info!("Run structure ({} bytes):", run_struct_size);
>              if self.data.len() >= run_struct_start + run_struct_size {
>                  let run_struct_slice = &self.data[run_struct_start..run_struct_start + run_struct_size];
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 421:
>              } else {
>                  pr_info!("(Run structure not available or not enough data)\n");
>              }
>     -
>     +
>              // Dump opcode data (first 200 bytes)
>              let opcode_data_start = run_struct_start + run_struct_size;
>     -
>     +
>              pr_info!("First 200 bytes of opcode data:");
>              if self.data.len() > opcode_data_start {
>                  let opcode_data_len = core::cmp::min(200, self.data.len() - opcode_data_start);
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 435:
>              }
>          }
>      
>     -    pub(crate) fn run(&self) ->  Result {
>     +    pub(crate) fn run(&self) -> Result {
>              pr_info!("Running CPU Sequencer commands\n");
>              self.dump_bytes();
>      
>>> Diff in drivers/gpu/nova-core/nova_core.rs at line 25:
>          }
>      }
>      
>     +mod debugfs;
>      mod dma;
>      mod driver;
>      mod falcon;
>     Diff in drivers/gpu/nova-core/nova_core.rs at line 37:
>      mod regs;
>      mod util;
>      mod vbios;
>     -mod debugfs;
>      
>      pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
>      
>     Diff in drivers/gpu/nova-core/regs.rs at line 204:
>          31:0    value as u32;
>      });
>      
>     -
>      // Used to store version information about the firmware running
>      // on the Falcon processor.
>      register!(NV_PFALCON_FALCON_OS @ +0x00000080 {
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 1:
>      // SPDX-License-Identifier: GPL-2.0
>      
>     -use kernel::time::Delta;
>      use kernel::prelude::*;
>     +use kernel::time::Delta;
>      
>      use crate::{
>          driver::Bar0,
>     Diff in drivers/gpu/nova-core/falcon/gsp.rs at line 27:
>          }
>      
>          /// Function to check if GSP reload/resume has completed during the boot process.
>     -    pub(crate) fn check_reload_completed(
>     -        &self,
>     -        bar: &Bar0,
>     -        timeout: Delta,
>     -    ) -> Result<bool> {
>     +    pub(crate) fn check_reload_completed(&self, bar: &Bar0, timeout: Delta) -> Result<bool> {
>              wait_on(timeout, || {
>                  let val = regs::NV_PGC6_BSI_SECURE_SCRATCH_14::read(bar);
>                  if val.boot_stage_3_handoff() {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 5:
>      use core::{mem::size_of, slice, time::Duration};
>      use kernel::delay::sleep;
>      use kernel::devres::Devres;
>     -use kernel::time::Delta;
>      use kernel::prelude::*;
>     +use kernel::time::Delta;
>      
>      use crate::driver::Bar0;
>      use crate::falcon::{gsp::Gsp, sec2::Sec2, Falcon};
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 15:
>      use crate::nvfw::r570_144 as fw;
>      use crate::util::wait_on;
>      
>     -use kernel::{pr_info, pr_cont};
>     +use kernel::{pr_cont, pr_info};
>      
>      /// Print a byte slice using pr_info, with bytes_per_line bytes on each line.
>      /// Each line is formatted as [0xAA, 0xBB, ...].
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 23:
>          for chunk in bytes.chunks(bytes_per_line) {
>              // Print opening bracket
>              pr_info!("[");
>     -
>     +
>              // Print each byte with comma separators
>              for (i, byte) in chunk.iter().enumerate() {
>                  if i > 0 {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 31:
>                  }
>                  pr_cont!("0x{:02X}", byte);
>              }
>     -
>     +
>              // Print closing bracket and newline
>              pr_cont!("]\n");
>          }
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 136:
>      }
>      
>      pub(crate) trait GspSeqCmdRunner {
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result;
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
>      }
>      
>      impl GspSeqCmdRunner for fw::GSP_SEQ_BUF_PAYLOAD_REG_WRITE {
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 143:
>          // TODO: Can we return Result instead of  Result?
>     -    fn run(&self, sequencer: &GspSequencer<'_>) ->  Result {
>     +    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>              pr_debug!("RegWrite: addr=0x{:x}, val=0x{:x}\n", self.addr, self.val);
>              let addr = self.addr as usize;
>              let val = self.val;
>     Diff in drivers/gpu/nova-core/gsp/sequencer.rs at line 151:
>      }
> ..
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [jfern:nova/master 72/87] Diff in drivers/gpu/nova-core/debugfs.rs at line 1:
  2025-07-01 17:56 ` John Hubbard
@ 2025-07-01 21:33   ` Joel Fernandes
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2025-07-01 21:33 UTC (permalink / raw)
  To: John Hubbard, kernel test robot; +Cc: oe-kbuild-all



On 7/1/2025 1:56 PM, John Hubbard wrote:
> On 7/1/25 9:14 AM, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git nova/
>> master
>> head:   dfa2b234298399a62d48d2a78ce8f3f58d21cda1
>> commit: 70794f2c1436933de0355b0bc0eb6faf16e968f8 [72/87] DEBUG: nova-core:
>> debugfs support to dump logrm, logintr, loginit
> 
> Hi Joel,
> 
> I've forgotten, but did you submit this and its related patches,
> directly to the kernel test robot? Otherwise I'm wondering how
> this was launched. Just curious.

It launches for all my upstream trees (scheduler, RCU), and I push my WIP trees
to kernel.org as well to share with others, so it tests everything. There used
to be a way to stop it from doing so by appending '.wip' but now I believe that
doesn't work (also its odd to suffix .wip). To its credit, I did fix the lint
errors it shared in my latest tree.

> I also noticed that the patch title (subject line) should be
> tweaked, in order to have the right hierarchy, to:
> 
>     nova-core: debugfs support to dump logrm, logintr, loginit
> 
> ...and if this is not a keeper, then maybe put "DEBUG" in there,
> somewhere well after the "nova-core: " prefix.

Yep, fixed. thanks,

 - Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-01 21:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 16:14 [jfern:nova/master 72/87] Diff in drivers/gpu/nova-core/debugfs.rs at line 1: kernel test robot
2025-07-01 17:56 ` John Hubbard
2025-07-01 21:33   ` Joel Fernandes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.