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.7 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796369070; b=k4TpgjKGZI2xGyqFrP1QJ4bvi9Cavo+ZBuuc1v9TK/7uZmC5Fd6JPZeBuNjrfJnwffyB ScVFiVq3hd6Q9FffeNubmu/UKqXIaWdx/CZsKdo1DGFGwRopf70QRQFgJUCdbRBm6TieC YNuFNx4LNu+RsmLHHfZZjfyKry9JbV7AUkxMVR6vLsjrUulsLet0n4rsBVt4oWFMXQ7xk NGigKqgHYstNxsdTJp26kSYK6keXgPETQja13K7HiDSiP1ABE1MGI65wSJWjQ9vxQ0B7B UuorSZsLsO/yB5P/NR1fCkD1IIgAHl/KaFTPmbO/fiVFNw7hwcVYOg3BSBRxGm3hA4w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796369070; h=DMARC-Filter:DKIM-Signature:Received:Received: Content-Transfer-Encoding:Content-Type:Date:Message-Id:Cc:Subject: From:To:X-Mailer:References:In-Reply-To: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=oIxZRuYmPuON0G57aaQqT07Qi2AEehvAxoMKoJEyCAQ=; b=wG/rDq0yVAMI+E82qK5xHGJ4JKVrGTxx71A1Nqoq9iMrdkFdou7rdjRg0bKCcWS4160K FJVh9nz5inmFVGh955T0ZpDqKdRGBOeRV8pXU1pFKBBbs/96djJYALf1NuyfuqDToenWO 9MFfrQQXJvS0mUX38HcGhET3mkzAn+ao1rAaAy10Spjy8mcL4c2Lo+Y1dzRDWGORJaM90 /1LMCo4oyyGAhCK6UIfplmEo4KFag+iCZrtybos94XafjlPuUHRA4WupCHzzgOyesO1f1 FqZIfQzLBQbmT0FJGszGWFzDRHAeaXYvj74DA19fG/WH2diMdOPx8F5bo0E/ienopHg== 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=ADpzqAO+; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.56.7 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010007.outbound.protection.outlook.com [52.101.56.7]) (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 8A266606A322; Fri, 4 Dec 2026 07:24:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A266606A322 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=ADpzqAO+ ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U9UfBETpNKJZbJ1WAcAk+DrX8o9zr4PXXfjmiGD60w+b5pmm9DAPFV5KfaTZCFYYM7NxlKYyG5wdUJ12SSjR7uIgMJlbkK99kebvpx7cvIJQMUtkUAeg9q2yXu3Orw2IrbWj3dADi9u1uWwoSugK9OiadB1+sX6w7/BK8wOD1+0HOQIfaCqdxarNc+suEwuvk2/L//0l+jhP86lE7EcKftSpdoLRJYjEWBi/AkbZYe/MNXVbt3D2rEOg8pUMcbK7c1fxqIKN7tYqNew6Zzp6QryewMpELzB4U5l0dKWQE43tH1rGD+rquPVNgAYbqe4r71N55Oh4g5787OaVYYSdXA== 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=oIxZRuYmPuON0G57aaQqT07Qi2AEehvAxoMKoJEyCAQ=; b=j9dClgZ/GE4o3d5ZCZKWZdwh2cnL1BAXuFmeC4ao97eaHtjC0BQnQ5ccFmmInFUWfLZLKTQRYQXLzOi81st2ngdtkjKvcUHrw6ecFYhmnLbKSS9iESNSriaBC4KiPQCC2Nbf2SlF9iX6xC16X7d0JaGnqqZYb1B5OcPHa0eV1EsnHc9I8k6+SgYCeBRsldsO8yo641HET5DtqFFFrKM4Eb0RRGteBM7XK3h7d8whLZW2GfpcnOHR7+OUFI4qBgVjoUvoa8y3u9GpE+y9ZlYM1J0g8XjDZ8SfIff9Prvn35x+DjvrRphALaUTZY1tj7nStamROfRb9npQf8jfXCdN6Q== 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=oIxZRuYmPuON0G57aaQqT07Qi2AEehvAxoMKoJEyCAQ=; b=ADpzqAO+vUh1qTcCItJOWuhhTvqbZCoYBPOOYQC+woEFH2AUUb7/lcF62gCy9OIxD0NYvONkeebS1+F/vjRHJKq8sJvZDRDTDXfpS2uXZDZtrq1uKvVax8wG0DH4muF01xNmIxrXERumsQwFS/glUyxErQW6kuSKPEjaYWIhoST5gjjnvRJCcB+6/c5lz8+FdLP0nFCkeRUX3WyjnTSPHYlldf02kONs5JrciFZfteNJmEveI0NXxaM7K+1SvMzPSxMSFjEMetX+j6eMSxYB+/qIPCTBPN3SP0WQ3erpeM1Ht9edviUTN5NPftY5PklF1LD5IZrCwHzixWZ3jvQ9hw== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB6413.namprd12.prod.outlook.com (2603:10b6:8:ce::10) by CH3PR12MB9026.namprd12.prod.outlook.com (2603:10b6:610:125::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Fri, 4 Dec 2026 07:24:19 +0000 Received: from DS0PR12MB6413.namprd12.prod.outlook.com ([fe80::e82a:6673:4142:37fa]) by DS0PR12MB6413.namprd12.prod.outlook.com ([fe80::e82a:6673:4142:37fa%5]) with mapi id 15.21.0688.011; Fri, 4 Dec 2026 07:24:17 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 04 Dec 2026 16:24:13 +0900 Message-Id: Cc: "John Hubbard" , "Alistair Popple" , "Timur Tabi" , "Eliot Courtney" , "Zhi Wang" , "Alok Kumar" , , , , , , "dri-devel" Subject: Re: [PATCH 02/15] gpu: nova-core: gsp: add the GSP_INIT command and its reply From: "Eliot Courtney" To: "Alexandre Courbot" , "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" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261203-b4-r000-switch-v1-0-b1463ec6dae2@nvidia.com> <20261203-b4-r000-switch-v1-2-b1463ec6dae2@nvidia.com> In-Reply-To: <20261203-b4-r000-switch-v1-2-b1463ec6dae2@nvidia.com> X-ClientProxiedBy: TYCPR01CA0150.jpnprd01.prod.outlook.com (2603:1096:400:2b7::19) To DS0PR12MB6413.namprd12.prod.outlook.com (2603:10b6:8:ce::10) 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: DS0PR12MB6413:EE_|CH3PR12MB9026:EE_ X-MS-Office365-Filtering-Correlation-Id: 05146410-b832-44f4-17f9-08df51d79b0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|10070799003|23010399003|366016|921020|56012099006|10067099003|261021123027099003|261022105027099003|261009223027099003|261021121427099003|261022075727099003|261022113327099003|261026140227099003|261028144727099003|261102123227099003|261026121527099003|18002099003|22082099003|4143699003|6133799003|11063799006|3023799007; X-Microsoft-Antispam-Message-Info: WhUCk/j+w/0cEI0DPT2WP/yFNQSMrkl9bTqBvCg+hpc32eBtND6tUUz14s1eamxrj3+JUowDZb5ZZ+/l2KleczUi2pJyI9jPx3uDfIOmcKaZ8J7gKYWDosh8zz4Mg4RK/zz8zsNwmWpxmQBNxhB4D2JHnXQQZBC5RNNPOHfMHZPfX0tPtg5z2I2rQ3vG7pHGJG6k3fJNDdzTjZjOHUN4xu2hPB5yHCxK+Z5yEwPR3RyNtUmOQSu0SsU//u3SbHTwdwPlR4efTWbfnDL2f1e84ofkTMvq1H2csXVNkzJi6+b1B+RZoS/9cdH/itmhaHtd5I32b3rvo+8PGylRq9ECv9H+77Ty8nZnYPea+20BePWUNYMC95K++2dRzfNZjs9v9dQA4QoXavyasBYuVInAUw5sh3GbqbxD7iPiE4MLPmpa6cFIjwch5zBZliaR866pR1e/gr74NpbRoJpqJr6h8MnXpn93IgtQJ3S9IA6GwRrIAPulFDhw3W0MM7KF3ZyB/O+FSA6Kt88tmJ90DCLE9pNylk4ROPU4ZXVHxJQv5ymReY/vnfEJYneGtut1KVjK/kdCB9THULrKHNbjK9aQknvcZQI5f6AWpb56f6cxN/+ujTAKdPJHCzvpOk6ghzdA/rFbNYk4kix+ULR3IUzn1aaK0Zo+WSKx5q6yAtOUuVnmQbuslZ/jPrZvpqLY7zNqERA3O6C9YYdDHCkdeYzXDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6413.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(10070799003)(23010399003)(366016)(921020)(56012099006)(10067099003)(261021123027099003)(261022105027099003)(261009223027099003)(261021121427099003)(261022075727099003)(261022113327099003)(261026140227099003)(261028144727099003)(261102123227099003)(261026121527099003)(18002099003)(22082099003)(4143699003)(6133799003)(11063799006)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NVRBMytkS0lxUUVvbEhuN0lhV0JYYkd2bG9tTFVLdVpPY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NC9lSk1SOVNSWHY3dTdPK3IzWkk3K29DVENBQkNJZmtKdVptZm5ZWllR?= =?utf-8?B?bWRYZDU1Z0VnMDE5dUQ5bEdUeTdwczlReS81aldYUzZvTm1EbDZBTDBMaVl6?= =?utf-8?B?YjlpWGppUU5WMnkzN3NzdWoydHRkVTluTU9mWGhqc2k4cndPSmI0Tkl3UTFq?= =?utf-8?B?cXFZNTRPM3F4dEpLV3g4N2djL09qYlFUVEtzeTNXS0ViaENlVWFTY2FSZXRQ?= =?utf-8?B?OXVnaWdsTDhJK0F6WWVCMS94QkJYMFpsQmpUakkzelBXVGlKUk1wSGtZV3Q4?= =?utf-8?B?L2NYSU9UTTdFakdSRGJ2YThnekRWV3R6NGxpb1JDQVZNUWdWanAxTUkvYk9Q?= =?utf-8?B?cmdZTjNmQmJIaFpyT3F1QlFYZVAxMmNBZDNBRld4Q0VkM3IrODU4RDJpQzh4?= =?utf-8?B?SSt4bktNNXZlWUtTYXBlZ014MGVtclpTR1BaLzhIMjlVdWM0SlhNb3pNVVh4?= =?utf-8?B?dE0yaUpkd2xKem1pM3d6djdWZkYvSHp5U1Z1VHM3UFZqd1E4c0cyQWRyV0pD?= =?utf-8?Q?Q8uMOsijJsNA5+bOI7J+CY/2nK1e3dVFWuQA9ETQcD5Wy?= X-MS-Exchange-AntiSpam-MessageData-1: PDxpT9+WSDkACQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05146410-b832-44f4-17f9-08df51d79b0d X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6413.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 07:24:17.3967 (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: CZQV9M7S+NJf1vvsdekllV8Jm/mOsl+O9eDJrdAdgtManJ9U2P9NZAekwbpj8trgK0wo6oyh4hNVHoif5pbgRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9026 On Thu Dec 3, 2026 at 9:09 PM JST, Alexandre Courbot wrote: > From: John Hubbard > > The r000 boot protocol replaces the system-info, registry and > static-info RPC commands with one GMC command, GSP_INIT, whose payload > is an NVKV stream of key-value pairs. GSP-RM answers it once it has > finished starting, with the static GPU configuration. > > Nova-core has the NVKV codec and the GSP_INIT schemas. It has no code > that fills the request schema in from the PCI device, and no code that > decodes the reply into the static configuration type that the boot > sequence returns. > > Add the GSP_INIT command, whose variable payload is the encoded request, > and decode its reply into the static configuration type, so that the > rest of the driver reads the same configuration whichever firmware > reported it. > > The request carries the registry keys that the r570 registry command > sends, and it reports the architecture that the kernel is built for. > > Signed-off-by: John Hubbard > [acourbot: declare `REGISTRY_ENTRIES` as const `Key`s.] > [acourbot: avoid double-copy in `read`.] > [acourbot: use `CStr` in `RegKey::new`.] > [acourbot: return fixed-size arrays from `GspInitResponse`.] > Co-developed-by: Alexandre Courbot > Signed-off-by: Alexandre Courbot > --- > drivers/gpu/nova-core/gsp/commands.rs | 3 + > drivers/gpu/nova-core/gsp/commands/gmc.rs | 133 ++++++++++++++++++++++++= + > drivers/gpu/nova-core/gsp/fw/commands.rs | 155 ++++++++++++++++++++++++= +++--- > 3 files changed, 279 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-cor= e/gsp/commands.rs > index 91f63f704e55..b48cf30978cf 100644 > --- a/drivers/gpu/nova-core/gsp/commands.rs > +++ b/drivers/gpu/nova-core/gsp/commands.rs > @@ -1,6 +1,9 @@ > // SPDX-License-Identifier: GPL-2.0 > // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & = AFFILIATES. All rights reserved. > =20 > +// The r570 firmware does not use GMC. > +#[expect(dead_code)] > +pub(crate) mod gmc; > pub(crate) mod rpc; > =20 > use core::{ > diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova= -core/gsp/commands/gmc.rs > new file mode 100644 > index 000000000000..f74ada78f7ac > --- /dev/null > +++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs > @@ -0,0 +1,133 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFIL= IATES. All rights reserved. > + > +//! GMC (GPU Management Controller) API commands. > + > +use core::convert::Infallible; > + > +use kernel::{ > + device, > + pci, > + prelude::*, > + time::Delta, > + transmute::AsBytes, // > +}; > + > +use crate::{ > + gpu::Chipset, > + gsp::{ > + cmdq::gmc::{ > + CommandToGsp, > + MessageFromGsp, // > + }, > + commands::GspStaticInfo, > + fw::{ > + commands::{ > + GspInitRequest, > + GspInitResponseSchema, // > + }, > + GmcCommandId, // > + }, > + nvkv::{ > + Decoder, > + Encodable, > + Encoder, > + Schema, > + UnknownKeyPolicy, // > + }, > + }, > + sbuffer::SBufferIter, > +}; > + > +/// The `GSP_INIT` command, which carries the system information and reg= istry keys to GSP-RM. > +/// > +/// GSP-RM answers it with the static GPU configuration once it has fini= shed starting. > +pub(crate) struct GspInit { > + /// The NVKV-encoded request. > + payload: KVVec, > +} > + > +impl GspInit { > + /// Builds the request for `pdev`. > + /// > + /// # Errors > + /// > + /// - `ENOMEM` if the request or the encoder buffer cannot be alloca= ted. > + pub(crate) fn new(pdev: &pci::Device, chipset: Chipse= t) -> Result { > + let mut encoder =3D Encoder::new(); > + GspInitRequest::new(pdev, chipset)?.encode(&mut encoder)?; > + > + Ok(Self { > + payload: encoder.finish(), > + }) > + } > + > + /// Returns the request as the bytes that the GSP reads. > + fn payload_bytes(&self) -> &[u8] { > + AsBytes::as_bytes(self.payload.as_slice()) Can we use zerocopy intobytes stuff here instead? > + } > +} > + > +impl CommandToGsp for GspInit { > + const COMMAND: GmcCommandId =3D GmcCommandId::GspInit; > + /// Largest reply that the driver accepts, in bytes. > + const MAX_REPLY_SIZE: u32 =3D 48 * 1024; I know this is what OpenRM uses, but for stability purposes it might be safer to use a larger value. I guess the largest value we can use would be `GSP_MSG_QUEUE_ELEMENT_SIZE_MAX - size_of::() - size_of= ::()` Perhaps as a new constant (GMC_MAX_PAYLOAD_SIZE, for example). > + /// `GspInit` can take longer than 5 seconds to complete on some SKU= s. > + const COMPLETION_TIMEOUT: Delta =3D Delta::from_secs(15); > + type Command =3D (); > + type Reply =3D GspStaticInfo; > + type InitError =3D Infallible; > + > + fn init(&self) -> impl Init { > + pin_init::init_zeroed() > + } > + > + fn variable_payload_len(&self) -> usize { > + self.payload_bytes().len() > + } > + > + fn init_variable_payload( > + &self, > + dst: &mut SBufferIter>, > + ) -> Result { > + dst.write_all(self.payload_bytes()) > + } > +} > + > +impl MessageFromGsp for GspStaticInfo { > + type InitError =3D Error; > + > + /// Decodes the `GSP_INIT` reply, an NVKV stream, into the static co= nfiguration. > + /// > + /// # Errors > + /// > + /// - `EINVAL` if the payload is not a whole number of NVKV words, i= f the stream is malformed > + /// or omits a required key, or if GSP-RM reported no framebuffer = region. > + /// - `ENOMEM` if the words or the decoded regions cannot be allocat= ed. > + fn read(payload: &mut SBufferIter>) = -> Result { > + let mut words =3D KVVec::new(); > + while !payload.is_empty() { > + let mut word =3D [0u8; size_of::()]; > + payload.read_exact(&mut word)?; > + words.push(u64::from_le_bytes(word), GFP_KERNEL)?; > + } This code will probably get repeated, so some options could be adding a try_into_u64_vec function SBufferIter (ala flush_into_kvec), or exposing a len() method so we can read_exact into a preallocated KVVec. Unfortunately we can't easily let the decoder run directly on SBufferIter, because DecoderValue takes direct references to NVKV arrays, so it requires the memory to be contiguous. OTOH it may be better for us to quickly copy out of the command queue and return the lock anyway. So I think that is compatible with the direction of adding a kvvec readout to SBufferIter. WDYT? > + > + let decoder =3D Decoder::new(&words, UnknownKeyPolicy::Ignore); > + let mut schema =3D KBox::init(GspInitResponseSchema::init(), GFP= _KERNEL)?; > + let reply =3D KBox::try_init(decoder.decode(&mut *schema)?, GFP_= KERNEL)?; > + > + let mut usable_fb_regions =3D KVec::new(); > + for region in reply.usable_fb_regions() { > + usable_fb_regions.push(region, GFP_KERNEL)?; > + } > + > + Ok(GspStaticInfo { > + gpu_name: reply.gpu_name(), > + gpu_short_name: reply.gpu_short_name(), > + gpu_gid: reply.gpu_gid(), > + bar1_pde_base: reply.bar1_pde_base(), > + usable_fb_regions, > + total_fb_end: reply.total_fb_end().ok_or(EINVAL)?, > + }) > + } > +} > diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-= core/gsp/fw/commands.rs > index 76f8d4a75562..c7f544775ce9 100644 > --- a/drivers/gpu/nova-core/gsp/fw/commands.rs > +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs > @@ -331,6 +331,25 @@ fn from(value: HostArch) -> Self { > } > } > =20 > +impl HostArch { > + /// Returns the variant that names the architecture for which this k= ernel is built. > + fn host() -> Self { > + if cfg!(target_arch =3D "x86_64") { > + Self::X86_64 > + } else if cfg!(target_arch =3D "aarch64") { > + Self::Aarch64 > + } else if cfg!(all(target_arch =3D "powerpc64", target_endian = =3D "little")) { > + Self::Ppc64le > + } else if cfg!(target_arch =3D "arm") { > + Self::Arm > + } else if cfg!(target_arch =3D "riscv64") { > + Self::Riscv64 > + } else { > + Self::None > + } > + } > +} > + > nvkv_encode! { > /// A GSP registry entry. > struct RegKey { > @@ -339,6 +358,18 @@ struct RegKey { > } > } > =20 > +impl RegKey { > + /// Creates a registry entry. > + /// > + /// GSP-RM counts the NUL terminator in the encoded name length. > + const fn new(key_name: &'static CStr, key_value: u32) -> Self { > + Self { > + key_name: Key::new(key_name.to_bytes_with_nul()), > + key_value: Key::new(key_value), > + } > + } > +} > + > impl Encodable for KVVec { > fn encode(&self, encoder: &mut Encoder) -> Result { > for regkey in self { > @@ -362,10 +393,7 @@ struct VfInfo { > =20 > nvkv_encode! { > /// Payload of the `GSP_INIT` command. > - // TODO: expect() doesn't work here before rustc 1.97.0 > - // https://github.com/rust-lang/rust/pull/154377 > - #[allow(dead_code)] > - struct GspInitRequest { Unfortunately this still causes errors on some versions of rustc. I have sent a prereq patch that should fix this [1]. [1]: https://lore.kernel.org/all/20261204-nvkv-build-fix-v1-1-72b42a776511@= nvidia.com/ > + pub(crate) struct GspInitRequest { > pci_device_id: Key, > pci_sub_device_id: Key, > pci_revision_id: Key, I noticed that openrm additionally sends HOST_OS_TYPE, HOST_PAGE_SIZE, SYS_TIMER_OFFSET_NS; and DEFAULT_TIMEOUT_US_{VGPU,GRAPHICS_MODE,COMPUTE_MODE} in r620. We even have, in timer.rs, a comment saying that it should be passed to GspInit. Should we be passing these values too? I see that Alok has sent one adding the default timeouts [2]. We also appear to have dropped sending these which were sent in r570: NVGMC_SI_GPU_PHYS_ADDR NVGMC_SI_GPU_PHYS_FB_ADDR NVGMC_SI_GPU_PHYS_INST_ADDR NVGMC_SI_MAX_USER_VA [2]: https://lore.kernel.org/all/20261117061053.915254-1-alkumar@nvidia.com= / > @@ -406,15 +434,55 @@ fn new(dev: &pci::Device) -> Self { > } > } > =20 > +/// Registry entries that the driver sends to GSP-RM on every boot. > +const REGISTRY_ENTRIES: [RegKey; 3] =3D [ > + // Enables PCI secondary bus reset. > + RegKey::new(c"RMSecBusResetEnable", 1), > + // Makes GSP-RM preserve PCI configuration registers across any PCI = reset. > + RegKey::new(c"RMForcePcieConfigSave", 1), > + // Lets GSP-RM boot when the PCI device id is absent from its produc= t name database. > + RegKey::new(c"RMDevidCheckIgnore", 1), > +]; > + > +impl GspInitRequest { > + /// Creates the request for `dev`. > + /// > + /// The registry keys are [`REGISTRY_ENTRIES`]. > + /// > + /// # Errors > + /// > + /// - `ENOMEM` if the registry list cannot be allocated. > + pub(crate) fn new(dev: &pci::Device, chipset: Chipset= ) -> Result { > + let mut regkeys =3D KVVec::new(); > + for entry in REGISTRY_ENTRIES { > + regkeys.push(entry, GFP_KERNEL)?; > + } > + > + let mirror =3D chipset.pci_config_mirror_range(); openrm sends (0, 0) for this for gb100,102. It's not an error in this patch but let me send a follow up to fix this. > + let device_id =3D (u32::from(dev.device_id()) << 16) | u32::from= (dev.vendor_id().as_raw()); > + let sub_device_id =3D > + (u32::from(dev.subsystem_device_id()) << 16) | u32::from(dev= .subsystem_vendor_id()); optional nit: We could define a new bitfield (could be used for both of these) instead of manually bitpacking. WDYT?