Skip to content

Commit 206bb14

Browse files
johnhubbardGnurou
authored andcommitted
gpu: nova-core: Blackwell: compute PMU-reserved framebuffer size
GSP boot needs to know how much framebuffer memory is reserved for the PMU. Compute it per architecture: Blackwell dGPUs reserve a non-zero amount, earlier architectures leave it at zero, matching Open RM behavior. Signed-off-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260602032111.224790-4-jhubbard@nvidia.com Co-developed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
1 parent ee9414e commit 206bb14

7 files changed

Lines changed: 88 additions & 6 deletions

File tree

drivers/gpu/nova-core/fb.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ pub(crate) struct FbLayout {
165165
pub(crate) wpr2: FbRange,
166166
pub(crate) heap: FbRange,
167167
pub(crate) vf_partition_count: u8,
168+
/// PMU reserved memory size, in bytes.
169+
pub(crate) pmu_reserved_size: u32,
168170
}
169171

170172
impl FbLayout {
@@ -265,6 +267,7 @@ impl FbLayout {
265267
wpr2,
266268
heap,
267269
vf_partition_count: 0,
270+
pmu_reserved_size: hal.pmu_reserved_size(),
268271
})
269272
}
270273
}

drivers/gpu/nova-core/fb/hal.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
23

34
use kernel::prelude::*;
45

@@ -12,6 +13,7 @@ use crate::{
1213

1314
mod ga100;
1415
mod ga102;
16+
mod gb100;
1517
mod tu102;
1618

1719
pub(crate) trait FbHal {
@@ -29,6 +31,9 @@ pub(crate) trait FbHal {
2931
/// Returns the VRAM size, in bytes.
3032
fn vidmem_size(&self, bar: &Bar0) -> u64;
3133

34+
/// Returns the amount of VRAM to reserve for the PMU.
35+
fn pmu_reserved_size(&self) -> u32;
36+
3237
/// Returns the FRTS size, in bytes.
3338
fn frts_size(&self) -> u64;
3439
}
@@ -38,10 +43,7 @@ pub(super) fn fb_hal(chipset: Chipset) -> &'static dyn FbHal {
3843
match chipset.arch() {
3944
Architecture::Turing => tu102::TU102_HAL,
4045
Architecture::Ampere if chipset == Chipset::GA100 => ga100::GA100_HAL,
41-
Architecture::Ampere => ga102::GA102_HAL,
42-
Architecture::Ada
43-
| Architecture::Hopper
44-
| Architecture::BlackwellGB10x
45-
| Architecture::BlackwellGB20x => ga102::GA102_HAL,
46+
Architecture::Ampere | Architecture::Ada | Architecture::Hopper => ga102::GA102_HAL,
47+
Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => gb100::GB100_HAL,
4648
}
4749
}

drivers/gpu/nova-core/fb/hal/ga100.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
23

34
use kernel::{
45
io::Io,
@@ -67,6 +68,10 @@ impl FbHal for Ga100 {
6768
super::tu102::vidmem_size_gp102(bar)
6869
}
6970

71+
fn pmu_reserved_size(&self) -> u32 {
72+
super::tu102::pmu_reserved_size_tu102()
73+
}
74+
7075
// GA100 is a special case where its FRTS region exists, but is empty. We
7176
// return a size of 0 because we still need to record where the region starts.
7277
fn frts_size(&self) -> u64 {

drivers/gpu/nova-core/fb/hal/ga102.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
23

34
use kernel::{
45
io::Io,
@@ -11,7 +12,7 @@ use crate::{
1112
regs, //
1213
};
1314

14-
fn vidmem_size_ga102(bar: &Bar0) -> u64 {
15+
pub(super) fn vidmem_size_ga102(bar: &Bar0) -> u64 {
1516
bar.read(regs::NV_USABLE_FB_SIZE_IN_MB).usable_fb_size()
1617
}
1718

@@ -36,6 +37,10 @@ impl FbHal for Ga102 {
3637
vidmem_size_ga102(bar)
3738
}
3839

40+
fn pmu_reserved_size(&self) -> u32 {
41+
super::tu102::pmu_reserved_size_tu102()
42+
}
43+
3944
fn frts_size(&self) -> u64 {
4045
super::tu102::frts_size_tu102()
4146
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
4+
//! Blackwell framebuffer HAL.
5+
6+
use kernel::{
7+
prelude::*,
8+
ptr::{
9+
const_align_up,
10+
Alignment, //
11+
},
12+
sizes::*, //
13+
};
14+
15+
use crate::{
16+
driver::Bar0,
17+
fb::hal::FbHal,
18+
num::usize_into_u32, //
19+
};
20+
21+
struct Gb100;
22+
23+
const fn pmu_reserved_size_gb100() -> u32 {
24+
usize_into_u32::<{ const_align_up(SZ_8M + SZ_16M + SZ_4K, Alignment::new::<SZ_128K>()).unwrap() }>(
25+
)
26+
}
27+
28+
impl FbHal for Gb100 {
29+
fn read_sysmem_flush_page(&self, bar: &Bar0) -> u64 {
30+
super::ga100::read_sysmem_flush_page_ga100(bar)
31+
}
32+
33+
fn write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result {
34+
super::ga100::write_sysmem_flush_page_ga100(bar, addr);
35+
36+
Ok(())
37+
}
38+
39+
fn supports_display(&self, bar: &Bar0) -> bool {
40+
super::ga100::display_enabled_ga100(bar)
41+
}
42+
43+
fn vidmem_size(&self, bar: &Bar0) -> u64 {
44+
super::ga102::vidmem_size_ga102(bar)
45+
}
46+
47+
fn pmu_reserved_size(&self) -> u32 {
48+
pmu_reserved_size_gb100()
49+
}
50+
51+
fn frts_size(&self) -> u64 {
52+
super::tu102::frts_size_tu102()
53+
}
54+
}
55+
56+
const GB100: Gb100 = Gb100;
57+
pub(super) const GB100_HAL: &dyn FbHal = &GB100;

drivers/gpu/nova-core/fb/hal/tu102.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
23

34
use kernel::{
45
io::Io,
@@ -39,6 +40,10 @@ pub(super) fn vidmem_size_gp102(bar: &Bar0) -> u64 {
3940
.usable_fb_size()
4041
}
4142

43+
pub(super) const fn pmu_reserved_size_tu102() -> u32 {
44+
0
45+
}
46+
4247
pub(super) const fn frts_size_tu102() -> u64 {
4348
u64::SZ_1M
4449
}
@@ -62,6 +67,10 @@ impl FbHal for Tu102 {
6267
vidmem_size_gp102(bar)
6368
}
6469

70+
fn pmu_reserved_size(&self) -> u32 {
71+
pmu_reserved_size_tu102()
72+
}
73+
6574
fn frts_size(&self) -> u64 {
6675
frts_size_tu102()
6776
}

drivers/gpu/nova-core/gsp/fw.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ impl GspFwWprMeta {
247247
fbSize: fb_layout.fb.end - fb_layout.fb.start,
248248
vgaWorkspaceOffset: fb_layout.vga_workspace.start,
249249
vgaWorkspaceSize: fb_layout.vga_workspace.end - fb_layout.vga_workspace.start,
250+
pmuReservedSize: fb_layout.pmu_reserved_size,
250251
..Zeroable::init_zeroed()
251252
});
252253

0 commit comments

Comments
 (0)