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.53.28 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796299828; b=I7Pjr0sFUB4fZToHh/M2ALumRzElGQpRrb5mcmUS6if1rLAY2oGdixe8L+96BuuKRxty gvscdVx9JD2jH3a1mm2UqteSeOrCw1m+E8cqF1cRO0ObZLIrjhT312V41gDzKxX9qo6nd JMI/OCKUMTDAxThbw1ZU4Mfhvpr8Kh5d3EdJn+QUy+oQGbiwFKmg7RArUlWjwZG09xnYv rlC1z4w6zGWwOXbpqA81SDFk6sjuMj+AGVxaXVvODJoPoXp2HYuajD55WXRX7sQGctBiA gey/9/CUhejeFX+7i/eh20DQIMNtTvNgyQm6JaT2Ax2wAlUAlwxx5Q9uHp1sZG3eraQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299828; 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=f6X9b732gWSKi6t6oSSwuroR6e9ebV5Ir6e/zlZw5tI=; b=etwWcUuVRu3JclWEdKWKmRJPP80nmd8OZ3SHXixXSJ119VVJ2db2fPAUQjru4Sg5WCAM qn4uNIr5ZsXfiRz9fmAilOdGePmy2GH8OomwzmaZ1sMpUH1BBXpx/tHnNn3vx/tA33Cy9 2Ee/ktF2AD283hgOZLpDkiRVT0Tk3qkUHomlWZb0qcfoROdjm0Dtyv/ec1+SRZVzLZGTL tETKPl0KMiOci1HtEOGOl61H1FG75lHMSPsorIQFG2h3mSdHtqz4WMIPloel4Qb4PCb9E xzNyo/CvKuou2MXbkw3RS3+D177xl0dJDis9hKWe2uOlS0dldiJB2Dfbxnc+k3B9o0Q== 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=tJfa4u9E; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.28 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012028.outbound.protection.outlook.com [52.101.53.28]) (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 3177960A2613; Thu, 3 Dec 2026 12:10:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3177960A2613 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=tJfa4u9E ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e3MCXpgCIkWSYM0yGbtFQD0G7TmofLZmAcSx4LJ+RX8GDA1WYzEZRO6YCaV2Zi2UYuxOMeZ+s+lddyqSldoA2tNZSf4lUt54hm7EEPSbHdQxeWWoj2/f+Z0peMf6CkF1+86zuON3Z88/uUPaUTLWRUKLyaYv85zekX8kpjBXi3iRtVowCSAqoYkXLukjarP+JhAho8E8uAsOLPgaDMmfSQNiV5osqUXZ7KVnm57s8yZiSGGPtkBcLmTJIiHvVEDQ5FTbFhieum6sTXrgec3kFGXkCxc34x9/2N8bhfJ7u+H2UqmMia+0PaNOZaHkmA+e1m52sx6TgZ4HzJPwIUblSQ== 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=f6X9b732gWSKi6t6oSSwuroR6e9ebV5Ir6e/zlZw5tI=; b=i3bdLEW3sv++ST0ScJudDbqn0pF6vzJVZ43cn/2Cn7ux6B1AcGP99PbLppQJuVD1G9mY1C3s6IbRjuH8rZulwR/IjRa42vMzNQTEtXusSCBMVbkJVn/0wapxJAvH4hM6pukWgyWMZ4xw8Ztm2UtI2vYjXrDzP0kZ0CNsUJxnBgi3XMLh1LZ2chjFI0cujDVAbNQ7IZWt0lL8TJZSnk3PSCZG9vZeUNlit7EMFPaXT9EkFeYUk12Jd+BidqwFN3Gr1yAJnE0pebHgVvTP0XhivIEnmQMDO+0UzGIUgRK1Sbu8WacnX1sMST5B2LHUDOKtQXhpnohwM90AbihaFLca5g== 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=f6X9b732gWSKi6t6oSSwuroR6e9ebV5Ir6e/zlZw5tI=; b=tJfa4u9EFG6vOYyn6FXkqyzuQ38LKGup+0oM//fEXCjZVh4Ta60DSUcoUYe10z/4k0jpuYtvkYOJenpKGJD8CmtM7Gzl8FGt7/NQrlihD7+DzGisxRfLU8HcFo8FvjbGgf338D1Sd7vPRSLpMlzRCTVp1nTTfiVin3LSF34YMFZ1gCuK/80i62wROzDzq0iPIcsyFr3hXgCw3B9s5ijpkQoiQblOAnG2e+YQRcuf2Z7kAfjYPsMTSzV9oWY+5HzxMe28Kee2KnmJynsYrdtyZm6601Nm/rpo7ofFVB9E+9PB+M4iyMkslVHzAMAxnv70EuCMXmadnq9zrpyt0C+YeA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from PH7PR12MB6858.namprd12.prod.outlook.com (2603:10b6:510:1b4::20) by IA0PR12MB8984.namprd12.prod.outlook.com (2603:10b6:208:492::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Thu, 3 Dec 2026 12:10:23 +0000 Received: from PH7PR12MB6858.namprd12.prod.outlook.com ([fe80::a550:dbcf:2fcf:463d]) by PH7PR12MB6858.namprd12.prod.outlook.com ([fe80::a550:dbcf:2fcf:463d%6]) with mapi id 15.21.0688.009; Thu, 3 Dec 2026 12:10:23 +0000 From: Alexandre Courbot Date: Thu, 03 Dec 2026 21:09:31 +0900 Subject: [PATCH 14/15] gpu: nova-core: gsp: delete the r570 RPC commands Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-b4-r000-switch-v1-14-b1463ec6dae2@nvidia.com> References: <20261203-b4-r000-switch-v1-0-b1463ec6dae2@nvidia.com> In-Reply-To: <20261203-b4-r000-switch-v1-0-b1463ec6dae2@nvidia.com> To: Danilo Krummrich , Alice Ryhl , David Airlie , Simona Vetter , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Daniel Almeida , Tamir Duberstein , =?utf-8?q?Onur_=C3=96zkan?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: John Hubbard , Alistair Popple , Timur Tabi , Eliot Courtney , Zhi Wang , Alok Kumar , nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot X-Mailer: b4 0.16.0 X-ClientProxiedBy: TY4P301CA0037.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:2be::6) To PH7PR12MB6858.namprd12.prod.outlook.com (2603:10b6:510:1b4::20) 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: PH7PR12MB6858:EE_|IA0PR12MB8984:EE_ X-MS-Office365-Filtering-Correlation-Id: a45b7d76-7e90-4a96-7bac-08df5136681b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|23010399003|366016|376014|1800799024|7416014|11063799006|6133799003|261009223027099003|18002099003|22082099003|3023799007|921020|10067099003|56012099006|261026121527099003|261102123227099003|261021123027099003|261022113327099003|261028144727099003|261021121427099003|261022105027099003|261022075727099003|261026140227099003; X-Microsoft-Antispam-Message-Info: sZ5B2oWlvrjSA5hu3vIct9gId9QamC/Iv+DjCd2ZsMq8YyK0ieyigN65QQU21T2LvL72J+gSnXSwcFgBLpxpre7oShbvt71MdtvNR/KpF8xg6ZwHT2iT+59dJ5wtjGqsjTmWAaDXQCnjWzisvXwcUFxHOmIdy+z7dS6xFjxtVECIMXAPA8HwPcS3YQnjxe7Q1R/sBT+li0w/xSmuQH2sJFHk8ZNUGqTW/TCYPUAc2mPBCZz6EtL0LqMWPOlUFyk42ZdtXnHwTUGIoTJOpnzr+AfH/gvSNehdaGiMDYygB4vO6+sRoJK46e2FI1zxX0q7bNfT7DUAIrH6EkxEmL7tpxp4Pbb9HfAMf2YXGIx75kF5atR0Ebmd9qEJD/9Mx95kokbo4f+6vkKr2CYmNJvuVLNmeVRf3FX77XD54eerzl3kM3SzfhpuUEJTbwfFdwC9QBAkp5ZxJj3GHr5PJog6JaeKTUVBzT841NPtYV2X1AOTZPW7BCRcPICpZr5e1JkvFbwuOHRe7ZOQVKBRgQKda7jHbCq4djnjFu/elBsXk2u9Rf2PL62dxuEjNs8IlmR8Wq1w1DInJ9dISvozSRUOhXxUFaXOmZ2BihIc1LX5gyJcU+t6Eys6QqrhNPRt7ItYGi4PCcmeB6hwERKUS833InMfnLtDRoEzmxqUKfwftAA0mbB71MZ5UZMKKWmwvs7hKLTdu57X0QIafm+CWrf2Sw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB6858.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(23010399003)(366016)(376014)(1800799024)(7416014)(11063799006)(6133799003)(261009223027099003)(18002099003)(22082099003)(3023799007)(921020)(10067099003)(56012099006)(261026121527099003)(261102123227099003)(261021123027099003)(261022113327099003)(261028144727099003)(261021121427099003)(261022105027099003)(261022075727099003)(261026140227099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RTlEVEI5VmJnd0JuNzlmT0VzTG1kSDE2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= =?utf-8?B?dHVzTVc0S1FYVUpwUUhhYlhIK1RLM0NhVVpvZnQzZElVaW4rRVpRS1RnbXk5?= =?utf-8?B?TU9ZUWVQcHFMZlQrQUFncjl3ZVpXY1REOUhad0tENDNhMzVOeDJDU3ExTnN6?= =?utf-8?B?d0ExeFd5aGRxUURkMnZGOUIwR1huREZrUVI4NFc5MysydEI4QXN3d29yLzJJ?= =?utf-8?B?QTBzWlRBYlF2N1J1R1NYazRmRnZ0Z3FpRUhPYkV1UTFhaEVvWmk3amdKNkFT?= =?utf-8?B?cXF4N0V3Qi92Q2xuNDA1VEdXVEVLemRMWjBzcW1HTkV4cEtBTlB0MXh5cG1r?= =?utf-8?B?RDFZM3lRL0dtVXl4RnFUeDlSOXRtMEVuNzhnRE1nMmJCb2JTN2pkZzdoSk11?= =?utf-8?B?SEY2eFl1REF4b1J3MFZ3aEN4MW1sdjdOYUUvUDJRT2YzVEV4WkJsRWtDT2RV?= =?utf-8?B?dUdjeWFIR01sTGRId2FKcFBMR3VyYVJ2SVNRb3NPNEFvKzI3NCs0TnpFazVn?= =?utf-8?B?aVkvdUdTelhmZFNRWE05aW00NUFJQTk4OU9BVjBBVlVEazA4aUdqMDRaYmwz?= =?utf-8?Q?P3lw9PUhDNg6vd+Kvo1/S4lmWGvC7D8LoHMDDU2wJ/K6A?= X-MS-Exchange-AntiSpam-MessageData-1: cbRaelZGipORuA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a45b7d76-7e90-4a96-7bac-08df5136681b X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB6858.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 12:10:22.9498 (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: 6wZlv1ZKTavNyZScHh8dETj1ETie2EpvQCXU98tyWTwgBmFA48ckm63X5tc3n7xSRwliZVojrv++DWdApBpQmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8984 From: John Hubbard With the switch to the r000 GSP firmware, the GSP_INIT and GSP_SUSPEND GMC commands replaced the four RPC commands that the r570 boot and shutdown paths sent (SetSystemInfo, SetRegistry, GetGspStaticInfo and UnloadingGuestDriver), and the reply to GSP_INIT replaced the init-done event. Delete the unused r570 RPC commands module and its firmware payload wrappers. Signed-off-by: John Hubbard Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gsp/commands.rs | 2 - drivers/gpu/nova-core/gsp/commands/rpc.rs | 285 ------------------------------ drivers/gpu/nova-core/gsp/fw/commands.rs | 250 +------------------------- 3 files changed, 3 insertions(+), 534 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs index df920e3d8322..cf522a90eae4 100644 --- a/drivers/gpu/nova-core/gsp/commands.rs +++ b/drivers/gpu/nova-core/gsp/commands.rs @@ -2,8 +2,6 @@ // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. pub(crate) mod gmc; -#[expect(dead_code)] -pub(crate) mod rpc; use core::{ ffi::FromBytesUntilNulError, diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs deleted file mode 100644 index 084214d69f1f..000000000000 --- a/drivers/gpu/nova-core/gsp/commands/rpc.rs +++ /dev/null @@ -1,285 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - -use core::{ - array, - convert::Infallible, // -}; - -use kernel::{ - device, - pci, - prelude::*, - transmute::{ - AsBytes, - FromBytes, // - }, // -}; - -use crate::{ - gpu::Chipset, - gsp::{ - cmdq::{ - rpc::{ - CommandToGsp, - MessageFromGsp, // - }, - Cmdq, - NoReply, // - }, - commands::{ - GspStaticInfo, - PowerStateLevel, // - }, - fw::{ - self, - MsgFunction, // - }, - }, - sbuffer::SBufferIter, - vgpu::VgpuState, // -}; - -/// The `GspSetSystemInfo` command. -pub(crate) struct SetSystemInfo<'a> { - pdev: &'a pci::Device, - chipset: Chipset, - vgpu_state: VgpuState, -} - -impl<'a> SetSystemInfo<'a> { - /// Creates a new `GspSetSystemInfo` command using the parameters of `pdev`. - pub(crate) fn new( - pdev: &'a pci::Device, - chipset: Chipset, - vgpu_state: VgpuState, - ) -> Self { - Self { - pdev, - chipset, - vgpu_state, - } - } -} - -impl<'a> CommandToGsp for SetSystemInfo<'a> { - const FUNCTION: MsgFunction = MsgFunction::GspSetSystemInfo; - type Command = fw::commands::GspSetSystemInfo; - type Reply = NoReply; - type InitError = Error; - - fn init(&self) -> impl Init { - Self::Command::init(self.pdev, self.chipset, self.vgpu_state) - } -} - -struct RegistryEntry { - key: &'static str, - value: u32, -} - -/// The `SetRegistry` command. -pub(crate) struct SetRegistry { - entries: KVec, -} - -impl SetRegistry { - /// Creates a new `SetRegistry` command, using a set of hardcoded entries. - pub(crate) fn new(vgpu_state: VgpuState) -> Result { - let mut entries = KVec::new(); - - // RMSecBusResetEnable - enables PCI secondary bus reset - entries.push( - RegistryEntry { - key: "RMSecBusResetEnable", - value: 1, - }, - GFP_KERNEL, - )?; - - // RMForcePcieConfigSave - forces GSP-RM to preserve PCI configuration registers on - // any PCI reset. - entries.push( - RegistryEntry { - key: "RMForcePcieConfigSave", - value: 1, - }, - GFP_KERNEL, - )?; - - // RMDevidCheckIgnore - allows GSP-RM to boot even if the PCI dev ID is not found - // in the internal product name database. - entries.push( - RegistryEntry { - key: "RMDevidCheckIgnore", - value: 1, - }, - GFP_KERNEL, - )?; - - if matches!(vgpu_state, VgpuState::Enabled { .. }) { - // RMSetSriovMode - required when vGPU is enabled. - entries.push( - RegistryEntry { - key: "RMSetSriovMode", - value: 1, - }, - GFP_KERNEL, - )?; - } - - Ok(Self { entries }) - } -} - -impl CommandToGsp for SetRegistry { - const FUNCTION: MsgFunction = MsgFunction::SetRegistry; - type Command = fw::commands::PackedRegistryTable; - type Reply = NoReply; - type InitError = Infallible; - - fn init(&self) -> impl Init { - Self::Command::init(self.entries.len() as u32, self.size() as u32) - } - - fn variable_payload_len(&self) -> usize { - let mut key_size = 0; - for entry in self.entries.iter() { - key_size += entry.key.len() + 1; // +1 for NULL terminator - } - self.entries.len() * size_of::() + key_size - } - - fn init_variable_payload( - &self, - dst: &mut SBufferIter>, - ) -> Result { - let string_data_start_offset = size_of::() - + self.entries.len() * size_of::(); - - // Array for string data. - let mut string_data = KVec::new(); - - for entry in self.entries.iter() { - dst.write_all( - fw::commands::PackedRegistryEntry::new( - (string_data_start_offset + string_data.len()) as u32, - entry.value, - ) - .as_bytes(), - )?; - - let key_bytes = entry.key.as_bytes(); - string_data.extend_from_slice(key_bytes, GFP_KERNEL)?; - string_data.push(0, GFP_KERNEL)?; - } - - dst.write_all(string_data.as_slice()) - } -} - -/// Message type for GSP initialization done notification. -struct GspInitDone; - -// SAFETY: `GspInitDone` is a zero-sized type with no bytes, therefore it -// trivially has no uninitialized bytes. -unsafe impl FromBytes for GspInitDone {} - -impl MessageFromGsp for GspInitDone { - const FUNCTION: MsgFunction = MsgFunction::GspInitDone; - type InitError = Infallible; - type Message = (); - - fn read( - _msg: &Self::Message, - _sbuffer: &mut SBufferIter>, - ) -> Result { - Ok(GspInitDone) - } -} - -/// Waits for GSP initialization to complete. -pub(crate) fn wait_gsp_init_done(cmdq: &Cmdq<'_>) -> Result { - cmdq.await_rpc_msg::().map(|_| ()) -} - -/// The `GetGspStaticInfo` command. -pub(crate) struct GetGspStaticInfo; - -impl CommandToGsp for GetGspStaticInfo { - const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo; - type Command = fw::commands::GspStaticConfigInfo; - type Reply = GspStaticInfo; - type InitError = Infallible; - - fn init(&self) -> impl Init { - Self::Command::init_zeroed() - } -} - -impl MessageFromGsp for GspStaticInfo { - const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo; - type Message = fw::commands::GspStaticConfigInfo; - type InitError = Error; - - fn read( - msg: &Self::Message, - _sbuffer: &mut SBufferIter>, - ) -> Result { - let mut usable_fb_regions = KVec::new(); - for region in msg.usable_fb_regions() { - usable_fb_regions.push(region, GFP_KERNEL)?; - } - let total_fb_end = msg.total_fb_end().ok_or(EINVAL)?; - - Ok(GspStaticInfo { - gpu_name: msg.gpu_name_str(), - gpu_short_name: msg.gpu_short_name_str(), - gpu_gid: msg.gpu_gid(), - bar1_pde_base: msg.bar1_pde_base(), - usable_fb_regions, - total_fb_end, - }) - } -} - -/// The `UnloadingGuestDriver` command, used to shut down the GSP. -/// -/// Only used within the `gsp` module. -pub(crate) struct UnloadingGuestDriver { - level: PowerStateLevel, -} - -impl UnloadingGuestDriver { - /// Creates a new `UnloadingGuestDriver` command for the given [`PowerStateLevel`]. - pub(crate) fn new(level: PowerStateLevel) -> Self { - Self { level } - } -} - -impl CommandToGsp for UnloadingGuestDriver { - const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver; - type Command = fw::commands::UnloadingGuestDriver; - type Reply = UnloadingGuestDriverReply; - type InitError = Infallible; - - fn init(&self) -> impl Init { - fw::commands::UnloadingGuestDriver::new(self.level) - } -} - -/// The reply from the GSP to the [`UnloadingGuestDriver`] command. -pub(crate) struct UnloadingGuestDriverReply; - -impl MessageFromGsp for UnloadingGuestDriverReply { - const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver; - type InitError = Infallible; - type Message = (); - - fn read( - _msg: &Self::Message, - _sbuffer: &mut SBufferIter>, - ) -> Result { - Ok(UnloadingGuestDriverReply) - } -} diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs index f83a04bc0816..f72b4c94efe6 100644 --- a/drivers/gpu/nova-core/gsp/fw/commands.rs +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs @@ -11,11 +11,7 @@ bitfield, device, pci, - prelude::*, - transmute::{ - AsBytes, - FromBytes, // - }, // + prelude::*, // }; use crate::{ @@ -32,230 +28,13 @@ Required, TruncatingArray, // }, - GSP_PAGE_SIZE, // }, - num::IntoSafeCast, vgpu::VgpuState, // }; -use super::r570_144 as bindings; +use super::bindings; -/// Payload of the `GspSetSystemInfo` command. -#[repr(transparent)] -pub(crate) struct GspSetSystemInfo { - inner: bindings::GspSystemInfo, -} -static_assert!(size_of::() < GSP_PAGE_SIZE); - -impl GspSetSystemInfo { - /// Builds the VF topology passed to GSP-RM as part of the system information. - fn build_vf_info( - dev: &pci::Device, - vgpu_state: VgpuState, - ) -> Result { - let VgpuState::Enabled { total_vfs } = vgpu_state else { - return Ok(Zeroable::zeroed()); - }; - - let sriov = dev - .config_space_extended()? - .find_ext_capability::()? - .ok_or(ENODEV)?; - - let mut vf_bars = sriov.vf_bars()?; - let bar0 = vf_bars.next().ok_or(EINVAL)?; - let bar1 = vf_bars.next().ok_or(EINVAL)?; - let bar2 = vf_bars.next().ok_or(EINVAL)?; - - Ok(bindings::GSP_VF_INFO { - totalVFs: u32::from(total_vfs.get()), - firstVFOffset: u32::from(sriov.first_vf_offset()), - FirstVFBar0Address: bar0.address, - FirstVFBar1Address: bar1.address, - FirstVFBar2Address: bar2.address, - b64bitBar0: u8::from(bar0.is_64bit), - b64bitBar1: u8::from(bar1.is_64bit), - b64bitBar2: u8::from(bar2.is_64bit), - ..Zeroable::zeroed() - }) - } - - /// Returns an in-place initializer for the `GspSetSystemInfo` command. - pub(crate) fn init<'a>( - dev: &'a pci::Device, - chipset: Chipset, - vgpu_state: VgpuState, - ) -> impl Init + 'a { - type InnerGspSystemInfo = bindings::GspSystemInfo; - let pci_config_mirror_range = chipset.pci_config_mirror_range(); - let init_inner = try_init!(InnerGspSystemInfo { - gpuPhysAddr: dev.resource_start(0)?, - gpuPhysFbAddr: dev.resource_start(1)?, - gpuPhysInstAddr: dev.resource_start(3)?, - nvDomainBusDeviceFunc: u64::from(DomainBusDevice::new(dev)), - - // Using TASK_SIZE in r535_gsp_rpc_set_system_info() seems wrong because - // TASK_SIZE is per-task. That's probably a design issue in GSP-RM though. - maxUserVa: (1 << 47) - 4096, - pciConfigMirrorBase: pci_config_mirror_range.start, - pciConfigMirrorSize: pci_config_mirror_range.end - pci_config_mirror_range.start, - - PCIDeviceID: (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw()), - PCISubDeviceID: (u32::from(dev.subsystem_device_id()) << 16) - | u32::from(dev.subsystem_vendor_id()), - PCIRevisionID: u32::from(dev.revision_id()), - bIsPrimary: 0, - bPreserveVideoMemoryAllocations: 0, - gspVFInfo: Self::build_vf_info(dev, vgpu_state)?, - ..Zeroable::init_zeroed() - }); - - try_init!(GspSetSystemInfo { - inner <- init_inner, - }) - } -} - -// SAFETY: These structs don't meet the no-padding requirements of AsBytes but -// that is not a problem because they are not used outside the kernel. -unsafe impl AsBytes for GspSetSystemInfo {} - -// SAFETY: These structs don't meet the no-padding requirements of FromBytes but -// that is not a problem because they are not used outside the kernel. -unsafe impl FromBytes for GspSetSystemInfo {} - -#[repr(transparent)] -pub(crate) struct PackedRegistryEntry(bindings::PACKED_REGISTRY_ENTRY); - -impl PackedRegistryEntry { - pub(crate) fn new(offset: u32, value: u32) -> Self { - Self({ - bindings::PACKED_REGISTRY_ENTRY { - nameOffset: offset, - - // We only support DWORD types for now. Support for other types - // will come later if required. - type_: cv!(bindings::REGISTRY_TABLE_ENTRY_TYPE_DWORD), - __bindgen_padding_0: Default::default(), - data: value, - length: 0, - } - }) - } -} - -// SAFETY: Padding is explicit and will not contain uninitialized data. -unsafe impl AsBytes for PackedRegistryEntry {} - -/// Payload of the `SetRegistry` command. -#[repr(transparent)] -pub(crate) struct PackedRegistryTable { - inner: bindings::PACKED_REGISTRY_TABLE, -} - -impl PackedRegistryTable { - pub(crate) fn init(num_entries: u32, size: u32) -> impl Init { - type InnerPackedRegistryTable = bindings::PACKED_REGISTRY_TABLE; - let init_inner = init!(InnerPackedRegistryTable { - numEntries: num_entries, - size, - entries: Default::default() - }); - - init!(PackedRegistryTable { inner <- init_inner }) - } -} - -// SAFETY: Padding is explicit and will not contain uninitialized data. -unsafe impl AsBytes for PackedRegistryTable {} - -// SAFETY: This struct only contains integer types for which all bit patterns -// are valid. -unsafe impl FromBytes for PackedRegistryTable {} - -/// Payload of the `GetGspStaticInfo` command and message. -#[repr(transparent)] -#[derive(Zeroable)] -pub(crate) struct GspStaticConfigInfo(bindings::GspStaticConfigInfo_t); - -impl GspStaticConfigInfo { - /// Returns a bytes array containing the (hopefully) zero-terminated name of this GPU. - pub(crate) fn gpu_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] { - self.0.gpuNameString - } - - /// Returns a bytes array containing the (hopefully) zero-terminated short name of this GPU. - pub(crate) fn gpu_short_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] { - self.0.gpuShortNameString - } - - /// Returns the 16-byte SHA-1 GPU identifier supplied by GSP-RM. - /// - /// GSP-RM reports the GID in binary SHA-1 form, which occupies the first 16 bytes of the - /// GID info payload. - pub(crate) fn gpu_gid(&self) -> [u8; GspStaticInfo::GID_LEN] { - let mut gid = [0u8; GspStaticInfo::GID_LEN]; - gid.copy_from_slice(&self.0.gidInfo.data[..GspStaticInfo::GID_LEN]); - gid - } - - /// Returns the BAR1 Page Directory Entry base address. - /// - /// This is the root page table address for BAR1 virtual memory, - /// set up by GSP-RM firmware. - pub(crate) fn bar1_pde_base(&self) -> u64 { - self.0.bar1PdeBase - } - - /// Returns an iterator over valid FB regions from GSP firmware data. - fn fb_regions( - &self, - ) -> impl Iterator { - let fb_info = &self.0.fbRegionInfoParams; - fb_info - .fbRegion - .iter() - .take(fb_info.numFBRegions.into_safe_cast()) - .filter(|reg| reg.limit >= reg.base) - } - - /// Iterates over usable FB regions from GSP firmware data. - /// - /// Each yielded region is a [`Range`] suitable for driver memory allocation. - /// Usable regions are those that satisfy all the following properties: - /// - Are not reserved for firmware internal use. - /// - Are not protected (hardware-enforced access restrictions). - /// - Support compression (can use GPU memory compression for bandwidth). - /// - Support ISO (isochronous memory for display requiring guaranteed bandwidth). - pub(crate) fn usable_fb_regions(&self) -> impl Iterator> + '_ { - self.fb_regions().filter_map(|reg| { - // Filter: not reserved, not protected, supports compression and ISO. - if reg.reserved == 0 - && reg.bProtected == 0 - && reg.supportCompressed != 0 - && reg.supportISO != 0 - { - reg.limit.checked_add(1).map(|end| reg.base..end) - } else { - None - } - }) - } - - /// Computes the exclusive end of the FB physical address space. - pub(crate) fn total_fb_end(&self) -> Option { - self.fb_regions().map(|reg| reg.limit).max()?.checked_add(1) - } -} - -// SAFETY: Padding is explicit and will not contain uninitialized data. -unsafe impl AsBytes for GspStaticConfigInfo {} - -// SAFETY: This struct only contains integer types for which all bit patterns -// are valid. -unsafe impl FromBytes for GspStaticConfigInfo {} - -/// Power level requested to the [`UnloadingGuestDriver`] command. +/// Power level that a `GSP_SUSPEND` request names. #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u32)] #[expect(unused)] @@ -295,29 +74,6 @@ fn from(level: PowerStateLevel) -> Self { } } -/// Payload of the `UnloadingGuestDriver` command and message. -#[repr(transparent)] -#[derive(Clone, Copy, Debug, Zeroable)] -pub(crate) struct UnloadingGuestDriver(bindings::rpc_unloading_guest_driver_v1F_07); - -impl UnloadingGuestDriver { - pub(crate) fn new(level: PowerStateLevel) -> Self { - Self(bindings::rpc_unloading_guest_driver_v1F_07 { - bInPMTransition: u8::from(level.is_power_transition()), - bGc6Entering: 0, - newLevel: level as u32, - ..Zeroable::zeroed() - }) - } -} - -// SAFETY: Padding is explicit and will not contain uninitialized data. -unsafe impl AsBytes for UnloadingGuestDriver {} - -// SAFETY: This struct only contains integer types for which all bit patterns -// are valid. -unsafe impl FromBytes for UnloadingGuestDriver {} - /// The host CPU architecture. #[derive(Clone, Copy)] enum HostArch { -- 2.56.1