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.61.36 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795965076; b=ANYok2pv67z+jKYWLNF1Xiz/dqlZxqlGzo1YVvox5FwaTRZj8pvMXVimZXCMARbJHOI/ AB57qQPzlDc1qx1R2gpRbeKWjFYT0tuH3t0jG/tVW39Kv+Jq43cBIogT8e7f1xgbADvXa AdlMA+4UqfrMgehAUmzU4TuPFRRhf2scKDa2lvOGpTHbv5oT/I5YF1FlDUFHpSgrfuCZy A4/fUBUrupLS5B78IWZqJWmhkvWyWKgGSagpJiC4qwO8e8Gpwt8/lVP8kdpjlQ/EfTrGH +Vu8Qp9mq0LX9M1PIUYWK5XCr9ZbfX/XJs9Nca9V6K0brRr4Uu+xDhm+hDqwtCCQXuw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795965076; 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=Q8dAkhwB9y6sqkLUY+xmrweouPoGYxb8RkPDaIE9ZP8=; b=sQXyoFE7/whkoqzzoo0SZdKW4PIjIQuBvLTh4xKX1rfkQGzTh/rsDF3Hu5ElhN/K2RMJ OZduu9EcFYR0GmZrkWUk/T8gHnOyzfybPF4esWWrNIum1i5BdsYFhvEQNR6F+8vmm9fT0 /LDj1mQZRsDtZrkkeUtkOLPqe256Hv0tDy/QQpxT119s3k+HWecRjEuND2icDSn8RPsSB DmGyGPdCSPhVWQPapom6V534XqoFcNkJqzLR/p3bT001hd8Oto1L/4Dp253z93IG8l5DL Lk1kldy7TW5JLC3BnbkhxIYvWMhLYddM5GGBOHQWZ2HdUu7tIDseM3hXupRnsm/Zg0g== 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=IfuGIy5T; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.61.36 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010036.outbound.protection.outlook.com [52.101.61.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6677606A330 for ; Sun, 29 Nov 2026 15:11:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B6677606A330 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=IfuGIy5T ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VnowPz081TfNKq3my+GuyFEJ5ptL9m9snVLYgQIdXAXQ226mA7g+k8GpbeoTBTzO7+ROib3yWQSLPEpke32DhLYS2jYvqMXY6usi2cpjeLc9TqLs2LzY25VrlTOAAuMCrydfWNwkTueEtYzvzgMF+CyOXkv8jA56AZx0zGv6wPPJaoukk5LgW06+Z+9b5GwPb8UKucdj3oy0K/pQvJQCYnzMQ/HwoMXYvMN5lPDl/m7BcSrhgyrQFEd+cjcL+hixv9M2cUI8rVoi/47KoxcLNUEq93a5AF7eqY+RLsqevjU9+dBwhnt2NDKFutzxwTUh677QX2xYHorFiG/MLAsKHQ== 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=Q8dAkhwB9y6sqkLUY+xmrweouPoGYxb8RkPDaIE9ZP8=; b=V4OM/I1vju6SYoP6jqMa2ijKRCLoJsRY/TDoz8FZtPN/4vscZOK1bkx7uZjm1c04BU4wCgVVK/xnFZLfvJqaDBFILBkMoXF27YaAeN7eXKJxcQ//u6TmRCUvhP2klV2vEW8udhqokSI8gFSUXNQVhk8DiuSSzd7s8JDwlZoyE2kzB5QLp0tBR8/CHCybxqR15ji4pgszMcefhMM5C2WeWm3dU76XzrlBqLbsghNlN9tqesQuj0g9yPl0iDNafOoMlC3h/o/JpQH0HSiT6FJ7jBp2sSnaB+BB5vSmdssImCpsEX6FVehujg9DegieKQF8DLSILtV+a8Q9uBeiX6udKA== 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=Q8dAkhwB9y6sqkLUY+xmrweouPoGYxb8RkPDaIE9ZP8=; b=IfuGIy5T+eCvA9anOubK7E7t4AsA8zCA22KGpCIWsTwxXXelGv48xks2SHjWjRdW9RZ7yqne4Yl3baCho3n9jTtfDcNFWdjZIkYdcUPP8AFvEGL1hlG6f6nbSxvyfjCzg+uGbsNAd6vesj1ADaCzC4So+Q7ZNrSbPCLWEBv2wOeUpjR/AsywxHu+qIftjNdfvqAQpNK2vL9txB+0V9oExlOVp3a7OTy3BBTcLCAYgTSfd5wL8gNP46qyRV1yD5RJ78U/X35OUgZEevPAPDcI8S99rUJRQ3kKeYS1x7crIQVmXRLat9//nKdoZaY0p4A3IIeXB7Wr/3Z/rLomJimiNA== 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 IA3PR12MB524589.namprd12.prod.outlook.com (2603:10b6:208:705::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.11; Sun, 29 Nov 2026 15:11:13 +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; Sun, 29 Nov 2026 15:11:13 +0000 From: Alexandre Courbot Date: Mon, 30 Nov 2026 00:11:01 +0900 Subject: [PATCH v2 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-v2-2-afd079026a61@nvidia.com> References: <20261130-nova-r000-staging-v2-0-afd079026a61@nvidia.com> In-Reply-To: <20261130-nova-r000-staging-v2-0-afd079026a61@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: TY4P301CA0052.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:36b::15) 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_|IA3PR12MB524589:EE_ X-MS-Office365-Filtering-Correlation-Id: bb1db063-c6f3-4123-a247-08df4e2b01c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|23010399003|1800799024|10070799003|11063799006|6133799003|261009223027099003|22082099003|18002099003|3023799007|10067099003|56012099006|261102123227099003|261028144727099003|261026140227099003|261026121527099003|261021121427099003|261021123027099003|261022105027099003|261022075727099003|261022113327099003; X-Microsoft-Antispam-Message-Info: xyPR/5eQwQT7WhRLY2dckdHimdd+Y5pfJxjwipXc1Mb3052ITc2UHYgfWmyz4oTmKjvKR39+nWC71KyuJ/5FIqAFeDsSewWB2CKKSHcQvjPaJIiIRhIg8mRg4YV1gd7dh+SoXV4k5oKeMmKVwL5fIhnNsTUgBOQOu/n3F5prXt+/MYWfE+I4yj5uInasGGcVTF8+bMDuAb3SEBl6UvIPvmwBsvRibzbc4+8fhRJ9owt6cYt9ah7JSkOaXqiIqTUomIFOkPjzNNv73qhOYcgiT4us/q/2LiXX48hD/2zyqY91NmMMGTcHgYNpfIhi8PKOEnRkjoPUhs+xcyhwtoPCY3wzMNS4thnwaUzpnm1aDxqMpbnXbe9aei9pbVVNUoxe5DcEvOjLLqNxpa4Iio04lJFwZ32aNNxqp8f1dZtLsXYA2uV43oReOXZEXKZ+YEPD83E2GWRuevZwWJ7z0CzCRr5uO2npwFJpQovjknaNbXdT9c/6WTkcOBFik8GmlILkpQyDf6ptX6Rc1oAuCCIblGxb+gVLPnSF6XKbGj6iLojKonGhNKa9gSWMeSsCB9/XT/SgErFIUd4yW1aAaiHu6YRp22MJCj6H1JauxzMJX9DKRNyYy1t34wFEoE2E6VVs4McQ66A8jzkSJ1rI9W9b0is4O2j6Z8QdCwVNdsodQ2w= 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)(376014)(23010399003)(1800799024)(10070799003)(11063799006)(6133799003)(261009223027099003)(22082099003)(18002099003)(3023799007)(10067099003)(56012099006)(261102123227099003)(261028144727099003)(261026140227099003)(261026121527099003)(261021121427099003)(261021123027099003)(261022105027099003)(261022075727099003)(261022113327099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VVA1OHNhOUJCb3hFNnk2bUI2NG84Rm5nQUwyb2h3dUtTcmtrRUh0Rnl4cVRR?= =?utf-8?B?d0o1MlFTWXBnY1RCMjF0aGgvVVNkVE9JQ1orUnNaMjVSY0ZOb3h3L2l0MHFx?= =?utf-8?B?UTgxWFNScmsxK0RTZmVGcWtzbGJjbmp4aFV6Tlp1S2R5ZVlvLzE0bTVPYWc0?= =?utf-8?B?SkhzaFZpVEw4S3o1UDg5cDJvU092WWRtQUFDRkh4RlZkNjJUSmZ4YS8xUlVr?= =?utf-8?B?dHo1UldiNlVMcnBmWndSV2pBWXNOYmFqSEc4dmdhd2pUNVFGTGw0b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Ux4d01wMXV6RkJVdDhqQXN1YTFTVUZGY0FiY1JjUjZQK1dBUFhVR2lQa3F0?= =?utf-8?B?YVNGK0ZEZ21aMENTNG02bTRpZHhNNktFREp6VnQxQUtoOW50SEw5MUpock5G?= =?utf-8?B?YjhXUlkrdU1xcHd0Vk5RelNtb1o2eDg4QzVxQk5DN3lhUjFiME83bE5VM3B3?= =?utf-8?B?Nm4wQmRPRm1WZ3A2RkhmMDZXWmQ1SDlCZDdmTU9iQlZ0UHZrcDJZTDV5bTRN?= =?utf-8?B?R3daWXhwMDliakJrN0ZUaUY2RU85V0I1OUNRMnQxUnppRnBOMHo1ZjJld1Ix?= =?utf-8?Q?0fRjvyRtb3wWyUv3yAUx/IoewSS2iXvc2zOrHwrM7EoYs?= X-MS-Exchange-AntiSpam-MessageData-1: kSI62InwULjn9A== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb1db063-c6f3-4123-a247-08df4e2b01c8 X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB6873.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2026 15:11:13.1299 (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: T6+IXYJe+n2/ZRB4l6Jli+q6dBVI76yBjI3BBtJjcZ6D+GvCT3w2GQ8WIBW9DipUWYH+G2rzwqXTgY3CFKJG0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR12MB524589 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 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..4aae94b7ca2e 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) -> 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) + }) + } +} 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