> -----Original Message----- > Sent: Saturday, April 12, 2025 11:17 AM > Subject: [PATCH] dmidecode: Use binary unit prefixes > > The SMBIOS 3.7.1 specification updated all unit size references to > comply with IEC 60027, that is, use binary prefixes (KiB, MiB...) to > express memory size instead of the inaccurate SI prefixes (kB, > MB...). Update the code to embrace this clarification. ...
> void dmi_print_memory_size(const char *attr, u64 code, int shift) > + "bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB" > @@ -331,7 +331,7 @@ static void dmi_bios_runtime_size(u32 co > + format = "%u KiB"; > static void dmi_bios_rom_size(u8 code1, u16 code2) > + "MiB", "GiB", out_of_spec, out_of_spec > @@ -1709,7 +1709,7 @@ static void dmi_memory_module_size(const > + pr_attr(attr, "%u MiB%s", 1 << (code & 0x7F), > @@ -2767,11 +2767,11 @@ static void dmi_memory_device_extended_s > + pr_attr("Size", "%lu MiB", (unsigned long)code); > + pr_attr("Size", "%lu GiB", (unsigned long)code >> 10); > + pr_attr("Size", "%lu TiB", (unsigned long)code >> 20); > static void dmi_memory_voltage_value(const char *attr, u16 code) > + pr_attr("Maximum Memory Module Size", "%u MiB", > + pr_attr("Maximum Total Memory Size", "%u MiB", As discussed in 2018, I still think it'd be good to have a generic helper that selects the biggest unit size without rounding and use that for all the size prints. See https://lists.gnu.org/archive/html/dmidecode-devel/2018-12/msg00005.html Make any unexpected values be more obvious.