[PATCH v4 17/20] drm/tyr: validate presence of CSF shared section
From: Deborah Brouwer
Date: Fri Apr 24 2026 - 19:45:23 EST
The firmware binary must have a shared section for communicating with
the MCU. Check for this section after parsing and fail with -EINVAL if it
is missing.
Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
---
drivers/gpu/drm/tyr/fw/parser.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/tyr/fw/parser.rs b/drivers/gpu/drm/tyr/fw/parser.rs
index 638707430701..0be3b740ea65 100644
--- a/drivers/gpu/drm/tyr/fw/parser.rs
+++ b/drivers/gpu/drm/tyr/fw/parser.rs
@@ -175,6 +175,19 @@ pub(super) fn parse(&mut self) -> Result<KVec<ParsedSection>> {
}
}
+ // Validate that the firmware contains the required shared memory section.
+ let has_shared_section = parsed_sections
+ .iter()
+ .any(|section| section.va.start == super::CSF_MCU_SHARED_REGION_START);
+
+ if !has_shared_section {
+ pr_err!(
+ "No shared section found at 0x{:08x} in firmware\n",
+ super::CSF_MCU_SHARED_REGION_START
+ );
+ return Err(EINVAL);
+ }
+
Ok(parsed_sections)
}
--
2.53.0