diff options
| author | Dave Airlie <airlied@redhat.com> | 2025-11-20 10:42:50 +1000 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2025-11-20 10:44:50 +1000 |
| commit | f0ded972d37150f9f889de75c9eecc5cb0730013 (patch) | |
| tree | 1cbf2650fd192cd2b10d497ada78dc55721d842a /drivers/gpu/nova-core/dma.rs | |
| parent | f3a1d69f9b388271986f4efe1fd775df15b443c1 (diff) | |
| parent | 77b686f688126a5f758b51441a03186e9eb1b0f1 (diff) | |
Merge tag 'drm-rust-next-2025-11-18' of https://gitlab.freedesktop.org/drm/rust/kernel into drm-next
Cross-subsystem Changes:
Rust
- Make slice::as_flattened usable on all supported versions of rustc.
- Add FromBytes::from_bytes_prefix() method.
Core Changes:
- Update Tyr in MAINTAINERS file.
- Remove redundant device ptr from Rust GEM object.
- Change how AlwaysRefCounted is implemented for GEM objects.
- Add deferred vm_bo cleanup to GPUVM and use it in Panthor.
Driver Changes:
Nova Core
- Introduction of bitfield! macro, with support for different storage sizes
and custom visibility.
- Introduction of safe converters between integer types for which the
conversion is lossless.
- GSP initialized up to fully booted state on Ampere.
- Use more future-proof register for GPU identification.
- Various simplifications and optimizations.
Nova
- Select NOVA_CORE.
- Depend on CONFIG_64BIT.
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/aRxtJC0D1pQUepF4@google.com
Diffstat (limited to 'drivers/gpu/nova-core/dma.rs')
| -rw-r--r-- | drivers/gpu/nova-core/dma.rs | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/gpu/nova-core/dma.rs b/drivers/gpu/nova-core/dma.rs index 94f44bcfd748..7215398969da 100644 --- a/drivers/gpu/nova-core/dma.rs +++ b/drivers/gpu/nova-core/dma.rs @@ -2,12 +2,17 @@ //! Simple DMA object wrapper. -use core::ops::{Deref, DerefMut}; - -use kernel::device; -use kernel::dma::CoherentAllocation; -use kernel::page::PAGE_SIZE; -use kernel::prelude::*; +use core::ops::{ + Deref, + DerefMut, // +}; + +use kernel::{ + device, + dma::CoherentAllocation, + page::PAGE_SIZE, + prelude::*, // +}; pub(crate) struct DmaObject { dma: CoherentAllocation<u8>, @@ -25,20 +30,11 @@ impl DmaObject { } pub(crate) fn from_data(dev: &device::Device<device::Bound>, data: &[u8]) -> Result<Self> { - Self::new(dev, data.len()).map(|mut dma_obj| { - // TODO[COHA]: replace with `CoherentAllocation::write()` once available. - // SAFETY: - // - `dma_obj`'s size is at least `data.len()`. - // - We have just created this object and there is no other user at this stage. - unsafe { - core::ptr::copy_nonoverlapping( - data.as_ptr(), - dma_obj.dma.start_ptr_mut(), - data.len(), - ); - } - - dma_obj + Self::new(dev, data.len()).and_then(|mut dma_obj| { + // SAFETY: We have just allocated the DMA memory, we are the only users and + // we haven't made the device aware of the handle yet. + unsafe { dma_obj.write(data, 0)? } + Ok(dma_obj) }) } } |
