Intel® Agilex™ Hard Processor System Remote System Update User Guide

ID 683184
Date 7/13/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.5.5.3. Corrupted Configuration Pointer Block

This section uses the RSU client to demonstrate how configuration pointer block corruptions can be detected and recovered. It also uses U-Boot to corrupt the CPB, as it's more conveniently done there.
Note: The commands listed in this example assume the initial flash image (JIC) was written to flash, with no other changes.
  1. Power cycle the board, boot to Linux, and query RSU status:
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed

    There are no errors.

  2. Reboot or power cycle the board, stop at U-Boot prompt, and corrupt CPB0 by erasing the corresponding flash area:
    SOCFPGA # sf probe
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x0920000 0x1000
    SF: 4096 bytes @ 0x920000 Erased: OK
  3. Power cycle the board. U-Boot runs, and before starting Linux, it executes a few RSU commands, which causes rsu_init to be called, and that restores CPB0 from the CPB1 copy:
    FW detects corrupted CPB0 but CPB1 is fine
    Restoring CPB0
  4. Once Linux has booted, query the RSU status:
    root@linux:~# ./rsu_client --log
    librsu: load_cpb(): FW detects corrupted CPB0, fine CPB1
     [LOW]
    librsu: load_cpb(): warning: Restoring CPB0 [LOW]
          VERSION: 0x0DCF0202
            STATE: 0xF004D010
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000100000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed

    The State field has the special error code 0xF004D010 which indicates that CPB0 was corrupted. The Last Fail Image has the special value 0x00100000 which is used in this case. The Version field indicates that the eror was reported by the decision firmware (0xDCF). Although the U-Boot already recovered CPB0 from CPB1, the firmware still reports CPB0 as corrupted, and LibRSU recovers it again.

  5. Clear the error status, so that the firmware stops reporting CPB0 corrupted, and query RSU status again to verify there are no errors:
    root@linux:~# ./rsu_client --clear-error-status
    librsu: load_cpb(): FW detects corrupted CPB0, fine CPB1
     [LOW]
    librsu: load_cpb(): warning: Restoring CPB0 [LOW]
    Operation completed
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed
  6. Power cycle the board, boot to Linux and query RSU status. Verify there are no errors:
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000001000000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed
  7. Save the CPB contents to a file, to be used later for recovery. Also call sync command to make sure the file is saved to storage:
    root@linux:~# ./rsu_client --save-cpb cpb-backup.bin
    Operation completed
    root@linux:~# sync
  8. Reboot or power cycle, stop in U-Boot and corrupt both CPBs by erasing the flash at their location:
    SOCFPGA # sf probe
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x0920000 0x1000
    SF: 4096 bytes @ 0x920000 Erased: OK
    SOCFPGA # sf erase 0x0928000 0x1000
    SF: 4096 bytes @ 0x928000 Erased: OK
  9. Power cycle the board, boot to Linux and query RSU status:
    root@linux:~# ./rsu_client --log
    librsu: load_cpb(): FW detects both CPBs corrupted
     [LOW]
          VERSION: 0x0DCF0202
            STATE: 0xF004D011
    CURRENT IMAGE: 0x0000000000110000
       FAIL IMAGE: 0x0000000000100000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed

    The Current Image is reported as being the factory image, as expected. The State field has the special error code 0xF004D011 which indicates that both CPBs were corrupted. The Last Fail Image has the special value 0x00100000 which is used in this case. The Version field indicates that the eror was reported by the decision firmware (0xDCF). The LibRSU reported that both CPBs are corrupted.

  10. Try to run a command which requires a valid CPB - verify it is rejected:
    root@linux:~# ./rsu_client --list 1
    librsu: load_cpb(): FW detects both CPBs corrupted
     [LOW]
    librsu: rsu_cpb_corrupted_info(): corrupted CPB -- [LOW]
    librsu: rsu_cpb_corrupted_info(): run rsu_client create-empty-cpb or  [LOW]
    librsu: rsu_cpb_corrupted_info(): rsu_client restore_cpb <file_name> first
     [LOW]
    ERROR: Failed to get slot attributes
  11. Clear errors, so that the CPBs are not reported as corrupted by the firmware anymore:
    root@linux:~# ./rsu_client --clear-error-status
    librsu: load_cpb(): FW detects both CPBs corrupted
     [LOW]
    Operation completed
    root@linux:~# ./rsu_client --log
    librsu: load_cpb(): Bad CPB1 is bad [MED]
    librsu: load_cpb(): Bad CPB0 is bad [MED]
    librsu: load_cpb(): error: found both corrupted CPBs [LOW]
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000000110000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed
  12. Restore the saved CPB from the backup file that we created:
    root@linux:~# ./rsu_client --restore-cpb cpb-backup.bin
    librsu: load_cpb(): Bad CPB1 is bad [MED]
    librsu: load_cpb(): Bad CPB0 is bad [MED]
    librsu: load_cpb(): error: found both corrupted CPBs [LOW]
    Operation completed
  13. Query again RSU status, there should be no errors signalled now:
    root@linux:~# ./rsu_client --log
          VERSION: 0x00000202
            STATE: 0x00000000
    CURRENT IMAGE: 0x0000000000110000
       FAIL IMAGE: 0x0000000000000000
        ERROR LOC: 0x00000000
    ERROR DETAILS: 0x00000000
    RETRY COUNTER: 0x00000000
    Operation completed
  14. Try to run a command which requries a valid CPB - verify it is not rejected:
    root@linux:~# ./rsu_client --list 1
          NAME: P2
        OFFSET: 0x0000000002000000
          SIZE: 0x01000000
      PRIORITY: [disabled]
    Operation completed