Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManageabilityPkg/IpmiSmbiosTransferDxe: add support of sending SMBIOS table to BMC #187

Merged
merged 5 commits into from
Oct 24, 2024

Conversation

nicklela
Copy link
Contributor

@nicklela nicklela commented Sep 4, 2024

Add IpmiSmbiosTransferDxe driver to ManageabilityPkg. This enables the ability of sending SMBIOS table to BMC by using IPMI Blob transfer protocol.

I also fixed several build issues observed on GCC5 build.

Add missing "EFIAPI" to fix GCC5 build failure.

Signed-off-by: Nickle Wang <[email protected]>
Add missing PCD: PcdIpmiSsifSmbusSlaveAddr.

Signed-off-by: Nickle Wang <[email protected]>
@nhivp
Copy link
Member

nhivp commented Sep 5, 2024

I'm getting the following error when testing on Ampere Mt. Jade platform.

IpmiBlobTransferSendIpmi: SendDataSize: 00
Data:
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 04
Data: CFC20000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0A
Data: 00CFC200A47801000000
CalculateCrc16Ccitt: CRC-16-CCITT 78A4
CalculateCrc16Ccitt: CRC-16-CCITT E10
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 04
Data: 00000000
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 0A
Data: CFC20001100E00000000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0E
Data: 00CFC20081132F736D62696F7300
CalculateCrc16Ccitt: CRC-16-CCITT 1381
CalculateCrc16Ccitt: CRC-16-CCITT A8CB
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 0A
Data: 02002F736D62696F7300
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 10
Data: CFC20002CBA802002F736D62696F7300
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 08
Data: 00CFC200D0C52125
CalculateCrc16Ccitt: CRC-16-CCITT C5D0
IpmiSmbiosTransferSendTables: Failure writing to blob: Invalid Parameter
ERROR: C80000002:V03080000 I0 1E2F6B56-4675-446B-9C0A-1EB66E50C840 BFB13728
PROGRESS CODE: V03051001 I0

@nhivp
Copy link
Member

nhivp commented Sep 5, 2024

I'm getting the following error when testing on Ampere Mt. Jade platform.

IpmiBlobTransferSendIpmi: SendDataSize: 00
Data:
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 04
Data: CFC20000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0A
Data: 00CFC200A47801000000
CalculateCrc16Ccitt: CRC-16-CCITT 78A4
CalculateCrc16Ccitt: CRC-16-CCITT E10
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 04
Data: 00000000
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 0A
Data: CFC20001100E00000000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0E
Data: 00CFC20081132F736D62696F7300
CalculateCrc16Ccitt: CRC-16-CCITT 1381
CalculateCrc16Ccitt: CRC-16-CCITT A8CB
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 0A
Data: 02002F736D62696F7300
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 10
Data: CFC20002CBA802002F736D62696F7300
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 08
Data: 00CFC200D0C52125
CalculateCrc16Ccitt: CRC-16-CCITT C5D0
IpmiSmbiosTransferSendTables: Failure writing to blob: Invalid Parameter
ERROR: C80000002:V03080000 I0 1E2F6B56-4675-446B-9C0A-1EB66E50C840 BFB13728
PROGRESS CODE: V03051001 I0

It could be a bug in the IpmiBlobTransferSendIpmi (). I think the ResponseData is an optional parameter. See the following patch. It works on my system.

