linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.42k stars 185 forks source link

Heads' System Information is x86 centric #1220

Open tlaurion opened 2 years ago

tlaurion commented 2 years ago

`2022-09-26-150328

Missing above:


macpijan commented 2 years ago

@SergiiDmytruk Can /proc/cpuinfo content depend on what we put in the firmware?

Do you have any more suggestions on getting the CPU info here?

SergiiDmytruk commented 2 years ago

Can /proc/cpuinfo content depend on what we put in the firmware?

It probably can to some extend (e.g., if it comes from device tree), but /proc contents can also be arch-specific.

tlaurion commented 2 years ago

@SergiiDmytruk "pvr 004e 1201" relates to the model, while model here is populated with motherboard information.

~ # cat  /proc/cpuinfo 
processor   : 0
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 1
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 2
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 3
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 4
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 5
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 6
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 7
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 8
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 9
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 10
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 11
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 12
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 13
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 14
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

processor   : 15
cpu     : POWER9, altivec supported
clock       : 2500.000000MHz
revision    : 2.1 (pvr 004e 1201)

timebase    : 512000000
platform    : PowerNV
model       : T2P9D01 REV 1.00
machine     : PowerNV T2P9D01 REV 1.00
firmware    : OPAL
MMU     : Radix
krystian-hebel commented 2 years ago

CPU model can't be done through /proc/cpuinfo, at least without patches to Linux:

Also, what would be printed if there were two different CPU models installed? :thinking:

As for FW_VER, there is some kind of information in device tree, it should be obtainable through sysfs. However, it is read from PNOR version partition and isn't reported correctly for coreboot, because possible entries are hardcoded in Skiboot (and few other components, but these shouldn't be too much of a problem for coreboot). We haven't decided on how to approach this without breaking anything else yet.

tlaurion commented 2 years ago

@krystian-hebel

CPU model can't be done through /proc/cpuinfo, at least without patches to Linux:

x86 https://github.com/torvalds/linux/blob/master/arch/x86/kernel/cpu/proc.c#L72
PPC https://github.com/torvalds/linux/blob/master/arch/powerpc/kernel/setup-common.c#L228

Also, what would be printed if there were two different CPU models installed?

Question is if the following would be satisfying as a base for further parsing:

cat /proc/cpuinfo | grep -e "cpu" -e "revision" | sort | uniq
cpu     : POWER9, altivec supported
revision    : 2.1 (pvr 004e 1201)

If two different CPUs, we would have 2 different revisions strings. Not sure who would put two different revisions of CPUs either? Something that happens a lot in the wild?

As for FW_VER, there is some kind of information in device tree, it should be obtainable through sysfs. However, it is read from PNOR version partition and isn't reported correctly for coreboot, because possible entries are hardcoded in Skiboot (and few other components, but these shouldn't be too much of a problem for coreboot). We haven't decided on how to approach this without breaking anything else yet.

From Heads perspective, cbmem -1 | grep Heads | awk -F " " {'print $1'} | awk -F "--" {'print $NF'} | uniq reports Heads correct versioning: Heads-v5.0.1-212-g585e581d (without coreboot standard's CBET4000 reported from DMI). That is, release+commit#+g+commitId.

@SergiiDmytruk : Good enough? (FWUPD/LVFS related question/comparison).

That would change how FW_VER is extracted under Heads at https://github.com/osresearch/heads/blob/f2e45c4396456679284eeda9a26196ee7a3a14d1/initrd/init#L116-L119

Which is then used as is in System Information https://github.com/osresearch/heads/blob/f2e45c4396456679284eeda9a26196ee7a3a14d1/initrd/bin/gui-init#L514

SergiiDmytruk commented 2 years ago

Good enough? (FWUPD/LVFS related question/comparison).

You mean for versioning of firmware for LVFS? It might need a bit of reformatting to match one of supported formats, maybe to make it look like 5.0.1.212.