linux-gbmc_aspeedg7: Make SGPIO default values persist BMC reboot
Summary:
Rebooting the BMC will cause all SGPIO values to temporarily go to 0.
This would cause a lot of undefined/unwanted behavior. Main example
would be all PCIE slots being reset on BMC reboot.
Make the default set SGPIO values persistent.
Tested:
Flashed on a Pre-EVT platform30 unit. Previously rebooting the BMC
would cause the host to enter an inoperable state when the host image
was provided via PE5A.
```
// Connect to the main host console
Enter "okok" to return back to the BMC console
-sh: $'okokH\370': command not found
root@localhost:~# [ 237.017161] EXT4-fs warning: 22455 callbacks suppressed
[ 237.017167] EXT4-fs warning (device nvme0n1p3): dx_probe:823: inode #1418: lblock 0: comm ovss-wdctl: error -5 reading directory block
[ 237.033698] EXT4-fs warning (device nvme0n1p3): dx_probe:823: inode #1418: lblock 0: comm ovss-wdctl: error -5 reading directory block
...
root@localhost:~# ls
-sh: ls: command not found
```
With the changes, rebooting the BMC no longer causes the host to enter
this faulty state.
```
root@platform30:~# journalctl -u gbmc-release-host@0.service
Oct 12 08:04:43 platform30 systemd[1]: Starting The HPM0 is ready to be powered on...
Oct 12 08:04:43 platform30 host_auto_power_on.sh[2424]: [Auto Power On]: Host 0 is already Running
Oct 12 08:04:43 platform30 systemd[1]: Finished The HPM0 is ready to be powered on.
// Connect to the main host console
Enter "okok" to return back to the BMC console
-sh: okok: command not found
root@localhost:~# ls -alh
total 40K
drwx------ 3 root root 4.0K Mar 9 2018 .
drwxr-xr-x 21 root root 20K Dec 18 21:34 ..
-rwxr-xr-x 1 root root 588 Mar 9 2018 .bashrc
-rwxr-xr-x 1 root root 102 Mar 9 2018 .profile
dr-xr-xr-x 2 root root 4.0K Mar 9 2018 .ssh
root@localhost:~# date
Thu Dec 18 21:38:00 UTC 2025
root@localhost:~#
```
SGPIO values are also only set to the default following an AC cycle.
Following a BMC reboot, the values are left as they were set previously.
```
// Can see following an AC cycle, first byte of SGPIOs are high
root@platform30:~# ./b-471067239-check-sgpio-reset-tolerance.sh
SGPIO NAME | MEMORY ADDRESS | VALUE
-------------------------------------------------------------------------
HPM0_FM_BMC_PERST_PE3B : 0x14C0C09C : 1
HPM0_FM_BMC_PERST_PE3A : 0x14C0C098 : 1
HPM0_FM_BMC_PERST_PE0B : 0x14C0C094 : 1
HPM0_FM_BMC_PERST_PE0A : 0x14C0C090 : 1
HPM0_FM_BMC_PERST_PE2A : 0x14C0C080 : 1
HPM0_FM_BMC_PERST_PE2B : 0x14C0C084 : 1
HPM0_FM_BMC_PERST_PE1A : 0x14C0C088 : 1
HPM0_FM_BMC_PERST_PE1B : 0x14C0C08C : 1
// Set some low and then reboot the BMC
root@platform30:~# gpioset $(gpiofind HPM0_FM_BMC_PERST_PE0B)=0
root@platform30:~# gpioset $(gpiofind HPM0_FM_BMC_PERST_PE0A)=0
root@platform30:~# ./b-471067239-check-sgpio-reset-tolerance.sh
SGPIO NAME | MEMORY ADDRESS | VALUE
-------------------------------------------------------------------------
HPM0_FM_BMC_PERST_PE3B : 0x14C0C09C : 1
HPM0_FM_BMC_PERST_PE3A : 0x14C0C098 : 1
HPM0_FM_BMC_PERST_PE0B : 0x14C0C094 : 0
HPM0_FM_BMC_PERST_PE0A : 0x14C0C090 : 0
HPM0_FM_BMC_PERST_PE2A : 0x14C0C080 : 1
HPM0_FM_BMC_PERST_PE2B : 0x14C0C084 : 1
HPM0_FM_BMC_PERST_PE1A : 0x14C0C088 : 1
HPM0_FM_BMC_PERST_PE1B : 0x14C0C08C : 1
root@platform30:~# reboot
[ 2384.802070] kauditd_printk_skb: 2 callbacks suppressed
[ 2384.877951] watchdog: watchdog0: watchdog did not stop!
shutdown: reboot --timeout=20000000us --log-level info --log-target=kmsg --log-color --exit-code=0
Unmounting /rw
Unmounting /ro
// The values aren't set back to the default
root@platform30:~# journalctl -u gbmc-release-host@0.service
Oct 12 08:44:21 platform30 systemd[1]: Starting The HPM0 is ready to be powered on...
Oct 12 08:44:22 platform30 host_auto_power_on.sh[2432]: [Auto Power On]: Host 0 is already Running
Oct 12 08:44:22 platform30 systemd[1]: Finished The HPM0 is ready to be powered on.
root@platform30:~# ./b-471067239-check-sgpio-reset-tolerance.sh
SGPIO NAME | MEMORY ADDRESS | VALUE
-------------------------------------------------------------------------
HPM0_FM_BMC_PERST_PE3B : 0x14C0C09C : 1
HPM0_FM_BMC_PERST_PE3A : 0x14C0C098 : 1
HPM0_FM_BMC_PERST_PE0B : 0x14C0C094 : 0
HPM0_FM_BMC_PERST_PE0A : 0x14C0C090 : 0
HPM0_FM_BMC_PERST_PE2A : 0x14C0C080 : 1
HPM0_FM_BMC_PERST_PE2B : 0x14C0C084 : 1
HPM0_FM_BMC_PERST_PE1A : 0x14C0C088 : 1
HPM0_FM_BMC_PERST_PE1B : 0x14C0C08C : 1
```
Fusion-Link: fusion2 N/A - presubmit not available
Google-Bug-Id: 471067239
Change-Id: I3e37043a31ff08e97d4436f6e62277be81f9906b
Signed-off-by: Kyle Nieman <kyle.nieman@fii-na.corp-partner.google.com>
1 file changed