summaryrefslogtreecommitdiff
path: root/drivers/gpu/nova-core/irq/hal/tu102.rs
blob: 7e3aea946d054184271f9f5a96ce55e217dab905 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

use kernel::io::Io;

use crate::{
    driver::Bar0,
    irq::regs::NV_XVE_CYA_2, //
};

use super::{
    cycle_top_enables,
    CpuInterruptHal,
    LeafCount,
    MsiType,
    Subtree,
    SubtreeSet, //
};

/// The CPU interrupt tree properties of Turing, Ampere, and Ada.
struct Tu102;

impl CpuInterruptHal for Tu102 {
    fn leaf_count(&self) -> LeafCount {
        LeafCount::Eight
    }

    fn rearm_pci_irq(
        &self,
        bar: Bar0<'_>,
        msi_type: MsiType,
        _serviced: SubtreeSet,
        subtree: Subtree,
    ) {
        match msi_type {
            MsiType::Msi => bar.write(NV_XVE_CYA_2, 0u32.into()),
            MsiType::MsiX => cycle_top_enables(bar, subtree.into()),
        }
    }
}

const TU102: Tu102 = Tu102;
pub(super) const TU102_HAL: &dyn CpuInterruptHal = &TU102;