All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the driver-core tree with the drm-rust tree
@ 2026-07-26 21:57 Mark Brown
  2026-07-26 22:30 ` Danilo Krummrich
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-07-26 21:57 UTC (permalink / raw)
  To: Greg KH, Danilo Krummrich, Rafael J. Wysocki
  Cc: Alexandre Courbot, Gary Guo, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 3480 bytes --]

Hi all,

Today's linux-next merge of the driver-core tree got a conflict in:

  drivers/gpu/nova-core/gpu.rs

between commit:

  f1aab4b1ab829 ("gpu: nova-core: avoid repeated calls to pci::Device::as_ref")

from the drm-rust tree and commit:

  f7acb19abcd86 ("rust: device: make lifetime on `Core` and `CoreInternal` invariant")

from the driver-core tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc drivers/gpu/nova-core/gpu.rs
index 42a4cd7971fa1,b603b0bd2692b..0000000000000
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@@ -277,61 -284,15 +277,61 @@@ struct GspResources<'gpu> 
      unload_bundle: Option<gsp::UnloadBundle>,
  }
  
 +/// Structure holding the resources required to operate the GPU.
 +#[pin_data]
 +pub(crate) struct Gpu<'gpu> {
 +    spec: Spec,
 +    /// Static GPU information as provided by the GSP.
 +    gsp_static_info: GetGspStaticInfoReply,
 +    /// GSP and its resources.
 +    #[pin]
 +    gsp_resources: GspResources<'gpu>,
 +    /// System memory page required for flushing all pending GPU-side memory writes done through
 +    /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
 +    ///
 +    /// Must be kept declared *after* `gsp_resources`, as the latter's `PinnedDrop` implementation
 +    /// requires the sysmem flush page to be in place.
 +    sysmem_flush: SysmemFlush<'gpu>,
 +}
 +
 +#[pinned_drop]
 +impl PinnedDrop for GspResources<'_> {
 +    fn drop(self: Pin<&mut Self>) {
 +        let this = self.project();
 +        let device = *this.device;
 +        let bar = *this.bar;
 +        let bundle = this.unload_bundle.take();
 +
 +        let _ = this
 +            .gsp
 +            .as_ref()
 +            .get_ref()
 +            .unload(
 +                GspBootContext {
 +                    pdev: device,
 +                    bar,
 +                    chipset: this.spec.chipset,
 +                    gsp_falcon: &*this.gsp_falcon,
 +                    sec2_falcon: &*this.sec2_falcon,
 +                    fsp: this.fsp.as_mut(),
 +                    vgpu: &*this.vgpu,
 +                },
 +                bundle,
 +            )
 +            .inspect_err(|e| dev_err!(device, "failed to unload GSP: {:?}\n", e));
 +    }
 +}
 +
  impl<'gpu> Gpu<'gpu> {
-     pub(crate) fn new(
-         pdev: &'gpu pci::Device<device::Core<'_>>,
+     pub(crate) fn new<'a>(
+         pdev: &'gpu pci::Device<device::Core<'a>>,
          bar: Bar0<'gpu>,
-     ) -> impl PinInit<Self, Error> + 'gpu {
+     ) -> impl PinInit<Self, Error> + use<'gpu, 'a> {
 +        let dev = pdev.as_ref();
 +
          try_pin_init!(Self {
 -            device: pdev.as_ref(),
 -            spec: Spec::new(pdev.as_ref(), bar).inspect(|spec| {
 -                dev_info!(pdev,"NVIDIA ({})\n", spec);
 +            spec: Spec::new(dev, bar).inspect(|spec| {
 +                dev_info!(dev,"NVIDIA ({})\n", spec);
              })?,
  
              // We must wait for GFW_BOOT completion before doing any significant setup on the GPU.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* linux-next: manual merge of the driver-core tree with the drm-rust tree
@ 2025-11-17  5:06 Stephen Rothwell
  2025-11-17 14:47 ` Alice Ryhl
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2025-11-17  5:06 UTC (permalink / raw)
  To: Greg KH, Danilo Krummrich, Rafael J. Wysocki, Alice Ryhl
  Cc: Alexandre Courbot, Alistair Popple, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 3901 bytes --]

