Re: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules

Nícolas F. R. A. Prado
2024-02-01T22:45:26Z

On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote:
> On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote:
> > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote:
> > > > "Don't you want to have a driver data or so associated with this?"
> > ...
> > > But why limit yourself to 32bits now? Why not make it 64? It is going
> > > to be sent to userspace, so you have to be very careful about it.
> >
> > Is that question related to the question I pasted/replied to, about
> > driver data? Or a new topic? Sorry if I'm misunderstanding.
>
> Same question, driver data, you make it 32 bits.
>
> > Anyway, for the size of the tag field: I don't have a strong opinion.
> > But FWIW, they're coming from this project:
> >
> > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36
> >
> > As you can see there, we're extremely far from exhausting 16 bits, let alone 32.
>
> We've run into running out of bits in other subsystems before, it's
> "free" now, just be safe and make it 64 like I think Andy is suggesting.

Either you and Andy are suggesting different things, or I still don't quite get
what you mean.

Andy was suggesting we added a driver_data field, that is:

struct coreboot_device_id {
__u32 tag;
kernel_ulong_t driver_data;
};

You're suggesting we make the tag 64 bits long:

struct coreboot_device_id {
__u64 tag;
};

Like Brian, I'm not sure I see the benefit of either change. As he said, it's
unlikely that having a driver_data would provide any benefit and won't ever be
required anyway, and 32 bits is already a generous space to give to coreboot
tags. That said, I'm also not against either change, and can apply both of them
to the next version if that's indeed what your experience says will work best.
I'll wait another week or so before following up though to make sure we're all
on the same page.

(To be honest I also still don't see how this struct makes it to userspace and
is considered ABI, I only see the generated modalias being ABI and hence 32 vs
64 bit tag is ABI breakage but not adding driver_data, but I'll take your word
for it for now)

Thanks,
Nícolas