From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.56.10 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796067700; b=kb7D3MT5JX6gZ5t6HG1u5kI5CzKi+E/l5vawy/gqo3Bii6OrD2pEVpj1MPtvTQ/DCPfm FxU8Slss+NyPQ0qTN6YPwqH2y7evbA8wZJLSPWVoG7wIVQOTySczd+CgQeA9QHInXzW++ jpWLXbvMQr+F8shMtQG5hslFx133617BknKpncBnhdiaDjCFQG8PB9q2F4UtvtN6C0h9M xA1ebW7483aPTnNthvybntZLLmQlFSCV74FDZpZjqL1NipCQFn7V0dEIXNOTnj9shy3zS nWFtcAzgwljY70rJtdUAtJAbvkInE8fb3oskPd6pgbR9uyQmiPyNDfGtQ5hlK9Nx2nw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796067700; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:To:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=hlfZyvRAlqa6icufyzoXzxCzeKZ/TjgDQ0zkxRqbots=; b=fdr88NJgzt6S3+liSlHIqt2JRUHSMbYwVOvTiMIQ7was2QMB+OLW6D8Fm/NZ+Ocd/LKU DgBEggzvGgYI9fgSyopT+ZiB/mO/VEwHKLm4S0jbpUTI6EF6LD+u6pNQKg0ihFjavYMu2 IFZKv3WBDhLHArwthS0f940Y3tu/z2ffaPDLbwcLOfv+q3CRwE3HU0WyCLauo+sRh/9fE l7rSPUM6J97DA+M/bevso5Cwd3wmFqtFWrM8tUbC40h83F7kqiOXpFqTpcsYpUUFmq9Sy JbEsNOei6ghMZJcY83CEvLmt4DNLwmz3Rcag+6Fdk24wWRla9xMuJyIcEXPO4Ad3Viw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=Wl0PRnaG; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.56.10 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010010.outbound.protection.outlook.com [52.101.56.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 571A7606A320 for ; Mon, 30 Nov 2026 19:41:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 571A7606A320 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, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=Wl0PRnaG ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GGystks28vx3XM98vTFIZ6OYPSaHSQVd+LBpLV8WrSrwPe7x3+x5TUoNwA8mco1uMM4WPCGJ7mditnT+kxMEooarQKWX9E8XtzvFuYerlcCsVhg/kpY7ZGC+OUeDA5UGwvxDV0R922GBXwB8ERXmWILIqIvEnSf6Y86PU/aoQVtQViFJcB+/4dqm0g+lIrIhxzFTaEj6nNMrblxggA2IJPk6g4iYwvGQLXY4qfFggXyqFmTcoqn99JeCQCSlAwQW4tKQPOy10L6MqbaMsORADMAPLf2DmsyDMuucGCTN+LsCOl830P8i1T+kZzLVguyiEND1LhrcnddQviOTDVScWw== 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=hlfZyvRAlqa6icufyzoXzxCzeKZ/TjgDQ0zkxRqbots=; b=Cx8C/WRx2qIOxmYejtMwST5i6NzAIdqVv+xeqpWtLWZNiG/UdDPx0WqNgU8FqqIwFAN43gquW8Ww6l0QhUNO0UBO3Dci9uajJPriJEebhTW+hb4zSRHmJYWb0dKvB1Diljk7RqCwe5ps4EhHNGjbz2SpvhiBlAIsVyuTktNtWVgDXsCvikej87wMSweVZpBzXwNilazkM1REPfXRItGIVNBuoNhH2Yxu/mY5RZ46DAsrF99nMbNc1xr/ESRBMLlZkkbp5Ycm0HcYgImMqp6ZLUZRV8TYSr6m0yCi7th0xmmkDC/psdm32kDCPvkxrcAoEyrWqA7YTsg3Bdg/HpxvqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=hlfZyvRAlqa6icufyzoXzxCzeKZ/TjgDQ0zkxRqbots=; b=Wl0PRnaGr1ZJmRVu56mmcbdzjHt3yrtB+wvpEPYVad3Zz9V0/C8jLMCNnfcUfAEpVTzTvbgL/yoXkfc5Zhm6SREWVnM9cKKX9/7RUo0KZEV8I5npGBTWscKsJllutnPVGg1Z5dd/SszYAYwNLpNpINYqFP43HyjOrGB4ldumCRB2MNiu71Jfl4fINbZTf71x4ewgfhtrpAimO7CdOHEez7QJyG8H/o3wTTa/PU6rQiPYesO3aI1Fc1seBKkiZ5EAkWs1z1xzoyty37/mI2pENI4WicsANA1FVGE0m4d1aQtHryYb0QgobSha+T3fnxeGOcTtv+mMunsZEWq+GaJlfA== Received: from BL1PR13CA0265.namprd13.prod.outlook.com (2603:10b6:208:2ba::30) by DS6PR12MB602245.namprd12.prod.outlook.com (2603:10b6:8:499::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Mon, 30 Nov 2026 19:41:33 +0000 Received: from IA0PEPF00000041.namprd04.prod.outlook.com (2603:10b6:208:2ba:cafe::76) by BL1PR13CA0265.outlook.office365.com (2603:10b6:208:2ba::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Mon, 30 Nov 2026 19:41:33 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by IA0PEPF00000041.mail.protection.outlook.com (10.167.249.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Mon, 30 Nov 2026 19:41:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 11:41:05 -0800 Received: from ubuntu (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 11:41:04 -0800 From: Timur Tabi To: Danilo Krummrich , Alexandre Courbot , Eliot Courtney , John Hubbard , Subject: [PATCH v5 7/7] gpu: nova-core: remove LibosParams Date: Mon, 30 Nov 2026 13:40:45 -0600 Message-ID: <20261130194045.358943-8-ttabi@nvidia.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130194045.358943-1-ttabi@nvidia.com> References: <20261130194045.358943-1-ttabi@nvidia.com> X-Mailing-List: nova-gpu@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA0PEPF00000041:EE_|DS6PR12MB602245:EE_ X-MS-Office365-Filtering-Correlation-Id: 534087f0-48cf-4ee7-b3a9-08df4f19f093 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|23010399003|82310400026|376014|10067099003|56012099006|261022105027099003|261026140227099003|261028144727099003|261021121427099003|261021123027099003|261022075727099003|261021135927099003|261102123227099003|261009223027099003|22082099003|18002099003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: APAO7o7QWfrhSTXf+dwzp7deQUSVxOuKx9ecsD9jImpWVOxkL6WuXu/vFteKTrfyhOZQmKlLjRcxa3kkcnGT/11jubR+dY1DphER3OpstMd1M3KPzGbPNwKQvYt+JhyJMEg1yXXFYFdI7z46yOQzRi/7sxQggzUZAtl453vo6aJaBEgz/AMxq6S7fOn+wF+CYUl8Ss36AnXLP16pUBvuLAm3wOMLPJ0qBSpbd7ih82VSaCxDidtqUjWApTw6Sw/rkRY+hOKQxuYlXM2y9BUDMaxKHX8oI6UMVVEBy0GS/LdyrZtGSUyr8vVpJdrMlqP+4nBhqNxG1e9jmPlvv5Sw1hr//xm3kUPHfhs6J7AxPegZVedeuyqZWRh+gVae5MLG0Bhc15OvmWjBJwfmVeg8H1/hTCVN1EKfwjZuBJut9/AeOBLlMen+m2YCcBO5QAuOqYyo3JTq0xanm0GaoJyhQCrVShYUur9B99a/MaA31LplyB1UY2tusju7qJtWyLErTEkt7dBwifnXIcCwAfHLJwA5EQtLeGIP1YuCi2IrVYsrS3i7LgKWhQft6DizE2CRNLF3z9bzOlRlnox+a4IaU7HL3c8dGb3LqBncUKo/vNa2L39ENoqjgUlZL6tZxALrqozNh2YNfWQlI9s8M+gNui9fKUMwBrD2obwYtFXxj/J07LkfmMPjNxcApeY1irK7YspWzyu7K//+BBqxTzgSWQ== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(23010399003)(82310400026)(376014)(10067099003)(56012099006)(261022105027099003)(261026140227099003)(261028144727099003)(261021121427099003)(261021123027099003)(261022075727099003)(261021135927099003)(261102123227099003)(261009223027099003)(22082099003)(18002099003)(11063799006)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ebj24LBdhDr8SoErwyfd257AMvgqJAZvYNKMDktmR8FN0wSya1U7ETzi8+0QwYu0uph9EqtgteYaOyLGicSY7wKVhu6gbU8i+NXT4nu5ufj4MTvG04av0AwOFLnfM8L6T/oFO/MZkYacExD9tf0YYgtejrSLRl6ELerhlB0t5Tr3KSREiw7AGeShWSgjpFzjn0mZwDv7ycGpUkN9wHn/4oMlos4vb3zYCkze9CB9kEvgsFsmUcg+5O8yaoyjCnLXTqXocdQmdECBGLkpYfXBBT9f9GAKsfZdMXi4FQlGkE2IqW9GygNCYJ6iwRb3cmiyyMkxMVUm2D0/Z9q66NIcAR7CcIdSJ5PDwqYPAFLO/27g9lWXUOB7Eb+Aq4egZY1r28chsdfSAvMftDrrK4BGQ1/QtXSXC5BSTKzraPPP3AmxdmKduhOhbpBuyBQ4ERor X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 19:41:33.7173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 534087f0-48cf-4ee7-b3a9-08df4f19f093 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: IA0PEPF00000041.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS6PR12MB602245 All functionality that was provided by LibosParams has now been replaced with TLV-based implementations in GspFwHeapParams, so we can remove LibosParams and all its dependencies. This also allows us to remove the legacy methods base_rm_size(), client_alloc_size(), and management_overhead(). These were used to calculate intermediate values that are now represented by TLV values. LibosParams and GspFwHeapParams were two types used to hold data and/or methods for calculating the heap sides that GSP-RM needs for booting. Although they technically represent distinct parts of the equations, they were always used together, so it makes sense to merge LibosParams into GspFwHeapParams. Signed-off-by: Timur Tabi Reviewed-by: Eliot Courtney --- drivers/gpu/nova-core/gsp/fw.rs | 96 --------------------------------- 1 file changed, 96 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs index 8a3812cba89f..237e97ea30b2 100644 --- a/drivers/gpu/nova-core/gsp/fw.rs +++ b/drivers/gpu/nova-core/gsp/fw.rs @@ -7,8 +7,6 @@ // Alias to avoid repeating the version number with every use. use r000_00 as bindings; -use core::ops::Range; - use kernel::{ bitfield, dma::Coherent, @@ -40,10 +38,6 @@ gsp::GspFirmware, tlv::Tlv, // }, - gpu::{ - Architecture, - Chipset, // - }, gsp::{ cmdq::Cmdq, GSP_PAGE_SHIFT, @@ -80,19 +74,6 @@ pub(crate) struct GspFwHeapParams { const GSP_HEAP_ALIGNMENT: Alignment = Alignment::new::<{ 1 << 20 }>(); impl GspFwHeapParams { - /// Returns the amount of GSP-RM heap memory used during GSP-RM boot and initialization (up to - /// and including the first client subdevice allocation). - fn base_rm_size(chipset: Chipset) -> u64 { - match chipset.arch() { - Architecture::Turing | Architecture::Ampere | Architecture::Ada => { - u64::from(bindings::GSP_FW_HEAP_PARAM_BASE_RM_SIZE_TU10X) - } - Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => { - u64::from(bindings::GSP_FW_HEAP_PARAM_BASE_RM_SIZE_GH100) - } - } - } - /// Returns the heap parameters from the TLV pub(crate) fn from_tlv(tlv: &Tlv<'_>) -> Result { Ok(Self { @@ -105,25 +86,6 @@ pub(crate) fn from_tlv(tlv: &Tlv<'_>) -> Result { }) } - /// Returns the amount of heap memory required to support a single channel allocation. - fn client_alloc_size() -> u64 { - u64::from(bindings::GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE) - .align_up(GSP_HEAP_ALIGNMENT) - .unwrap_or(u64::MAX) - } - - /// Returns the amount of memory to reserve for management purposes for a framebuffer of size - /// `fb_size`. - fn management_overhead(fb_size: u64) -> Result { - let fb_size_gb = fb_size.div_ceil(u64::SZ_1G); - - u64::from(bindings::GSP_FW_HEAP_PARAM_SIZE_PER_GB) - .checked_mul(fb_size_gb) - .ok_or(EINVAL)? - .align_up(GSP_HEAP_ALIGNMENT) - .ok_or(EINVAL) - } - /// Returns the WPR heap size to reserve when vGPU is enabled. pub(crate) fn vgpu_wpr_heap_size(&self, total_vfs: u16) -> Result { let vm_size = self @@ -153,64 +115,6 @@ pub(crate) fn wpr_heap_size(&self, fb_size: u64) -> Result { } } -/// Heap memory requirements and constraints for a given version of the GSP LIBOS. -pub(crate) struct LibosParams { - /// The base amount of heap required by the GSP operating system, in bytes. - carveout_size: u64, - /// The minimum and maximum sizes allowed for the GSP FW heap, in bytes. - allowed_heap_size: Range, -} - -#[expect(unused)] -impl LibosParams { - /// Version 2 of the GSP LIBOS (Turing and GA100) - const LIBOS2: LibosParams = LibosParams { - carveout_size: cv!(bindings::GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS2), - allowed_heap_size: cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MIN_MB => u64) - * u64::SZ_1M - ..cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MAX_MB => u64) * u64::SZ_1M, - }; - - /// Version 3 of the GSP LIBOS (GA102+) - const LIBOS3: LibosParams = LibosParams { - carveout_size: cv!(bindings::GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS3_BAREMETAL), - allowed_heap_size: cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MIN_MB => u64) - * u64::SZ_1M - ..cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MAX_MB => u64) * u64::SZ_1M, - }; - - /// Returns the libos parameters corresponding to `chipset`. - pub(crate) fn from_chipset(chipset: Chipset) -> &'static LibosParams { - if chipset < Chipset::GA102 { - &Self::LIBOS2 - } else { - &Self::LIBOS3 - } - } - - /// Returns the WPR heap size to reserve when vGPU is enabled. - pub(crate) fn vgpu_wpr_heap_size() -> u64 { - u64::from(bindings::GSP_FW_HEAP_SIZE_VGPU_DEFAULT) - } - - /// Returns the amount of memory (in bytes) to allocate for the WPR heap for a framebuffer size - /// of `fb_size` (in bytes) for `chipset`. - pub(crate) fn wpr_heap_size(&self, chipset: Chipset, fb_size: u64) -> Result { - // The WPR heap will contain the following: - // LIBOS carveout, - Ok(self - .carveout_size - // RM boot working memory, - .saturating_add(GspFwHeapParams::base_rm_size(chipset)) - // One RM client, - .saturating_add(GspFwHeapParams::client_alloc_size()) - // Overhead for memory management. - .saturating_add(GspFwHeapParams::management_overhead(fb_size)?) - // Clamp to the supported heap sizes. - .clamp(self.allowed_heap_size.start, self.allowed_heap_size.end - 1)) - } -} - /// Structure passed to the GSP bootloader, containing the framebuffer layout as well as the DMA /// addresses of the GSP bootloader and firmware. #[repr(transparent)] -- 2.56.1