File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,9 +252,8 @@ impl FbLayout {
252252 } ;
253253
254254 let heap = {
255- const HEAP_SIZE : u64 = u64:: SZ_1M ;
256-
257- FbRange ( wpr2. start - HEAP_SIZE ..wpr2. start )
255+ let heap_size = u64:: from ( hal. non_wpr_heap_size ( ) ) ;
256+ FbRange ( wpr2. start - heap_size..wpr2. start )
258257 } ;
259258
260259 Ok ( Self {
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ use crate::{
1414mod ga100;
1515mod ga102;
1616mod gb100;
17+ mod gb202;
18+ mod gh100;
1719mod tu102;
1820
1921pub ( crate ) trait FbHal {
@@ -34,6 +36,9 @@ pub(crate) trait FbHal {
3436 /// Returns the amount of VRAM to reserve for the PMU.
3537 fn pmu_reserved_size ( & self ) -> u32 ;
3638
39+ /// Returns the non-WPR heap size for this chipset, in bytes.
40+ fn non_wpr_heap_size ( & self ) -> u32 ;
41+
3742 /// Returns the FRTS size, in bytes.
3843 fn frts_size ( & self ) -> u64 ;
3944}
@@ -43,7 +48,9 @@ pub(super) fn fb_hal(chipset: Chipset) -> &'static dyn FbHal {
4348 match chipset. arch ( ) {
4449 Architecture :: Turing => tu102:: TU102_HAL ,
4550 Architecture :: Ampere if chipset == Chipset :: GA100 => ga100:: GA100_HAL ,
46- Architecture :: Ampere | Architecture :: Ada | Architecture :: Hopper => ga102:: GA102_HAL ,
47- Architecture :: BlackwellGB10x | Architecture :: BlackwellGB20x => gb100:: GB100_HAL ,
51+ Architecture :: Ampere | Architecture :: Ada => ga102:: GA102_HAL ,
52+ Architecture :: Hopper => gh100:: GH100_HAL ,
53+ Architecture :: BlackwellGB10x => gb100:: GB100_HAL ,
54+ Architecture :: BlackwellGB20x => gb202:: GB202_HAL ,
4855 }
4956}
Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ impl FbHal for Ga100 {
7272 super :: tu102:: pmu_reserved_size_tu102 ( )
7373 }
7474
75+ fn non_wpr_heap_size ( & self ) -> u32 {
76+ super :: tu102:: non_wpr_heap_size_tu102 ( )
77+ }
78+
7579 // GA100 is a special case where its FRTS region exists, but is empty. We
7680 // return a size of 0 because we still need to record where the region starts.
7781 fn frts_size ( & self ) -> u64 {
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ impl FbHal for Ga102 {
4141 super :: tu102:: pmu_reserved_size_tu102 ( )
4242 }
4343
44+ fn non_wpr_heap_size ( & self ) -> u32 {
45+ super :: tu102:: non_wpr_heap_size_tu102 ( )
46+ }
47+
4448 fn frts_size ( & self ) -> u64 {
4549 super :: tu102:: frts_size_tu102 ( )
4650 }
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: GPL-2.0
22// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
4- //! Blackwell framebuffer HAL.
4+ //! Blackwell GB10x framebuffer HAL.
55
66use kernel:: {
77 prelude:: * ,
@@ -20,7 +20,7 @@ use crate::{
2020
2121struct Gb100 ;
2222
23- const fn pmu_reserved_size_gb100 ( ) -> u32 {
23+ pub ( super ) const fn pmu_reserved_size_gb100 ( ) -> u32 {
2424 usize_into_u32 :: < { const_align_up ( SZ_8M + SZ_16M + SZ_4K , Alignment :: new :: < SZ_128K > ( ) ) . unwrap ( ) } > (
2525 )
2626}
@@ -48,6 +48,11 @@ impl FbHal for Gb100 {
4848 pmu_reserved_size_gb100 ( )
4949 }
5050
51+ fn non_wpr_heap_size ( & self ) -> u32 {
52+ // Non-WPR heap for GB10x (see Open RM: kgspGetNonWprHeapSize, GB100/GB102).
53+ u32:: SZ_2M
54+ }
55+
5156 fn frts_size ( & self ) -> u64 {
5257 super :: tu102:: frts_size_tu102 ( )
5358 }
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
4+ //! Blackwell GB20x framebuffer HAL.
5+
6+ use kernel:: {
7+ prelude:: * ,
8+ sizes:: SizeConstants , //
9+ } ;
10+
11+ use crate :: {
12+ driver:: Bar0 ,
13+ fb:: hal:: FbHal , //
14+ } ;
15+
16+ struct Gb202 ;
17+
18+ impl FbHal for Gb202 {
19+ fn read_sysmem_flush_page ( & self , bar : & Bar0 ) -> u64 {
20+ super :: ga100:: read_sysmem_flush_page_ga100 ( bar)
21+ }
22+
23+ fn write_sysmem_flush_page ( & self , bar : & Bar0 , addr : u64 ) -> Result {
24+ super :: ga100:: write_sysmem_flush_page_ga100 ( bar, addr) ;
25+
26+ Ok ( ( ) )
27+ }
28+
29+ fn supports_display ( & self , bar : & Bar0 ) -> bool {
30+ super :: ga100:: display_enabled_ga100 ( bar)
31+ }
32+
33+ fn vidmem_size ( & self , bar : & Bar0 ) -> u64 {
34+ super :: ga102:: vidmem_size_ga102 ( bar)
35+ }
36+
37+ fn pmu_reserved_size ( & self ) -> u32 {
38+ super :: gb100:: pmu_reserved_size_gb100 ( )
39+ }
40+
41+ fn non_wpr_heap_size ( & self ) -> u32 {
42+ // Non-WPR heap for GB20x (see Open RM: kgspGetNonWprHeapSize, GB202+).
43+ u32:: SZ_2M + u32:: SZ_128K
44+ }
45+
46+ fn frts_size ( & self ) -> u64 {
47+ super :: tu102:: frts_size_tu102 ( )
48+ }
49+ }
50+
51+ const GB202 : Gb202 = Gb202 ;
52+ pub ( super ) const GB202_HAL : & dyn FbHal = & GB202 ;
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
4+ use kernel:: {
5+ prelude:: * ,
6+ sizes:: SizeConstants , //
7+ } ;
8+
9+ use crate :: {
10+ driver:: Bar0 ,
11+ fb:: hal:: FbHal , //
12+ } ;
13+
14+ struct Gh100 ;
15+
16+ impl FbHal for Gh100 {
17+ fn read_sysmem_flush_page ( & self , bar : & Bar0 ) -> u64 {
18+ super :: ga100:: read_sysmem_flush_page_ga100 ( bar)
19+ }
20+
21+ fn write_sysmem_flush_page ( & self , bar : & Bar0 , addr : u64 ) -> Result {
22+ super :: ga100:: write_sysmem_flush_page_ga100 ( bar, addr) ;
23+
24+ Ok ( ( ) )
25+ }
26+
27+ fn supports_display ( & self , bar : & Bar0 ) -> bool {
28+ super :: ga100:: display_enabled_ga100 ( bar)
29+ }
30+
31+ fn vidmem_size ( & self , bar : & Bar0 ) -> u64 {
32+ super :: ga102:: vidmem_size_ga102 ( bar)
33+ }
34+
35+ fn pmu_reserved_size ( & self ) -> u32 {
36+ super :: tu102:: pmu_reserved_size_tu102 ( )
37+ }
38+
39+ fn non_wpr_heap_size ( & self ) -> u32 {
40+ // Non-WPR heap for Hopper (see Open RM: kgspCalculateFbLayout_GH100).
41+ u32:: SZ_2M
42+ }
43+
44+ fn frts_size ( & self ) -> u64 {
45+ super :: tu102:: frts_size_tu102 ( )
46+ }
47+ }
48+
49+ const GH100 : Gh100 = Gh100 ;
50+ pub ( super ) const GH100_HAL : & dyn FbHal = & GH100 ;
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ pub(super) const fn pmu_reserved_size_tu102() -> u32 {
4444 0
4545}
4646
47+ pub ( super ) const fn non_wpr_heap_size_tu102 ( ) -> u32 {
48+ u32:: SZ_1M
49+ }
50+
4751pub ( super ) const fn frts_size_tu102 ( ) -> u64 {
4852 u64:: SZ_1M
4953}
@@ -71,6 +75,10 @@ impl FbHal for Tu102 {
7175 pmu_reserved_size_tu102 ( )
7276 }
7377
78+ fn non_wpr_heap_size ( & self ) -> u32 {
79+ non_wpr_heap_size_tu102 ( )
80+ }
81+
7482 fn frts_size ( & self ) -> u64 {
7583 frts_size_tu102 ( )
7684 }
You can’t perform that action at this time.
0 commit comments