From nobody Mon Apr 6 21:09:52 2026 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012002.outbound.protection.outlook.com [52.101.53.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 822FB33B97A; Wed, 18 Mar 2026 04:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.2 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773806873; cv=fail; b=hcXEjD9gxnD+51SYCs/MBp+l1KX+Qyr3qNH1dMEoVuenc9Gc6gfG5wHxYG1jomzzirDUe8WohcAMkJqnWdQN6DXoaByzlFGrijV8GY5UI8d23ZjfRlOh3k8BsbrcfU+b3djNWQZXEN8GZh/xAXA9H5GpyVnSblaE7eLtWnQtYOQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773806873; c=relaxed/simple; bh=c1nsz+dc0V54j9I4OQzNCq6jz6gw3xIBEjjgLfBULtY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pKneBau3rOGW6hCGIrj1Met3NtUZ8kTpQrUjbJ0PGSbO0PWmrti/dG6ETrKl1ewu7VCs2GSj5h5JFeqPc2y5FXw7fbumOG93OwSEk6PmTQBJlAxPr6YS39E4MkgY2RK9IcNq4J7qK/Ne3qh47yXsKydrkvKk7kzb9sRG7R3X+RM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=gmBlqTO2; arc=fail smtp.client-ip=52.101.53.2 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) header.d=Nvidia.com header.i=@Nvidia.com header.b="gmBlqTO2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w3Rovn9ltXkc/qEKg3nDrX6CeYnO+vn0kviBTIsnSi7CC4jKLb1va+jHfeKnRUSiRannocwtFD8WdxxI+uaTExNYEoHFPVtAXa3y/2AzzeEw87zXbk4F0s9kDcuxwEDe93PIwArMwDvQeGgF1OUUmvzv80eyHOZtB8CnBhsbdvJ9Wl3PNyEq1HcNOupBpYojg8SrKoFkKS/sylKisTxRvvOrhKev33xRa4yxITVkbw4r8isRiyNLRO0ygIvIusXe/jROVPNvRX36e8i5J+BvJjxnEW5nuoa5RRB0+GuZtRB2F1OkxqTO0bU0wRaMFlXzFpjrzZsVQEZlqxijJb1l3w== 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=sWzBDG/QxRbwJx7SQgDrh1kHKoXiWoQmLIJ2EiVGfCo=; b=caLVn2AKr0MffcPgm1bq9InvaTTRCozFPIf/Es9dwCJO4xpf3ORX1k0WpbC+PceomAbQaqwUmakncGXqwa6lCyxDPlHPRfNMbgEcPu2z0Cing/tKKA7SJiEj+R3SB2THErlkI2fg8cLFK3iuqViL6OhdAr9GYgHENqOGyMextQP9wpIvOgPRCzdh9EX+gOtrTV6dyc6NQQZT7ulkaFwPSbyII/SbNaASdQQ/j6Qkr9f16dhfJg+2p54eJaqUiocbuov3sr4g7KOnEQT1zWI9DZS8Poe7CpYZyQadOmLrIZ+UUCVSbiIG330DY/J5mlq/r2BD4jVWJiDR2JdDkO/aQg== 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=sWzBDG/QxRbwJx7SQgDrh1kHKoXiWoQmLIJ2EiVGfCo=; b=gmBlqTO2oyDh3scyrL15cKIsbcETOffku0IKBYAqspZRj1ORVPNIfR10GLFSaYIFpLYxdN+ByyFKwsY2CtDp9Dx7Ju3hm/jqei4o9Q9SrJVdnvMl05S/oOFAExxUQgA+APgRYbFTPiSe5XSHzYfvHQVefJ7/z0x2Sw7o91J0LIHjxbXnAghfrxQJOfiGs3XTWIJVlkAVxnFiIKW5ZgySKiO6BHG4buHSOUGMjlOKYmK5+f+A+Sg/b7Dc7216ggKsMMMSLtH9IQnjJMF9hXbMitZiAMSYJ1z2MGt/zVnUNQY4VZbH3CwR78+UQ8ehoubOculwvaxA0bGB8tYhCv+FKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB2353.namprd12.prod.outlook.com (2603:10b6:207:4c::31) by DS4PR12MB9634.namprd12.prod.outlook.com (2603:10b6:8:280::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9723.19; Wed, 18 Mar 2026 04:07:47 +0000 Received: from BL0PR12MB2353.namprd12.prod.outlook.com ([fe80::99b:dcff:8d6d:78e0]) by BL0PR12MB2353.namprd12.prod.outlook.com ([fe80::99b:dcff:8d6d:78e0%4]) with mapi id 15.20.9723.016; Wed, 18 Mar 2026 04:07:47 +0000 From: Eliot Courtney Date: Wed, 18 Mar 2026 13:07:11 +0900 Subject: [PATCH v5 3/5] gpu: nova-core: gsp: add reply/no-reply info to `CommandToGsp` Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260318-cmdq-locking-v5-3-18b37e3f9069@nvidia.com> References: <20260318-cmdq-locking-v5-0-18b37e3f9069@nvidia.com> In-Reply-To: <20260318-cmdq-locking-v5-0-18b37e3f9069@nvidia.com> To: Danilo Krummrich , Alice Ryhl , Alexandre Courbot , David Airlie , Simona Vetter , Benno Lossin , Gary Guo Cc: John Hubbard , Alistair Popple , Joel Fernandes , Timur Tabi , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Eliot Courtney , Zhi Wang X-Mailer: b4 0.14.3 X-ClientProxiedBy: TY4P286CA0019.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:2b0::16) To BL0PR12MB2353.namprd12.prod.outlook.com (2603:10b6:207:4c::31) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR12MB2353:EE_|DS4PR12MB9634:EE_ X-MS-Office365-Filtering-Correlation-Id: d70f1058-4e82-4567-2627-08de84a3e9d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024|10070799003|56012099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: 4NgrzoulrQTVfkqbN4zRON0tfW4hsvh11RGP3zy+iG/pelbZJgLnvbgAPB0xq+9BAxcn1bzYplUQvrVfmMI1+Z4R2x4uLxrMYRNDm4bzDomBpCbUJGyNDy16gWeOS/XkrMF8QlQWyrtPiA+/owj7LY4qYUCjuL5jDeg9Di1g1dDN/9P4YWDibvLvTyFQGkj2LSuRe0246ADVGRrB1Kmqq5Lh8odjQ3PthfYvClQpDjpt8/AhVLBKEUYKywqbYvBUC8e4k4IfLYl1PYMXwGxYEk8u/9IsOk77Zj823TVsJNc5t+anbGJcu5e3gkQwFvDjM9+Kz6adtkMOTXH8MgJzrh9Z8gzXxpsvZGuKxkoxT5TkEsrDIlCw25F5o4hxgmqpBr3ITvKKeylrUokgkGynDZovqh54LVEwBExdV4gXz4MmaziJr0Hd/OWLmTHATvXOZw7ZGuPSRi8IURbr6TF6kljGMHo/j7Y7w/aujdvUmpqGi04zUS/g91XzuNBziYHpKf95X6swBFdIuoutWhX/kdxbauWWN2QySEMxDD3hp4kjZ359oqUdSjB/cknCEKjrOop/7vxbiYYHqI2G1KlQ4T8hapmUyQI6JiIQHYKkiTxm09pFzPoGuFf4tY6+xHn9dXjaIDu3p8Iqcz0yB3q0k7VQIDTh/GXn/RiwHt3fk5DQRBIAqNe49up+GjEQ9wr6fY2RX8sq4E9zFH1eiRnzmgTV0J0T4ELsaJJ7UArmWkU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB2353.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(10070799003)(56012099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eWI3TnBPeDQ5Yk1NcmQ0UGhvR0RvcW4rRkdtTTlydElDVWF0bk9RZzZyTzdT?= =?utf-8?B?UjZiM2pESmgydUd0N052b1Y4UGE1NWw2YzV4ejFsclRiNjZSTVI2Z1E1U1RD?= =?utf-8?B?dFk4S0l6RjlpcENVQmthTWU5aXpLQ3BhMXhQVXFTZldaKzN6b0srSlNBOHZl?= =?utf-8?B?cG1CRWExcm4waFphWnJxSEpxZ0VDMnJibEF1S0xlVkdhWDNxS2ZkS2pJa1Vi?= =?utf-8?B?V0pOTnd4S1haZ3ljVTFyYVhYTVBYdzArL0FtdElrc1dONGNMOEJ4bjNvYkp5?= =?utf-8?B?Y1VWS2luRGd3bWRvK1MxMThDaDZHNUMwRk45Q2FNNlpwZkZtM084b1JYNXBj?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2YjlEWS9hQUZKWi9LNkRkcDg1K2tiSmNpeWVk?= =?utf-8?B?dmlmeE5xZ3AwNW9pQ0ZQRjF4WkdHaFloUGxPZlVsY2U4N0d5UDVTZExSeTIw?= =?utf-8?B?M2lNYVEzSDM0aU40RDRZRytCektRd2c0UjAyeElSLzlVTjdRV1d5Si84WHFp?= =?utf-8?B?emRVek1HY2xMcTU2OFowMGRoWHE3SUFJQmhRd3RwREZoQVJSRG9XSXVuVzdl?= =?utf-8?Q?syZ8tocWscjjLyo9tAsgHGikET/F6FzvJXqK8ssw1yi62?= X-MS-Exchange-AntiSpam-MessageData-1: RBZ2qSsZbAn83Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d70f1058-4e82-4567-2627-08de84a3e9d8 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB2353.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2026 04:07:47.1969 (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: OI6NCi1P46lh5J6MnC/2oPMmlto91cNVuIN7FbBavvviIcaTMgMjUTnyieApGD2kfIhPQ8Bzy3nyYD85pDhMKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS4PR12MB9634 Add type infrastructure to know what reply is expected from each `CommandToGsp`. Uses a marker type `NoReply` which does not implement `MessageFromGsp` to mark commands which don't expect a response. Update `send_command` to wait for a reply and add `send_command_no_wait` which sends a command that has no reply, without blocking. This prepares for adding locking to the queue. Tested-by: Zhi Wang Reviewed-by: Gary Guo Signed-off-by: Eliot Courtney --- drivers/gpu/nova-core/gsp/boot.rs | 5 ++- drivers/gpu/nova-core/gsp/cmdq.rs | 62 ++++++++++++++++++++++= ++-- drivers/gpu/nova-core/gsp/cmdq/continuation.rs | 8 +++- drivers/gpu/nova-core/gsp/commands.rs | 16 +++---- 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/= boot.rs index 6db2decbc6f5..ffc478b33640 100644 --- a/drivers/gpu/nova-core/gsp/boot.rs +++ b/drivers/gpu/nova-core/gsp/boot.rs @@ -169,8 +169,9 @@ pub(crate) fn boot( dma_write!(wpr_meta, [0]?, GspFwWprMeta::new(&gsp_fw, &fb_layout)); =20 self.cmdq - .send_command(bar, commands::SetSystemInfo::new(pdev))?; - self.cmdq.send_command(bar, commands::SetRegistry::new())?; + .send_command_no_wait(bar, commands::SetSystemInfo::new(pdev))= ?; + self.cmdq + .send_command_no_wait(bar, commands::SetRegistry::new())?; =20 gsp_falcon.reset(bar)?; let libos_handle =3D self.libos.dma_handle(); diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/= cmdq.rs index c62db727a2a9..4fc14689d38e 100644 --- a/drivers/gpu/nova-core/gsp/cmdq.rs +++ b/drivers/gpu/nova-core/gsp/cmdq.rs @@ -45,10 +45,14 @@ sbuffer::SBufferIter, // }; =20 +/// Marker type representing the absence of a reply for a command. Command= s using this as their +/// reply type are sent using [`Cmdq::send_command_no_wait`]. +pub(crate) struct NoReply; + /// Trait implemented by types representing a command to send to the GSP. /// -/// The main purpose of this trait is to provide [`Cmdq::send_command`] wi= th the information it -/// needs to send a given command. +/// The main purpose of this trait is to provide [`Cmdq`] with the informa= tion it needs to send +/// a given command. /// /// [`CommandToGsp::init`] in particular is responsible for initializing t= he command directly /// into the space reserved for it in the command queue buffer. @@ -63,6 +67,10 @@ pub(crate) trait CommandToGsp { /// Type generated by [`CommandToGsp::init`], to be written into the c= ommand queue buffer. type Command: FromBytes + AsBytes; =20 + /// Type of the reply expected from the GSP, or [`NoReply`] for comman= ds that don't + /// have a reply. + type Reply; + /// Error type returned by [`CommandToGsp::init`]. type InitError; =20 @@ -581,7 +589,7 @@ fn send_single_command(&mut self, bar: &Bar0, comman= d: M) -> Result /// written to by its [`CommandToGsp::init_variable_payload`] method. /// /// Error codes returned by the command initializers are propagated as= -is. - pub(crate) fn send_command(&mut self, bar: &Bar0, command: M) -> Re= sult + fn send_command_internal(&mut self, bar: &Bar0, command: M) -> Resu= lt where M: CommandToGsp, Error: From, @@ -601,6 +609,54 @@ pub(crate) fn send_command(&mut self, bar: &Bar0, c= ommand: M) -> Result } } =20 + /// Sends `command` to the GSP and waits for the reply. + /// + /// Messages with non-matching function codes are silently consumed un= til the expected reply + /// arrives. + /// + /// # Errors + /// + /// - `ETIMEDOUT` if space does not become available to send the comma= nd, or if the reply is + /// not received within the timeout. + /// - `EIO` if the variable payload requested by the command has not b= een entirely + /// written to by its [`CommandToGsp::init_variable_payload`] method. + /// + /// Error codes returned by the command and reply initializers are pro= pagated as-is. + pub(crate) fn send_command(&mut self, bar: &Bar0, command: M) -> Re= sult + where + M: CommandToGsp, + M::Reply: MessageFromGsp, + Error: From, + Error: From<::InitError>, + { + self.send_command_internal(bar, command)?; + + loop { + match self.receive_msg::(Self::RECEIVE_TIMEOUT) { + Ok(reply) =3D> break Ok(reply), + Err(ERANGE) =3D> continue, + Err(e) =3D> break Err(e), + } + } + } + + /// Sends `command` to the GSP without waiting for a reply. + /// + /// # Errors + /// + /// - `ETIMEDOUT` if space does not become available within the timeou= t. + /// - `EIO` if the variable payload requested by the command has not b= een entirely + /// written to by its [`CommandToGsp::init_variable_payload`] method. + /// + /// Error codes returned by the command initializers are propagated as= -is. + pub(crate) fn send_command_no_wait(&mut self, bar: &Bar0, command: = M) -> Result + where + M: CommandToGsp, + Error: From, + { + self.send_command_internal(bar, command) + } + /// Wait for a message to become available on the message queue. /// /// This works purely at the transport layer and does not interpret or= validate the message diff --git a/drivers/gpu/nova-core/gsp/cmdq/continuation.rs b/drivers/gpu/n= ova-core/gsp/cmdq/continuation.rs index 2aa17caac2e0..05e904f18097 100644 --- a/drivers/gpu/nova-core/gsp/cmdq/continuation.rs +++ b/drivers/gpu/nova-core/gsp/cmdq/continuation.rs @@ -6,7 +6,10 @@ =20 use kernel::prelude::*; =20 -use super::CommandToGsp; +use super::{ + CommandToGsp, + NoReply, // +}; =20 use crate::{ gsp::fw::{ @@ -63,6 +66,7 @@ fn new(data: &'a [u8]) -> Self { impl<'a> CommandToGsp for ContinuationRecord<'a> { const FUNCTION: MsgFunction =3D MsgFunction::ContinuationRecord; type Command =3D (); + type Reply =3D NoReply; type InitError =3D Infallible; =20 fn init(&self) -> impl Init { @@ -144,6 +148,7 @@ fn new(command: C, payload: KVVec) -> Self { impl CommandToGsp for SplitCommand { const FUNCTION: MsgFunction =3D C::FUNCTION; type Command =3D C::Command; + type Reply =3D C::Reply; type InitError =3D C::InitError; =20 fn init(&self) -> impl Init { @@ -206,6 +211,7 @@ fn new(len: usize) -> Result { impl CommandToGsp for TestPayload { const FUNCTION: MsgFunction =3D MsgFunction::Nop; type Command =3D TestHeader; + type Reply =3D NoReply; type InitError =3D Infallible; =20 fn init(&self) -> impl Init { diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/= gsp/commands.rs index 88df117ba575..77054c92fcc2 100644 --- a/drivers/gpu/nova-core/gsp/commands.rs +++ b/drivers/gpu/nova-core/gsp/commands.rs @@ -23,7 +23,8 @@ cmdq::{ Cmdq, CommandToGsp, - MessageFromGsp, // + MessageFromGsp, + NoReply, // }, fw::{ commands::*, @@ -48,6 +49,7 @@ pub(crate) fn new(pdev: &'a pci::Device) -= > Self { impl<'a> CommandToGsp for SetSystemInfo<'a> { const FUNCTION: MsgFunction =3D MsgFunction::GspSetSystemInfo; type Command =3D GspSetSystemInfo; + type Reply =3D NoReply; type InitError =3D Error; =20 fn init(&self) -> impl Init { @@ -99,6 +101,7 @@ pub(crate) fn new() -> Self { impl CommandToGsp for SetRegistry { const FUNCTION: MsgFunction =3D MsgFunction::SetRegistry; type Command =3D PackedRegistryTable; + type Reply =3D NoReply; type InitError =3D Infallible; =20 fn init(&self) -> impl Init { @@ -178,6 +181,7 @@ pub(crate) fn wait_gsp_init_done(cmdq: &mut Cmdq) -> Re= sult { impl CommandToGsp for GetGspStaticInfo { const FUNCTION: MsgFunction =3D MsgFunction::GetGspStaticInfo; type Command =3D GspStaticConfigInfo; + type Reply =3D GetGspStaticInfoReply; type InitError =3D Infallible; =20 fn init(&self) -> impl Init { @@ -231,13 +235,5 @@ pub(crate) fn gpu_name(&self) -> core::result::Result<= &str, GpuNameError> { =20 /// Send the [`GetGspInfo`] command and awaits for its reply. pub(crate) fn get_gsp_info(cmdq: &mut Cmdq, bar: &Bar0) -> Result { - cmdq.send_command(bar, GetGspStaticInfo)?; - - loop { - match cmdq.receive_msg::(Cmdq::RECEIVE_TIME= OUT) { - Ok(info) =3D> return Ok(info), - Err(ERANGE) =3D> continue, - Err(e) =3D> return Err(e), - } - } + cmdq.send_command(bar, GetGspStaticInfo) } --=20 2.53.0