[PATCH v4 07/12] drm/panthor: Keep size and VA in FW section obj
From: Ketil Johnsen
Date: Mon Oct 12 2026 - 09:10:59 EST
From: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
Keep a copy of the FW section size and VA in the
panthor_fw_section object. We need this in the future when handling
late init of protected memory for FW sections of type
CSF_FW_BINARY_IFACE_ENTRY_PROT.
Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
Co-developed-by: Ketil Johnsen <ketil.johnsen@xxxxxxx>
Signed-off-by: Ketil Johnsen <ketil.johnsen@xxxxxxx>
---
v4:
- First version of this change as a separate commit
---
drivers/gpu/drm/panthor/panthor_fw.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 7b8c90b19f4fe..fc07796fc9ef7 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -198,6 +198,12 @@ struct panthor_fw_section {
/** @size: Size of @buf in bytes. */
size_t size;
} data;
+
+ /** @size: Section size. */
+ size_t size;
+
+ /** @va: Section VA. */
+ u32 va;
};
#define CSF_MCU_SHARED_REGION_START 0x04000000ULL
@@ -669,18 +675,21 @@ static int panthor_fw_load_section_entry(struct panthor_device *ptdev,
section->name = name;
}
+ section->size = section_size;
+ section->va = hdr.va.start;
+
if (section_size) {
u32 vm_map_flags = section_vm_map_flags(section);
- u64 va = hdr.va.start;
- section->mem = panthor_kernel_bo_create(ptdev, panthor_fw_vm(ptdev),
- section_size,
- DRM_PANTHOR_BO_NO_MMAP,
- vm_map_flags, va, "FW section");
+ section->mem = panthor_kernel_bo_create(
+ ptdev, panthor_fw_vm(ptdev), section->size,
+ DRM_PANTHOR_BO_NO_MMAP, vm_map_flags, section->va,
+ "FW section");
if (IS_ERR(section->mem))
return PTR_ERR(section->mem);
- if (drm_WARN_ON(&ptdev->base, section->mem->va_node.start != hdr.va.start))
+ if (drm_WARN_ON(&ptdev->base,
+ section->mem->va_node.start != section->va))
return -EINVAL;
if (section->flags & CSF_FW_BINARY_IFACE_ENTRY_SHARED) {
--
2.43.0