]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpu: nova-core: add FbHal::frts_size() for GA100 support
authorTimur Tabi <ttabi@nvidia.com>
Fri, 17 Apr 2026 19:13:57 +0000 (14:13 -0500)
committerAlexandre Courbot <acourbot@nvidia.com>
Tue, 28 Apr 2026 23:27:53 +0000 (08:27 +0900)
Introduce FbHal method frts_size() to return the size of the FRTS
window.  GA100 is a special case in that although there is an
FRTS, its size must arbitrarily be set to 0.

Note that we cannot use supports_display() to determine the FRTS
size because there are other GPUs (e.g. GA102GL) that have display
disabled (and so supports_display() returns False), but the FRTS
window size still needs to be 1MB.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
Acked-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260417191359.1307434-5-ttabi@nvidia.com
[acourbot: apply requested fix to commit message.]
[acourbot: fix minor conflict.]
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
drivers/gpu/nova-core/fb.rs
drivers/gpu/nova-core/fb/hal.rs
drivers/gpu/nova-core/fb/hal/ga100.rs
drivers/gpu/nova-core/fb/hal/ga102.rs
drivers/gpu/nova-core/fb/hal/tu102.rs

index 5c304fc034673991654fe0987dead7efb60dfe12..667f5e850175f1bf8423267a761354139a301b6a 100644 (file)
@@ -213,10 +213,10 @@ impl FbLayout {
 
         let frts = {
             const FRTS_DOWN_ALIGN: Alignment = Alignment::new::<SZ_128K>();
-            const FRTS_SIZE: u64 = u64::SZ_1M;
-            let frts_base = vga_workspace.start.align_down(FRTS_DOWN_ALIGN) - FRTS_SIZE;
+            let frts_size: u64 = hal.frts_size();
+            let frts_base = vga_workspace.start.align_down(FRTS_DOWN_ALIGN) - frts_size;
 
-            FbRange(frts_base..frts_base + FRTS_SIZE)
+            FbRange(frts_base..frts_base + frts_size)
         };
 
         let boot = {
index aba0abd8ee005c85216b18470000c551547e95ac..1c01a6cbed652640cec5d15028299a9cbb93f6a8 100644 (file)
@@ -25,6 +25,9 @@ pub(crate) trait FbHal {
 
     /// Returns the VRAM size, in bytes.
     fn vidmem_size(&self, bar: &Bar0) -> u64;
+
+    /// Returns the FRTS size, in bytes.
+    fn frts_size(&self) -> u64;
 }
 
 /// Returns the HAL corresponding to `chipset`.
index 1c03783cddefb32371fb0459d4cd2740ad5c43a1..2f5871d915c3739276faf31613b72dd5ec665ef3 100644 (file)
@@ -66,6 +66,12 @@ impl FbHal for Ga100 {
     fn vidmem_size(&self, bar: &Bar0) -> u64 {
         super::tu102::vidmem_size_gp102(bar)
     }
+
+    // GA100 is a special case where its FRTS region exists, but is empty.  We
+    // return a size of 0 because we still need to record where the region starts.
+    fn frts_size(&self) -> u64 {
+        0
+    }
 }
 
 const GA100: Ga100 = Ga100;
index 4b9f0f74d0e76a4a27d45ccf6b4224daff33e2f5..3bb66f64bef7c7d0da9f8f58872a21b9808b0b00 100644 (file)
@@ -35,6 +35,10 @@ impl FbHal for Ga102 {
     fn vidmem_size(&self, bar: &Bar0) -> u64 {
         vidmem_size_ga102(bar)
     }
+
+    fn frts_size(&self) -> u64 {
+        super::tu102::frts_size_tu102()
+    }
 }
 
 const GA102: Ga102 = Ga102;
index 281bb796e198e0e70f28af6ddb2534c477ebd074..22c174bf1472ddab93c49c9161abf263fa389480 100644 (file)
@@ -2,7 +2,8 @@
 
 use kernel::{
     io::Io,
-    prelude::*, //
+    prelude::*,
+    sizes::*, //
 };
 
 use crate::{
@@ -38,6 +39,10 @@ pub(super) fn vidmem_size_gp102(bar: &Bar0) -> u64 {
         .usable_fb_size()
 }
 
+pub(super) const fn frts_size_tu102() -> u64 {
+    u64::SZ_1M
+}
+
 struct Tu102;
 
 impl FbHal for Tu102 {
@@ -56,6 +61,10 @@ impl FbHal for Tu102 {
     fn vidmem_size(&self, bar: &Bar0) -> u64 {
         vidmem_size_gp102(bar)
     }
+
+    fn frts_size(&self) -> u64 {
+        frts_size_tu102()
+    }
 }
 
 const TU102: Tu102 = Tu102;