Rust for Linux List
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: nova-gpu <nova-gpu@lists.linux.dev>,
	Alice Ryhl <aliceryhl@google.com>,
	 David Airlie <airlied@gmail.com>,
	Alexandre Courbot <acourbot@nvidia.com>,
	 Benno Lossin <lossin@kernel.org>, Gary Guo <gary@garyguo.net>,
	 Eliot Courtney <ecourtney@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	linux-kernel@vger.kernel.org,  dri-devel@lists.freedesktop.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v4 6/7] drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter
Date: Fri, 21 Aug 2026 15:13:24 +1000	[thread overview]
Message-ID: <aofd84GR1HA2H7xS@nvdebian.thelocal> (raw)
In-Reply-To: <DKRHR24SW3XR.27EE53NSRT1D3@kernel.org>

On 2026-08-18 at 06:11 +1000, Danilo Krummrich <dakr@kernel.org> wrote...
> On Tue Aug 11, 2026 at 7:06 AM CEST, Alistair Popple wrote:
> > Currently nova-drm reads the VRAM BAR size directly from the PCIe device
> > which requires trying to cast the parent device into a PCIe device. This
> > obviously requires the parent device to actually be a PCIe bus device.
> > Whilst that is true today it may not always be the case, and there
> > is no reason to make this assumption now that NovaCoreApi can hold a
> > reference to the bound PCIe device.
> >
> > So convert nova-drm to using nova-core to obtain the VRAM_BAR_SIZE
> > parameter.
> >
> > Signed-off-by: Alistair Popple <apopple@nvidia.com>
> 
> Suggested-by: Danilo Krummrich <dakr@kernel.org>
> 
> > @@ -33,16 +30,13 @@ fn open(_dev: &NovaDevice) -> Result<Pin<KBox<Self>>> {
> >  impl File {
> >      /// IOCTL: get_param: Query GPU / driver metadata.
> >      pub(crate) fn get_param(
> > -        dev: &NovaDevice<Registered>,
> > -        _reg_data: &DrmRegData<'_>,
> > +        _dev: &NovaDevice<Registered>,
> > +        reg_data: &DrmRegData<'_>,
> >          getparam: &mut uapi::drm_nova_getparam,
> >          _file: &drm::File<File>,
> >      ) -> Result<u32> {
> > -        let adev: &auxiliary::Device<Bound> = dev.as_ref();
> > -        let pdev: &pci::Device<Bound> = adev.parent().try_into()?;
> > -
> >          let value = match getparam.param as u32 {
> > -            uapi::NOVA_GETPARAM_VRAM_BAR_SIZE => pdev.resource_len(1)?,
> > +            uapi::NOVA_GETPARAM_VRAM_BAR_SIZE => reg_data.api.bar1_size()?,
> >              _ => return Err(EINVAL),
> >          };
> 
> That's much cleaner, thanks for adding this patch!

No problem! Agree it's much nicer.

> Once this landed we can remove the
> 
> 	impl<Ctx: device::DeviceContext> TryFrom<&device::Device<Ctx>> for &Device<Ctx>
> 
> impl in rust/kernel/pci.rs. (I think platform should have the same impl to get
> rid of independently.)
> 
> If your are interested, feel free to send a follow-up patch (or include it in
> this series).

Happy to do either. Seems like it might be easiest just to add it to this
series so will add it to v5.

  reply	other threads:[~2026-08-21  5:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  5:06 [PATCH v4 0/7] gpu: nova: Export parameters from nova-core to nova-drm Alistair Popple
2026-08-11  5:06 ` [PATCH v4 1/7] gpu: nova-core: Add public driver API to nova-core Alistair Popple
2026-08-11  5:06 ` [PATCH v4 2/7] drm: nova: Add DRM registration data Alistair Popple
2026-08-11  5:06 ` [PATCH v4 3/7] drm: nova: Add chipid enum to nova-drm UAPI Alistair Popple
2026-08-11  5:06 ` [PATCH v4 4/7] drm: nova: Add a GPU info ioctl Alistair Popple
2026-08-17 20:18   ` Danilo Krummrich
2026-08-21  5:10     ` Alistair Popple
2026-08-11  5:06 ` [PATCH v4 5/7] drm: nova: Add usable VRAM size to " Alistair Popple
2026-08-11  5:06 ` [PATCH v4 6/7] drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter Alistair Popple
2026-08-17 20:11   ` Danilo Krummrich
2026-08-21  5:13     ` Alistair Popple [this message]
2026-08-11  5:06 ` [PATCH v4 7/7] drm: nova: Expose a render node Alistair Popple

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=aofd84GR1HA2H7xS@nvdebian.thelocal \
    --to=apopple@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    /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