Hi all,

Today's linux-next merge of the driver-core tree got a conflict in:

  drivers/gpu/nova-core/driver.rs

between commit:

  1101c442410c ("gpu: nova-core: Set correct DMA mask")

from the drm-rust tree and commits:

  0242623384c7 ("rust: driver: let probe() return impl PinInit<Self, Error>")
  e4e679c8608e ("rust: auxiliary: unregister on parent device unbind")

from the driver-core tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/nova-core/driver.rs
index d91bbc50cde7,ca0d5f8ad54b..000000000000
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@@ -1,20 -1,14 +1,21 @@@
  // SPDX-License-Identifier: GPL-2.0
  
  use kernel::{
 -    auxiliary, c_str,
 +    auxiliary,
 +    c_str,
      device::Core,
+     devres::Devres,
 +    dma::Device,
 +    dma::DmaMask,
      pci,
 -    pci::{Class, ClassMask, Vendor},
 +    pci::{
 +        Class,
 +        ClassMask,
 +        Vendor, //
 +    },
      prelude::*,
      sizes::SZ_16M,
 -    sync::Arc,
 +    sync::Arc, //
  };
  
  use crate::gpu::Gpu;
@@@ -67,31 -53,21 +69,26 @@@ impl pci::Driver for NovaCore 
      type IdInfo = ();
      const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
  
-     fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> {
-         dev_dbg!(pdev.as_ref(), "Probe Nova Core GPU driver.\n");
+     fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
+         pin_init::pin_init_scope(move || {
+             dev_dbg!(pdev.as_ref(), "Probe Nova Core GPU driver.\n");
  
-         pdev.enable_device_mem()?;
-         pdev.set_master();
+             pdev.enable_device_mem()?;
+             pdev.set_master();
  
-         // SAFETY: No concurrent DMA allocations or mappings can be made because
-         // the device is still being probed and therefore isn't being used by
-         // other threads of execution.
-         unsafe { pdev.dma_set_mask_and_coherent(DmaMask::new::<GPU_DMA_BITS>())? };
++            // SAFETY: No concurrent DMA allocations or mappings can be made because
++            // the device is still being probed and therefore isn't being used by
++            // other threads of execution.
++            unsafe { pdev.dma_set_mask_and_coherent(DmaMask::new::<GPU_DMA_BITS>())? };
 +
-         let devres_bar = Arc::pin_init(
-             pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core/bar0")),
-             GFP_KERNEL,
-         )?;
+             let bar = Arc::pin_init(
+                 pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core/bar0")),
+                 GFP_KERNEL,
+             )?;
  
-         // Used to provided a `&Bar0` to `Gpu::new` without tying it to the lifetime of
-         // `devres_bar`.
-         let bar_clone = Arc::clone(&devres_bar);
-         let bar = bar_clone.access(pdev.as_ref())?;
- 
-         let this = KBox::pin_init(
-             try_pin_init!(Self {
-                 gpu <- Gpu::new(pdev, devres_bar, bar),
-                 _reg: auxiliary::Registration::new(
+             Ok(try_pin_init!(Self {
+                 gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
+                 _reg <- auxiliary::Registration::new(
                      pdev.as_ref(),
                      c_str!("nova-drm"),
                      0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-26 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26 21:57 linux-next: manual merge of the driver-core tree with the drm-rust tree Mark Brown
2026-07-26 22:30 ` Danilo Krummrich
  -- strict thread matches above, loose matches on Subject: below --
2025-11-17  5:06 Stephen Rothwell
2025-11-17 14:47 ` Alice Ryhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.