All of lore.kernel.org
 help / color / mirror / Atom feed
* [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
@ 2022-07-13  8:15 Chris Chen (TPI)
  2022-07-13 16:40 ` Willy Tu
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Chen (TPI) @ 2022-07-13  8:15 UTC (permalink / raw)
  To: Brandon Kim, William Kennington, Willy Tu, openbmc; +Cc: chris6906

[-- Attachment #1: Type: text/plain, Size: 8495 bytes --]

Hi Brandon and William,

As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.

Host-side
=====

  *   The e820 map of the Host system (just choose one area randomly, should I need to reserve a specific area for this??)
####
archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820

[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable

[    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved

[    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable

[    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.

[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable

[    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved

[    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data

[    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS

[    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved

[    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable

[    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved

[    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved

[    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved

[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable

[    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable

[    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable

[    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved

[    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable

[    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved

[    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved

[    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved

[    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]

[    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]

[    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]

[    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]

[    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]

[    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]

[   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...

[   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
####

  *   The executed command and its result.
####
archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
                                                            --command update \
                                                            --interface ipmilpc
                                                            --image ./image-bmc \
                                                            --sig ./image-bmc.sig \
                                                            --type image \
                                                            --address 0x000a0000 \
                                                            --length 0x10000
Sending over the firmware image.
sending writeMeta
writemeta sent
Progress: 100.00%
Sending over the hash file.
sending writeMeta
writemeta sent
Progress: 100.00%
Opening the verification file
Committing to /flash/verify to trigger service
Calling stat on /flash/verify session to check status
success
succeeded
Opening the update file
Committing to /flash/update to trigger service
Calling stat on /flash/update session to check status
success
succeeded

real  0m17.616s
user  0m0.046s
sys   0m0.147s
####
=====

BMC-side
=====

  *   Code changes

     *   Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
####
SUMMARY:${PN}-system = "Flex Ltd System"
RDEPENDS:${PN}-system = " \
        phosphor-ipmi-blobs \
        phosphor-ipmi-flash \
        "
####

     *   Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
####
SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"

PACKAGECONFIG:append = " static-bmc"
PACKAGECONFIG:append = " aspeed-lpc"
PACKAGECONFIG:append = " reboot-update"
IPMI_FLASH_BMC_ADDRESS = "0x98000000"
####

     *   Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
####
PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
####

     *   Add these lines(Bold). in Kernel dts file
####
reserved-memory {
       #address-cells = <1>;
       #size-cells = <1>;
       ranges;

       video_engine_memory: video {
            size = <0x04000000>;
            alignment = <0x01000000>;
            compatible = "shared-dma-pool";
            reusable;
       };

       /* LPC FW cycle bridge region requires natural alignment */
       flash_memory: region@98000000 {
            no-map;
            reg = <0x98000000 0x04000000>; /* 64M */
       };
};

&lpc_ctrl {
      status = "okay";
      memory-region = <&flash_memory>;
};
####

  *   BMC console

     *   Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
####
root@hudsonbay-obmc:~# cat /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
[{
        "blob": "/flash/image",
        "handler": {
                "type": "file",
                "path": "/run/initramfs/bmc-image"
        },
        "actions": {
                "preparation": {
                        "type": "skip"
                },
                "verification": {
                        "type": "skip"
                },
                "update": {
                        "type": "skip"
                }
        }
}]
####

     *   Create "/run/initramfs" directory manually.
####
root@hudsonbay-obmc:~# mkdir /run/initramfs
####

     *   Result after executing burn_my_bmc command. (the content of bmc-image and bmc.sig are all 0xff)
####
root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
-rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
04000000
root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
-rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000080
####
=====

Regards,
Chris Chen

Legal Disclaimer :
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is addressed 
or by their designee. If the reader of this message is not the intended recipient, 
you are on notice that any distribution of this message, in any form, 
is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this message!

[-- Attachment #2: Type: text/html, Size: 52854 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-13  8:15 [phosphor-ipmi-flash]: Question about in-band update of BMC firmware Chris Chen (TPI)
@ 2022-07-13 16:40 ` Willy Tu
  2022-07-13 16:45   ` Brandon Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Willy Tu @ 2022-07-13 16:40 UTC (permalink / raw)
  To: Chris Chen (TPI); +Cc: chris6906, Brandon Kim, openbmc, William Kennington

[-- Attachment #1: Type: text/plain, Size: 9127 bytes --]

Hi Chris,

I think you were able to set it up correctly. Can you check if you can
read/write to the flash memory on the BMC 0x98000000? I am also wondering
if that address is correct  or not. Like if that address is mapped to the
BMC's memory. I have hit an issue where the image transferred does not
match because the BIOS didn't set that up properly. I am unsure how to set
that up.

Willy Tu

On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com>
wrote:

> Hi Brandon and William,
>
>
>
> As you know, I have already built the "burn_my_bmc" on my Host (Eagle
> Stream with Aspeed 2600). I for now tried to use it to do the in-band
> update of BMC firmware, the debug messages of the "burn_my_bmc" look good
> and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and
> "/tmp" directory respectively via LPC data transfer mechanism on the BMC.
> However, one thing is strange which is the content of the "bmcimage" and
> "bmc.sig" file are all 0xff. I think this should not be the normal case,
> perhaps I made a mistake. Following are my steps/changes on the Host-side
> and BMC-side, could you please take a look at it, is there anything wrong?
> Or do you have any suggestions for enabling the feature? Thanks.
>
>
>
> *Host-side*
>
> =====
>
>    - The e820 map of the Host system (just choose one area randomly,
>    should I need to reserve a specific area for this??)
>    ####
>    archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
>
> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff]
> usable
>
> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff]
> usable
>
> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff]
> reserved                   *<-- choose this area.*
>
> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff]
> usable
>
> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI
> data
>
> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI
> NVS
>
> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff]
> usable
>
> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff]
> reserved
>
> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff]
> usable
>
> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>
> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>
> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
>
> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
>
> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
>
> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
>
> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
>
> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
>
> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
>
> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
>
> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
>
> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
>
> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
>
> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
>
> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
> ####
>
>    - The executed command and its result.
>    ####
>    archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
>                                                                --command
>    update \
>
>                                                             --interface
> ipmilpc
>                                                             --image
> ./image-bmc \
>                                                             --sig
> ./image-bmc.sig \
>                                                             --type image \
>                                                             --address
> 0x000a0000 \
>                                                             --length
> 0x10000
>
> Sending over the firmware image.
>
> sending writeMeta
>
> writemeta sent
>
> Progress: 100.00%
>
> Sending over the hash file.
>
> sending writeMeta
>
> writemeta sent
>
> Progress: 100.00%
>
> Opening the verification file
>
> Committing to /flash/verify to trigger service
>
> Calling stat on /flash/verify session to check status
>
> success
>
> succeeded
>
> Opening the update file
>
> Committing to /flash/update to trigger service
>
> Calling stat on /flash/update session to check status
>
> success
>
> succeeded
>
>
>
> real 0m17.616s
>
> user 0m0.046s
>
> sys 0m0.147s
>
> ####
>
> =====
>
>
>
> *BMC-side*
>
> =====
>
>    - Code changes
>
>
>    - Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these
>       two packages in packagegroup recipe.
>
> ####
> SUMMARY:${PN}-system = "Flex Ltd System"
>
> RDEPENDS:${PN}-system = " \
>
>         *phosphor-ipmi-blobs \*
>
> *        phosphor-ipmi-flash \*
>
>         "
>
> ####
>
>    - Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
>
> ####
> *SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"*
>
>
>
> *PACKAGECONFIG:append = " static-bmc"*
>
> *PACKAGECONFIG:append = " aspeed-lpc"*
>
> *PACKAGECONFIG:append = " reboot-update"*
>
> *IPMI_FLASH_BMC_ADDRESS = "0x98000000"*
>
> ####
>
>    - Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb
>       recipe as below, because the "Enabled Firmware Update Features" and
>       "config-static-bmc-reboot.json" are not be included. This seems the
>       "update-type" would always pass "none" to "phosphor-impi-flash" package
>       without this change, but I'm not sure??
>
> ####
> *PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"*
> ####
>
>    - Add these lines(Bold). in Kernel dts file
>
> ####
>
> reserved-memory {
>
> #address-cells = <1>;
>
> #size-cells = <1>;
>
> ranges;
>
>
>
> video_engine_memory: video {
>
> size = <0x04000000>;
>
> alignment = <0x01000000>;
>
> compatible = "shared-dma-pool";
>
> reusable;
>
> };
>
>
>
> */* LPC FW cycle bridge region requires natural alignment */*
>
> * flash_memory: region@98000000 {*
>
> * no-map;*
>
> * reg = <0x98000000 0x04000000>; /* 64M */*
>
> * };*
>
> };
>
> *&lpc_ctrl {*
>
> * status = "okay";*
>
> * memory-region = <&flash_memory>;*
>
> *};*
>
> ####
>
>    - BMC console
>
>
>    - Manually modify "config-static-bmc-reboot.json" to skip
>       "preparation", "verification", and "update" actions because I want to make
>       sure image file transfer is okay first.
>       ####
>       root@hudsonbay-obmc:~# cat
>       /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
>
> [{
>
>         "blob": "/flash/image",
>
>         "handler": {
>
>                 "type": "file",
>
>                 "path": "/run/initramfs/bmc-image"
>
>         },
>
>         "actions": {
>
>                 "preparation": {
>
>                         "type": "skip"
>
>                 },
>
>                 "verification": {
>
>                         "type": "skip"
>
>                 },
>
>                 "update": {
>
>                         "type": "skip"
>
>                 }
>
>         }
>
> }]
> ####
>
>    - Create "/run/initramfs" directory manually.
>       ####
>       root@hudsonbay-obmc:~# mkdir /run/initramfs
>
> ####
>
>    - Result after executing burn_my_bmc command. (the content of
>       bmc-image and bmc.sig are all 0xff)
>       ####
>
> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
> -rw-r--r--    1 root     root      67108864 Jan  1 01:47
> /run/initramfs/bmc-image
>
> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
>
> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>  |................|
>
> *
>
> 04000000
>
> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
>
> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
>
> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
>
> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>  |................|
>
> *
>
> 00000080
> ####
>
> =====
>
>
>
> Regards,
>
> Chris Chen
> Legal Disclaimer :
> The information contained in this message may be privileged and
> confidential.
> It is intended to be read only by the individual or entity to whom it is
> addressed
> or by their designee. If the reader of this message is not the intended
> recipient,
> you are on notice that any distribution of this message, in any form,
> is strictly prohibited. If you have received this message in error,
> please immediately notify the sender and delete or destroy any copy of
> this message!
>

[-- Attachment #2: Type: text/html, Size: 38787 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-13 16:40 ` Willy Tu
@ 2022-07-13 16:45   ` Brandon Kim
  2022-07-14 11:39     ` 回覆: " Chris Chen (TPI)
  0 siblings, 1 reply; 7+ messages in thread
From: Brandon Kim @ 2022-07-13 16:45 UTC (permalink / raw)
  To: Willy Tu; +Cc: chris6906, openbmc, Chris Chen (TPI), William Kennington

Hi Chris,

The region you choose on both the BMC and the BIOS IS important as the
BMC and the BIOS usually has a dedicated address for such a shared
MMIO. I am not a BIOS expert so I had to ask the BIOS team for the
address that is dedicated for LPC / eSPI (if you plan on using LPC /
eSPI) and had to refer to the BMC's datasheet for the region (I
believe it's defaulted to the Nuvoton region currently). As Willy
pointed out, my guess is that a manual write to the memory won't work
for you.

Which BMC are you using if you don't mind me asking? Nuvoton vs. Aspeed?

Thanks,
Brandon

On Wed, Jul 13, 2022 at 9:40 AM Willy Tu <wltu@google.com> wrote:
>
> Hi Chris,
>
> I think you were able to set it up correctly. Can you check if you can read/write to the flash memory on the BMC 0x98000000? I am also wondering if that address is correct  or not. Like if that address is mapped to the BMC's memory. I have hit an issue where the image transferred does not match because the BIOS didn't set that up properly. I am unsure how to set that up.
>
> Willy Tu
>
> On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
>>
>> Hi Brandon and William,
>>
>>
>>
>> As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.
>>
>>
>>
>> Host-side
>>
>> =====
>>
>> The e820 map of the Host system (just choose one area randomly, should I need to reserve a specific area for this??)
>> ####
>> archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
>>
>> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>>
>> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>>
>> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
>>
>> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
>>
>> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
>>
>> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
>>
>> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
>>
>> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
>>
>> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
>>
>> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
>>
>> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
>>
>> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
>>
>> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
>>
>> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
>>
>> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
>> ####
>>
>> The executed command and its result.
>> ####
>> archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
>>                                                             --command update \
>>
>>                                                             --interface ipmilpc
>>                                                             --image ./image-bmc \
>>                                                             --sig ./image-bmc.sig \
>>                                                             --type image \
>>                                                             --address 0x000a0000 \
>>                                                             --length 0x10000
>>
>> Sending over the firmware image.
>>
>> sending writeMeta
>>
>> writemeta sent
>>
>> Progress: 100.00%
>>
>> Sending over the hash file.
>>
>> sending writeMeta
>>
>> writemeta sent
>>
>> Progress: 100.00%
>>
>> Opening the verification file
>>
>> Committing to /flash/verify to trigger service
>>
>> Calling stat on /flash/verify session to check status
>>
>> success
>>
>> succeeded
>>
>> Opening the update file
>>
>> Committing to /flash/update to trigger service
>>
>> Calling stat on /flash/update session to check status
>>
>> success
>>
>> succeeded
>>
>>
>>
>> real  0m17.616s
>>
>> user  0m0.046s
>>
>> sys   0m0.147s
>>
>> ####
>>
>> =====
>>
>>
>>
>> BMC-side
>>
>> =====
>>
>> Code changes
>>
>> Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
>>
>> ####
>> SUMMARY:${PN}-system = "Flex Ltd System"
>>
>> RDEPENDS:${PN}-system = " \
>>
>>         phosphor-ipmi-blobs \
>>
>>         phosphor-ipmi-flash \
>>
>>         "
>>
>> ####
>>
>> Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
>>
>> ####
>> SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"
>>
>>
>>
>> PACKAGECONFIG:append = " static-bmc"
>>
>> PACKAGECONFIG:append = " aspeed-lpc"
>>
>> PACKAGECONFIG:append = " reboot-update"
>>
>> IPMI_FLASH_BMC_ADDRESS = "0x98000000"
>>
>> ####
>>
>> Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
>>
>> ####
>> PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
>> ####
>>
>> Add these lines(Bold). in Kernel dts file
>>
>> ####
>>
>> reserved-memory {
>>
>>        #address-cells = <1>;
>>
>>        #size-cells = <1>;
>>
>>        ranges;
>>
>>
>>
>>        video_engine_memory: video {
>>
>>             size = <0x04000000>;
>>
>>             alignment = <0x01000000>;
>>
>>             compatible = "shared-dma-pool";
>>
>>             reusable;
>>
>>        };
>>
>>
>>
>>        /* LPC FW cycle bridge region requires natural alignment */
>>
>>        flash_memory: region@98000000 {
>>
>>             no-map;
>>
>>             reg = <0x98000000 0x04000000>; /* 64M */
>>
>>        };
>>
>> };
>>
>> &lpc_ctrl {
>>
>>       status = "okay";
>>
>>       memory-region = <&flash_memory>;
>>
>> };
>>
>> ####
>>
>> BMC console
>>
>> Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
>> ####
>> root@hudsonbay-obmc:~# cat /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
>>
>> [{
>>
>>         "blob": "/flash/image",
>>
>>         "handler": {
>>
>>                 "type": "file",
>>
>>                 "path": "/run/initramfs/bmc-image"
>>
>>         },
>>
>>         "actions": {
>>
>>                 "preparation": {
>>
>>                         "type": "skip"
>>
>>                 },
>>
>>                 "verification": {
>>
>>                         "type": "skip"
>>
>>                 },
>>
>>                 "update": {
>>
>>                         "type": "skip"
>>
>>                 }
>>
>>         }
>>
>> }]
>> ####
>>
>> Create "/run/initramfs" directory manually.
>> ####
>> root@hudsonbay-obmc:~# mkdir /run/initramfs
>>
>> ####
>>
>> Result after executing burn_my_bmc command. (the content of bmc-image and bmc.sig are all 0xff)
>> ####
>>
>> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
>> -rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
>>
>> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
>>
>> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
>>
>> *
>>
>> 04000000
>>
>> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
>>
>> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
>>
>> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
>>
>> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
>>
>> *
>>
>> 00000080
>> ####
>>
>> =====
>>
>>
>>
>> Regards,
>>
>> Chris Chen
>>
>> Legal Disclaimer :
>> The information contained in this message may be privileged and confidential.
>> It is intended to be read only by the individual or entity to whom it is addressed
>> or by their designee. If the reader of this message is not the intended recipient,
>> you are on notice that any distribution of this message, in any form,
>> is strictly prohibited. If you have received this message in error,
>> please immediately notify the sender and delete or destroy any copy of this message!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* 回覆: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-13 16:45   ` Brandon Kim
@ 2022-07-14 11:39     ` Chris Chen (TPI)
  2022-07-14 15:58       ` Brandon Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Chen (TPI) @ 2022-07-14 11:39 UTC (permalink / raw)
  To: Brandon Kim, Willy Tu; +Cc: chris6906, openbmc, William Kennington

[-- Attachment #1: Type: text/plain, Size: 11745 bytes --]

Hi Brandon and Willy,

The host platform I'm using is Intel eagle stream with Aspeed 2600-A1.

I am able to read/write to the dram memory on the BMC 0x98000000. Here is my result.
=====
root@hudsonbay-obmc:~# devmem 0x98000000 32
0xFFFFFFFF
root@hudsonbay-obmc:~# devmem 0x98000000 32 0x55AA66BB
root@hudsonbay-obmc:~#
root@hudsonbay-obmc:~# devmem 0x98000000 32
0x55AA66BB
=====

In addition, I found the "bmc-image" and "bmc.sig" files are with part of 0x55AA66BB after I finished the upper commands. It looks like that LPC/eSPI MMIO is not working in my case as you mentioned. So I am thinking is it possible that you could share how to set BIOS with me?

Thank you.

Regards,
Chris Chen

________________________________
寄件者: Brandon Kim <brandonkim@google.com>
寄件日期: 2022年7月14日 上午 12:45
收件者: Willy Tu <wltu@google.com>
副本: Chris Chen (TPI) <Chris.Chen3@flex.com>; William Kennington <wak@google.com>; openbmc@lists.ozlabs.org <openbmc@lists.ozlabs.org>; chris6906@gmail.com <chris6906@gmail.com>
主旨: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware

Hi Chris,

The region you choose on both the BMC and the BIOS IS important as the
BMC and the BIOS usually has a dedicated address for such a shared
MMIO. I am not a BIOS expert so I had to ask the BIOS team for the
address that is dedicated for LPC / eSPI (if you plan on using LPC /
eSPI) and had to refer to the BMC's datasheet for the region (I
believe it's defaulted to the Nuvoton region currently). As Willy
pointed out, my guess is that a manual write to the memory won't work
for you.

Which BMC are you using if you don't mind me asking? Nuvoton vs. Aspeed?

Thanks,
Brandon

On Wed, Jul 13, 2022 at 9:40 AM Willy Tu <wltu@google.com> wrote:
>
> Hi Chris,
>
> I think you were able to set it up correctly. Can you check if you can read/write to the flash memory on the BMC 0x98000000? I am also wondering if that address is correct  or not. Like if that address is mapped to the BMC's memory. I have hit an issue where the image transferred does not match because the BIOS didn't set that up properly. I am unsure how to set that up.
>
> Willy Tu
>
> On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
>>
>> Hi Brandon and William,
>>
>>
>>
>> As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.
>>
>>
>>
>> Host-side
>>
>> =====
>>
>> The e820 map of the Host system (just choose one area randomly, should I need to reserve a specific area for this??)
>> ####
>> archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>>
>> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
>>
>> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>>
>> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
>>
>> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
>>
>> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
>>
>> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
>>
>> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
>>
>> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
>>
>> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
>>
>> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
>>
>> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
>>
>> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
>>
>> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
>>
>> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
>>
>> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
>>
>> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
>> ####
>>
>> The executed command and its result.
>> ####
>> archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
>>                                                             --command update \
>>
>>                                                             --interface ipmilpc
>>                                                             --image ./image-bmc \
>>                                                             --sig ./image-bmc.sig \
>>                                                             --type image \
>>                                                             --address 0x000a0000 \
>>                                                             --length 0x10000
>>
>> Sending over the firmware image.
>>
>> sending writeMeta
>>
>> writemeta sent
>>
>> Progress: 100.00%
>>
>> Sending over the hash file.
>>
>> sending writeMeta
>>
>> writemeta sent
>>
>> Progress: 100.00%
>>
>> Opening the verification file
>>
>> Committing to /flash/verify to trigger service
>>
>> Calling stat on /flash/verify session to check status
>>
>> success
>>
>> succeeded
>>
>> Opening the update file
>>
>> Committing to /flash/update to trigger service
>>
>> Calling stat on /flash/update session to check status
>>
>> success
>>
>> succeeded
>>
>>
>>
>> real  0m17.616s
>>
>> user  0m0.046s
>>
>> sys   0m0.147s
>>
>> ####
>>
>> =====
>>
>>
>>
>> BMC-side
>>
>> =====
>>
>> Code changes
>>
>> Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
>>
>> ####
>> SUMMARY:${PN}-system = "Flex Ltd System"
>>
>> RDEPENDS:${PN}-system = " \
>>
>>         phosphor-ipmi-blobs \
>>
>>         phosphor-ipmi-flash \
>>
>>         "
>>
>> ####
>>
>> Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
>>
>> ####
>> SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"
>>
>>
>>
>> PACKAGECONFIG:append = " static-bmc"
>>
>> PACKAGECONFIG:append = " aspeed-lpc"
>>
>> PACKAGECONFIG:append = " reboot-update"
>>
>> IPMI_FLASH_BMC_ADDRESS = "0x98000000"
>>
>> ####
>>
>> Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
>>
>> ####
>> PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
>> ####
>>
>> Add these lines(Bold). in Kernel dts file
>>
>> ####
>>
>> reserved-memory {
>>
>>        #address-cells = <1>;
>>
>>        #size-cells = <1>;
>>
>>        ranges;
>>
>>
>>
>>        video_engine_memory: video {
>>
>>             size = <0x04000000>;
>>
>>             alignment = <0x01000000>;
>>
>>             compatible = "shared-dma-pool";
>>
>>             reusable;
>>
>>        };
>>
>>
>>
>>        /* LPC FW cycle bridge region requires natural alignment */
>>
>>        flash_memory: region@98000000 {
>>
>>             no-map;
>>
>>             reg = <0x98000000 0x04000000>; /* 64M */
>>
>>        };
>>
>> };
>>
>> &lpc_ctrl {
>>
>>       status = "okay";
>>
>>       memory-region = <&flash_memory>;
>>
>> };
>>
>> ####
>>
>> BMC console
>>
>> Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
>> ####
>> root@hudsonbay-obmc:~# cat /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
>>
>> [{
>>
>>         "blob": "/flash/image",
>>
>>         "handler": {
>>
>>                 "type": "file",
>>
>>                 "path": "/run/initramfs/bmc-image"
>>
>>         },
>>
>>         "actions": {
>>
>>                 "preparation": {
>>
>>                         "type": "skip"
>>
>>                 },
>>
>>                 "verification": {
>>
>>                         "type": "skip"
>>
>>                 },
>>
>>                 "update": {
>>
>>                         "type": "skip"
>>
>>                 }
>>
>>         }
>>
>> }]
>> ####
>>
>> Create "/run/initramfs" directory manually.
>> ####
>> root@hudsonbay-obmc:~# mkdir /run/initramfs
>>
>> ####
>>
>> Result after executing burn_my_bmc command. (the content of bmc-image and bmc.sig are all 0xff)
>> ####
>>
>> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
>> -rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
>>
>> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
>>
>> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
>>
>> *
>>
>> 04000000
>>
>> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
>>
>> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
>>
>> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
>>
>> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
>>
>> *
>>
>> 00000080
>> ####
>>
>> =====
>>
>>
>>
>> Regards,
>>
>> Chris Chen
>>
>> Legal Disclaimer :
>> The information contained in this message may be privileged and confidential.
>> It is intended to be read only by the individual or entity to whom it is addressed
>> or by their designee. If the reader of this message is not the intended recipient,
>> you are on notice that any distribution of this message, in any form,
>> is strictly prohibited. If you have received this message in error,
>> please immediately notify the sender and delete or destroy any copy of this message!

[-- Attachment #2: Type: text/html, Size: 23975 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-14 11:39     ` 回覆: " Chris Chen (TPI)
@ 2022-07-14 15:58       ` Brandon Kim
  2022-07-15  6:25         ` Chris Chen (TPI)
  0 siblings, 1 reply; 7+ messages in thread
From: Brandon Kim @ 2022-07-14 15:58 UTC (permalink / raw)
  To: Chris Chen (TPI); +Cc: chris6906, openbmc, William Kennington, Willy Tu

Hi Chris,

I'm unfortunately not familiar with the BIOS side of things - but I
just know that we worked with the BIOS engineers to "reserve" some
space at an arbitrary location for this MMIO and enable some flag to
mark this as a shared location. To check if it works, I would
encourage you use a mem write to the memory from the BIOS to the
shared region to verify the change can be read back from the BIOS +
BMC. To do this manually, you may also have to look through the
Intel's PCH documentation regarding eSPI or LPC - and set the
registers up using setpci commands (this should be done automatically
by the burn_my_bmc tool).

Looking through our internal codebase, we have not tested with Aspeed
LPC in a very long time so it's also possible that there were some
regression introduced, if you were able to successfully do a manual
write to this shared region.

Thanks,
Brandon

On Thu, Jul 14, 2022 at 4:39 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
>
> Hi Brandon and Willy,
>
> The host platform I'm using is Intel eagle stream with Aspeed 2600-A1.
>
> I am able to read/write to the dram memory on the BMC 0x98000000. Here is my result.
> =====
> root@hudsonbay-obmc:~# devmem 0x98000000 32
> 0xFFFFFFFF
> root@hudsonbay-obmc:~# devmem 0x98000000 32 0x55AA66BB
> root@hudsonbay-obmc:~#
> root@hudsonbay-obmc:~# devmem 0x98000000 32
> 0x55AA66BB
> =====
>
> In addition, I found the "bmc-image" and "bmc.sig" files are with part of 0x55AA66BB after I finished the upper commands. It looks like that LPC/eSPI MMIO is not working in my case as you mentioned. So I am thinking is it possible that you could share how to set BIOS with me?
>
> Thank you.
>
> Regards,
> Chris Chen
>
> ________________________________
> 寄件者: Brandon Kim <brandonkim@google.com>
> 寄件日期: 2022年7月14日 上午 12:45
> 收件者: Willy Tu <wltu@google.com>
> 副本: Chris Chen (TPI) <Chris.Chen3@flex.com>; William Kennington <wak@google.com>; openbmc@lists.ozlabs.org <openbmc@lists.ozlabs.org>; chris6906@gmail.com <chris6906@gmail.com>
> 主旨: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
>
> Hi Chris,
>
> The region you choose on both the BMC and the BIOS IS important as the
> BMC and the BIOS usually has a dedicated address for such a shared
> MMIO. I am not a BIOS expert so I had to ask the BIOS team for the
> address that is dedicated for LPC / eSPI (if you plan on using LPC /
> eSPI) and had to refer to the BMC's datasheet for the region (I
> believe it's defaulted to the Nuvoton region currently). As Willy
> pointed out, my guess is that a manual write to the memory won't work
> for you.
>
> Which BMC are you using if you don't mind me asking? Nuvoton vs. Aspeed?
>
> Thanks,
> Brandon
>
> On Wed, Jul 13, 2022 at 9:40 AM Willy Tu <wltu@google.com> wrote:
> >
> > Hi Chris,
> >
> > I think you were able to set it up correctly. Can you check if you can read/write to the flash memory on the BMC 0x98000000? I am also wondering if that address is correct  or not. Like if that address is mapped to the BMC's memory. I have hit an issue where the image transferred does not match because the BIOS didn't set that up properly. I am unsure how to set that up.
> >
> > Willy Tu
> >
> > On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
> >>
> >> Hi Brandon and William,
> >>
> >>
> >>
> >> As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.
> >>
> >>
> >>
> >> Host-side
> >>
> >> =====
> >>
> >> The e820 map of the Host system (just choose one area randomly, should I need to reserve a specific area for this??)
> >> ####
> >> archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
> >>
> >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> >>
> >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> >>
> >> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
> >>
> >> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
> >>
> >> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
> >>
> >> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
> >>
> >> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
> >>
> >> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
> >>
> >> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
> >>
> >> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
> >>
> >> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
> >>
> >> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
> >>
> >> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
> >>
> >> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
> >>
> >> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
> >> ####
> >>
> >> The executed command and its result.
> >> ####
> >> archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
> >>                                                             --command update \
> >>
> >>                                                             --interface ipmilpc
> >>                                                             --image ./image-bmc \
> >>                                                             --sig ./image-bmc.sig \
> >>                                                             --type image \
> >>                                                             --address 0x000a0000 \
> >>                                                             --length 0x10000
> >>
> >> Sending over the firmware image.
> >>
> >> sending writeMeta
> >>
> >> writemeta sent
> >>
> >> Progress: 100.00%
> >>
> >> Sending over the hash file.
> >>
> >> sending writeMeta
> >>
> >> writemeta sent
> >>
> >> Progress: 100.00%
> >>
> >> Opening the verification file
> >>
> >> Committing to /flash/verify to trigger service
> >>
> >> Calling stat on /flash/verify session to check status
> >>
> >> success
> >>
> >> succeeded
> >>
> >> Opening the update file
> >>
> >> Committing to /flash/update to trigger service
> >>
> >> Calling stat on /flash/update session to check status
> >>
> >> success
> >>
> >> succeeded
> >>
> >>
> >>
> >> real  0m17.616s
> >>
> >> user  0m0.046s
> >>
> >> sys   0m0.147s
> >>
> >> ####
> >>
> >> =====
> >>
> >>
> >>
> >> BMC-side
> >>
> >> =====
> >>
> >> Code changes
> >>
> >> Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
> >>
> >> ####
> >> SUMMARY:${PN}-system = "Flex Ltd System"
> >>
> >> RDEPENDS:${PN}-system = " \
> >>
> >>         phosphor-ipmi-blobs \
> >>
> >>         phosphor-ipmi-flash \
> >>
> >>         "
> >>
> >> ####
> >>
> >> Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
> >>
> >> ####
> >> SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"
> >>
> >>
> >>
> >> PACKAGECONFIG:append = " static-bmc"
> >>
> >> PACKAGECONFIG:append = " aspeed-lpc"
> >>
> >> PACKAGECONFIG:append = " reboot-update"
> >>
> >> IPMI_FLASH_BMC_ADDRESS = "0x98000000"
> >>
> >> ####
> >>
> >> Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
> >>
> >> ####
> >> PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
> >> ####
> >>
> >> Add these lines(Bold). in Kernel dts file
> >>
> >> ####
> >>
> >> reserved-memory {
> >>
> >>        #address-cells = <1>;
> >>
> >>        #size-cells = <1>;
> >>
> >>        ranges;
> >>
> >>
> >>
> >>        video_engine_memory: video {
> >>
> >>             size = <0x04000000>;
> >>
> >>             alignment = <0x01000000>;
> >>
> >>             compatible = "shared-dma-pool";
> >>
> >>             reusable;
> >>
> >>        };
> >>
> >>
> >>
> >>        /* LPC FW cycle bridge region requires natural alignment */
> >>
> >>        flash_memory: region@98000000 {
> >>
> >>             no-map;
> >>
> >>             reg = <0x98000000 0x04000000>; /* 64M */
> >>
> >>        };
> >>
> >> };
> >>
> >> &lpc_ctrl {
> >>
> >>       status = "okay";
> >>
> >>       memory-region = <&flash_memory>;
> >>
> >> };
> >>
> >> ####
> >>
> >> BMC console
> >>
> >> Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
> >> ####
> >> root@hudsonbay-obmc:~# cat /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
> >>
> >> [{
> >>
> >>         "blob": "/flash/image",
> >>
> >>         "handler": {
> >>
> >>                 "type": "file",
> >>
> >>                 "path": "/run/initramfs/bmc-image"
> >>
> >>         },
> >>
> >>         "actions": {
> >>
> >>                 "preparation": {
> >>
> >>                         "type": "skip"
> >>
> >>                 },
> >>
> >>                 "verification": {
> >>
> >>                         "type": "skip"
> >>
> >>                 },
> >>
> >>                 "update": {
> >>
> >>                         "type": "skip"
> >>
> >>                 }
> >>
> >>         }
> >>
> >> }]
> >> ####
> >>
> >> Create "/run/initramfs" directory manually.
> >> ####
> >> root@hudsonbay-obmc:~# mkdir /run/initramfs
> >>
> >> ####
> >>
> >> Result after executing burn_my_bmc command. (the content of bmc-image and bmc.sig are all 0xff)
> >> ####
> >>
> >> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
> >> -rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
> >>
> >> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
> >>
> >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
> >>
> >> *
> >>
> >> 04000000
> >>
> >> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
> >>
> >> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
> >>
> >> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
> >>
> >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
> >>
> >> *
> >>
> >> 00000080
> >> ####
> >>
> >> =====
> >>
> >>
> >>
> >> Regards,
> >>
> >> Chris Chen
> >>
> >> Legal Disclaimer :
> >> The information contained in this message may be privileged and confidential.
> >> It is intended to be read only by the individual or entity to whom it is addressed
> >> or by their designee. If the reader of this message is not the intended recipient,
> >> you are on notice that any distribution of this message, in any form,
> >> is strictly prohibited. If you have received this message in error,
> >> please immediately notify the sender and delete or destroy any copy of this message!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-14 15:58       ` Brandon Kim
@ 2022-07-15  6:25         ` Chris Chen (TPI)
  2022-07-15 15:36           ` Brandon Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Chen (TPI) @ 2022-07-15  6:25 UTC (permalink / raw)
  To: Brandon Kim; +Cc: chris6906, openbmc, William Kennington, Willy Tu

Hi Brandon,

Understood. Thank you for the information.

Just one more question would like to confirm with you, the README.md in the phosphor-ipmi-flash repo mentioned using net data transfer mechanism, this is not an in-band update, it is through the network connection, that means I can't use it if there is no network port on the motherboard, am I correct? 

Regards,
Chris Chen

-----Original Message-----
From: Brandon Kim <brandonkim@google.com> 
Sent: Thursday, July 14, 2022 11:58 PM
To: Chris Chen (TPI) <Chris.Chen3@flex.com>
Cc: Willy Tu <wltu@google.com>; William Kennington <wak@google.com>; openbmc@lists.ozlabs.org; chris6906@gmail.com
Subject: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware

Hi Chris,

I'm unfortunately not familiar with the BIOS side of things - but I just know that we worked with the BIOS engineers to "reserve" some space at an arbitrary location for this MMIO and enable some flag to mark this as a shared location. To check if it works, I would encourage you use a mem write to the memory from the BIOS to the shared region to verify the change can be read back from the BIOS + BMC. To do this manually, you may also have to look through the Intel's PCH documentation regarding eSPI or LPC - and set the registers up using setpci commands (this should be done automatically by the burn_my_bmc tool).

Looking through our internal codebase, we have not tested with Aspeed LPC in a very long time so it's also possible that there were some regression introduced, if you were able to successfully do a manual write to this shared region.

Thanks,
Brandon

On Thu, Jul 14, 2022 at 4:39 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
>
> Hi Brandon and Willy,
>
> The host platform I'm using is Intel eagle stream with Aspeed 2600-A1.
>
> I am able to read/write to the dram memory on the BMC 0x98000000. Here is my result.
> =====
> root@hudsonbay-obmc:~# devmem 0x98000000 32 0xFFFFFFFF 
> root@hudsonbay-obmc:~# devmem 0x98000000 32 0x55AA66BB 
> root@hudsonbay-obmc:~# root@hudsonbay-obmc:~# devmem 0x98000000 32 
> 0x55AA66BB =====
>
> In addition, I found the "bmc-image" and "bmc.sig" files are with part of 0x55AA66BB after I finished the upper commands. It looks like that LPC/eSPI MMIO is not working in my case as you mentioned. So I am thinking is it possible that you could share how to set BIOS with me?
>
> Thank you.
>
> Regards,
> Chris Chen
>
> ________________________________
> 寄件者: Brandon Kim <brandonkim@google.com>
> 寄件日期: 2022年7月14日 上午 12:45
> 收件者: Willy Tu <wltu@google.com>
> 副本: Chris Chen (TPI) <Chris.Chen3@flex.com>; William Kennington 
> <wak@google.com>; openbmc@lists.ozlabs.org <openbmc@lists.ozlabs.org>; 
> chris6906@gmail.com <chris6906@gmail.com>
> 主旨: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC 
> firmware
>
> Hi Chris,
>
> The region you choose on both the BMC and the BIOS IS important as the 
> BMC and the BIOS usually has a dedicated address for such a shared 
> MMIO. I am not a BIOS expert so I had to ask the BIOS team for the 
> address that is dedicated for LPC / eSPI (if you plan on using LPC /
> eSPI) and had to refer to the BMC's datasheet for the region (I 
> believe it's defaulted to the Nuvoton region currently). As Willy 
> pointed out, my guess is that a manual write to the memory won't work 
> for you.
>
> Which BMC are you using if you don't mind me asking? Nuvoton vs. Aspeed?
>
> Thanks,
> Brandon
>
> On Wed, Jul 13, 2022 at 9:40 AM Willy Tu <wltu@google.com> wrote:
> >
> > Hi Chris,
> >
> > I think you were able to set it up correctly. Can you check if you can read/write to the flash memory on the BMC 0x98000000? I am also wondering if that address is correct  or not. Like if that address is mapped to the BMC's memory. I have hit an issue where the image transferred does not match because the BIOS didn't set that up properly. I am unsure how to set that up.
> >
> > Willy Tu
> >
> > On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
> >>
> >> Hi Brandon and William,
> >>
> >>
> >>
> >> As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.
> >>
> >>
> >>
> >> Host-side
> >>
> >> =====
> >>
> >> The e820 map of the Host system (just choose one area randomly, 
> >> should I need to reserve a specific area for this??) #### 
> >> archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
> >>
> >> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
> >>
> >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> >>
> >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> >>
> >> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
> >>
> >> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
> >>
> >> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
> >>
> >> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
> >>
> >> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
> >>
> >> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
> >>
> >> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
> >>
> >> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
> >>
> >> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
> >>
> >> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
> >>
> >> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
> >>
> >> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
> >>
> >> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
> >> ####
> >>
> >> The executed command and its result.
> >> ####
> >> archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
> >>                                                             
> >> --command update \
> >>
> >>                                                             --interface ipmilpc
> >>                                                             --image ./image-bmc \
> >>                                                             --sig ./image-bmc.sig \
> >>                                                             --type image \
> >>                                                             --address 0x000a0000 \
> >>                                                             
> >> --length 0x10000
> >>
> >> Sending over the firmware image.
> >>
> >> sending writeMeta
> >>
> >> writemeta sent
> >>
> >> Progress: 100.00%
> >>
> >> Sending over the hash file.
> >>
> >> sending writeMeta
> >>
> >> writemeta sent
> >>
> >> Progress: 100.00%
> >>
> >> Opening the verification file
> >>
> >> Committing to /flash/verify to trigger service
> >>
> >> Calling stat on /flash/verify session to check status
> >>
> >> success
> >>
> >> succeeded
> >>
> >> Opening the update file
> >>
> >> Committing to /flash/update to trigger service
> >>
> >> Calling stat on /flash/update session to check status
> >>
> >> success
> >>
> >> succeeded
> >>
> >>
> >>
> >> real  0m17.616s
> >>
> >> user  0m0.046s
> >>
> >> sys   0m0.147s
> >>
> >> ####
> >>
> >> =====
> >>
> >>
> >>
> >> BMC-side
> >>
> >> =====
> >>
> >> Code changes
> >>
> >> Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
> >>
> >> ####
> >> SUMMARY:${PN}-system = "Flex Ltd System"
> >>
> >> RDEPENDS:${PN}-system = " \
> >>
> >>         phosphor-ipmi-blobs \
> >>
> >>         phosphor-ipmi-flash \
> >>
> >>         "
> >>
> >> ####
> >>
> >> Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
> >>
> >> ####
> >> SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"
> >>
> >>
> >>
> >> PACKAGECONFIG:append = " static-bmc"
> >>
> >> PACKAGECONFIG:append = " aspeed-lpc"
> >>
> >> PACKAGECONFIG:append = " reboot-update"
> >>
> >> IPMI_FLASH_BMC_ADDRESS = "0x98000000"
> >>
> >> ####
> >>
> >> Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
> >>
> >> ####
> >> PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
> >> ####
> >>
> >> Add these lines(Bold). in Kernel dts file
> >>
> >> ####
> >>
> >> reserved-memory {
> >>
> >>        #address-cells = <1>;
> >>
> >>        #size-cells = <1>;
> >>
> >>        ranges;
> >>
> >>
> >>
> >>        video_engine_memory: video {
> >>
> >>             size = <0x04000000>;
> >>
> >>             alignment = <0x01000000>;
> >>
> >>             compatible = "shared-dma-pool";
> >>
> >>             reusable;
> >>
> >>        };
> >>
> >>
> >>
> >>        /* LPC FW cycle bridge region requires natural alignment */
> >>
> >>        flash_memory: region@98000000 {
> >>
> >>             no-map;
> >>
> >>             reg = <0x98000000 0x04000000>; /* 64M */
> >>
> >>        };
> >>
> >> };
> >>
> >> &lpc_ctrl {
> >>
> >>       status = "okay";
> >>
> >>       memory-region = <&flash_memory>;
> >>
> >> };
> >>
> >> ####
> >>
> >> BMC console
> >>
> >> Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
> >> ####
> >> root@hudsonbay-obmc:~# cat 
> >> /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
> >>
> >> [{
> >>
> >>         "blob": "/flash/image",
> >>
> >>         "handler": {
> >>
> >>                 "type": "file",
> >>
> >>                 "path": "/run/initramfs/bmc-image"
> >>
> >>         },
> >>
> >>         "actions": {
> >>
> >>                 "preparation": {
> >>
> >>                         "type": "skip"
> >>
> >>                 },
> >>
> >>                 "verification": {
> >>
> >>                         "type": "skip"
> >>
> >>                 },
> >>
> >>                 "update": {
> >>
> >>                         "type": "skip"
> >>
> >>                 }
> >>
> >>         }
> >>
> >> }]
> >> ####
> >>
> >> Create "/run/initramfs" directory manually.
> >> ####
> >> root@hudsonbay-obmc:~# mkdir /run/initramfs
> >>
> >> ####
> >>
> >> Result after executing burn_my_bmc command. (the content of 
> >> bmc-image and bmc.sig are all 0xff) ####
> >>
> >> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
> >> -rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
> >>
> >> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
> >>
> >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
> >> |................|
> >>
> >> *
> >>
> >> 04000000
> >>
> >> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
> >>
> >> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
> >>
> >> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
> >>
> >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  
> >> |................|
> >>
> >> *
> >>
> >> 00000080
> >> ####
> >>
> >> =====
> >>
> >>
> >>
> >> Regards,
> >>
> >> Chris Chen
> >>
> >> Legal Disclaimer :
> >> The information contained in this message may be privileged and confidential.
> >> It is intended to be read only by the individual or entity to whom 
> >> it is addressed or by their designee. If the reader of this message 
> >> is not the intended recipient, you are on notice that any 
> >> distribution of this message, in any form, is strictly prohibited. 
> >> If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
  2022-07-15  6:25         ` Chris Chen (TPI)
@ 2022-07-15 15:36           ` Brandon Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Brandon Kim @ 2022-07-15 15:36 UTC (permalink / raw)
  To: Chris Chen (TPI); +Cc: chris6906, openbmc, William Kennington, Willy Tu

Hi Chris,

The network connection is actually referring to the BMC to host
in-band network so no network port on the motherboard is necessary as
long as there is a suitable network connection between the 2.

Thanks,
Brandon

On Thu, Jul 14, 2022 at 11:25 PM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
>
> Hi Brandon,
>
> Understood. Thank you for the information.
>
> Just one more question would like to confirm with you, the README.md in the phosphor-ipmi-flash repo mentioned using net data transfer mechanism, this is not an in-band update, it is through the network connection, that means I can't use it if there is no network port on the motherboard, am I correct?
>
> Regards,
> Chris Chen
>
> -----Original Message-----
> From: Brandon Kim <brandonkim@google.com>
> Sent: Thursday, July 14, 2022 11:58 PM
> To: Chris Chen (TPI) <Chris.Chen3@flex.com>
> Cc: Willy Tu <wltu@google.com>; William Kennington <wak@google.com>; openbmc@lists.ozlabs.org; chris6906@gmail.com
> Subject: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC firmware
>
> Hi Chris,
>
> I'm unfortunately not familiar with the BIOS side of things - but I just know that we worked with the BIOS engineers to "reserve" some space at an arbitrary location for this MMIO and enable some flag to mark this as a shared location. To check if it works, I would encourage you use a mem write to the memory from the BIOS to the shared region to verify the change can be read back from the BIOS + BMC. To do this manually, you may also have to look through the Intel's PCH documentation regarding eSPI or LPC - and set the registers up using setpci commands (this should be done automatically by the burn_my_bmc tool).
>
> Looking through our internal codebase, we have not tested with Aspeed LPC in a very long time so it's also possible that there were some regression introduced, if you were able to successfully do a manual write to this shared region.
>
> Thanks,
> Brandon
>
> On Thu, Jul 14, 2022 at 4:39 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
> >
> > Hi Brandon and Willy,
> >
> > The host platform I'm using is Intel eagle stream with Aspeed 2600-A1.
> >
> > I am able to read/write to the dram memory on the BMC 0x98000000. Here is my result.
> > =====
> > root@hudsonbay-obmc:~# devmem 0x98000000 32 0xFFFFFFFF
> > root@hudsonbay-obmc:~# devmem 0x98000000 32 0x55AA66BB
> > root@hudsonbay-obmc:~# root@hudsonbay-obmc:~# devmem 0x98000000 32
> > 0x55AA66BB =====
> >
> > In addition, I found the "bmc-image" and "bmc.sig" files are with part of 0x55AA66BB after I finished the upper commands. It looks like that LPC/eSPI MMIO is not working in my case as you mentioned. So I am thinking is it possible that you could share how to set BIOS with me?
> >
> > Thank you.
> >
> > Regards,
> > Chris Chen
> >
> > ________________________________
> > 寄件者: Brandon Kim <brandonkim@google.com>
> > 寄件日期: 2022年7月14日 上午 12:45
> > 收件者: Willy Tu <wltu@google.com>
> > 副本: Chris Chen (TPI) <Chris.Chen3@flex.com>; William Kennington
> > <wak@google.com>; openbmc@lists.ozlabs.org <openbmc@lists.ozlabs.org>;
> > chris6906@gmail.com <chris6906@gmail.com>
> > 主旨: Re: [phosphor-ipmi-flash]: Question about in-band update of BMC
> > firmware
> >
> > Hi Chris,
> >
> > The region you choose on both the BMC and the BIOS IS important as the
> > BMC and the BIOS usually has a dedicated address for such a shared
> > MMIO. I am not a BIOS expert so I had to ask the BIOS team for the
> > address that is dedicated for LPC / eSPI (if you plan on using LPC /
> > eSPI) and had to refer to the BMC's datasheet for the region (I
> > believe it's defaulted to the Nuvoton region currently). As Willy
> > pointed out, my guess is that a manual write to the memory won't work
> > for you.
> >
> > Which BMC are you using if you don't mind me asking? Nuvoton vs. Aspeed?
> >
> > Thanks,
> > Brandon
> >
> > On Wed, Jul 13, 2022 at 9:40 AM Willy Tu <wltu@google.com> wrote:
> > >
> > > Hi Chris,
> > >
> > > I think you were able to set it up correctly. Can you check if you can read/write to the flash memory on the BMC 0x98000000? I am also wondering if that address is correct  or not. Like if that address is mapped to the BMC's memory. I have hit an issue where the image transferred does not match because the BIOS didn't set that up properly. I am unsure how to set that up.
> > >
> > > Willy Tu
> > >
> > > On Wed, Jul 13, 2022 at 1:15 AM Chris Chen (TPI) <Chris.Chen3@flex.com> wrote:
> > >>
> > >> Hi Brandon and William,
> > >>
> > >>
> > >>
> > >> As you know, I have already built the "burn_my_bmc" on my Host (Eagle Stream with Aspeed 2600). I for now tried to use it to do the in-band update of BMC firmware, the debug messages of the "burn_my_bmc" look good and I also got "bmc-image" and "bmc.sig" file in the "/run/initramfs" and "/tmp" directory respectively via LPC data transfer mechanism on the BMC. However, one thing is strange which is the content of the "bmcimage" and "bmc.sig" file are all 0xff. I think this should not be the normal case, perhaps I made a mistake. Following are my steps/changes on the Host-side and BMC-side, could you please take a look at it, is there anything wrong? Or do you have any suggestions for enabling the feature? Thanks.
> > >>
> > >>
> > >>
> > >> Host-side
> > >>
> > >> =====
> > >>
> > >> The e820 map of the Host system (just choose one area randomly,
> > >> should I need to reserve a specific area for this??) ####
> > >> archer@archer-ArcherCityM:mtd.all$ sudo dmesg | grep e820
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x000000000009e000-0x000000000009efff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] usable
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved                   <-- choose this area.
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000006d8effff] usable
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x000000006d8f0000-0x000000006f9effff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x000000006f9f0000-0x00000000702effff] ACPI data
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x00000000702f0000-0x0000000072c2ffff] ACPI NVS
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x0000000072c30000-0x00000000777fefff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x00000000777ff000-0x00000000777fffff] usable
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x0000000077800000-0x000000008fffffff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x00000000fe010000-0x00000000fe010fff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
> > >>
> > >> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000047fffffff] usable
> > >>
> > >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> > >>
> > >> [    0.000000] e820: update [mem 0x624a8018-0x624b0057] usable ==> usable
> > >>
> > >> [    0.000022] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
> > >>
> > >> [    0.000027] e820: remove [mem 0x000a0000-0x000fffff] usable
> > >>
> > >> [    0.003943] e820: update [mem 0x80000000-0xffffffff] usable ==> reserved
> > >>
> > >> [    0.017281] e820: update [mem 0x69d87000-0x69d87fff] usable ==> reserved
> > >>
> > >> [    0.017300] e820: update [mem 0x686c6000-0x686c6fff] usable ==> reserved
> > >>
> > >> [    5.045333] e820: reserve RAM buffer [mem 0x0009e000-0x0009ffff]
> > >>
> > >> [    5.045336] e820: reserve RAM buffer [mem 0x624a8018-0x63ffffff]
> > >>
> > >> [    5.045338] e820: reserve RAM buffer [mem 0x686c6000-0x6bffffff]
> > >>
> > >> [    5.045340] e820: reserve RAM buffer [mem 0x69d87000-0x6bffffff]
> > >>
> > >> [    5.045341] e820: reserve RAM buffer [mem 0x6d8f0000-0x6fffffff]
> > >>
> > >> [    5.045342] e820: reserve RAM buffer [mem 0x77800000-0x77ffffff]
> > >>
> > >> [   33.565052] systemd[1]: Mounting Mount unit for e820-bios, revision 9...
> > >>
> > >> [   33.702641] systemd[1]: Mounted Mount unit for e820-bios, revision 9.
> > >> ####
> > >>
> > >> The executed command and its result.
> > >> ####
> > >> archer@archer-ArcherCityM:mtd.all$ time sudo burn_my_bmc \
> > >>
> > >> --command update \
> > >>
> > >>                                                             --interface ipmilpc
> > >>                                                             --image ./image-bmc \
> > >>                                                             --sig ./image-bmc.sig \
> > >>                                                             --type image \
> > >>                                                             --address 0x000a0000 \
> > >>
> > >> --length 0x10000
> > >>
> > >> Sending over the firmware image.
> > >>
> > >> sending writeMeta
> > >>
> > >> writemeta sent
> > >>
> > >> Progress: 100.00%
> > >>
> > >> Sending over the hash file.
> > >>
> > >> sending writeMeta
> > >>
> > >> writemeta sent
> > >>
> > >> Progress: 100.00%
> > >>
> > >> Opening the verification file
> > >>
> > >> Committing to /flash/verify to trigger service
> > >>
> > >> Calling stat on /flash/verify session to check status
> > >>
> > >> success
> > >>
> > >> succeeded
> > >>
> > >> Opening the update file
> > >>
> > >> Committing to /flash/update to trigger service
> > >>
> > >> Calling stat on /flash/update session to check status
> > >>
> > >> success
> > >>
> > >> succeeded
> > >>
> > >>
> > >>
> > >> real  0m17.616s
> > >>
> > >> user  0m0.046s
> > >>
> > >> sys   0m0.147s
> > >>
> > >> ####
> > >>
> > >> =====
> > >>
> > >>
> > >>
> > >> BMC-side
> > >>
> > >> =====
> > >>
> > >> Code changes
> > >>
> > >> Add to install "phosphor-ipmi-flash" and "phosphor-ipmi-blobs" these two packages in packagegroup recipe.
> > >>
> > >> ####
> > >> SUMMARY:${PN}-system = "Flex Ltd System"
> > >>
> > >> RDEPENDS:${PN}-system = " \
> > >>
> > >>         phosphor-ipmi-blobs \
> > >>
> > >>         phosphor-ipmi-flash \
> > >>
> > >>         "
> > >>
> > >> ####
> > >>
> > >> Add "phosphor-impi-flash_%.bbapend" recipe with these lines(Bold).
> > >>
> > >> ####
> > >> SRCREV = "c277935e6fe0cdcf8aefc45b53d11bd6ca20f964"
> > >>
> > >>
> > >>
> > >> PACKAGECONFIG:append = " static-bmc"
> > >>
> > >> PACKAGECONFIG:append = " aspeed-lpc"
> > >>
> > >> PACKAGECONFIG:append = " reboot-update"
> > >>
> > >> IPMI_FLASH_BMC_ADDRESS = "0x98000000"
> > >>
> > >> ####
> > >>
> > >> Remove ",-Dupdate-type=none" in the phosphor-ipmi-flash_git.bb recipe as below, because the "Enabled Firmware Update Features" and "config-static-bmc-reboot.json" are not be included. This seems the "update-type" would always pass "none" to "phosphor-impi-flash" package without this change, but I'm not sure??
> > >>
> > >> ####
> > >> PACKAGECONFIG[static-bmc] = "-Dupdate-type=static-layout"
> > >> ####
> > >>
> > >> Add these lines(Bold). in Kernel dts file
> > >>
> > >> ####
> > >>
> > >> reserved-memory {
> > >>
> > >> #address-cells = <1>;
> > >>
> > >> #size-cells = <1>;
> > >>
> > >> ranges;
> > >>
> > >>
> > >>
> > >> video_engine_memory: video {
> > >>
> > >> size = <0x04000000>;
> > >>
> > >> alignment = <0x01000000>;
> > >>
> > >> compatible = "shared-dma-pool";
> > >>
> > >> reusable;
> > >>
> > >> };
> > >>
> > >>
> > >>
> > >> /* LPC FW cycle bridge region requires natural alignment */
> > >>
> > >> flash_memory: region@98000000 {
> > >>
> > >> no-map;
> > >>
> > >> reg = <0x98000000 0x04000000>; /* 64M */
> > >>
> > >> };
> > >>
> > >> };
> > >>
> > >> &lpc_ctrl {
> > >>
> > >> status = "okay";
> > >>
> > >> memory-region = <&flash_memory>;
> > >>
> > >> };
> > >>
> > >> ####
> > >>
> > >> BMC console
> > >>
> > >> Manually modify "config-static-bmc-reboot.json" to skip "preparation", "verification", and "update" actions because I want to make sure image file transfer is okay first.
> > >> ####
> > >> root@hudsonbay-obmc:~# cat
> > >> /usr/share/phosphor-ipmi-flash/config-static-bmc-reboot.json
> > >>
> > >> [{
> > >>
> > >>         "blob": "/flash/image",
> > >>
> > >>         "handler": {
> > >>
> > >>                 "type": "file",
> > >>
> > >>                 "path": "/run/initramfs/bmc-image"
> > >>
> > >>         },
> > >>
> > >>         "actions": {
> > >>
> > >>                 "preparation": {
> > >>
> > >>                         "type": "skip"
> > >>
> > >>                 },
> > >>
> > >>                 "verification": {
> > >>
> > >>                         "type": "skip"
> > >>
> > >>                 },
> > >>
> > >>                 "update": {
> > >>
> > >>                         "type": "skip"
> > >>
> > >>                 }
> > >>
> > >>         }
> > >>
> > >> }]
> > >> ####
> > >>
> > >> Create "/run/initramfs" directory manually.
> > >> ####
> > >> root@hudsonbay-obmc:~# mkdir /run/initramfs
> > >>
> > >> ####
> > >>
> > >> Result after executing burn_my_bmc command. (the content of
> > >> bmc-image and bmc.sig are all 0xff) ####
> > >>
> > >> root@hudsonbay-obmc:~# ls -al /run/initramfs/bmc-image
> > >> -rw-r--r--    1 root     root      67108864 Jan  1 01:47 /run/initramfs/bmc-image
> > >>
> > >> root@hudsonbay-obmc:~# hexdump -C /run/initramfs/bmc-image
> > >>
> > >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > >> |................|
> > >>
> > >> *
> > >>
> > >> 04000000
> > >>
> > >> root@hudsonbay-obmc:~# ls -al /tmp/bmc.sig
> > >>
> > >> -rw-r--r--    1 root     root           128 Jan  1 01:47 /tmp/bmc.sig
> > >>
> > >> root@hudsonbay-obmc:~# hexdump -C /tmp/bmc.sig
> > >>
> > >> 00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > >> |................|
> > >>
> > >> *
> > >>
> > >> 00000080
> > >> ####
> > >>
> > >> =====
> > >>
> > >>
> > >>
> > >> Regards,
> > >>
> > >> Chris Chen
> > >>
> > >> Legal Disclaimer :
> > >> The information contained in this message may be privileged and confidential.
> > >> It is intended to be read only by the individual or entity to whom
> > >> it is addressed or by their designee. If the reader of this message
> > >> is not the intended recipient, you are on notice that any
> > >> distribution of this message, in any form, is strictly prohibited.
> > >> If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-15 15:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13  8:15 [phosphor-ipmi-flash]: Question about in-band update of BMC firmware Chris Chen (TPI)
2022-07-13 16:40 ` Willy Tu
2022-07-13 16:45   ` Brandon Kim
2022-07-14 11:39     ` 回覆: " Chris Chen (TPI)
2022-07-14 15:58       ` Brandon Kim
2022-07-15  6:25         ` Chris Chen (TPI)
2022-07-15 15:36           ` Brandon Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.