mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
gpu: nova-core: falcon: add distinct base address for PFALCON2
Falcon engines have two distinct register bases: `PFALCON` and `PFALCON2`. So far we assumed that `PFALCON2` was located at `PFALCON + 0x1000` because that is the case of most engines, but there are exceptions (NVDEC uses `0x1c00`). Fix this shortcoming by leveraging the redesigned relative registers definitions to assign a distinct `PFalcon2Base` base address to each falcon engine. Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://lore.kernel.org/r/20250718-nova-regs-v2-16-7b6a762aa1cd@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
@@ -278,11 +278,16 @@ impl From<bool> for FalconFbifMemType {
|
||||
/// Type used to represent the `PFALCON` registers address base for a given falcon engine.
|
||||
pub(crate) struct PFalconBase(());
|
||||
|
||||
/// Type used to represent the `PFALCON2` registers address base for a given falcon engine.
|
||||
pub(crate) struct PFalcon2Base(());
|
||||
|
||||
/// Trait defining the parameters of a given Falcon engine.
|
||||
///
|
||||
/// Each engine provides one base for `PFALCON` and `PFALCON2` registers. The `ID` constant is used
|
||||
/// to identify a given Falcon instance with register I/O methods.
|
||||
pub(crate) trait FalconEngine: Sync + RegisterBase<PFalconBase> + Sized {
|
||||
pub(crate) trait FalconEngine:
|
||||
Sync + RegisterBase<PFalconBase> + RegisterBase<PFalcon2Base> + Sized
|
||||
{
|
||||
/// Singleton of the engine, used to identify it with register I/O methods.
|
||||
const ID: Self;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{
|
||||
driver::Bar0,
|
||||
falcon::{Falcon, FalconEngine, PFalconBase},
|
||||
falcon::{Falcon, FalconEngine, PFalcon2Base, PFalconBase},
|
||||
regs::{self, macros::RegisterBase},
|
||||
};
|
||||
|
||||
@@ -13,6 +13,10 @@ impl RegisterBase<PFalconBase> for Gsp {
|
||||
const BASE: usize = 0x00110000;
|
||||
}
|
||||
|
||||
impl RegisterBase<PFalcon2Base> for Gsp {
|
||||
const BASE: usize = 0x00111000;
|
||||
}
|
||||
|
||||
impl FalconEngine for Gsp {
|
||||
const ID: Self = Gsp(());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
use crate::falcon::{FalconEngine, PFalconBase};
|
||||
use crate::falcon::{FalconEngine, PFalcon2Base, PFalconBase};
|
||||
use crate::regs::macros::RegisterBase;
|
||||
|
||||
/// Type specifying the `Sec2` falcon engine. Cannot be instantiated.
|
||||
@@ -10,6 +10,10 @@ impl RegisterBase<PFalconBase> for Sec2 {
|
||||
const BASE: usize = 0x00840000;
|
||||
}
|
||||
|
||||
impl RegisterBase<PFalcon2Base> for Sec2 {
|
||||
const BASE: usize = 0x00841000;
|
||||
}
|
||||
|
||||
impl FalconEngine for Sec2 {
|
||||
const ID: Self = Sec2(());
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pub(crate) mod macros;
|
||||
|
||||
use crate::falcon::{
|
||||
DmaTrfCmdSize, FalconCoreRev, FalconCoreRevSubversion, FalconFbifMemType, FalconFbifTarget,
|
||||
FalconModSelAlgo, FalconSecurityModel, PFalconBase, PeregrineCoreSelect,
|
||||
FalconModSelAlgo, FalconSecurityModel, PFalcon2Base, PFalconBase, PeregrineCoreSelect,
|
||||
};
|
||||
use crate::gpu::{Architecture, Chipset};
|
||||
use kernel::prelude::*;
|
||||
@@ -296,20 +296,22 @@ register!(NV_PFALCON_FBIF_CTL @ PFalconBase[0x00000624] {
|
||||
7:7 allow_phys_no_ctx as bool;
|
||||
});
|
||||
|
||||
register!(NV_PFALCON2_FALCON_MOD_SEL @ PFalconBase[0x00001180] {
|
||||
/* PFALCON2 */
|
||||
|
||||
register!(NV_PFALCON2_FALCON_MOD_SEL @ PFalcon2Base[0x00000180] {
|
||||
7:0 algo as u8 ?=> FalconModSelAlgo;
|
||||
});
|
||||
|
||||
register!(NV_PFALCON2_FALCON_BROM_CURR_UCODE_ID @ PFalconBase[0x00001198] {
|
||||
register!(NV_PFALCON2_FALCON_BROM_CURR_UCODE_ID @ PFalcon2Base[0x00000198] {
|
||||
7:0 ucode_id as u8;
|
||||
});
|
||||
|
||||
register!(NV_PFALCON2_FALCON_BROM_ENGIDMASK @ PFalconBase[0x0000119c] {
|
||||
register!(NV_PFALCON2_FALCON_BROM_ENGIDMASK @ PFalcon2Base[0x0000019c] {
|
||||
31:0 value as u32;
|
||||
});
|
||||
|
||||
// TODO[REGA]: this is an array of registers.
|
||||
register!(NV_PFALCON2_FALCON_BROM_PARAADDR @ PFalconBase[0x00001210] {
|
||||
register!(NV_PFALCON2_FALCON_BROM_PARAADDR @ PFalcon2Base[0x00000210] {
|
||||
31:0 value as u32;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user