[<prev] [next>] [day] [month] [year] [list]
Message-ID: <aXEF-ESjd5ouyXRq@sirena.org.uk>
Date: Wed, 21 Jan 2026 16:59:36 +0000
From: Mark Brown <broonie@...nel.org>
To: Alice Ryhl <aliceryhl@...gle.com>, Danilo Krummrich <dakr@...nel.org>
Cc: Deborah Brouwer <deborah.brouwer@...labora.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: linux-next: manual merge of the drm-rust tree with the drm-misc tree
Hi all,
Today's linux-next merge of the drm-rust tree got a conflict in:
drivers/gpu/drm/tyr/gpu.rs
between commit:
e005fd94e2e58 ("drm/tyr: rename pad0 to selected_coherency")
from the drm-misc tree and commit:
8304c44631c37 ("drm/tyr: use generated bindings for GpuInfo")
from the drm-rust 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 --git a/drivers/gpu/drm/tyr/gpu.rs b/drivers/gpu/drm/tyr/gpu.rs
index fb7ef71454021..6395ffcfdc57c 100644
--- a/drivers/gpu/drm/tyr/gpu.rs
+++ b/drivers/gpu/drm/tyr/gpu.rs
@@ -1,12 +1,15 @@
// SPDX-License-Identifier: GPL-2.0 or MIT
+use core::ops::Deref;
+use core::ops::DerefMut;
use kernel::bits::genmask_u32;
use kernel::device::Bound;
use kernel::device::Device;
use kernel::devres::Devres;
+use kernel::io::poll;
use kernel::platform;
use kernel::prelude::*;
-use kernel::time;
+use kernel::time::Delta;
use kernel::transmute::AsBytes;
use kernel::uapi;
@@ -19,29 +22,9 @@
/// # Invariants
///
/// - The layout of this struct identical to the C `struct drm_panthor_gpu_info`.
-#[repr(C)]
-pub(crate) struct GpuInfo {
- pub(crate) gpu_id: u32,
- pub(crate) gpu_rev: u32,
- pub(crate) csf_id: u32,
- pub(crate) l2_features: u32,
- pub(crate) tiler_features: u32,
- pub(crate) mem_features: u32,
- pub(crate) mmu_features: u32,
- pub(crate) thread_features: u32,
- pub(crate) max_threads: u32,
- pub(crate) thread_max_workgroup_size: u32,
- pub(crate) thread_max_barrier_size: u32,
- pub(crate) coherency_features: u32,
- pub(crate) texture_features: [u32; 4],
- pub(crate) as_present: u32,
- pub(crate) selected_coherency: u32,
- pub(crate) shader_present: u64,
- pub(crate) l2_present: u64,
- pub(crate) tiler_present: u64,
- pub(crate) core_features: u32,
- pub(crate) pad: u32,
-}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub(crate) struct GpuInfo(pub(crate) uapi::drm_panthor_gpu_info);
impl GpuInfo {
pub(crate) fn new(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result<Self> {
@@ -74,7 +57,7 @@ pub(crate) fn new(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result<Self> {
let l2_present = u64::from(regs::GPU_L2_PRESENT_LO.read(dev, iomem)?);
let l2_present = l2_present | u64::from(regs::GPU_L2_PRESENT_HI.read(dev, iomem)?) << 32;
- Ok(Self {
+ Ok(Self(uapi::drm_panthor_gpu_info {
gpu_id,
gpu_rev,
csf_id,
@@ -96,7 +79,8 @@ pub(crate) fn new(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result<Self> {
tiler_present,
core_features,
pad: 0,
- })
+ gpu_features: 0,
+ }))
}
pub(crate) fn log(&self, pdev: &platform::Device) {
@@ -155,6 +139,20 @@ pub(crate) fn pa_bits(&self) -> u32 {
}
}
+impl Deref for GpuInfo {
+ type Target = uapi::drm_panthor_gpu_info;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl DerefMut for GpuInfo {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+
// SAFETY: `GpuInfo`'s invariant guarantees that it is the same type that is
// already exposed to userspace by the C driver. This implies that it fulfills
// the requirements for `AsBytes`.
@@ -207,14 +205,13 @@ fn from(value: u32) -> Self {
pub(crate) fn l2_power_on(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result {
regs::L2_PWRON_LO.write(dev, iomem, 1)?;
- // TODO: We cannot poll, as there is no support in Rust currently, so we
- // sleep. Change this when read_poll_timeout() is implemented in Rust.
- kernel::time::delay::fsleep(time::Delta::from_millis(100));
-
- if regs::L2_READY_LO.read(dev, iomem)? != 1 {
- dev_err!(dev, "Failed to power on the GPU\n");
- return Err(EIO);
- }
+ poll::read_poll_timeout(
+ || regs::L2_READY_LO.read(dev, iomem),
+ |status| *status == 1,
+ Delta::from_millis(1),
+ Delta::from_millis(100),
+ )
+ .inspect_err(|_| dev_err!(dev, "Failed to power on the GPU."))?;
Ok(())
}
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists