From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010007.outbound.protection.outlook.com [52.101.61.7]) (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 3BAB42DC791; Mon, 22 Jun 2026 07:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.61.7 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782112337; cv=fail; b=F63O6M+UZJ+k2kZ2HUX6WSuyFwz8yBPwMPZXTYwIBMLClplrG9/kk7MO1bTBCP+kqliPdSP4VCPomFBcumpkRRlhhiuGJPU+Z/Gh4r+HL/3zo7i1WsiEZPDccDF4BosbqlsUaI9aZfIMQV6LeshRqZKvbgsRfVaQTjfZUWQw490= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782112337; c=relaxed/simple; bh=AShXg4awObHISuqhiAIhwz47OBLjNYTv88I4lQlKYmk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=QVv4gYu/0zzqTae3Aw8459D4sBOZDmw9ZsMAfWQmWbTiT54qM2FlzGp+F4ZfR9Xw87/qqP8+W+YRluhEceNYZgRIMnpX75fJFb2i6Nh7vdkEKJCPtlhtPa4tV0lU+ywtJN/KF3Tf6emRrC7ShAORNIqXBpCPbgwhs0KYUlhnwRc= 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=p9bBZH4P; arc=fail smtp.client-ip=52.101.61.7 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="p9bBZH4P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rwq7k1Sy20050j0hGTcEdL1QbsATOH4UtZQcIyH3mbBfWRbP3D3TdX0oToVuG23mfKnBS0HwnPaTL2DU3Z99nVH4xJLaV5HEhgQeK6iKOrHSFAA0fAjZ2zA5KKfXKBsU+1yoxt5X5VbQg4hvz0BTqZmzFjo31d4xm4cbfY5INYyw7et4Kunfs0hsYW8EPYtyfUVDUebRWsNE2AfVris6At6IWa2AiwoidRJMO6d3tsoR8PzzlOexx7JpDpgVeg2aEYSQRb9o6hjS5uJLt2xurGOjVIKsGFgJJlS1MQtiGTaXjnVtQSGCBxBW/XtLRCUB6VpL7fpI8xc7PsB0hSsL/A== 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=61ct2nEsvgntTyk+OtCr8HbBqpbqPf4c7rQNfCAGbV0=; b=o7nJ/Iaq4OrdKH31X5rmQfztQYZXMe3feEZ7FRJzt44OYPrVR4vZyoQ91P1FIjxIl5Ex51twJjh4juXqRu479i1iVZ9Q51UfIlqt8LVEhcTATKyEZoSr4S4RG0RCWAo/aeOCj1ppN6I74g8eZSuIaHJg/yyAhxcnkNzPbyZblce4i2YSQu60jI9v8KigMAOULVEBEI87VmFzVETs1OtBRLCSsL7BaLzjZvCYU/sZx8bcd167XpuU8ffMH1eHN2q7iS4JvJIETMuC7QZ25ReKf2D8iFGhPVXegmZsVUfAkpwI8Ob972V94ae+/Cj6Z3Vp5gfX3sCA1a9N2nwuZJt18Q== 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=61ct2nEsvgntTyk+OtCr8HbBqpbqPf4c7rQNfCAGbV0=; b=p9bBZH4PkOhdBl2ymo+olAr2pBOTsnCvCIqNjZ+ndsVgDglh+RuOExEaXnGymOPMDoLpQpA4UG8rnqKco+YLck8qnJF0e38m08wVkNvcVyuxT720GhdFcjKPX2Y5ikqZzrKxTpawEEFvOWZO4TkWg0FQDlDabbctYfoh0N04SC8ZmoET65wf8rPOQWd9WllCWAkPsxF1TsmItQdjz/g+IbQGB3o2jfyA582qE1IpDtJTpgjy0seAGT3Gae7q2jesunNRANrWKe6UcAfsStVEfqJ13Ao1eWPfqPbR6tfpalOn11zQg/XO2mRRr21uTPdldw9+3ilYvCyly7IAdgfZfg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB3997.namprd12.prod.outlook.com (2603:10b6:208:161::11) by PH8PR12MB6700.namprd12.prod.outlook.com (2603:10b6:510:1cf::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.139.18; Mon, 22 Jun 2026 07:12:11 +0000 Received: from MN2PR12MB3997.namprd12.prod.outlook.com ([fe80::73c6:e479:9b75:b2cf]) by MN2PR12MB3997.namprd12.prod.outlook.com ([fe80::73c6:e479:9b75:b2cf%6]) with mapi id 15.21.0139.018; Mon, 22 Jun 2026 07:12:11 +0000 From: Alexandre Courbot Date: Mon, 22 Jun 2026 16:10:32 +0900 Subject: [PATCH v2 10/13] gpu: nova-core: introduce GspBootMethod Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260622-nova-bootcontext-v2-10-0ddeafc06f5d@nvidia.com> References: <20260622-nova-bootcontext-v2-0-0ddeafc06f5d@nvidia.com> In-Reply-To: <20260622-nova-bootcontext-v2-0-0ddeafc06f5d@nvidia.com> To: Danilo Krummrich , Alice Ryhl , David Airlie , Simona Vetter , Gary Guo Cc: John Hubbard , Alistair Popple , Timur Tabi , Eliot Courtney , Zhi Wang , 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: TYCPR01CA0123.jpnprd01.prod.outlook.com (2603:1096:400:26d::9) To MN2PR12MB3997.namprd12.prod.outlook.com (2603:10b6:208:161::11) Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB3997:EE_|PH8PR12MB6700:EE_ X-MS-Office365-Filtering-Correlation-Id: 8abc5d12-bae8-429f-b097-08ded02d9442 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|23010399003|366016|376014|10070799003|18002099003|22082099003|3023799007|11063799006|6133799003|56012099006; X-Microsoft-Antispam-Message-Info: Zwb2R1Ygc1vXlS+8Rr6fn7j+lCK3yH57t9l5sl0OfZ8j9j1pesEB3Q7uLC7um+EtFBBP0DoPqUU0HDYBMQ+z4RQIbv+bsPUPlCGqyIa2MiQ3yKwA/ghZhsQxmc6WfSEFsE1eZB9IbfsIQ1zIQwY6jb1N3DxhMF9Ncq5YjbEd/4wxDSPF2T50Xcy0C9hGnS6sb+jzgbCR/oRdXEZnw9oiYy90wxmRvZ6zKdBL01KV9vvdfPwjRQ7ZQjM7fmj3ImslSEPjQYMPHaAKvVluL7Xb7X0QGD2eDN3/kbI6ts0Nl25ZwWh8yw7IWOwVQXsLKbs+0rhrG+RyjkPnuAfGq0ptCspb2buMDrMdARu6TX+oEAAhAky9i/GIhk4y0+JvLHF7SGpzmwv5STOvZOMySOF0mHOD3360WcrFS9EYBznIusDxaP+ts+zw0gen4IVpg9PPisLphSsNt5e3o82huYC1fKPu1naPt3MYUwawpdbdjzoxNFiVJihlyoBlJO8KhWtCauEFqei+VoZLOcvCNJFMYAi2ypWTfiWiBq9yfQyJOUoCG9Se/q8hD5XkCB4Ca37bdiJbvUvXgsfDKOhWogdshwZYfElfjN7h4VzgfvK1aNxselER1lQy7QagQTj7NYkooiEY7VjzxNYuhPqjq0K4IAwSoiPBNKSouQ542dFVaIk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3997.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(23010399003)(366016)(376014)(10070799003)(18002099003)(22082099003)(3023799007)(11063799006)(6133799003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?alhsSVR0NzkrZDB5dzFoblhoaWRueTg3V1ZCdjZNdnhCVjJEbFBhdk1MMXNu?= =?utf-8?B?dTNlZWV5K1BIQjltbXBwM091VmVrdHQyUW1BMmp3Z3lEQVRHVUJIRGZTTVRq?= =?utf-8?B?bG9Cd1YyaFFJN3AwUmJEd09mMlE2QWZnRlJGcnpPT3o2UHhlWVlINmlDYzNU?= =?utf-8?B?RU9LNlpUdkh0U0hQZ1pvMmRwZ3hCVjhqMDN5SEY3WnNCUGNnMmFPMmYzUmRo?= =?utf-8?B?bDUxUkliYkd6MFphMitCYjhXM2VQajhJSjMwaW8zaS9xQ3QxMXNZYkxiekhF?= =?utf-8?B?bEcveWNsek9HYldBM3krTFVLQURnMkRHWExlb2tXMWVsekFpcFppOWdYOGcz?= =?utf-8?B?ZmZnaWdtT2ZqU3ZPRyt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-8?B?V2RyYlVlU0psM01nNmF5RlM5NG5MZ2hEckFRQTNCUUVHdHdyL3lWbUN3QWZz?= =?utf-8?B?SGl3SFZaWlhCZTY2ZS8rZHMwSm5Cck1QYXNpWU1PSzhnd3RxYk1jYUdFZ2tM?= =?utf-8?B?M2dWNlZqZVArYmZZYlBKTFNxeW5yMFlla1Bud1B1N2xhbWdiRmhjVnBwbEtI?= =?utf-8?Q?dTa8xH3BrG3AynmyTZfSQbmIDiiht0+YbdkikjJRcIWXj?= X-MS-Exchange-AntiSpam-MessageData-1: NYpdH7RpGERutw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8abc5d12-bae8-429f-b097-08ded02d9442 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3997.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2026 07:12:11.3622 (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: JoQ0SiX6Pfo0peCphctco6zzW+xXiCWfDj6Rq1a+GcDjKnzEwzAoPNftV4zEmRmY/CpLV3on9Ii8zZvbSVXclw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6700 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 15a61edaaa82..0b7047646bf2 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, // @@ -432,17 +433,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..a1cdf1aa8773 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` do, 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 7918ebb508f9..d80c6dbb4cba 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -132,22 +132,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 ae4c44aeddaa..9abdafbdbb57 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, // }, }; @@ -66,12 +64,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