From nobody Mon Feb 9 15:26:21 2026 Received: from PH0PR06CU001.outbound.protection.outlook.com (mail-westus3azon11011056.outbound.protection.outlook.com [40.107.208.56]) (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 3DD213451B0; Thu, 16 Oct 2025 15:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.208.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760627614; cv=fail; b=jlzJ1m4h6NU5wsMAv6gC7CYSwcTGh0kq2l+d7M+5qDVYdoFVbaoLMxCXM17fp+703qffZAi1GdlDRpq5GN3YDWIEH6IwY1CFxsZ4o4fH1LvuZG/TgzHzbUWngqLvLkvzmW2VRBmgBlP0XrVpmMOm7g/wGSr1aCUTOfp7ZGeKJBc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760627614; c=relaxed/simple; bh=TnE4y3RvU7fMmzuWnwmIKdsgCDUxhPqLl/Ln0iZEwUM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fdyh+sSDJLFSumzgla2gG7DTwdBGPuX+EhkwBdjyTwjy9I40nW3pl9fPn9PZ9LzZxxbVm1RNZRWurOQ8AIOLHDGyUGamKh7DUuSFVTrkUsLd9mbzQ64NfXoMOSOsM3Piuw5EFUpQluLi2IncrgVYlaXESOOO/0wrXXZn6SNKSHg= 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=uOmvWllb; arc=fail smtp.client-ip=40.107.208.56 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="uOmvWllb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SwT/9esEm9WWXC+JluvpbR3o/FUtRYnM6doj4sltA8vZG03lFdUrAkKdYyzNP39mQy+xFAT7oKe+T18djRk4Xj9yXnHZgHDz7Fbu9yZHmk29C6Bi2aWnwAufVOSS88YPm7NUu5Qmh0jkVh5u9yC8gfTvrn+QyPHMPnt/4SOYe0Rhp8YjmpJGbcG8nZm3bV24vNtltIZ2iaWrU03l/F6ERy8egVxxDZNsPvsgPbbt+Kj7hihPHhbAak/aEtA+qN3gCWcSnxb1KI9BdY3SdnIQrADr8yOHEsMl89945nK2nSRvBk4/xImu1AeR5Pc4DdAcOcqIdGzjgOQ8umK0KIIB5g== 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=KAmpI8MkYGJzNWMUEeQJbkXicdfagVrV2YnN6fyAVUo=; b=fIgh7QDjRCCdacYBEop0ToUEDm3LuhgRlq1UUdNgxxZz6F9KCdiTjDljJoSjPkpZTvESA8DDFwI0kYIeuqx+1RtowD4Rl+D9jYBxGGhr1pUjY6y+g4TvVaYmAwNy/m7t/dXAlrWIm64EufpNq6sa4VytxpPlx3r8Rgaj1gsj9wpJ1sJ5DyILNeTO/BkP27K9BlkabU3SlgaZDWDTIJxlQ8Os+K4Y71WDUrcF2AyY8VHseKPOfjiefRogUzYEP2dkVa5zL7kyPWyH6b9WUahtiynXJah8k3DCVA1hWI+znobEX0pABEiaBS5csqorISVqOMK3veVNX1s9LN73DlXkBA== 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=KAmpI8MkYGJzNWMUEeQJbkXicdfagVrV2YnN6fyAVUo=; b=uOmvWllbK1OHMLPKv43HQXpLUC3wTv3mYkcEq4ziBQdHOuIKGuj26w3/qPAz0Ib8bQFn1vid+v6p2OqL8SARmyFcvU71TTLBvDOZcivNMoKGiXb+1zlYYLyjc0l0U8CIyHx4ER7Dtg08WbUouNKoG/i2isaTe28aWf+YR6ALBtElyGquGueFzLaH62houA85kdM1d6xWozAib8qsHRN9TeDY27EtZK2AjBv09COD71sG0tAOy31bd/4Cx8uwNXAFXHxi7tRna8L+mY3whOPkV0c2QCDzRbftMjVPNOZwE20J5dg04KzeCodgIpQBgVoaUiHS/OOoZmE4b5uB0aMQTg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SN7PR12MB8059.namprd12.prod.outlook.com (2603:10b6:806:32b::7) by DS0PR12MB8574.namprd12.prod.outlook.com (2603:10b6:8:166::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9228.10; Thu, 16 Oct 2025 15:13:29 +0000 Received: from SN7PR12MB8059.namprd12.prod.outlook.com ([fe80::4ee2:654e:1fe8:4b91]) by SN7PR12MB8059.namprd12.prod.outlook.com ([fe80::4ee2:654e:1fe8:4b91%2]) with mapi id 15.20.9228.010; Thu, 16 Oct 2025 15:13:29 +0000 From: Joel Fernandes To: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org, dakr@kernel.org, acourbot@nvidia.com Cc: Alistair Popple , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , bjorn3_gh@protonmail.com, Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , John Hubbard , Joel Fernandes , Timur Tabi , joel@joelfernandes.org, Elle Rhumsaa , Yury Norov , Daniel Almeida , nouveau@lists.freedesktop.org Subject: [PATCH v7.1 1/4] gpu: nova-core: register: use field type for Into implementation Date: Thu, 16 Oct 2025 11:13:20 -0400 Message-Id: <20251016151323.1201196-2-joelagnelf@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251016151323.1201196-1-joelagnelf@nvidia.com> References: <20251016151323.1201196-1-joelagnelf@nvidia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9PR03CA0929.namprd03.prod.outlook.com (2603:10b6:408:107::34) To SN7PR12MB8059.namprd12.prod.outlook.com (2603:10b6:806:32b::7) 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: SN7PR12MB8059:EE_|DS0PR12MB8574:EE_ X-MS-Office365-Filtering-Correlation-Id: e332dd23-d744-429e-7dc6-08de0cc6901f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ak6gl9GZy002JCsOLhDXUPrgkCKrDg47qYLyN+c6WLjC/9JvImIsN/o8eFiU?= =?us-ascii?Q?aEDY4uSs9Y+OtRcvPKq9V98Iqoc37dHpZmiTzerJH3ES/4mKjtZhK3Y8rXC4?= =?us-ascii?Q?SZqUb1FgAwHjms6XjbhmH71M0I3Fy28RW2XbmXQ1iGQ5wjm4RfPV1EEIEzZa?= =?us-ascii?Q?l7geAOJcw8bTAbu3X7qyEdy+vVJVH/FAwLyHk9MDa75rT9UEz8YIf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yEic53mjz4yZECV72lrJ/WYbirOdyKrGkvV?= =?us-ascii?Q?PydfuTMDdt4O5Q19X+hLNfH+dJSt6pnuEZpoQ/xVqzNXOP38Fk2akbHTI5fP?= =?us-ascii?Q?6d2dwS+yf4A9029oBMm5OT5OXVZhFDslqCQK8oeN5+08002S/Epxjfc3/CYF?= =?us-ascii?Q?aDwuqj+HrRYkrFBODKoD4LaBfKlGyd/javHG5jMlEkClqkEkbWd35OpvDl1d?= =?us-ascii?Q?7cgTXuawzifTZJ4Sv+BONmxfdUS5JFfoty323W6T7Vx+aSLsuwYPEuhcOXN1?= =?us-ascii?Q?GC4VBQQ+5DEBX6KZErDIO8lz46TESEpSJS0bIZLfKpFVOFGFsBJBmN+j5PKW?= =?us-ascii?Q?B4UXogj31tcfSVScl6VolpTSo+Tm/mWF?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR12MB8059.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?h89UA7zo9oJqs9JXZhn/dVQ+Zge6Y+meJRL6oaEHDqQtOyenjMU6cQZ6jMCq?= =?us-ascii?Q?s/TyPQKgeevV5IamdClvE8AoV0VxYUHdN5iBuIkMMYH0+905kKPHd1BaPq8g?= =?us-ascii?Q?gPQE3xZ58167mBGtiObeq/G3kVkMsBVVqtkpvRbCx22iYEGTSHqjK43Jbk8o?= =?us-ascii?Q?Blwx6/ZX+D+v2V3SvHwp9/e/GKriBfPPtMm6v9PrsrwxPMMzqGxhfwMe6XAo?= =?us-ascii?Q?WIP6EaMX1FwgMdiLAB9zD0iB5amfIYtz3P6onumLzcBH1AwsS31yoODqN5jL?= =?us-ascii?Q?jQNGxWFROAYROqCVNkkSkdnLJhsgMnxTHBja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1dhOgLkfOp+qgvENA8CbWX4DHAGAFMfltyPzKGLHXbWCZhXwZAOxE7K/?= =?us-ascii?Q?bFQXqw+dbqst6E0wgRWZ2cj5ladxpv55zLpxEJqx3QCkGXkS6R58mdpw3os5?= =?us-ascii?Q?G+DYJnLlsd9g1XH8nzZT+Mji7J3QlhvxkoiJ6PAM4s6oyRtxASPV2jjWWdZ2?= =?us-ascii?Q?HP0So5etST7qnmC0UHRFI+fVyrR8BspjOAe3Ebprj2+AnhV557FFdjZDVRZx?= =?us-ascii?Q?+n3btwT62ScKJzOogMvQx9tUPxY+8sRiUcDbA8cLR6643g+RNVzzVTHJ0E3f?= =?us-ascii?Q?E5VY35mr8T4eK4h9Nyd0yKQ8oHLgVwBKhreXnfzQ4znIwFU35c8gOHWeOnr0?= =?us-ascii?Q?DQQpXgguxm+H8U6ljIaunUc2SP/z2CUeNre/TYmx?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e332dd23-d744-429e-7dc6-08de0cc6901f X-MS-Exchange-CrossTenant-AuthSource: SN7PR12MB8059.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2025 15:13:29.5487 (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: z0CVWeF3nJca65dDQxSg7WLlVcSV/oSTtFtNkUtzE02J5a4Z6Wt9rWMesFWuVUtabQIFyObZ11+QfzD0WmmrEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8574 Content-Type: text/plain; charset="utf-8" From: Alexandre Courbot The getter method of a field works with the field type, but its setter expects the type of the register. This leads to an asymmetry in the From/Into implementations required for a field with a dedicated type. For instance, a field declared as pub struct ControlReg(u32) { 3:0 mode as u8 ?=3D> Mode; ... } currently requires the following implementations: impl TryFrom for Mode { ... } impl From for u32 { ... } Change this so the `From` now needs to be implemented for `u8`, i.e. the primitive type of the field. This is more consistent, and will become a requirement once we start using the TryFrom/Into derive macros to implement these automatically. Reviewed-by: Joel Fernandes Signed-off-by: Alexandre Courbot Signed-off-by: Joel Fernandes --- drivers/gpu/nova-core/falcon.rs | 38 ++++++++++++++++++++-------- drivers/gpu/nova-core/regs/macros.rs | 10 ++++---- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon= .rs index 37e6298195e4..3f505b870601 100644 --- a/drivers/gpu/nova-core/falcon.rs +++ b/drivers/gpu/nova-core/falcon.rs @@ -22,11 +22,11 @@ pub(crate) mod sec2; =20 // TODO[FPRI]: Replace with `ToPrimitive`. -macro_rules! impl_from_enum_to_u32 { +macro_rules! impl_from_enum_to_u8 { ($enum_type:ty) =3D> { - impl From<$enum_type> for u32 { + impl From<$enum_type> for u8 { fn from(value: $enum_type) -> Self { - value as u32 + value as u8 } } }; @@ -46,7 +46,7 @@ pub(crate) enum FalconCoreRev { Rev6 =3D 6, Rev7 =3D 7, } -impl_from_enum_to_u32!(FalconCoreRev); +impl_from_enum_to_u8!(FalconCoreRev); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for FalconCoreRev { @@ -81,7 +81,7 @@ pub(crate) enum FalconCoreRevSubversion { Subversion2 =3D 2, Subversion3 =3D 3, } -impl_from_enum_to_u32!(FalconCoreRevSubversion); +impl_from_enum_to_u8!(FalconCoreRevSubversion); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for FalconCoreRevSubversion { @@ -125,7 +125,7 @@ pub(crate) enum FalconSecurityModel { /// Also known as High-Secure, Privilege Level 3 or PL3. Heavy =3D 3, } -impl_from_enum_to_u32!(FalconSecurityModel); +impl_from_enum_to_u8!(FalconSecurityModel); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for FalconSecurityModel { @@ -157,7 +157,7 @@ pub(crate) enum FalconModSelAlgo { #[default] Rsa3k =3D 1, } -impl_from_enum_to_u32!(FalconModSelAlgo); +impl_from_enum_to_u8!(FalconModSelAlgo); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for FalconModSelAlgo { @@ -179,7 +179,7 @@ pub(crate) enum DmaTrfCmdSize { #[default] Size256B =3D 0x6, } -impl_from_enum_to_u32!(DmaTrfCmdSize); +impl_from_enum_to_u8!(DmaTrfCmdSize); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for DmaTrfCmdSize { @@ -202,7 +202,6 @@ pub(crate) enum PeregrineCoreSelect { /// RISC-V core is active. Riscv =3D 1, } -impl_from_enum_to_u32!(PeregrineCoreSelect); =20 impl From for PeregrineCoreSelect { fn from(value: bool) -> Self { @@ -213,6 +212,15 @@ fn from(value: bool) -> Self { } } =20 +impl From for bool { + fn from(value: PeregrineCoreSelect) -> Self { + match value { + PeregrineCoreSelect::Falcon =3D> false, + PeregrineCoreSelect::Riscv =3D> true, + } + } +} + /// Different types of memory present in a falcon core. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) enum FalconMem { @@ -236,7 +244,7 @@ pub(crate) enum FalconFbifTarget { /// Non-coherent system memory (System DRAM). NoncoherentSysmem =3D 2, } -impl_from_enum_to_u32!(FalconFbifTarget); +impl_from_enum_to_u8!(FalconFbifTarget); =20 // TODO[FPRI]: replace with `FromPrimitive`. impl TryFrom for FalconFbifTarget { @@ -263,7 +271,6 @@ pub(crate) enum FalconFbifMemType { /// Physical memory addresses. Physical =3D 1, } -impl_from_enum_to_u32!(FalconFbifMemType); =20 /// Conversion from a single-bit register field. impl From for FalconFbifMemType { @@ -275,6 +282,15 @@ fn from(value: bool) -> Self { } } =20 +impl From for bool { + fn from(value: FalconFbifMemType) -> Self { + match value { + FalconFbifMemType::Virtual =3D> false, + FalconFbifMemType::Physical =3D> true, + } + } +} + /// Type used to represent the `PFALCON` registers address base for a give= n falcon engine. pub(crate) struct PFalconBase(()); =20 diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/r= egs/macros.rs index 8058e1696df9..1c54a4533822 100644 --- a/drivers/gpu/nova-core/regs/macros.rs +++ b/drivers/gpu/nova-core/regs/macros.rs @@ -482,7 +482,7 @@ impl $name { register!( @leaf_accessor $name $hi:$lo $field { |f| <$into_type>::from(if f !=3D 0 { true } else { false }) } - $into_type =3D> $into_type $(, $comment)?; + bool $into_type =3D> $into_type $(, $comment)?; ); }; =20 @@ -499,7 +499,7 @@ impl $name { $(, $comment:literal)?; ) =3D> { register!(@leaf_accessor $name $hi:$lo $field - { |f| <$try_into_type>::try_from(f as $type) } $try_into_type = =3D> + { |f| <$try_into_type>::try_from(f as $type) } $type $try_into= _type =3D> ::core::result::Result< $try_into_type, <$try_into_type as ::core::convert::TryFrom<$type>>::Error @@ -513,7 +513,7 @@ impl $name { $(, $comment:literal)?; ) =3D> { register!(@leaf_accessor $name $hi:$lo $field - { |f| <$into_type>::from(f as $type) } $into_type =3D> $into_t= ype $(, $comment)?;); + { |f| <$into_type>::from(f as $type) } $type $into_type =3D> $= into_type $(, $comment)?;); }; =20 // Shortcut for non-boolean fields defined without the `=3D>` or `?=3D= >` syntax. @@ -527,7 +527,7 @@ impl $name { // Generates the accessor methods for a single field. ( @leaf_accessor $name:ident $hi:tt:$lo:tt $field:ident - { $process:expr } $to_type:ty =3D> $res_type:ty $(, $comment:l= iteral)?; + { $process:expr } $prim_type:tt $to_type:ty =3D> $res_type:ty = $(, $comment:literal)?; ) =3D> { ::kernel::macros::paste!( const [<$field:upper _RANGE>]: ::core::ops::RangeInclusive =3D= $lo..=3D$hi; @@ -559,7 +559,7 @@ pub(crate) fn $field(self) -> $res_type { pub(crate) fn [](mut self, value: $to_type) -> Self { const MASK: u32 =3D $name::[<$field:upper _MASK>]; const SHIFT: u32 =3D $name::[<$field:upper _SHIFT>]; - let value =3D (u32::from(value) << SHIFT) & MASK; + let value =3D (u32::from($prim_type::from(value)) << SHIFT) & = MASK; self.0 =3D (self.0 & !MASK) | value; =20 self --=20 2.34.1