mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drm: nova: Add chipid enum to nova-drm UAPI
The chip identifier uniquely identifies a GPU chip and needs to be exposed to user-space so it can look up chip specific properties that cannot be derived from the architecture alone. This adds a public enum to the userspace headers for each chip ID. Nova-core can then use this enum to define its chipsets. The values are opaque to user-space. They may be compared against the enum to identify a chip but user-space must not assume the values carry any particular meaning or encoding. This does create a coupling between nova-drm and nova-core whereby nova-core depends on the values defined by the user-space API for nova-drm. However this is entirely appropriate as nova-core must be bound by the UAPI headers as the enum values are read by nova-core and passed through to user-space. Note that nova-core currently refers to the chipid as a chipset. This isn't ideal given that chipid is the preferred and more accurate term and is what should be exposed via the uAPI. Therefore a future patch series will be posted that aligns nova-core internals to using chipid rather than chipset. Assisted-by: LLM Signed-off-by: Alistair Popple <apopple@nvidia.com> Link: https://patch.msgid.link/20260909064506.910162-6-apopple@nvidia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
parent
342aaa7bb3
commit
a1678ed1f8
|
|
@ -51,13 +51,14 @@
|
|||
mod regs;
|
||||
|
||||
macro_rules! define_chipset {
|
||||
({ $($variant:ident = $value:literal),* $(,)* }) =>
|
||||
({ $($variant:ident),* $(,)* }) =>
|
||||
{
|
||||
::kernel::macros::paste!(
|
||||
/// Enum representation of the GPU chipset.
|
||||
#[derive(fmt::Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub(crate) enum Chipset {
|
||||
$($variant = $value),*,
|
||||
$($variant = uapi::[<drm_nova_chipid_NOVA_DRM_CHIPID_ $variant:upper>]),*,
|
||||
}
|
||||
|
||||
impl Chipset {
|
||||
|
|
@ -89,7 +90,9 @@ impl TryFrom<u32> for Chipset {
|
|||
fn try_from(value: u32) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
$(
|
||||
$value => Ok(Chipset::$variant),
|
||||
uapi::[<drm_nova_chipid_NOVA_DRM_CHIPID_ $variant:upper>] => {
|
||||
Ok(Chipset::$variant)
|
||||
}
|
||||
)*
|
||||
_ => Err(ENODEV),
|
||||
}
|
||||
|
|
@ -101,35 +104,35 @@ fn try_from(value: u32) -> Result<Self, Self::Error> {
|
|||
|
||||
define_chipset!({
|
||||
// Turing
|
||||
TU102 = 0x162,
|
||||
TU104 = 0x164,
|
||||
TU106 = 0x166,
|
||||
TU117 = 0x167,
|
||||
TU116 = 0x168,
|
||||
TU102,
|
||||
TU104,
|
||||
TU106,
|
||||
TU117,
|
||||
TU116,
|
||||
// Ampere
|
||||
GA100 = 0x170,
|
||||
GA102 = 0x172,
|
||||
GA103 = 0x173,
|
||||
GA104 = 0x174,
|
||||
GA106 = 0x176,
|
||||
GA107 = 0x177,
|
||||
GA100,
|
||||
GA102,
|
||||
GA103,
|
||||
GA104,
|
||||
GA106,
|
||||
GA107,
|
||||
// Hopper
|
||||
GH100 = 0x180,
|
||||
GH100,
|
||||
// Ada
|
||||
AD102 = 0x192,
|
||||
AD103 = 0x193,
|
||||
AD104 = 0x194,
|
||||
AD106 = 0x196,
|
||||
AD107 = 0x197,
|
||||
AD102,
|
||||
AD103,
|
||||
AD104,
|
||||
AD106,
|
||||
AD107,
|
||||
// Blackwell GB10x
|
||||
GB100 = 0x1a0,
|
||||
GB102 = 0x1a2,
|
||||
GB100,
|
||||
GB102,
|
||||
// Blackwell GB20x
|
||||
GB202 = 0x1b2,
|
||||
GB203 = 0x1b3,
|
||||
GB205 = 0x1b5,
|
||||
GB206 = 0x1b6,
|
||||
GB207 = 0x1b7,
|
||||
GB202,
|
||||
GB203,
|
||||
GB205,
|
||||
GB206,
|
||||
GB207,
|
||||
});
|
||||
|
||||
impl Chipset {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,46 @@ enum drm_nova_architecture {
|
|||
NOVA_DRM_ARCHITECTURE_BLACKWELL_GB20X = 0x1b,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum drm_nova_chipid - opaque GPU chip identifier
|
||||
*
|
||||
* These values identify the chip a GPU is based on. They are otherwise
|
||||
* opaque: userspace must not assume the values carry any particular meaning
|
||||
* or encoding, only that they may be compared against this enum.
|
||||
*/
|
||||
enum drm_nova_chipid {
|
||||
/* Turing */
|
||||
NOVA_DRM_CHIPID_TU102 = 0x162,
|
||||
NOVA_DRM_CHIPID_TU104 = 0x164,
|
||||
NOVA_DRM_CHIPID_TU106 = 0x166,
|
||||
NOVA_DRM_CHIPID_TU117 = 0x167,
|
||||
NOVA_DRM_CHIPID_TU116 = 0x168,
|
||||
/* Ampere */
|
||||
NOVA_DRM_CHIPID_GA100 = 0x170,
|
||||
NOVA_DRM_CHIPID_GA102 = 0x172,
|
||||
NOVA_DRM_CHIPID_GA103 = 0x173,
|
||||
NOVA_DRM_CHIPID_GA104 = 0x174,
|
||||
NOVA_DRM_CHIPID_GA106 = 0x176,
|
||||
NOVA_DRM_CHIPID_GA107 = 0x177,
|
||||
/* Hopper */
|
||||
NOVA_DRM_CHIPID_GH100 = 0x180,
|
||||
/* Ada */
|
||||
NOVA_DRM_CHIPID_AD102 = 0x192,
|
||||
NOVA_DRM_CHIPID_AD103 = 0x193,
|
||||
NOVA_DRM_CHIPID_AD104 = 0x194,
|
||||
NOVA_DRM_CHIPID_AD106 = 0x196,
|
||||
NOVA_DRM_CHIPID_AD107 = 0x197,
|
||||
/* Blackwell GB10x */
|
||||
NOVA_DRM_CHIPID_GB100 = 0x1a0,
|
||||
NOVA_DRM_CHIPID_GB102 = 0x1a2,
|
||||
/* Blackwell GB20x */
|
||||
NOVA_DRM_CHIPID_GB202 = 0x1b2,
|
||||
NOVA_DRM_CHIPID_GB203 = 0x1b3,
|
||||
NOVA_DRM_CHIPID_GB205 = 0x1b5,
|
||||
NOVA_DRM_CHIPID_GB206 = 0x1b6,
|
||||
NOVA_DRM_CHIPID_GB207 = 0x1b7,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_nova_getparam - query GPU and driver metadata
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user