Re: [RFC PATCH] drm: panthor: add dev_coredumpv support

From: Danilo Krummrich
Date: Fri Jul 12 2024 - 10:53:59 EST


On Fri, Jul 12, 2024 at 11:35:25AM -0300, Daniel Almeida wrote:
> Hi Steven, thanks for the review!
>
> >
> > This is defining the ABI to userspace and as such we'd need a way of
> > exporting this for userspace tools to use. The C approach is a header in
> > include/uabi. I'd also suggest making it obvious this enum can't be
> > rearranged (e.g. a comment, or assigning specific numbers). There's also
> > some ABI below which needs exporting in some way, along with some
> > documentation (comments may be sufficient) explaining how e.g.
> > header_size works.
> >
>
> I will defer this topic to others in the Rust for Linux community. I think this is the first time this scenario comes up in Rust code?
>
> FYI I am working on a tool in Mesa to decode the dump [0]. Since the tool is also written in Rust, and given the RFC nature of this patch, I just copied and pasted things for now, including panthor_regs.rs.
>
> IMHO, the solution here is to use cbindgen to automatically generate a C header to place in include/uapi. This will ensure that the header is in sync with the Rust code. I will do that in v2.

You could also just define those structures in a C header directly and use it
from Rust, can't you?