drm/panfrost: Give name to anonymous coredump object union
Subsystems (3)
Adrián Larumbe
maintainerPATCH 1/1 drm/panfrost: Give name to anonymous coredump object union
Building Mesa's Perfetto requires including the panfrost drm uAPI header in C++ code, but the C++ compiler requires anonymous unions to have only public non-static data members.
Commit 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.
Give it a name, and also rename pan_reg_hdr structure because it will always be prefixed by the union name.
--- drivers/gpu/drm/panfrost/panfrost_dump.c | 20 ++++++++++---------- include/uapi/drm/panfrost_drm.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/panfrost/panfrost_dump.c +10 -10
@@ -177,11 +177,11 @@ void panfrost_core_dump(struct panfrost_job *job)* For now, we write the job identifier in the register dump header, * so that we can decode the entire dump later with pandecode */ - iter.hdr->reghdr.jc =cpu_to_le64 (job->jc); - iter.hdr->reghdr.major =cpu_to_le32 (PANFROSTDUMP_MAJOR ); - iter.hdr->reghdr.minor =cpu_to_le32 (PANFROSTDUMP_MINOR ); - iter.hdr->reghdr.gpu_id =cpu_to_le32 (pfdev->features.id); - iter.hdr->reghdr.nbos =cpu_to_le64 (job->bo_count); + iter.hdr->pan_hdr.regs.jc =cpu_to_le64 (job->jc); + iter.hdr->pan_hdr.regs.major =cpu_to_le32 (PANFROSTDUMP_MAJOR ); + iter.hdr->pan_hdr.regs.minor =cpu_to_le32 (PANFROSTDUMP_MINOR ); + iter.hdr->pan_hdr.regs.gpu_id =cpu_to_le32 (pfdev->features.id); + iter.hdr->pan_hdr.regs.nbos =cpu_to_le64 (job->bo_count);panfrost_core_dump_registers (&iter, pfdev, as_nr, slot);
@@ -205,20 +205,20 @@ void panfrost_core_dump(struct panfrost_job *job)if (!bo->base.sgt) {dev_err (pfdev->dev,"Panfrost Dump: BO has no sgt, cannot dump\n" ); - iter.hdr->bomap.valid =0 ; + iter.hdr->pan_hdr.bomap.valid =0 ; goto dump_header; } ret =drm_gem_shmem_vmap (&bo->base, &map);if (ret) {dev_err (pfdev->dev,"Panfrost Dump: couldn't map Buffer Object\n" ); - iter.hdr->bomap.valid =0 ; + iter.hdr->pan_hdr.bomap.valid =0 ; goto dump_header; }WARN_ON (!mapping->active); - iter.hdr->bomap.data[0 ] =cpu_to_le32 ((bomap - bomap_start)); + iter.hdr->pan_hdr.bomap.data[0 ] =cpu_to_le32 ((bomap - bomap_start));for_each_sgtable_page (bo->base.sgt, &page_iter,0 ) {struct page *page =sg_page_iter_page (&page_iter);
@@ -231,14 +231,14 @@ void panfrost_core_dump(struct panfrost_job *job) } } - iter.hdr->bomap.iova =cpu_to_le64 (mapping->mmnode.start <<PAGE_SHIFT ); + iter.hdr->pan_hdr.bomap.iova =cpu_to_le64 (mapping->mmnode.start <<PAGE_SHIFT ); vaddr = map.vaddr;memcpy (iter.data, vaddr, bo->base.base.size);drm_gem_shmem_vunmap (&bo->base, &map); - iter.hdr->bomap.valid =cpu_to_le32 (1 ); + iter.hdr->pan_hdr.bomap.valid =cpu_to_le32 (1 ); dump_header:panfrost_core_dump_header (&iter,PANFROSTDUMP_BUF_BO , iter.data + bo->base.base.size);
include/uapi/drm/panfrost_drm.h +2 -2
@@ -248,7 +248,7 @@ struct panfrost_dump_object_header {__le32 major;__le32 minor;__le64 nbos; - } reghdr; + } regs;struct pan_bomap_hdr {__le32 valid;
@@ -262,7 +262,7 @@ struct panfrost_dump_object_header {*/ __le32 sizer[496 ]; - }; + } pan_hdr; };/* Registers object, an array of these */
Signature · 1 line
2.37.0
Have we checked that this actually fixes the Mesa build? If so, R-b.
Quoted 9 lines
Commit
730c2bf4ad39("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.Give it a name, and also rename
pan_reg_hdrstructure because it will always be prefixed by the union name.Signed-off-by Adri??n Larumbe <[email protected]>
In Mesa, we would add a trailer "Fixes: 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")". If the kernel does the same (I don't remember), we should do that here, seeing as the panfrost uapi headers do need to build as C++.
Steven Price
maintainerQuoted 7 lines · Adrián Larumbe
Building Mesa's Perfetto requires including the panfrost drm uAPI header in C++ code, but the C++ compiler requires anonymous unions to have only public non-static data members.
Commit
730c2bf4ad39("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.
Quoted 6 lines
Give it a name, and also rename
pan_reg_hdrstructure because it will always be prefixed by the union name.Signed-off-by Adrián Larumbe <[email protected]>
Ouch! It's frustrating how C++ isn't quite a superset of C. However I think we can solve this with a simpler patch, I'd appreciate testing that this does indeed fix the build issues with Mesa with all supported compilers (I'm not so familiar with C++):
----8<----
From 492714a7dff0710ac5b8b457bcfe9ae52b458565 Mon Sep 17 00:00:00 2001
From: Steven Price <[email protected]>
Date: Tue, 13 Sep 2022 09:37:55 +0100
Subject: [PATCH] drm/panfrost: Remove type name from internal structs
The two structs internal to struct panfrost_dump_object_header were named, but sadly that is incompatible with C++, causing an error: "an anonymous union may only have public non-static data members".
However nothing refers to struct pan_reg_hdr and struct pan_bomap_hdr and there's no need to export these definitions, so lets drop them. This fixes the C++ build error with the minimum change in userspace API.
--- include/uapi/drm/panfrost_drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/include/uapi/drm/panfrost_drm.h
index eac87310b348..bd77254be121 100644
include/uapi/drm/panfrost_drm.h +2 -2
@@ -242,7 +242,7 @@ struct panfrost_dump_object_header {__le32 file_offset; union { - struct pan_reg_hdr { + struct { __le64 jc; __le32 gpu_id; __le32 major;
@@ -250,7 +250,7 @@ struct panfrost_dump_object_header {__le64 nbos; } reghdr; -struct pan_bomap_hdr { +struct {__le32 valid;__le64 iova;__le32 data[2 ];
Signature · 1 line
2.34.1
Adrián Larumbe
maintainerHi Steven,
Quoted 11 lines · Steven Price
Quoted 10 lines · Adrián Larumbe
Building Mesa's Perfetto requires including the panfrost drm uAPI header in C++ code, but the C++ compiler requires anonymous unions to have only public non-static data members.
Commit
730c2bf4ad39("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.Give it a name, and also rename
pan_reg_hdrstructure because it will always be prefixed by the union name.
Quoted 8 lines
Quoted 3 lines
Signed-off-by Adrián Larumbe <[email protected]>Ouch! It's frustrating how C++ isn't quite a superset of C. However I think we can solve this with a simpler patch, I'd appreciate testing that this does indeed fix the build issues with Mesa with all supported compilers (I'm not so familiar with C++):
I just tested your changes on Mesa and they do fix the build.
Quoted 46 lines
----8<----
From492714a7dff0710ac5b8b457bcfe9ae52b458565Mon Sep 17 00:00:00 2001
From: Steven Price <[email protected]>
Date: Tue, 13 Sep 2022 09:37:55 +0100
Subject: [PATCH] drm/panfrost: Remove type name from internal structsThe two structs internal to struct
panfrost_dump_object_headerwere named, but sadly that is incompatible with C++, causing an error: "an anonymous union may only have public non-static data members".However nothing refers to struct
pan_reg_hdrand structpan_bomap_hdrand there's no need to export these definitions, so lets drop them. This fixes the C++ build error with the minimum change in userspace API.Fixes 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")Signed-off-by Steven Price <[email protected]>---
include/uapi/drm/panfrost_drm.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)include/uapi/drm/panfrost_drm.h +2
-2@@ -242,7 +242,7 @@ struct panfrost_dump_object_header {__le32 file_offset; union { - struct pan_reg_hdr { + struct { __le64 jc; __le32 gpu_id; __le32 major;@@ -250,7 +250,7 @@ struct panfrost_dump_object_header {__le64 nbos; } reghdr; -struct pan_bomap_hdr { +struct {__le32 valid;__le64 iova;__le32 data[2 ];Signature · 1 line
2.34.1
Steven Price
maintainerQuoted 16 lines · Adrián Larumbe
Hi Steven,
Quoted 13 lines · Steven Price
Quoted 12 lines · Adrián Larumbe
Building Mesa's Perfetto requires including the panfrost drm uAPI header in C++ code, but the C++ compiler requires anonymous unions to have only public non-static data members.
Commit
730c2bf4ad39("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.Give it a name, and also rename
pan_reg_hdrstructure because it will always be prefixed by the union name.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Adrián Larumbe <[email protected]>Ouch! It's frustrating how C++ isn't quite a superset of C. However I think we can solve this with a simpler patch, I'd appreciate testing that this does indeed fix the build issues with Mesa with all supported compilers (I'm not so familiar with C++):
I just tested your changes on Mesa and they do fix the build.
Thanks Adrián!
Alyssa: Could you give your R-b if you're happy with this change? It would be good to get this fixed before it hits -rc1.
Thanks,
Steve
Quoted 47 lines
Quoted 47 lines
----8<----
From492714a7dff0710ac5b8b457bcfe9ae52b458565Mon Sep 17 00:00:00 2001
From: Steven Price <[email protected]>
Date: Tue, 13 Sep 2022 09:37:55 +0100
Subject: [PATCH] drm/panfrost: Remove type name from internal structsThe two structs internal to struct
panfrost_dump_object_headerwere named, but sadly that is incompatible with C++, causing an error: "an anonymous union may only have public non-static data members".However nothing refers to struct
pan_reg_hdrand structpan_bomap_hdrand there's no need to export these definitions, so lets drop them. This fixes the C++ build error with the minimum change in userspace API.Fixes 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")Signed-off-by Steven Price <[email protected]>---
include/uapi/drm/panfrost_drm.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)include/uapi/drm/panfrost_drm.h +2
-2@@ -242,7 +242,7 @@ struct panfrost_dump_object_header {__le32 file_offset; union { - struct pan_reg_hdr { + struct { __le64 jc; __le32 gpu_id; __le32 major;@@ -250,7 +250,7 @@ struct panfrost_dump_object_header {__le64 nbos; } reghdr; -struct pan_bomap_hdr { +struct {__le32 valid;__le64 iova;__le32 data[2 ];Signature · 1 line
2.34.1
Quoted 24 lines · Steven Price
Quoted 23 lines · Adri??n Larumbe
Hi Steven,
Quoted 19 lines · Steven Price
Quoted 7 lines · Adri??n Larumbe
Building Mesa's Perfetto requires including the panfrost drm uAPI header in C++ code, but the C++ compiler requires anonymous unions to have only public non-static data members.
Commit
730c2bf4ad39("drm/panfrost: Add support for devcoredump") introduces one such union, breaking the Mesa build.Quoted 6 lines
Give it a name, and also rename
pan_reg_hdrstructure because it will always be prefixed by the union name.Signed-off-by Adri??n Larumbe <[email protected]>Ouch! It's frustrating how C++ isn't quite a superset of C. However I think we can solve this with a simpler patch, I'd appreciate testing that this does indeed fix the build issues with Mesa with all supported compilers (I'm not so familiar with C++):
Quoted 6 lines
Quoted 1 line
I just tested your changes on Mesa and they do fix the build.
Thanks Adri??n!
Alyssa: Could you give your R-b if you're happy with this change? It would be good to get this fixed before it hits -rc1.
R-b, however the issue isn't totally gone: in a separate but related issue, apparently the __le types aren't portable and the devcoredump support has now broken the panfrost (mesa) build for FreeBSD, which has a UAPI-compatible reimplementation of panfrost.ko ...
Do we maybe want to change all the __le to u at the same time? If we have to break UAPI, better do it before the UAPI is actually merged. Panfrost is probably broken in far worse ways on big endian anyway. Or maybe we want to keep doing little-endian but in u32 containers and have conversions in the kernel for big-endian CPUs. Or maybe we want to just "we don't care about big endian, because you'll have worse problems", at a GPU level Mali hasn't supported big endian since Midgard so I doubt the recent DDKs would work on BE either.
Anyway, ideally we'd solve both at once, and soon, so we don't have to revert the devcoredump stuff from mesa.
Thanks,
Alyssa
Adrián Larumbe
maintainerPATCH 1/2 drm/panfrost: Remove type name from internal structs
From: Steven Price <[email protected]>
The two structs internal to struct panfrost_dump_object_header were named, but sadly that is incompatible with C++, causing an error: "an anonymous union may only have public non-static data members".
However nothing refers to struct pan_reg_hdr and struct pan_bomap_hdr and there's no need to export these definitions, so lets drop them. This fixes the C++ build error with the minimum change in userspace API.
--- include/uapi/drm/panfrost_drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/drm/panfrost_drm.h +2 -2
@@ -242,7 +242,7 @@ struct panfrost_dump_object_header {__le32 file_offset; union { - struct pan_reg_hdr { + struct { __le64 jc; __le32 gpu_id; __le32 major;
@@ -250,7 +250,7 @@ struct panfrost_dump_object_header {__le64 nbos; } reghdr; -struct pan_bomap_hdr { +struct {__le32 valid;__le64 iova;__le32 data[2 ];
Signature · 1 line
2.37.0
Adrián Larumbe
maintainerPATCH 2/2 drm/panfrost: replace endian-specific types with generic ones
__le32 and __l64 endian-specific types aren't portable and not available on FreeBSD, for which there's a uAPI compatible reimplementation of Panfrost.
Replace these specific types with more generic unsigned ones, to prevent FreeBSD Mesa build errors.
--- include/uapi/drm/panfrost_drm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
include/uapi/drm/panfrost_drm.h +15 -15
@@ -236,24 +236,24 @@ struct drm_panfrost_madvise {#define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1)struct panfrost_dump_object_header { -__le32 magic; -__le32 type; -__le32 file_size; -__le32 file_offset; +__u32 magic; +__u32 type; +__u32 file_size; +__u32 file_offset;union {struct { -__le64 jc; -__le32 gpu_id; -__le32 major; -__le32 minor; -__le64 nbos; +__u64 jc; +__u32 gpu_id; +__u32 major; +__u32 minor; +__u64 nbos; } reghdr;struct { -__le32 valid; -__le64 iova; -__le32 data[2 ]; +__u32 valid; +__u64 iova; +__u32 data[2 ]; } bomap;/*
@@ -261,14 +261,14 @@ struct panfrost_dump_object_header {* with new fields and also keep it 512-byte aligned */ -__le32 sizer[496 ]; +__u32 sizer[496 ]; }; };/* Registers object, an array of these */ struct panfrost_dump_registers { -__le32 reg; -__le32 value; +__u32 reg; +__u32 value; };#if defined(__cplusplus)
Signature · 1 line
2.37.0
Re: [PATCH 2/2] drm/panfrost: replace endian-specific types with generic ones
Tentative r-b, but we *do* need to make a decision on how we want to handle endianness. I don't have strong feelings but the results of that discussion should go in the commit message.
Quoted 75 lines · Adri??n Larumbe
__le32and__l64endian-specific types aren't portable and not available on FreeBSD, for which there's a uAPI compatible reimplementation of Panfrost.Replace these specific types with more generic unsigned ones, to prevent FreeBSD Mesa build errors.
Fixes 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")Signed-off-by Adri??n Larumbe <[email protected]>--- include/uapi/drm/panfrost_drm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)include/uapi/drm/panfrost_drm.h +15
-15@@ -236,24 +236,24 @@ struct drm_panfrost_madvise {#define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1)struct panfrost_dump_object_header { -__le32 magic; -__le32 type; -__le32 file_size; -__le32 file_offset; +__u32 magic; +__u32 type; +__u32 file_size; +__u32 file_offset;union {struct { -__le64 jc; -__le32 gpu_id; -__le32 major; -__le32 minor; -__le64 nbos; +__u64 jc; +__u32 gpu_id; +__u32 major; +__u32 minor; +__u64 nbos; } reghdr;struct { -__le32 valid; -__le64 iova; -__le32 data[2 ]; +__u32 valid; +__u64 iova; +__u32 data[2 ]; } bomap;/* @@ -261,14 +261,14 @@ struct panfrost_dump_object_header {* with new fields and also keep it 512-byte aligned */ -__le32 sizer[496 ]; +__u32 sizer[496 ]; }; };/* Registers object, an array of these */ struct panfrost_dump_registers { -__le32 reg; -__le32 value; +__u32 reg; +__u32 value; };#if defined(__cplusplus)Signature · 1 line
2.37.0
Steven Price
maintainerRe: [PATCH 2/2] drm/panfrost: replace endian-specific types with generic ones
Quoted 3 lines · Alyssa Rosenzweig
Tentative r-b, but we *do* need to make a decision on how we want to handle endianness. I don't have strong feelings but the results of that discussion should go in the commit message.
Linux currently treats the dump objects specially - the headers are little endian. All the other (Panfrost) DRM structures are native endian (although I doubt anyone has tested it so I expect bugs). I've no particularly strong views on this, but since the dump objects are likely to be saved to disk and transferred between computers it makes sense to fix the endianness for those. The __le types currently mean sparse can warn if we screw up in the kernel, so it would be a shame to lose that type checking.
Another option would be to extend the list of typedefs in include/uapi/drm/drm.h to include the __le types. We'd need wider buy-in for that change though.
Finally etnaviv 'solves' the issue by not including the dump structures in the UABI header...
Or of course we could just actually use native endian and detect from the magic which endian is in use. That would require ripping out the cpu_to_lexx() calls in Linux and making the user space tool more intelligent. I'm happy with that, but it's pushing the complexity onto Mesa.
Steve
Quoted 76 lines · Adri??n Larumbe
Quoted 75 lines
__le32and__l64endian-specific types aren't portable and not available on FreeBSD, for which there's a uAPI compatible reimplementation of Panfrost.Replace these specific types with more generic unsigned ones, to prevent FreeBSD Mesa build errors.
Fixes 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")Signed-off-by Adri??n Larumbe <[email protected]>--- include/uapi/drm/panfrost_drm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)include/uapi/drm/panfrost_drm.h +15
-15@@ -236,24 +236,24 @@ struct drm_panfrost_madvise {#define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1)struct panfrost_dump_object_header { -__le32 magic; -__le32 type; -__le32 file_size; -__le32 file_offset; +__u32 magic; +__u32 type; +__u32 file_size; +__u32 file_offset;union {struct { -__le64 jc; -__le32 gpu_id; -__le32 major; -__le32 minor; -__le64 nbos; +__u64 jc; +__u32 gpu_id; +__u32 major; +__u32 minor; +__u64 nbos; } reghdr;struct { -__le32 valid; -__le64 iova; -__le32 data[2 ]; +__u32 valid; +__u64 iova; +__u32 data[2 ]; } bomap;/* @@ -261,14 +261,14 @@ struct panfrost_dump_object_header {* with new fields and also keep it 512-byte aligned */ -__le32 sizer[496 ]; +__u32 sizer[496 ]; }; };/* Registers object, an array of these */ struct panfrost_dump_registers { -__le32 reg; -__le32 value; +__u32 reg; +__u32 value; };#if defined(__cplusplus)Signature · 1 line
2.37.0
Re: [PATCH 2/2] drm/panfrost: replace endian-specific types with generic ones
Quoted 8 lines · Steven Price
Quoted 3 lines · Alyssa Rosenzweig
Tentative r-b, but we *do* need to make a decision on how we want to handle endianness. I don't have strong feelings but the results of that discussion should go in the commit message.
Linux currently treats the dump objects specially - the headers are little endian. All the other (Panfrost) DRM structures are native endian (although I doubt anyone has tested it so I expect bugs).
If there can be *any* native-endian data included in the dump, then the original endianness needs to be recorded to be able to analyse it correctly anyway. The dumping code can't know the granularity at which arbitrary BOs may or may not need to be byteswapped to make everything consistently LE.
Quoted 11 lines
I've no
particularly strong views on this, but since the dump objects are likely to be saved to disk and transferred between computers it makes sense to fix the endianness for those. The__letypes currently mean sparse can warn if we screw up in the kernel, so it would be a shame to lose that type checking.Another option would be to extend the list of typedefs in
include/uapi/drm/drm.hto include the__letypes. We'd need wider buy-in for that change though.
Quoted 7 lines
Finally etnaviv 'solves' the issue by not including the dump structures in the UABI header...
Or of course we could just actually use native endian and detect from the magic which endian is in use. That would require ripping out the
cpu_to_lexx()calls in Linux and making the user space tool more intelligent. I'm happy with that, but it's pushing the complexity onto Mesa.
If there's a clearly identifiable header, then I'd say making the whole dump native-endian is probably the way to go. Unless and until anyone actually demands to be able to do cross-endian post-mortem GPU debugging, the realistic extent of the complexity in Mesa is that it doesn't recognise the foreign dump format and gives up, which I assume is already implemented :)
Cheers,
Robin.
Quoted 80 lines
Steve
Quoted 76 lines · Adri??n Larumbe
Quoted 75 lines
__le32and__l64endian-specific types aren't portable and not available on FreeBSD, for which there's a uAPI compatible reimplementation of Panfrost.Replace these specific types with more generic unsigned ones, to prevent FreeBSD Mesa build errors.
Fixes 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")Signed-off-by Adri??n Larumbe <[email protected]>--- include/uapi/drm/panfrost_drm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)include/uapi/drm/panfrost_drm.h +15
-15@@ -236,24 +236,24 @@ struct drm_panfrost_madvise {#define PANFROSTDUMP_BUF_TRAILER (PANFROSTDUMP_BUF_BO + 1)struct panfrost_dump_object_header { -__le32 magic; -__le32 type; -__le32 file_size; -__le32 file_offset; +__u32 magic; +__u32 type; +__u32 file_size; +__u32 file_offset;union {struct { -__le64 jc; -__le32 gpu_id; -__le32 major; -__le32 minor; -__le64 nbos; +__u64 jc; +__u32 gpu_id; +__u32 major; +__u32 minor; +__u64 nbos; } reghdr;struct { -__le32 valid; -__le64 iova; -__le32 data[2 ]; +__u32 valid; +__u64 iova; +__u32 data[2 ]; } bomap;/* @@ -261,14 +261,14 @@ struct panfrost_dump_object_header {* with new fields and also keep it 512-byte aligned */ -__le32 sizer[496 ]; +__u32 sizer[496 ]; }; };/* Registers object, an array of these */ struct panfrost_dump_registers { -__le32 reg; -__le32 value; +__u32 reg; +__u32 value; };#if defined(__cplusplus)Signature · 1 line
2.37.0
Re: [PATCH 2/2] drm/panfrost: replace endian-specific types with generic ones
Quoted 10 lines
Quoted 4 lines
Or of course we could just actually use native endian and detect from the magic which endian is in use. That would require ripping out the
cpu_to_lexx()calls in Linux and making the user space tool more intelligent. I'm happy with that, but it's pushing the complexity onto Mesa.If there's a clearly identifiable header, then I'd say making the whole dump native-endian is probably the way to go. Unless and until anyone actually demands to be able to do cross-endian post-mortem GPU debugging, the realistic extent of the complexity in Mesa is that it doesn't recognise the foreign dump format and gives up, which I assume is already implemented :)
+1 to this solution. Gets the complexity out of both kernel and Mesa, and in the vanishingly unlikely scenario that we need this functionality, we can add it to Mesa without kernel changes. As mesa panfrost maintainer I'll take those odds :+1: