summaryrefslogtreecommitdiff
path: root/drivers/gpu/nova-core/dma.rs
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2026-03-27 00:22:13 +0900
committerAlexandre Courbot <acourbot@nvidia.com>2026-03-28 22:20:08 +0900
commite10dcb9d654177270b48119fa79f3924aef9ff48 (patch)
tree4e8caf56d6041dbf97b8f0c89db44452f569ab86 /drivers/gpu/nova-core/dma.rs
parent371db8bcb925bfb0ac68db2f66aeaa0350ac1d06 (diff)
downloadlinux-next-e10dcb9d654177270b48119fa79f3924aef9ff48.tar.gz
linux-next-e10dcb9d654177270b48119fa79f3924aef9ff48.zip
gpu: nova-core: firmware: gsp: use dma::Coherent for level0 table
Replace the nova-core local `DmaObject` with a `CoherentBox` that can fulfill the same role. Since `CoherentBox` is more flexible than `DmaObject`, we can use the native `u64` type for page table entries instead of messing with bytes. The `dma` module becomes unused with that change, so remove it as well. Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260327-b4-nova-dma-removal-v2-7-616e1d0b5cb3@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Diffstat (limited to 'drivers/gpu/nova-core/dma.rs')
-rw-r--r--drivers/gpu/nova-core/dma.rs53
1 files changed, 0 insertions, 53 deletions
diff --git a/drivers/gpu/nova-core/dma.rs b/drivers/gpu/nova-core/dma.rs
deleted file mode 100644
index 3c19d5ffcfe8..000000000000
--- a/drivers/gpu/nova-core/dma.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-//! Simple DMA object wrapper.
-
-use core::ops::{
- Deref,
- DerefMut, //
-};
-
-use kernel::{
- device,
- dma::Coherent,
- page::PAGE_SIZE,
- prelude::*, //
-};
-
-pub(crate) struct DmaObject {
- dma: Coherent<[u8]>,
-}
-
-impl DmaObject {
- pub(crate) fn new(dev: &device::Device<device::Bound>, len: usize) -> Result<Self> {
- let len = core::alloc::Layout::from_size_align(len, PAGE_SIZE)
- .map_err(|_| EINVAL)?
- .pad_to_align()
- .size();
- let dma = Coherent::zeroed_slice(dev, len, GFP_KERNEL)?;
-
- Ok(Self { dma })
- }
-
- pub(crate) fn from_data(dev: &device::Device<device::Bound>, data: &[u8]) -> Result<Self> {
- let dma_obj = Self::new(dev, data.len())?;
- // 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.as_mut()[..data.len()].copy_from_slice(data) };
- Ok(dma_obj)
- }
-}
-
-impl Deref for DmaObject {
- type Target = Coherent<[u8]>;
-
- fn deref(&self) -> &Self::Target {
- &self.dma
- }
-}
-
-impl DerefMut for DmaObject {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.dma
- }
-}