diff options
| author | Eliot Courtney <ecourtney@nvidia.com> | 2026-03-18 13:07:12 +0900 |
|---|---|---|
| committer | Alexandre Courbot <acourbot@nvidia.com> | 2026-03-18 21:53:14 +0900 |
| commit | 9b786c7f630924fc3a6179b515e9d0d222d91c95 (patch) | |
| tree | 48b6a388e1fb704ba2043f3130170ba9fee650e5 /drivers/gpu/nova-core | |
| parent | c3bd240f97491122e3c9e9922def7e59eecd6145 (diff) | |
| download | linux-next-9b786c7f630924fc3a6179b515e9d0d222d91c95.tar.gz linux-next-9b786c7f630924fc3a6179b515e9d0d222d91c95.zip | |
gpu: nova-core: gsp: make `Cmdq` a pinned type
Make `Cmdq` a pinned type. This is needed to use Mutex, which is needed
to add locking to `Cmdq`.
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
Tested-by: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260318-cmdq-locking-v5-4-18b37e3f9069@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Diffstat (limited to 'drivers/gpu/nova-core')
| -rw-r--r-- | drivers/gpu/nova-core/gsp.rs | 5 | ||||
| -rw-r--r-- | drivers/gpu/nova-core/gsp/cmdq.rs | 9 |
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs index c69adaa92bbe..72f173726f87 100644 --- a/drivers/gpu/nova-core/gsp.rs +++ b/drivers/gpu/nova-core/gsp.rs @@ -114,6 +114,7 @@ pub(crate) struct Gsp { /// RM log buffer. logrm: LogBuffer, /// Command queue. + #[pin] pub(crate) cmdq: Cmdq, /// RM arguments. rmargs: CoherentAllocation<GspArgumentsPadded>, @@ -134,7 +135,7 @@ impl Gsp { loginit: LogBuffer::new(dev)?, logintr: LogBuffer::new(dev)?, logrm: LogBuffer::new(dev)?, - cmdq: Cmdq::new(dev)?, + cmdq <- Cmdq::new(dev), rmargs: CoherentAllocation::<GspArgumentsPadded>::alloc_coherent( dev, 1, @@ -151,7 +152,7 @@ impl Gsp { libos, [1]?, LibosMemoryRegionInitArgument::new("LOGINTR", &logintr.0) ); dma_write!(libos, [2]?, LibosMemoryRegionInitArgument::new("LOGRM", &logrm.0)); - dma_write!(rmargs, [0]?.inner, fw::GspArgumentsCached::new(cmdq)); + dma_write!(rmargs, [0]?.inner, fw::GspArgumentsCached::new(&cmdq)); dma_write!(libos, [3]?, LibosMemoryRegionInitArgument::new("RMARGS", rmargs)); }, })) diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs index 4fc14689d38e..86ff9a3d1732 100644 --- a/drivers/gpu/nova-core/gsp/cmdq.rs +++ b/drivers/gpu/nova-core/gsp/cmdq.rs @@ -446,6 +446,7 @@ struct GspMessage<'a> { /// /// Provides the ability to send commands and receive messages from the GSP using a shared memory /// area. +#[pin_data] pub(crate) struct Cmdq { /// Device this command queue belongs to. dev: ARef<device::Device>, @@ -479,13 +480,11 @@ impl Cmdq { pub(super) const RECEIVE_TIMEOUT: Delta = Delta::from_secs(5); /// Creates a new command queue for `dev`. - pub(crate) fn new(dev: &device::Device<device::Bound>) -> Result<Cmdq> { - let gsp_mem = DmaGspMem::new(dev)?; - - Ok(Cmdq { + pub(crate) fn new(dev: &device::Device<device::Bound>) -> impl PinInit<Self, Error> + '_ { + try_pin_init!(Self { + gsp_mem: DmaGspMem::new(dev)?, dev: dev.into(), seq: 0, - gsp_mem, }) } |
