public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3 01/10] gpu: nova-core: convert PMC registers to kernel register macro
Date: Mon, 23 Mar 2026 15:21:03 +0100	[thread overview]
Message-ID: <9a458b4e-982f-4371-8db5-295fce95f0ba@kernel.org> (raw)
In-Reply-To: <DHA81784G24U.1446CUTJC271J@nvidia.com>

On 3/23/26 3:11 PM, Alexandre Courbot wrote:
> On Mon Mar 23, 2026 at 8:21 PM JST, Danilo Krummrich wrote:
>> On Mon Mar 23, 2026 at 12:07 PM CET, Alexandre Courbot wrote:
>>> -impl TryFrom<u8> for Architecture {
>>> +impl TryFrom<Bounded<u32, 6>> for Architecture {
>>>      type Error = Error;
>>>  
>>> -    fn try_from(value: u8) -> Result<Self> {
>>> -        match value {
>>> +    fn try_from(value: Bounded<u32, 6>) -> Result<Self> {
>>> +        match u8::from(value) {
>>>              0x16 => Ok(Self::Turing),
>>>              0x17 => Ok(Self::Ampere),
>>>              0x19 => Ok(Self::Ada),
>>> @@ -155,23 +151,26 @@ fn try_from(value: u8) -> Result<Self> {
>>>      }
>>>  }
>>>  
>>> -impl From<Architecture> for u8 {
>>> +impl From<Architecture> for Bounded<u32, 6> {
>>>      fn from(value: Architecture) -> Self {
>>> -        // CAST: `Architecture` is `repr(u8)`, so this cast is always lossless.
>>> -        value as u8
>>> +        match value {
>>> +            Architecture::Turing => Bounded::<u32, _>::new::<0x16>(),
>>> +            Architecture::Ampere => Bounded::<u32, _>::new::<0x17>(),
>>> +            Architecture::Ada => Bounded::<u32, _>::new::<0x19>(),
>>> +        }
>>>      }
>>>  }
>>
>> Can this use bounded_enum!()?
> 
> If we move it outside of `falcon.rs`, yes. I didn't want to make too
> permanent a solution with the `TryFrom` macro being developed, but if
> you prefer that way that's doable. I guess `bounded_enum` would need to
> be in the root module though to be accessible by both `falcon` and
> `gpu`.

Since we are going to have it as an intermediate solution, let's be consistent
about it. Maybe num.rs is a good place?

  reply	other threads:[~2026-03-23 14:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 11:07 [PATCH v3 00/10] gpu: nova-core: convert registers to use the kernel register macro Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 01/10] gpu: nova-core: convert PMC registers to " Alexandre Courbot
2026-03-23 11:21   ` Danilo Krummrich
2026-03-23 14:11     ` Alexandre Courbot
2026-03-23 14:21       ` Danilo Krummrich [this message]
2026-03-23 11:07 ` [PATCH v3 02/10] gpu: nova-core: convert PBUS " Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 03/10] gpu: nova-core: convert PFB " Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 04/10] gpu: nova-core: convert GC6 " Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 05/10] gpu: nova-core: convert FUSE " Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 06/10] gpu: nova-core: convert PDISP " Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 07/10] gpu: nova-core: falcon: introduce `bounded_enum` macro Alexandre Courbot
2026-03-23 11:22   ` Danilo Krummrich
2026-03-23 12:43   ` Gary Guo
2026-03-23 14:22     ` Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 08/10] gpu: nova-core: convert falcon registers to kernel register macro Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 09/10] gpu: nova-core: remove `io::` qualifier to register macro invocations Alexandre Courbot
2026-03-23 11:07 ` [PATCH v3 10/10] Documentation: nova: remove register abstraction task Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a458b4e-982f-4371-8db5-295fce95f0ba@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lossin@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=tzimmermann@suse.de \
    --cc=zhiw@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox