mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simon Song <xinmengs@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: acourbot@nvidia.com, kvm@vger.kernel.org,
	rust-for-linux@vger.kernel.org, nova-gpu@lists.linux.dev,
	linux-pci@vger.kernel.org, alex@shazbot.org, jgg@nvidia.com,
	yishaih@nvidia.com, skolothumtho@nvidia.com,
	kevin.tian@intel.com, airlied@gmail.com, simona@ffwll.ch,
	ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com,
	gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	jhubbard@nvidia.com, ecourtney@nvidia.com, cjia@nvidia.com,
	smitra@nvidia.com, kjaju@nvidia.com, alkumar@nvidia.com,
	ankita@nvidia.com, aniketa@nvidia.com, kwankhede@nvidia.com,
	targupta@nvidia.com, linux-kernel@vger.kernel.org,
	zhiwang@kernel.org, zhiw@nvidia.com, boqun@kernel.org,
	daniel.almeida@collabora.com, tamird@kernel.org,
	work@onurozkan.dev, jgg@ziepe.ca, bhelgaas@google.com,
	kwilczynski@kernel.org, dri-devel@lists.freedesktop.org,
	peter@colberg.org
Subject: Re: [PATCH v3 7/9] rust: vfio: add PCI variant driver abstractions
Date: Thu, 26 Nov 2026 10:01:48 -0500	[thread overview]
Message-ID: <03b5355c-e8c9-4190-95b8-fb847756ad7f@nvidia.com> (raw)
In-Reply-To: <DN4P1UAAVP8G.2TUW0Q8UEQVCG@kernel.org>

On 11/25/2026 3:51 PM, Danilo Krummrich wrote:

>> +impl RuntimeActive {
>> +    fn new(dev: &device::Device<device::Bound>) -> Result<Self> {
>> +        // SAFETY: `dev` is a valid device. This is `pm_runtime_get_sync()`, which takes a usage
>> +        // reference even if it fails.
>> +        #[cfg(CONFIG_PM)]
>> +        let ret =
>> +            unsafe { bindings::__pm_runtime_resume(dev.as_raw(), bindings::RPM_GET_PUT as c_int) };
>> +        #[cfg(not(CONFIG_PM))]
>> +        let ret = 0;
>> +        // INVARIANT: `this` owns the usage reference, and drops it if the resume failed.
>> +        let this = Self(dev.into());
>> +        to_result(ret)?;
>> +        Ok(this)
>> +    }
>> +}
>> +
>> +impl Drop for RuntimeActive {
>> +    fn drop(&mut self) {
>> +        // SAFETY: `self.0` is a valid device, and `new()` took the usage reference dropped
>> +        // here. This is `pm_runtime_put()`.
>> +        #[cfg(CONFIG_PM)]
>> +        unsafe {
>> +            bindings::__pm_runtime_idle(
>> +                self.0.as_raw(),
>> +                (bindings::RPM_GET_PUT | bindings::RPM_ASYNC) as c_int,
>> +            )
>> +        };
>> +    }
>> +}
> 
> This seems reasonable, but doesn't belong into VFIO core code. This should e.g.
> go under rust/kernel/device/pm.rs.
> 
> However, it would become dead code once we land the runtime PM stuff and enable
> it for PCI, right? I think an alternative could be to just make nova-vgpu depend
> on !PM.
> 

Right, this goes away once driver has runtime PM callbacks, I tried !PM and it works, but CONFIG_PM
is set in x86_64_defconfig and allmodconfig, so driver won't be built there with default option for
x86, would you rather keep RuntimeActive and moved it to pm.rs or prefer to depend on the CONFIG_PM
until the runtime PM for PCI lands?




  reply	other threads:[~2026-11-26 15:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:50 [PATCH v3 0/9] Rust VFIO PCI support and NVIDIA vGPU driver Simon Song
2026-11-19 21:50 ` [PATCH v3 1/9] rust: pci: add VFIO override device IDs Simon Song
2026-11-19 21:50 ` [PATCH v3 2/9] rust: pci: expose the VF index within its PF Simon Song
2026-11-19 21:50 ` [PATCH v3 3/9] rust: pci: allow drivers to manage DMA ownership Simon Song
2026-11-19 21:50 ` [PATCH v3 4/9] rust: pci: add reset callbacks Simon Song
2026-11-19 21:50 ` [PATCH v3 5/9] rust: pci: add an error_detected callback Simon Song
2026-11-19 21:50 ` [PATCH v3 6/9] rust: vfio: add common VFIO device handling Simon Song
2026-11-25 17:57   ` Danilo Krummrich
2026-11-26 15:45     ` Simon Song
2026-11-19 21:50 ` [PATCH v3 7/9] rust: vfio: add PCI variant driver abstractions Simon Song
2026-11-25 23:51   ` Danilo Krummrich
2026-11-26 15:01     ` Simon Song [this message]
2026-11-26 15:15     ` Alice Ryhl
2026-11-19 21:50 ` [PATCH v3 8/9] gpu: nova-core: publish typed SR-IOV PF APIs Simon Song
2026-11-19 21:50 ` [PATCH v3 9/9] vfio/nova-vgpu: add the Rust VFIO variant driver Simon Song
2026-11-25  3:19   ` Alex Williamson
2026-11-26  2:45     ` Simon Song
2026-11-26  6:08       ` Alex Williamson
2026-11-24 22:21 ` (subset) [PATCH v3 0/9] Rust VFIO PCI support and NVIDIA vGPU driver Danilo Krummrich

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=03b5355c-e8c9-4190-95b8-fb847756ad7f@nvidia.com \
    --to=xinmengs@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=alex@shazbot.org \
    --cc=aliceryhl@google.com \
    --cc=alkumar@nvidia.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=boqun@kernel.org \
    --cc=cjia@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kjaju@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=peter@colberg.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skolothumtho@nvidia.com \
    --cc=smitra@nvidia.com \
    --cc=tamird@kernel.org \
    --cc=targupta@nvidia.com \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --cc=yishaih@nvidia.com \
    --cc=zhiw@nvidia.com \
    --cc=zhiwang@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

all inboxes | Powered by JetHome®