From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010031.outbound.protection.outlook.com [52.101.56.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16A3B408017 for ; Mon, 29 Jun 2026 12:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.56.31 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782736356; cv=fail; b=pxlCSKR1cPWUvND1sMyhyym91Dbk6JhQSsREIrEyQi45wsc2H3Uok9PG15Fzqtl57uqNg2Yin0qk/xeNr2XkLrKzb3FmGt7UYD/tJj2hDyyuUwx/mzcTM678e4jKtFPu8txHUbBUWJbZfilZgsUPNpLJ9kfR0qiG79z5ugHME5Y= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782736356; c=relaxed/simple; bh=LIQ/08HtO6OZIBdRaipYyLF5n+iMbmjpDvq3M5SqkR0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=G1qXGy4tLaucSFPw0v1J1147tB4LX5EYpdi0dIgFK7dbGsGXiMJZzJ5ncO1/6F0fBdzXYtAMb/1t+utKjxOUK6x6MT9CySWgr0bqlXh85sYQAq5i3WzUsyk5GhS+Dmh41BpduCIH3PwGrjLKwGCiQb8Zsp3KXOz/rvNwH9S9viM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=QesSOF7S; arc=fail smtp.client-ip=52.101.56.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QesSOF7S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nsfrQBRO+7m1N/KB03RFUqT8N8/zQBStsHsQf89STJOOg2fYjan21ot4ql5evzT7prS2ryjx2lIKaiNMv8aGEKaq2P3tQAmpnpWRtAV1wexd2iST54Q07d1wIMM6enFIHkqOFboo6zDfoodc2wL3R9iq0t/5zUVvB265MaGag/5zD43ZKANX+fXXQmIumZFhCot8sVg6i57C9WbJtQqlxtbU7CB0Rrvnljpk7n4JLYD5W5/lrIgBfJ8/4Rut9VmGF/cZBxtTJgxyFRNHXfRdgO4cMs3GoaWl7Mrp3A/fPm0Y3Vsz6NtSw9puElpOVlsc3Ac94HB0P2TrYdUPx8JCsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YZwN0O5ixNWGvU5rjEctypN9MMb7wpCehNUARTDrm5M=; b=cikPWZm+qC31DPVmO7IZQ6/dQL4uoYJeTf7CMb535HK1/F0ur4n9P8RX6wjkhvkeN59ko6jsDFslMaOVJFLJKyYmUR4env5/hwQxxEKPXirIhzy/aWBjP6+Io1/XLEZQMdQgbFXtYxpYVcQM1vNWSJFT+0RpF0mr5XFtyT6hzbbs1b1Gyo8MvRm2hWFwlqfYjwWswUqh7B+QjXWACOx1rEMUqdaLzEx5qk1hhw2O7Oteb3w+qWcfjGojdJ/uQaTZvVPS9683Wy8wB1DB9IPusaA9CEe9dm+LJBBWu8El0DCP3vo8UE+qF2EZFnoZwlTVETU/+vKNACeYUwOaCTcKfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YZwN0O5ixNWGvU5rjEctypN9MMb7wpCehNUARTDrm5M=; b=QesSOF7SReOEhCenz2kPrQk7uXlptMx57AP9pyM/Gd4FvnS0YL/Rw92yPnExH7MrWiTkTPa4boj/EEQi/m5K6XLX/o7GD5owMoedNc2+zitMuSQd1/33+nFQeaTfjkmNR3v9ppVVedqOS37vm42JrAvbIKINT8XUubv+28SFEk+rRJSYjwak4cklDUK6gr3MzzNdaioK3DX4/I7H/btf+fEmM9eV9njJRyctlS7chGdZGgAbHHUU/9txnfy/BrrZiLosacdGLjTWjzTpqR9fgpOpVAyc1GfBTxvPhYafcUzMZn0J7VIZEpjx87zA5o9uMJk51yXUHjNbH5hwwcnaiQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CH2PR12MB3990.namprd12.prod.outlook.com (2603:10b6:610:28::18) by PH7PR12MB8122.namprd12.prod.outlook.com (2603:10b6:510:2b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.159.12; Mon, 29 Jun 2026 12:32:30 +0000 Received: from CH2PR12MB3990.namprd12.prod.outlook.com ([fe80::7de1:4fe5:8ead:5989]) by CH2PR12MB3990.namprd12.prod.outlook.com ([fe80::7de1:4fe5:8ead:5989%4]) with mapi id 15.21.0159.018; Mon, 29 Jun 2026 12:32:30 +0000 From: Alexandre Courbot Date: Mon, 29 Jun 2026 21:31:52 +0900 Subject: [PATCH v3 09/12] gpu: nova-core: introduce GspBootMethod Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260629-nova-bootcontext-v3-9-26cb29ee8dee@nvidia.com> References: <20260629-nova-bootcontext-v3-0-26cb29ee8dee@nvidia.com> In-Reply-To: <20260629-nova-bootcontext-v3-0-26cb29ee8dee@nvidia.com> To: Danilo Krummrich , Alice Ryhl , David Airlie , Simona Vetter , Gary Guo , John Hubbard , Alistair Popple , Timur Tabi , Eliot Courtney , Zhi Wang Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alexandre Courbot X-Mailer: b4 0.15.2 X-ClientProxiedBy: TYCP301CA0047.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:384::11) To CH2PR12MB3990.namprd12.prod.outlook.com (2603:10b6:610:28::18) Precedence: bulk X-Mailing-List: nova-gpu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB3990:EE_|PH7PR12MB8122:EE_ X-MS-Office365-Filtering-Correlation-Id: 8563da88-486e-45da-3443-08ded5da7cb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|10070799003|23010399003|366016|1800799024|3023799007|22082099003|11063799006|56012099006|18002099003|6133799003|921020; X-Microsoft-Antispam-Message-Info: x6470+r+TASKiChIn7OlyhPxaQI/Ha0jTOsa/OgJi/goRYxsRBUhHvhUqBWJ7PGZo6rkSXVNSBzQ6p8Sl/I9VoThyR88WdSgRqmYHI8ArYWYEDP1kPw2DFgCnBnNOxbLrMAlCMjJ8VzA1483YxIzf/Mua6k+a727++leNnkJElpv0LpX7ZCYifDTs/lARLq16r/g9ucL8swGooHxJ10yYH85jvpWSiemtDZ6zqboQjoEXDpfIjkjXA6hmso1HVTORUh/10ZjpUxY6Ag80EM0eC+UqZwW679ZzFJ2jgjlEDVKnZ4wYfOY2Epzny8Sb0LrS6ZZYm2AY9TSyeNiDQFE9fagobgW3DThYvr3RfwjZSCZeD7uLaHguio7s44/LhjVWAZROkL/JuURhJh+6mCbnitDeatmtcr/MPuU5gE24aYxSwAm5WDntLKCQGwPDtctTWW4pRFNh4Ge6rsfRDCTArqceStxV32LVNnkMEjX+lTeD0Iuk19V4ckfsfcoW5V1sLkgjbJpPOeBiaXcxsvdY7UKG18RXCtzE45pDWpLivYYnIrGMJ5ahoxvNBRUEbDhmGq96j2DYTc9rf4zPz7tWeEMxaSeBG5TzXfubZQaU2qpNwcS3/fw/qbBKVrv3q9q8e7iEOtgF1AdDEAy5rQ5tmeQh4aiiLrBAGAnUv9kYx7CUqKBrwiKGiM6BiB2tytZ0NJZxkSLOsGtIJTpxRou2g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR12MB3990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(10070799003)(23010399003)(366016)(1800799024)(3023799007)(22082099003)(11063799006)(56012099006)(18002099003)(6133799003)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Mkh6Z0pGZ25oRHk1dzVQd05MYnJ1dFlFNEQ2VmRERzNrU2tubE4vUnNlVm8x?= =?utf-8?B?cVZHT2MrOHhUZlZ3SEtjeGd5Qjg4NG1TN2FhVGV6anpXTnVVK3NzRGk4bFFB?= =?utf-8?B?aG0yaC8xaVhJUmJkUWNMcTNoMkd2VzVnYk1kckx0ejVDVjRNeEVmK1hnOWFk?= =?utf-8?B?dGRiK3ZXZDIxU3drQkJiUjg5dHk1L0xINEdsL04rZGN3cExiOWgwdkZDQnEr?= =?utf-8?B?TXhTeFBvSURobzBoVXY5RzdOTWFSUXlXc3hsem53TXRxTitwckhuQXg3R2d0?= =?utf-8?B?bW5od2h2eU1RdGtYV0FUazlHTmRQUE1yYUZ2dlZJYTBhVUtuNS9EZ1Za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ZWtxeW9WQ094R1JuL0Ry?= =?utf-8?B?M0l2MWtkRWE2ZUZxN2F3S0ozSFRDbHc1a0lzcTM3eDRIeW5SNzd0ME9ETE1l?= =?utf-8?B?b28zOFQ5K3RhL2tDaHZjWDl6OTlMNytoSEc2UUtCejBmTCtOeDQ1WkRJV1Fx?= =?utf-8?B?UGk5UXRpWkdHdmhHNFdRcUFlQTNVUi8rYkhEQVgvUWFROGdCcjgycW0xQ1di?= =?utf-8?Q?eVfX7DaiIodbYJe0dTJQaE4Irj1O0uPRI5Hnz1+T8GFp0?= X-MS-Exchange-AntiSpam-MessageData-1: vewgM4a3Lrx69A== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8563da88-486e-45da-3443-08ded5da7cb2 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB3990.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2026 12:32:30.6439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ryVofidncoJrZHoGo7iN7YZYxRSj+XDXH4gOM4gbOs3HUtharH9fK6Uv+289FKCYMBqopZ3rAQ6bWXwCXDop3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8122 The GSP boot method is currently determined by two ad-hoc methods of `Chipset`: `uses_fsp` (a boolean telling whether to use the FSP boot path or the Sec2 Booter one) and `needs_fwsec_bootloader` (another boolean valid only for the Sec2 Booter method that tells whether the FWSEC bootloader must be used). This is neither extensible nor sound: the combination `uses_fsp && needs_fwsec_bootloader` is invalid, but can still be expressed. Thus, unify these two predicates into a single `gsp_boot_method` method that returns an enum type unambiguously describing the boot method to use. This ensures that no invalid combination can be expressed, which makes matching sounder. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/firmware.rs | 25 ++++++++++++-------- drivers/gpu/nova-core/firmware/fwsec.rs | 5 ++-- drivers/gpu/nova-core/gpu.rs | 16 ------------- drivers/gpu/nova-core/gsp.rs | 42 ++++++++++++++++++++++++++++++++- drivers/gpu/nova-core/gsp/hal.rs | 22 ++++++++--------- 5 files changed, 70 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs index 80e948bf7511..7a5978f93f4e 100644 --- a/drivers/gpu/nova-core/firmware.rs +++ b/drivers/gpu/nova-core/firmware.rs @@ -21,6 +21,7 @@ FalconFirmware, // }, gpu, + gsp::GspBootMethod, num::{ FromSafeCast, IntoSafeCast, // @@ -429,17 +430,21 @@ const fn make_entry_chipset(self, chipset: gpu::Chipset) -> Self { // FSP-based chipsets (Hopper, Blackwell and later) boot the GSP via the FMC image loaded by // FSP. Older chipsets use the SEC2 booter instead. - let this = if chipset.uses_fsp() { - this.make_entry_file(name, "fmc") - } else { - this.make_entry_file(name, "booter_load") - .make_entry_file(name, "booter_unload") - }; + match chipset.gsp_boot_method() { + GspBootMethod::Sec2 { + needs_fwsec_bootloader, + } => { + let mut this = this + .make_entry_file(name, "booter_load") + .make_entry_file(name, "booter_unload"); - if chipset.needs_fwsec_bootloader() { - this.make_entry_file(name, "gen_bootloader") - } else { - this + if needs_fwsec_bootloader { + this = this.make_entry_file(name, "gen_bootloader") + } + + this + } + GspBootMethod::Fsp => this.make_entry_file(name, "fmc"), } } diff --git a/drivers/gpu/nova-core/firmware/fwsec.rs b/drivers/gpu/nova-core/firmware/fwsec.rs index 199ae2adb664..a3a43a27ddd7 100644 --- a/drivers/gpu/nova-core/firmware/fwsec.rs +++ b/drivers/gpu/nova-core/firmware/fwsec.rs @@ -388,8 +388,9 @@ pub(crate) fn new( /// Loads the FWSEC firmware into `falcon` and execute it. /// /// This must only be called on chipsets that do not need the FWSEC bootloader (i.e., where - /// [`Chipset::needs_fwsec_bootloader()`](crate::gpu::Chipset::needs_fwsec_bootloader) returns - /// `false`). On chipsets that do, use [`bootloader::FwsecFirmwareWithBl`] instead. + /// [`Chipset::gsp_boot_method()`](crate::gpu::Chipset::gsp_boot_method) returns + /// `GspBootMethod::Sec2 { needs_fwsec_bootloader: false }`). On chipsets where + /// `needs_fwsec_bootloader` is `true`, use [`bootloader::FwsecFirmwareWithBl`] instead. pub(crate) fn run( &self, dev: &Device, diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 4ee0a43ac4b6..b3f04239d938 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -133,22 +133,6 @@ pub(crate) const fn arch(self) -> Architecture { } } - /// Returns `true` if this chipset requires the PIO-loaded bootloader in order to boot FWSEC. - /// - /// This includes all chipsets < GA102. - pub(crate) const fn needs_fwsec_bootloader(self) -> bool { - matches!(self.arch(), Architecture::Turing) || matches!(self, Self::GA100) - } - - /// Returns `true` if this chipset boots via FSP (Hopper and later), which requires the FMC - /// firmware image. - pub(crate) const fn uses_fsp(self) -> bool { - matches!( - self.arch(), - Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x - ) - } - /// Returns the address range of the PCI config mirror space. pub(crate) fn pci_config_mirror_range(self) -> Range { hal::gpu_hal(self).pci_config_mirror_range() diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs index 73e93403601c..771b38e6335d 100644 --- a/drivers/gpu/nova-core/gsp.rs +++ b/drivers/gpu/nova-core/gsp.rs @@ -38,7 +38,10 @@ sec2::Sec2 as Sec2Falcon, Falcon, // }, - gpu::Chipset, + gpu::{ + Architecture, + Chipset, // + }, gsp::{ cmdq::Cmdq, fw::{ @@ -217,5 +220,42 @@ pub(crate) fn get_static_info(&self, bar: Bar0<'_>) -> Result GspBootMethod { + match self.arch() { + // All Turing chipsets require the FWSEC bootloader. + Architecture::Turing => GspBootMethod::Sec2 { + needs_fwsec_bootloader: true, + }, + // GA100 also requires the FWSEC bootloader. + Architecture::Ampere if matches!(self, Self::GA100) => GspBootMethod::Sec2 { + needs_fwsec_bootloader: true, + }, + // Other Ampere chipsets, as well as Ada chipsets, do not require the FWSEC bootloader. + Architecture::Ampere | Architecture::Ada => GspBootMethod::Sec2 { + needs_fwsec_bootloader: false, + }, + // Hopper and more recent use the FSP Chain-of-Trust boot method. + Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => { + GspBootMethod::Fsp + } + } + } +} + /// Opaque bundle required to unload the GSP. Created by [`Gsp::boot`], consumed by [`Gsp::unload`]. pub(crate) struct UnloadBundle(KBox); diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs index eddb4e8bf510..90f076f640e0 100644 --- a/drivers/gpu/nova-core/gsp/hal.rs +++ b/drivers/gpu/nova-core/gsp/hal.rs @@ -13,13 +13,11 @@ use crate::{ fb::FbLayout, firmware::gsp::GspFirmware, - gpu::{ - Architecture, - Chipset, // - }, + gpu::Chipset, gsp::{ Gsp, GspBootContext, + GspBootMethod, GspFwWprMeta, // }, }; @@ -59,12 +57,14 @@ fn post_boot(&self, _gsp: &Gsp, _ctx: &GspBootContext<'_>, _gsp_fw: &GspFirmware /// Returns the GSP HAL to be used for `chipset`. pub(super) fn gsp_hal(chipset: Chipset) -> &'static dyn GspHal { - match chipset.arch() { - Architecture::Turing => tu102::TU102_HAL, - Architecture::Ampere if matches!(chipset, Chipset::GA100) => tu102::TU102_HAL, - Architecture::Ampere | Architecture::Ada => ga102::GA102_HAL, - Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => { - gh100::GH100_HAL - } + // The GSP HAL is entirely determined by the boot method. + match chipset.gsp_boot_method() { + GspBootMethod::Sec2 { + needs_fwsec_bootloader: true, + } => tu102::TU102_HAL, + GspBootMethod::Sec2 { + needs_fwsec_bootloader: false, + } => ga102::GA102_HAL, + GspBootMethod::Fsp => gh100::GH100_HAL, } } -- 2.54.0