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=40.93.198.50 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796028162; b=sgDInES1V7GOXVtRSV8JmrNohoNebZzmog9GjqlYQBSsGdxkpnLaejEhrQH/X/Uz8/6f 4jaHUz/lC8SibMcwv0Xz2thGQ/AgK4xWlmXR+HoS1s86+rlE7V31r9d46dPwcD8s+s5aY 8uOpSIAJMKj08cSU8bC+UEjzqWM+ECs7T52eHabx0qx2kz9vedtxC4vHTn9RmIqeLr95g fzBnPXfBDDAy9waIRSZZhBRn41opA/eipfyioQ0TIIAizEEmUfr1NYu5jOn2igRZKH8w9 beBplWgnAa7BhMZYG/2v70WsGpDQ/+cvva3NbMhs1dolS5jzPdiC5PiNfTLiHdm6fHA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796028162; h=DMARC-Filter:DKIM-Signature:Received:Received:From:Date:Subject: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ClientProxiedBy:MIME-Version: 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-MS-Exchange-AntiSpam-MessageData-1:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=0rGNzbK3OjO43r1SYwRR8NlRuJJvVtDbht6mLV26Zh4=; b=tRzO3GfdNnrneMZeO5Mkxwa85jWrR2kpAy/1oedSO91gIDs47NhRl9W7iM2dgUZcrB8b uzk3kxxE01L7Dkkr+YaOt0ChR3htg4fWAqLfTR/MN8L6/RTGbukiPJlVxYJxzPzycCG/P TzXl7Wm1CE3rPgaR81ObEo9XDIVNTpuzKPL/ex/41MF3jXbZqdZDzsgyywUudTjg/86mB JDBj+5gOi6nCaIJpuzLs0T62/tRcSCu23DAue1+Guw5FKP6qGfKG0Novs8QUez3MYm5s4 p5TppmtsmqvOybVqDkH9xZ2owsnJj4UhCITUOFkICxlGFhscObLj7WUY24M3kbrelnQ== 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=azP0oYUi; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.50 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010050.outbound.protection.outlook.com [40.93.198.50]) (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 D99A3606A32A for ; Mon, 30 Nov 2026 08:42:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D99A3606A32A 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=azP0oYUi ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KxG74EviA1rFFmQmH2jj6+CYhgvpK9Q8PxXkwq22tJpAQ1YUDw6j260J15wzu3s0kJJ+009EUB/TtAaTZhmCsCQbp7z6VT3fysNyxWaYodKVdVdcotgv8zVoK7tq8Dm80MtGhNhxwG7a8KHoZuhtOkdNQP0X/r4FyUXahwQCPcSLnkMKPrNqdrT1ZGL4CndwET9HyDT8Nts2QijQ1D7RbHD7iW8cxsUalZN2RBqrVbyyXhzPFuQweS/USgSI5xBdVZOy8y6TMqi6xGTIG7WohBrI6AivdAigBhKv1HLC9WCI1JCKYt+zcE76VCdnj4XLBt841a75W0U2gj4/EIRLug== 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=0rGNzbK3OjO43r1SYwRR8NlRuJJvVtDbht6mLV26Zh4=; b=BZbKBq5/MPnYG4ZY+FRWxh/2qRPThaHEh77NfGz8fokKk6IYKTrVXXAlwuWj+crqDfyROY+HBejPALek9z2VRTN1IIDTLm9H1i+mFX6S6pkHyjpydUa8qKBsfz8fAyKUCn1+I44hKyEnC1QR329R/Q51ohJ15PStsjvuwJZIH8FZrOkNMR8Ip0Rq7QAR9Xf+2cG3Bad43gxhkqKrzAbwqb6GVxZex/ya/nudJ6YVn1T7DodbuztiYWPmrCZpVoNwN61a0Nghi87aoXDpNvTJWioNkAXa8Hf+v3nId2awgJK3PcfGjtswyGxrJSKbvZove6/JgJYLrhF23anqIPqiJA== 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=0rGNzbK3OjO43r1SYwRR8NlRuJJvVtDbht6mLV26Zh4=; b=azP0oYUie2U1ZM/+2ZRqtMNU8keewGKeKlplLX/I/vA8pSd+WQxMoB52vgCB3oW47kIZPGIE9bEYcJ8JLtqWD4fpdUs2WQwUkBaD3zpJkAD/74DheMCel17xzNr3sHZ5yq0E7zBgHq+m9ZLpnxYiXya9xR/Q+6xpPk+Lby4MtcSeH5JV2DVALEnfdhskKShMADqDlF1050G5piyb6CsmOaxfA4ND6TnnYQb1CAwZqXiE7WcXib0q7J/jsnDFWwpJvN4LT6AOsH3EW0lTytPU5O8zdYCB/dkKhObrJjsSjxdC7PRvXHk5ycDEZ4Sa+k7iEqW3zZ3qJ5YEva/IskT6kQ== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MW4PR12MB6873.namprd12.prod.outlook.com (2603:10b6:303:20c::17) by DS7PPF5A996E821.namprd12.prod.outlook.com (2603:10b6:f:fc02::946) 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 08:42:38 +0000 Received: from MW4PR12MB6873.namprd12.prod.outlook.com ([fe80::a338:bd2c:3a38:ece1]) by MW4PR12MB6873.namprd12.prod.outlook.com ([fe80::a338:bd2c:3a38:ece1%5]) with mapi id 15.21.0662.001; Mon, 30 Nov 2026 08:42:38 +0000 From: Alexandre Courbot Date: Mon, 30 Nov 2026 17:42:28 +0900 Subject: [PATCH v3 02/11] gpu: nova-core: gsp: rename and move the static configuration type Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-nova-r000-staging-v3-2-55aceca8e958@nvidia.com> References: <20261130-nova-r000-staging-v3-0-55aceca8e958@nvidia.com> In-Reply-To: <20261130-nova-r000-staging-v3-0-55aceca8e958@nvidia.com> To: Danilo Krummrich , Alice Ryhl , David Airlie , Simona Vetter 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, Alexandre Courbot X-Mailer: b4 0.16.0 X-ClientProxiedBy: TY4PR01CA0077.jpnprd01.prod.outlook.com (2603:1096:405:36c::6) To MW4PR12MB6873.namprd12.prod.outlook.com (2603:10b6:303:20c::17) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR12MB6873:EE_|DS7PPF5A996E821:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a6e964e-048d-4094-89e5-08df4ebde3ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|23010399003|10070799003|10067099003|56012099006|261026121527099003|261026140227099003|261022113327099003|261022105027099003|261022075727099003|261028144727099003|261021123027099003|261021121427099003|261102123227099003|261009223027099003|18002099003|22082099003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: NeTeq2fJS3kOlE1zeKwc8/gKlbGvHlu59aT0SX6o4augytjYBSU86nCwlZM+OpD+w6KfHyP0eVZjZUwMJvZL+5Wo9MiUpVdXFsFA0yQnW783nFGIIBBg7oaHvDFiL4Z//WHquZfSph0JgTCnnDNKESZF1yDHlppbEAA4FNlMtzIuJNa+N9kNwbsWYgBaiw4iC7dzlLbCE7WTGhYwzA9rYDSEvT6oINRRUn6qQ19ZTn4SYU4h6iM5L27a1Y8GUiAr76DSILXIC2Wq/jOnlav8B7QxHjH6ZiqV70GZRxa0+1oFEblKZ96Y2mQJqbxNq0ELEKC2KhH7rcKJxABb1OfQzF6JksId2kQnhzRlNAH97xgAMZCvGT7gw5App354bO/eQywhp3hdQ27HxElAOKL2P+ZrvDWX/rmQJlxBUpNaqzUtTp2J1RGdEHwdDEFuD8zdXTkZCJIMPFZLluMJuqqprueQ2ifGR4DGpef5yFlV3DSOduavvpKydIXu5wjy5pm0/viw340WIFo+KpsElRtQXAbSYfW3HSOMVcxPrSYMmkmapQHBQZGgt1BSdvPU1YcGJpIfawJP9CSCTrYuRH0lVbjl+RMPjU+k5/VoWzW5Esc8ZaY9CP8CW1wAK+qpgtcicp3dlUO1xo2t0Ee9+XZvepWCuJf1RmuXhyUmUSlzEzY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR12MB6873.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(23010399003)(10070799003)(10067099003)(56012099006)(261026121527099003)(261026140227099003)(261022113327099003)(261022105027099003)(261022075727099003)(261028144727099003)(261021123027099003)(261021121427099003)(261102123227099003)(261009223027099003)(18002099003)(22082099003)(11063799006)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZzBCVkdVU3lYUytFd3VISU81SjRuT2tjd3JvMmFXb0dXSVZGMUpDa2s0ZEMx?= =?utf-8?B?RkJsR09TRVZrMzBwNVBOellZR3d3MDdtTFY5RDlQNXpRYkppdWVjSURJRlFV?= =?utf-8?B?R05QbmNxK0NRQXJSMXZhQkJSS2VRUWRvM3dsMWMwRFZjYm9VbStQSmhMVWRS?= =?utf-8?B?RmVnV3V2ZFpOUUQwb0V6TW01RSswcVdibzc3U0NmQUtnM0ZET3laMWx4STVn?= =?utf-8?B?dWpUUWtkYlpxZEFmeFZJY3JVdHVOSmhzd2pOZ3hBSXZDN1ZrKzhPZnY2NVFT?= =?utf-8?B?Q05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SeUV5TjRXYWFIMk81b25TbWZCR3BVL2NHK1pFVFo3TWJq?= =?utf-8?B?UlplTW4vbWZTVER1UEI2djdjV0ZlUlcyWDFiRXBMaEZOelRDL3hJUEY2c1lL?= =?utf-8?B?UzJUSngxK01lSFN5dzZ1M2ZVMElWYWd6cXA2TnlpVUI5NzVENDZxUkUxWlpw?= =?utf-8?B?bGROWWJwWXhVcnpIWHNPazNTTDgwektFdU9EYlFPZHJNeEhEMm5CNGdtTEpL?= =?utf-8?B?eUlHdU9CVXBCVWkrTm5wMEtXOW4xSjkydGtBMS91TUswZUFCYldUcFhkOElv?= =?utf-8?Q?3tH5J5SzrUwcgiPXHNlPkJ4rYqL56R0Me3/Qlysn8NKT+?= X-MS-Exchange-AntiSpam-MessageData-1: rQ++tcgaowG/ew== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a6e964e-048d-4094-89e5-08df4ebde3ab X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB6873.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 08:42:38.7176 (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: nITWXkKL5w/HGCGFyV1lI5pGG+RGI4iRUzEXOwrtlr52VeC/2G9oRkmljlO99ZuBqiGGS5xfiobueq8HnqvFww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PPF5A996E821 From: John Hubbard With the r000 firmware, GSP-RM reports the static GPU configuration in its reply to GSP_INIT, a GMC command, and no RPC command fetches it. The type that holds the configuration is named after the r570 RPC command that fetches it, and it is defined among the RPC commands. In order to make the type available to a GMC reply, name it after its contents, and move it out of the RPC commands, up into the commands module. No functional changes. Signed-off-by: John Hubbard Reviewed-by: Eliot Courtney Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/api.rs | 6 +-- drivers/gpu/nova-core/gpu.rs | 4 +- drivers/gpu/nova-core/gsp.rs | 2 +- drivers/gpu/nova-core/gsp/commands.rs | 65 +++++++++++++++++++++++++++++ drivers/gpu/nova-core/gsp/commands/rpc.rs | 68 +++---------------------------- 5 files changed, 76 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs index dc877ddebe8c..f800ba6c4183 100644 --- a/drivers/gpu/nova-core/api.rs +++ b/drivers/gpu/nova-core/api.rs @@ -18,7 +18,7 @@ use crate::{ driver, gpu::Gpu, - gsp::commands::rpc::GetGspStaticInfoReply, // + gsp::commands::GspStaticInfo, // }; /// API handle for the auxiliary bus child drivers to interact with nova-core. @@ -39,8 +39,8 @@ pub fn of(adev: &auxiliary::Device) -> Result> { NovaCoreApiHandle::of(adev) } - /// Returns the GPU [`GetGspStaticInfoReply`]. - pub fn gsp_static_info(&self) -> &GetGspStaticInfoReply { + /// Returns the GPU [`GspStaticInfo`]. + pub fn gsp_static_info(&self) -> &GspStaticInfo { &self.gpu.gsp_static_info } diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 8ab1687847ff..590d81f4e479 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -32,7 +32,7 @@ gsp::{ self, cmdq::Cmdq, - commands::rpc::GetGspStaticInfoReply, + commands::GspStaticInfo, Gsp, GspBootContext, // }, @@ -394,7 +394,7 @@ pub(crate) struct Gpu<'gpu> { #[uses('tree)] _gsp_subtree: GspSubtree<'gsp_resources>, /// Static GPU information as provided by the GSP. - pub(crate) gsp_static_info: GetGspStaticInfoReply, + pub(crate) gsp_static_info: GspStaticInfo, /// GPU memory manager owning memory management resources. /// /// Must be kept declared *before* `gsp_resources`, so that its components are dropped while diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs index 2f1cdf8b7bec..398d6525b133 100644 --- a/drivers/gpu/nova-core/gsp.rs +++ b/drivers/gpu/nova-core/gsp.rs @@ -159,7 +159,7 @@ pub(crate) fn new( } /// Query the GSP for the static GPU information. - pub(crate) fn get_static_info(&self) -> Result { + pub(crate) fn get_static_info(&self) -> Result { self.cmdq.send_rpc_command(commands::rpc::GetGspStaticInfo) } } diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs index 5f1c944678be..095fc0a3d972 100644 --- a/drivers/gpu/nova-core/gsp/commands.rs +++ b/drivers/gpu/nova-core/gsp/commands.rs @@ -2,3 +2,68 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. pub(crate) mod rpc; + +use core::{ + ffi::FromBytesUntilNulError, + ops::Range, + str::Utf8Error, // +}; + +use kernel::prelude::*; + +/// The static GPU configuration, which GSP-RM reports in reply to +/// [`GetGspStaticInfo`](rpc::GetGspStaticInfo). +pub struct GspStaticInfo { + gpu_name: [u8; 64], + gpu_short_name: [u8; 64], + /// The 16-byte SHA-1 based GPU identifier (GID) reported by GSP-RM. + pub gpu_gid: [u8; 16], + /// BAR1 Page Directory Entry base address. + pub(crate) bar1_pde_base: u64, + /// Usable FB (VRAM) regions for driver memory allocation. + pub(crate) usable_fb_regions: KVec>, + /// Exclusive end of the FB physical address space. + pub(crate) total_fb_end: u64, +} + +/// Error type for [`GspStaticInfo::gpu_name`]. +#[derive(Debug)] +pub enum GpuNameError { + /// The GPU name string does not contain a null terminator. + NoNullTerminator(FromBytesUntilNulError), + + /// The GPU name string contains invalid UTF-8. + InvalidUtf8(Utf8Error), +} + +impl GspStaticInfo { + /// Returns the name of the GPU as a string. + /// + /// Returns an error if the string given by the GSP does not contain a null terminator or + /// contains invalid UTF-8. + pub fn gpu_name(&self) -> Result<&str, GpuNameError> { + CStr::from_bytes_until_nul(&self.gpu_name) + .map_err(GpuNameError::NoNullTerminator)? + .to_str() + .map_err(GpuNameError::InvalidUtf8) + } + + /// Returns the short name of the GPU as a string. + /// + /// Returns an error if the string given by the GSP does not contain a null terminator or + /// contains invalid UTF-8. + pub fn gpu_short_name(&self) -> Result<&str, GpuNameError> { + CStr::from_bytes_until_nul(&self.gpu_short_name) + .map_err(GpuNameError::NoNullTerminator)? + .to_str() + .map_err(GpuNameError::InvalidUtf8) + } + + /// Returns the total usable VRAM size in bytes, i.e. the summed lengths of all usable FB + /// regions. + pub fn vram_size(&self) -> u64 { + self.usable_fb_regions.iter().fold(0, |size, region| { + size.saturating_add(region.end - region.start) + }) + } +} diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs index 023090ac6bd9..ab6d1114cead 100644 --- a/drivers/gpu/nova-core/gsp/commands/rpc.rs +++ b/drivers/gpu/nova-core/gsp/commands/rpc.rs @@ -3,10 +3,7 @@ use core::{ array, - convert::Infallible, - ffi::FromBytesUntilNulError, - ops::Range, - str::Utf8Error, // + convert::Infallible, // }; use kernel::{ @@ -30,6 +27,7 @@ Cmdq, NoReply, // }, + commands::GspStaticInfo, fw::{ self, MsgFunction, // @@ -208,7 +206,7 @@ pub(crate) fn wait_gsp_init_done(cmdq: &Cmdq<'_>) -> Result { impl CommandToGsp for GetGspStaticInfo { const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo; type Command = fw::commands::GspStaticConfigInfo; - type Reply = GetGspStaticInfoReply; + type Reply = GspStaticInfo; type InitError = Infallible; fn init(&self) -> impl Init { @@ -216,21 +214,7 @@ fn init(&self) -> impl Init { } } -/// The reply from the GSP to the [`GetGspStaticInfo`] command. -pub struct GetGspStaticInfoReply { - gpu_name: [u8; 64], - gpu_short_name: [u8; 64], - /// The 16-byte SHA-1 based GPU identifier (GID) reported by GSP-RM. - pub gpu_gid: [u8; 16], - /// BAR1 Page Directory Entry base address. - pub(crate) bar1_pde_base: u64, - /// Usable FB (VRAM) regions for driver memory allocation. - pub(crate) usable_fb_regions: KVec>, - /// Exclusive end of the FB physical address space. - pub(crate) total_fb_end: u64, -} - -impl MessageFromGsp for GetGspStaticInfoReply { +impl MessageFromGsp for GspStaticInfo { const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo; type Message = fw::commands::GspStaticConfigInfo; type InitError = Error; @@ -245,7 +229,7 @@ fn read( } let total_fb_end = msg.total_fb_end().ok_or(EINVAL)?; - Ok(GetGspStaticInfoReply { + Ok(GspStaticInfo { gpu_name: msg.gpu_name_str(), gpu_short_name: msg.gpu_short_name_str(), gpu_gid: msg.gpu_gid(), @@ -256,48 +240,6 @@ fn read( } } -/// Error type for [`GetGspStaticInfoReply::gpu_name`]. -#[derive(Debug)] -pub enum GpuNameError { - /// The GPU name string does not contain a null terminator. - NoNullTerminator(FromBytesUntilNulError), - - /// The GPU name string contains invalid UTF-8. - InvalidUtf8(Utf8Error), -} - -impl GetGspStaticInfoReply { - /// Returns the name of the GPU as a string. - /// - /// Returns an error if the string given by the GSP does not contain a null terminator or - /// contains invalid UTF-8. - pub fn gpu_name(&self) -> Result<&str, GpuNameError> { - CStr::from_bytes_until_nul(&self.gpu_name) - .map_err(GpuNameError::NoNullTerminator)? - .to_str() - .map_err(GpuNameError::InvalidUtf8) - } - - /// Returns the short name of the GPU as a string. - /// - /// Returns an error if the string given by the GSP does not contain a null terminator or - /// contains invalid UTF-8. - pub fn gpu_short_name(&self) -> core::result::Result<&str, GpuNameError> { - CStr::from_bytes_until_nul(&self.gpu_short_name) - .map_err(GpuNameError::NoNullTerminator)? - .to_str() - .map_err(GpuNameError::InvalidUtf8) - } - - /// Returns the total usable VRAM size in bytes, i.e. the summed lengths of all usable FB - /// regions. - pub fn vram_size(&self) -> u64 { - self.usable_fb_regions.iter().fold(0, |size, region| { - size.saturating_add(region.end - region.start) - }) - } -} - pub(crate) use fw::commands::PowerStateLevel; /// The `UnloadingGuestDriver` command, used to shut down the GSP. -- 2.56.1