--- a/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.c
+++ b/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.c
@@ -110,7 +110,9 @@ IpmiBlobTransferSendIpmi (
   UINT32                     IpmiResponseDataSize;
   IPMI_BLOB_TRANSFER_HEADER  Header;

-  if (((SendDataSize > 0) && (SendData == NULL)) || (ResponseData == NULL) || (ResponseDataSize == NULL)) {
+  if (  ((SendDataSize > 0) && (SendData == NULL))
+     || ((ResponseData == NULL) && (ResponseDataSize == NULL) && (*ResponseDataSize > 0)))
+  {
     return EFI_INVALID_PARAMETER;
   }

@nhivp
Copy link
Member

nhivp commented Oct 21, 2024

Hi @nicklela, for BMC-HOST synchronization, what will happen if users update the BMC firmware without preserving the configuration data while the HOST is still powered on? I think BMC will not be able to tell HOST to resend the SMBIOS table in that case.

Adding support to transfer SMBIOS binary blob to the BMC by using
the IpmiBlobTransfer protocol.

Signed-off-by: Nick Ramirez <[email protected]>
Co-authored-by: Nickle Wang <[email protected]>
Add IpmiSmbiosTransferDxe to ManageabilityPkg.

Signed-off-by: Nickle Wang <[email protected]>
@nicklela
Copy link
Contributor Author

Hi @nicklela, for BMC-HOST synchronization, what will happen if users update the BMC firmware without preserving the configuration data while the HOST is still powered on? I think BMC will not be able to tell HOST to resend the SMBIOS table in that case.

When BMC works in that way, BIOS has to send smbios table on every boot because there is no defined interface between BMC and BIOS to know this. So probably we can define PcdSendSmbiosOnChanged default to FALSE?

@nicklela
Copy link
Contributor Author

@nhivp @changab I think I addressed the most of review comments. Could you please help me to review it again?

@nhivp
Copy link
Member

nhivp commented Oct 22, 2024

Hi @nicklela, for BMC-HOST synchronization, what will happen if users update the BMC firmware without preserving the configuration data while the HOST is still powered on? I think BMC will not be able to tell HOST to resend the SMBIOS table in that case.

When BMC works in that way, BIOS has to send smbios table on every boot because there is no defined interface between BMC and BIOS to know this. So probably we can define PcdSendSmbiosOnChanged default to FALSE?

I think we need a clean solution for this corner case, rather than setting the PCD to always transfer the SMBIOS which impacts boot time performance. I'm unsure whether this is a gap in the IPMI blob transfer specification. @changab any thoughts?

@nhivp
Copy link
Member

nhivp commented Oct 22, 2024

I'm getting the following error when testing on Ampere Mt. Jade platform.

IpmiBlobTransferSendIpmi: SendDataSize: 00
Data:
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 04
Data: CFC20000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0A
Data: 00CFC200A47801000000
CalculateCrc16Ccitt: CRC-16-CCITT 78A4
CalculateCrc16Ccitt: CRC-16-CCITT E10
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 04
Data: 00000000
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 0A
Data: CFC20001100E00000000
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 0E
Data: 00CFC20081132F736D62696F7300
CalculateCrc16Ccitt: CRC-16-CCITT 1381
CalculateCrc16Ccitt: CRC-16-CCITT A8CB
IpmiBlobTransferSendIpmi: Inputs:
IpmiBlobTransferSendIpmi: SendDataSize: 0A
Data: 02002F736D62696F7300
IpmiBlobTransferSendIpmi: IpmiSendDataSize: 10
Data: CFC20002CBA802002F736D62696F7300
IpmiBlobTransferSendIpmi: IPMI Response:
IpmiBlobTransferSendIpmi: ResponseDataSize: 08
Data: 00CFC200D0C52125
CalculateCrc16Ccitt: CRC-16-CCITT C5D0
IpmiSmbiosTransferSendTables: Failure writing to blob: Invalid Parameter
ERROR: C80000002:V03080000 I0 1E2F6B56-4675-446B-9C0A-1EB66E50C840 BFB13728
PROGRESS CODE: V03051001 I0

It could be a bug in the IpmiBlobTransferSendIpmi (). I think the ResponseData is an optional parameter. See the following patch. It works on my system.

--- a/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.c
+++ b/Features/ManageabilityPkg/Universal/IpmiBlobTransferDxe/IpmiBlobTransferDxe.c
@@ -110,7 +110,9 @@ IpmiBlobTransferSendIpmi (
   UINT32                     IpmiResponseDataSize;
   IPMI_BLOB_TRANSFER_HEADER  Header;

-  if (((SendDataSize > 0) && (SendData == NULL)) || (ResponseData == NULL) || (ResponseDataSize == NULL)) {
+  if (  ((SendDataSize > 0) && (SendData == NULL))
+     || ((ResponseData == NULL) && (ResponseDataSize == NULL) && (*ResponseDataSize > 0)))
+  {
     return EFI_INVALID_PARAMETER;
   }

Can you apply this fix? The Mt. Jade platform does not work without this fix.

IpmiBlobTransferWrite() is calling the IpmiBlobTransferSendIpmi() with NULL ResponseData

@nicklela
Copy link
Contributor Author

if ( ((SendDataSize > 0) && (SendData == NULL))

  • || ((ResponseData == NULL) && (ResponseDataSize == NULL) && (*ResponseDataSize > 0)))
    

@nhivp

I think the condition statement would be:

if (((SendDataSize > 0) && (SendData == NULL)) 
|| ((ResponseData == NULL) && (((ResponseDataSize != NULL) && (*ResponseDataSize > 0))))) {

When ResponseDataSize is NULL, we are not able to get its value by *ResponseDataSize

Please correct me if I misunderstand your comment.

@nhivp
Copy link
Member

nhivp commented Oct 24, 2024

@nhivp

I think the condition statement would be:

if (((SendDataSize > 0) && (SendData == NULL)) 
|| ((ResponseData == NULL) && (((ResponseDataSize != NULL) && (*ResponseDataSize > 0))))) {

When ResponseDataSize is NULL, we are not able to get its value by *ResponseDataSize

Please correct me if I misunderstand your comment.

Ah, you're right. Please incorporate this change to the pull request.

While calling IpmiBlobTransferSendIpmi(), it is expected that
there is no response data for certain command. Enhance this function
to accept NULL response data parameter.

Signed-off-by: Nickle Wang <[email protected]>
@nicklela
Copy link
Contributor Author

Done. I add additional commit to handle the case when response data is optional.

@nhivp
I think the condition statement would be:

if (((SendDataSize > 0) && (SendData == NULL)) 
|| ((ResponseData == NULL) && (((ResponseDataSize != NULL) && (*ResponseDataSize > 0))))) {

When ResponseDataSize is NULL, we are not able to get its value by *ResponseDataSize
Please correct me if I misunderstand your comment.

Ah, you're right. Please incorporate this change to the pull request.

Copy link
Member

@nhivp nhivp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nicklela. It works perfectly on my Mt. Jade system.

@nicklela nicklela requested a review from changab October 24, 2024 08:48
@nicklela
Copy link
Contributor Author

Thanks @nicklela. It works perfectly on my Mt. Jade system.

@changab if latest commit looks good to you, please help to merge it. Thanks :)

Copy link
Member

@changab changab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the changes and I have no problem with this commit.

@changab changab merged commit 920dbcb into tianocore:master Oct 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants