[PATCH 1/2 v2] smbios: Simplify reporting of unknown values

Tom Rini trini at konsulko.com
Wed Dec 20 21:05:29 CET 2023


On Wed, Dec 20, 2023 at 10:32:26AM -0700, Simon Glass wrote:
> Hi Peter,
> 
> On Tue, 19 Dec 2023 at 13:40, Peter Robinson <pbrobinson at gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Mon, Dec 18, 2023 at 3:02 PM Simon Glass <sjg at chromium.org> wrote:
> > >
> > > Hi Ilias,
> > >
> > > On Wed, 6 Dec 2023 at 04:36, Ilias Apalodimas
> > > <ilias.apalodimas at linaro.org> wrote:
> > > >
> > > > [...]
> > > >
> > > > >
> > > > >>
> > > > >> >                 str = "Unknown";
> > > > >> >
> > > > >> >         for (;;) {
> > > > >> > @@ -151,8 +151,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
> > > > >> >                 const char *str;
> > > > >> >
> > > > >> >                 str = ofnode_read_string(ctx->node, prop);
> > > > >> > -               if (str)
> > > > >> > -                       return smbios_add_string(ctx, str);
> > > > >> > +               return smbios_add_string(ctx, str);
> > > > >> >         }
> > > > >> >
> > > > >> >         return 0;
> > > > >> > @@ -231,7 +230,7 @@ static int smbios_write_type0(ulong *current, int handle,
> > > > >> >         t->vendor = smbios_add_string(ctx, "U-Boot");
> > > > >> >
> > > > >> >         t->bios_ver = smbios_add_prop(ctx, "version");
> > > > >> > -       if (!t->bios_ver)
> > > > >> > +       if (!strcmp(ctx->last_str, "Unknown"))
> > > > >>
> > > > >> That is really ugly...checking the ctx value looking for a side effect.
> > > > >>
> > > > >> Can you not have smbios_add_prop() continue to return NULL in this case?
> > > > >
> > > > >
> > > > > Hmm I don't know, but I wonder why I am not just checking t->bios_ver for Unknown.
> > > > > I'll have a look and change it
> > > >
> > > > Ok, this can't be changed as easily.  smbios_add_prop() will not
> > > > return NULL in any case. It returns an integer. With the cleanup, it
> > > > will always writes 'Uknown' and not return 0 anymore.
> > > > I can add that default value you suggested but the ctx->last_str is
> > > > still used on the next line anyway.
> > >
> > > Would you mind if I tried to create a version of the patch which does
> > > the same thing but with less code, and perhaps a test? It might be
> > > easier to discuss it then. I can't claim to understand all the
> > > different code paths at this point.
> > >
> > > My main concern is that with so many code paths it will be hard even
> > > to refactor the code in the future, since it will become
> > > 'load-bearing' and anyone might turn up and say it breaks their board
> > > because different information is provided.
> >
> > I don't buy this argument at all, sorry.
> 
> OK.
> 
> >
> > > Overall, so long as the information isn't used for anything important
> > > in userspace, and we find a way to report SMBIOS to Linux without EFI,
> >
> > No, you can't tie random requirements to improving the SMBIOS support.
> > We *already* report SMBIOS to Linux, reporting SMBIOS to Linux without
> > EFI is changing things that will need different or extra standards,
> > that could take years.
> >
> > You are arbitrarily adding extra requirements just to suite yourself,
> > please STOP trying to hold things like this hostage.
> 
> Isn't that what is happening with Linux and ffi? My understanding is
> that there is no way to pass SMBIOS to Linux without EFI. Is that
> correct? I know some people at their wit's end about that.
> 
> You may know that I have tried for years to get bindings upstream to
> Linux....right now there is a reserved-memory binding which has been
> held up for longer than I can remember, because of EFI. How about a
> little give and take?

You aren't actually saying that since some patches are being held up by
"but what about EFI?" you're trying to hold this up as retaliation with
"but what about without EFI?". Right? And aside, I can point you at
other people that got fed up with trying to make ARM+(EFI+ACPI) work
because the feedback was "but what about DT?".

> > > it is OK to enable this feature (with a new Kconfig so it can be
> > > disabled). But there is already authoritative info in the DT, so this
> >
> > There is two types of information in DT, the smbios "entries" in DT
> > are not standardised in the dtschema and in most cases they're
> > unnecessarily replicating data ALREADY in DT which is being produced
> > automatically with these patches, making it zero effort for vendors to
> > produce.
> >
> > > transformation into SMBIOS really should just be used for user
> > > display, etc., not for anything which affects operation of the device.
> >
> > Well SMBIOS tables are used for a number of different things already
> > in the kernel.
> >
> > > Do you agree? If you do, how to ensure that? Perhaps a special string
> > > in the table like 'GENERATED'?
> >
> > Nope, I do not agree, at all.
> 
> OK, well there it is.
> 
> Anyway, as I said, I am happy for this to go in with a Kconfig
> controlling it (so it can be enabled/disabled). Then SoCs that don't
> want to go to the bother of adding authoritative info can just enable
> this Kconfig.
> 
> I would very much like to see some signal that it is not
> authoritative. That should not be a big imposition.

Lets try a different track here. We've had 3 years now of the
u-boot,sysinfo-smbios binding now. And there's been 14 ARM platforms
that tried to fill it out. With Ilias' series, now there's a much larger
chance that someone will see values populated and want to update them,
rather than "Unknown" and assume there's no way to have them populated.

> For my own interest, I would like to understand what actually uses it
> as I suspect it is just for display. The two programs I managed to
> find both handle devicetree and don't need SMBIOS.

Please re-read the examples where people have already explained where
they're used, today.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231220/d445c11f/attachment.sig>


More information about the U-Boot mailing list