drivers/gpu/nova-core/gsp/boot.rs

Source file repositories/reference/linux-study-clean/drivers/gpu/nova-core/gsp/boot.rs

File Facts

System
Linux kernel
Corpus path
drivers/gpu/nova-core/gsp/boot.rs
Extension
.rs
Size
7121 bytes
Lines
227
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

use kernel::{
    bits,
    device,
    dma::Coherent,
    io::poll::read_poll_timeout,
    pci,
    prelude::*,
    time::Delta,
    types::ScopeGuard, //
};

use crate::{
    driver::Bar0,
    falcon::{
        gsp::Gsp,
        sec2::Sec2,
        Falcon, //
    },
    fb::FbLayout,
    firmware::{
        gsp::GspFirmware,
        FIRMWARE_VERSION, //
    },
    gpu::Chipset,
    gsp::{
        cmdq::Cmdq,
        commands,
        GspFwWprMeta, //
    },
};

/// Arguments required to call [`Gsp::unload`](super::Gsp::unload).
///
/// Stored as their own type to avoid repeating a long and tedious list in [`BootUnloadGuard`].
pub(super) struct BootUnloadArgs<'a> {
    gsp: &'a super::Gsp,
    dev: &'a device::Device<device::Bound>,
    bar: Bar0<'a>,
    gsp_falcon: &'a Falcon<Gsp>,
    sec2_falcon: &'a Falcon<Sec2>,
    unload_bundle: Option<super::UnloadBundle>,
}

/// Guard that calls [`Gsp::unload`](super::Gsp::unload) with a
/// [`UnloadBundle`](super::UnloadBundle) when dropped.
///
/// Used to ensure the `UnloadBundle` is run during failure paths.
pub(super) struct BootUnloadGuard<'a> {
    guard: ScopeGuard<BootUnloadArgs<'a>, fn(BootUnloadArgs<'a>)>,
}

impl<'a> BootUnloadGuard<'a> {
    /// Wraps `unload_bundle` into a guard that executes it when dropped.
    pub(super) fn new(
        gsp: &'a super::Gsp,
        dev: &'a device::Device<device::Bound>,
        bar: Bar0<'a>,
        gsp_falcon: &'a Falcon<Gsp>,
        sec2_falcon: &'a Falcon<Sec2>,
        unload_bundle: Option<super::UnloadBundle>,
    ) -> Self {
        Self {
            guard: ScopeGuard::new_with_data(
                BootUnloadArgs {
                    gsp,
                    dev,
                    bar,
                    gsp_falcon,
                    sec2_falcon,
                    unload_bundle,
                },
                |args| {
                    let _ = super::Gsp::unload(
                        args.gsp,
                        args.dev,
                        args.bar,
                        args.gsp_falcon,
                        args.sec2_falcon,
                        args.unload_bundle,
                    );
                },
            ),
        }
    }

    /// Disarms the guard and returns the [`UnloadBundle`](super::UnloadBundle) it contains.
    pub(super) fn dismiss(self) -> Option<super::UnloadBundle> {

Annotation

Implementation Notes