d0ba43af | 09-Sep-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
clang-tidy: Enable cppcoreguidelines-pro-type-reinterpret-cast
There are ways to avoid reinterpret_cast<>() in many circumstances. For libpldm, often its use can be replaced with placement-new. Enab
clang-tidy: Enable cppcoreguidelines-pro-type-reinterpret-cast
There are ways to avoid reinterpret_cast<>() in many circumstances. For libpldm, often its use can be replaced with placement-new. Enable the lint for reinterpret_cast<>() to prevent its use in future changes. This way we can stay inside the language rather than rely on implementation-defined behavior.
Existing uses of reinterpret_cast<>() are marked NOLINT for now, with the intent that we clean them up over time. The insertion of the NOLINTs was automated with sed.
Change-Id: If6654f774e438de9262fe9f9012c6b574764c326 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
7a3c14ec | 08-Sep-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
base: Add size and buffer macros for struct pldm_msg
Give library users a supported way to allocate pldm_msg buffers on the stack.
A demonstration conversion is done in tests/oem/ibm/host.cpp.
Cha
base: Add size and buffer macros for struct pldm_msg
Give library users a supported way to allocate pldm_msg buffers on the stack.
A demonstration conversion is done in tests/oem/ibm/host.cpp.
Change-Id: I71158bd6b062c6e6522dc4a4cdcb089a139cd841 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
ea0bf3a8 | 19-Sep-2024 |
Lora Lin <lora.lin.wiwynn@gmail.com> |
oem: meta: Stabilise decode/encode file IO API
Stabilise decode_oem_meta_file_io_write_req() API Stabilise decode_oem_meta_file_io_read_req() API Stabilise encode_oem_meta_file_io_read_resp() API
S
oem: meta: Stabilise decode/encode file IO API
Stabilise decode_oem_meta_file_io_write_req() API Stabilise decode_oem_meta_file_io_read_req() API Stabilise encode_oem_meta_file_io_read_resp() API
See usage example at: [1] https://gerrit.openbmc.org/c/openbmc/pldm/+/71889/10/oem/meta/libpldmresponder/oem_meta_file_io.cpp#59 [2] https://gerrit.openbmc.org/c/openbmc/pldm/+/71889/10/oem/meta/libpldmresponder/oem_meta_file_io.cpp#89 [3] https://gerrit.openbmc.org/c/openbmc/pldm/+/71889/10/oem/meta/libpldmresponder/oem_meta_file_io.cpp#143
Change-Id: I8bc38e4fad7ad18dc7ab5062fab14cdd11fe9aef Signed-off-by: Lora Lin <lora.lin.wiwynn@gmail.com>
show more ...
|
6476c968 | 26-Jul-2024 |
Lora Lin <lora.lin.wiwynn@gmail.com> |
oem: meta: Add encode_oem_meta_file_io_read_resp()
Add encode_oem_meta_file_io_read_resp function
This function is used to encode the message of reading file IO. Assemble responses to read file IO
oem: meta: Add encode_oem_meta_file_io_read_resp()
Add encode_oem_meta_file_io_read_resp function
This function is used to encode the message of reading file IO. Assemble responses to read file IO messages, but the response content other than the completion code needs to be additionally appended.
Change-Id: Ib030ac9f37fe73b66fb762dcf8b8297bce79836a Signed-off-by: Lora Lin <lora.lin.wiwynn@gmail.com>
show more ...
|
893a08f0 | 16-Jul-2024 |
Lora Lin <lora.lin.wiwynn@gmail.com> |
oem: meta: Add decode_oem_meta_file_io_read_req()
Add decode_oem_meta_file_io_read_req function.
This function is used to decode the message of reading file IO. Need to include read_option (read fi
oem: meta: Add decode_oem_meta_file_io_read_req()
Add decode_oem_meta_file_io_read_req function.
This function is used to decode the message of reading file IO. Need to include read_option (read file attributes or data), length (the length of the read data) and read_info (The information needed to read the file). Take reading file data as an example: read_info needs to contain transferFlag, offset to know the starting position and transfer progress of the read file.
Change-Id: I425476d36e3cd69d2da45beceff1c4a2362640dc Signed-off-by: Lora Lin <lora.lin.wiwynn@gmail.com>
show more ...
|
84213eba | 21-Jul-2024 |
Lora Lin <lora.lin.wiwynn@gmail.com> |
tests: oem: meta: Convert to new API
Switching the test suite after the new API is introduced demonstrates that the existing API behaved as before at the time of merging the change.
Change-Id: I6d7
tests: oem: meta: Convert to new API
Switching the test suite after the new API is introduced demonstrates that the existing API behaved as before at the time of merging the change.
Change-Id: I6d7576bb8e8ad4f28e90b3b5f81e0f063a5496d4 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au> Signed-off-by: Lora Lin <lora.lin.wiwynn@gmail.com>
show more ...
|
e984a461 | 07-Sep-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
meson: Format build files with `meson format`
Additionally, add the formatting command to `scripts/pre-submit` so it's run by OpenBMC's CI (via `scripts/run-ci`).
Change-Id: Ifb8fc06106b8cfa9155e98
meson: Format build files with `meson format`
Additionally, add the formatting command to `scripts/pre-submit` so it's run by OpenBMC's CI (via `scripts/run-ci`).
Change-Id: Ifb8fc06106b8cfa9155e986528b769a5ca450b4c Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
0a1be3cb | 11-Aug-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
msgbuf: Harden pldm_msgbuf_{insert,extract}_array()
Review of some proposed APIs suggested that correct use of the pldm_msgbuf_{insert,extract}_array() helpers was more difficult that it should be.
msgbuf: Harden pldm_msgbuf_{insert,extract}_array()
Review of some proposed APIs suggested that correct use of the pldm_msgbuf_{insert,extract}_array() helpers was more difficult that it should be. In the three-parameter form, it was too tempting to provide the length to extract as parsed out of a PLDM message. The intended use was that the length parameter represented the length of the user-provided data buffer.
Instead, move to a four-parameter form, provide reasonable documentation for how these APIs should be used, fix all the call-sites, and deprecate some existing unsafe APIs.
Change-Id: If58e5574600e80b354f383554283c4eda5d7234c Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
48761c62 | 03-Jun-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
libpldm: Reorganize source and test files
Primarily this is about moving specification-specific files into 'dsp/' (in the "DMTF Standard Publication" sense[1]) subdirectories of both src/ and tests/
libpldm: Reorganize source and test files
Primarily this is about moving specification-specific files into 'dsp/' (in the "DMTF Standard Publication" sense[1]) subdirectories of both src/ and tests/.
[1]: https://www.dmtf.org/sites/default/files/standards/documents/DSP4014_2.14.0.pdf
libpldm is a concrete C implementation of the PLDM family of specifications. This invokes some accidental complexity[2] such as the msgbuf APIs and other concerns.
[2]: https://en.wikipedia.org/wiki/No_Silver_Bullet
Separate the essential complexity (everything under the dsp/ subdirectories) from the accidental complexity (almost everything else).
While doing so, I took the opportunity to drop the 'libpldm_' prefix and '_test' suffix from a variety of tests. The 'libpldm_' prefix is a hangover from the days when libpldm was a subproject of OpenBMC's pldm repo. The '_test' suffix feels redundant given the parent directory path.
Note that we maintain separation of the src/ and tests/. The test suite is implemented in C++ while libpldm's APIs are declared and defined in C. The ability to chop all the tests and C++ out of the implementation by ignoring a subtree seems like a desirable property when vendoring the library into other projects.
Finally, update the x86_64 GCC ABI dump, as rearranging the source causes a lot of churn in its definitions.
Change-Id: Icffcc6cf48b3101ecd38168827c0a81cffb8f083 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
d480b704 | 03-Jun-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
tests: meson: Push build configuration down to leaf directories
I feel this keeps things a bit more self-contained.
Change-Id: I68de6e4b0269d64b620b6c339825113e31074b4c Signed-off-by: Andrew Jeffer
tests: meson: Push build configuration down to leaf directories
I feel this keeps things a bit more self-contained.
Change-Id: I68de6e4b0269d64b620b6c339825113e31074b4c Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
c8df31c1 | 21-May-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
msgbuf: Add error code personalities
libpldm is in a bit of a transitional period with respect to returned error codes. A historical choice was to return PLDM completion codes from the library API t
msgbuf: Add error code personalities
libpldm is in a bit of a transitional period with respect to returned error codes. A historical choice was to return PLDM completion codes from the library API to indicate errors. This is unfortunate because we're now constrained to errors that are specified by the PLDM protocol, which is much less expressive than the set of errors that might be produced by a run-time environment for the library.
The choice going forward is to return C's errno codes. However at this point we step on another rake in the libpldm design, which is that some internal data structures are very much the wire format of corresponding PLDM messages (such as the PDR repository implementation). Working with wire-format buffers is most safely done via the msgbuf APIs, however we then hit the conflict of different error code styles in various parts of the API surface.
Do a bit of surgery to provide different error code personalities for msgbuf, such that the caller can pick the style of error code they need it to return to maintain consistency.
Note that like the previous patch marking all msgbuf APIs as __attribute__((always_inline)), the rework here makes another small impact on the argument register allocation of several stable APIs. The ABI dump is updated accordingly.
Change-Id: Id59c39c5c822f514f546dab88575317071a97c96 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
32df16c4 | 16-May-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
tests: oem: meta: Fix fileio use of msgbuf
After resolving some undefined behavior regarding pointer arithmetic in pldm_msgbuf_init(), clang-tidy detected the following:
``` clang-tidy-17 -export-f
tests: oem: meta: Fix fileio use of msgbuf
After resolving some undefined behavior regarding pointer arithmetic in pldm_msgbuf_init(), clang-tidy detected the following:
``` clang-tidy-17 -export-fixes /tmp/tmpmu0oifam/tmpwpj83pgb.yaml -p=/home/andrew/src/openbmc.org/openbmc/libpldm/origin/buildkcgocca3 -quiet /home/andrew/src/openbmc.org/openbmc/libpldm/origin/tests/oem/meta/libpldm_fileio_test.cpp ../src/msgbuf.h:593:14: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors] 593 | if (!ctx || !ctx->cursor) { | ^ ../tests/oem/meta/libpldm_fileio_test.cpp:26:5: note: Calling 'pldm_msgbuf_init' 26 | pldm_msgbuf_init(ctx, 0, &buf[hdrSize], sizeof(buf) - hdrSize); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/msgbuf.h:75:7: note: 'ctx' is non-null 75 | if (!ctx || !buf) { | ^~~ ../src/msgbuf.h:75:6: note: Left side of '||' is false 75 | if (!ctx || !buf) { | ^ ../src/msgbuf.h:75:15: note: 'buf' is non-null 75 | if (!ctx || !buf) { | ^~~ ../src/msgbuf.h:75:2: note: Taking false branch 75 | if (!ctx || !buf) { | ^ ../src/msgbuf.h:79:7: note: 'minsize' is <= 'len' 79 | if ((minsize > len) || (len > SSIZE_MAX)) { | ^~~~~~~ ../src/msgbuf.h:79:6: note: Left side of '||' is false 79 | if ((minsize > len) || (len > SSIZE_MAX)) { | ^ ../src/msgbuf.h:79:26: note: 'len' is <= SSIZE_MAX 79 | if ((minsize > len) || (len > SSIZE_MAX)) { | ^~~ ../src/msgbuf.h:79:2: note: Taking false branch 79 | if ((minsize > len) || (len > SSIZE_MAX)) { | ^ ../src/msgbuf.h:83:6: note: Assuming the condition is true 83 | if ((uintptr_t)buf + len < len) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/msgbuf.h:83:2: note: Taking true branch 83 | if ((uintptr_t)buf + len < len) { | ^ ../src/msgbuf.h:84:3: note: Returning without writing to 'ctx->cursor' 84 | return PLDM_ERROR_INVALID_LENGTH; | ^ ../tests/oem/meta/libpldm_fileio_test.cpp:26:5: note: Returning from 'pldm_msgbuf_init' 26 | pldm_msgbuf_init(ctx, 0, &buf[hdrSize], sizeof(buf) - hdrSize); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../tests/oem/meta/libpldm_fileio_test.cpp:28:5: note: Calling 'pldm_msgbuf_insert_uint8' 28 | pldm_msgbuf_insert_uint8(ctx, fileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/msgbuf.h:593:7: note: 'ctx' is non-null 593 | if (!ctx || !ctx->cursor) { | ^~~ ../src/msgbuf.h:593:6: note: Left side of '||' is false 593 | if (!ctx || !ctx->cursor) { | ^ ../src/msgbuf.h:593:14: note: Branch condition evaluates to a garbage value 593 | if (!ctx || !ctx->cursor) { | ^~~~~~~~~~~~ ```
Fixes: 22fad3957d36 ("oem: meta: Add decode_oem_meta_file_io_req()") Change-Id: I99f1d6f8c28a7e812b12f5ef60af5d0f0b0d1866 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
dc7d3b5b | 06-Feb-2024 |
Pavithra Barithaya <pavithra.b@ibm.com> |
libpldm: Change hexadecimal literals to lowercase
As per a comment at [1].
The change was generated with the following:
``` sed -Ei 's/0[xX]([0-9]*[A-F][0-9]*)+/\L\0/g' $(git ls-files) ```
[1]: h
libpldm: Change hexadecimal literals to lowercase
As per a comment at [1].
The change was generated with the following:
``` sed -Ei 's/0[xX]([0-9]*[A-F][0-9]*)+/\L\0/g' $(git ls-files) ```
[1]: https://gerrit.openbmc.org/c/openbmc/libpldm/+/69192
Change-Id: Ib0a41dfaf626aec3167e773262883f9c1de797b2 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
22fad395 | 26-Oct-2023 |
Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com> |
oem: meta: Add decode_oem_meta_file_io_req()
Support decode_oem_meta_file_io_req() cmd to decode the incoming post code.
PLDM OEM Meta Write File IO cmd: Example: Request: Byte 0: 0x3F (OEM c
oem: meta: Add decode_oem_meta_file_io_req()
Support decode_oem_meta_file_io_req() cmd to decode the incoming post code.
PLDM OEM Meta Write File IO cmd: Example: Request: Byte 0: 0x3F (OEM cmd) Byte 1: 0x02 (FILE IO) Byte 2: 0x00 (File io type : POST CODE) Byte 3-6: 0x04 (Data length) Byte 7-10: 0x93 0xE0 0x00 0xEA (post code)
Response: Byte 0: 0x00 (success)
Tested: - Unit Tests passed.
Change-Id: I85437698642dd3cbe6084acf1feada842d206eac Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
show more ...
|
a7989cd6 | 30-Oct-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
meson: Fix for OEM header collision issue
It needs to be possible to build libpldm with any number of oem features enabled simultaneously. If the header files are same then the earlier implementatio
meson: Fix for OEM header collision issue
It needs to be possible to build libpldm with any number of oem features enabled simultaneously. If the header files are same then the earlier implementation will not work.
Install the header file in a way that doesn't break any oem portions. Also the symlinks are generated to the older location until we migrate the applications using the files to new location.
Tested: The headers are installed in the new location and symlinks are generated.
Change-Id: I1455d52ff4b0c7f74b49d136bf582182537592d1 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
b0c1d20a | 07-Nov-2023 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
libpldm: Fix header use
The headers need to work whether we're building libpldm in the repo or we're building another project depending on the headers in the system include directory.
Tidy up the p
libpldm: Fix header use
The headers need to work whether we're building libpldm in the repo or we're building another project depending on the headers in the system include directory.
Tidy up the paths involved and switch to defining the public headers as system headers for the purpose of the build.
Change-Id: I49413988c94d393ea5761bc4684edcd2c2482a98 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
5a706073 | 05-Apr-2023 |
Andrew Jeffery <andrew@aj.id.au> |
clang-tidy: Fix modernize-deprecated-headers diagnostic
For example:
``` /mnt/host/andrew/src/openbmc/libpldm/build/../tests/libpldm_bios_test.cpp:2:10: error: inclusion of deprecated C++ header 's
clang-tidy: Fix modernize-deprecated-headers diagnostic
For example:
``` /mnt/host/andrew/src/openbmc/libpldm/build/../tests/libpldm_bios_test.cpp:2:10: error: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead [modernize-deprecated-headers,-warnings-as-errors] ^~~~~~~~~~ <cstdint> ```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ifebba7d7c21cc60a389a8783361fc23226135ee0
show more ...
|
9a8e4975 | 28-Nov-2022 |
Manojkiran Eda <manojkiran.eda@gmail.com> |
Fix includes using iwyu tool
These changes are done by running iwyu manually under clang14.
IWYU can increase readability, make maintenance easier, and avoid errors in some cases. See details in ``
Fix includes using iwyu tool
These changes are done by running iwyu manually under clang14.
IWYU can increase readability, make maintenance easier, and avoid errors in some cases. See details in ``` https: //github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md. ``` Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: Idaaeffd78c9ad7db2b41a057d40f889ade297c55
show more ...
|
9c766792 | 10-Aug-2022 |
Andrew Jeffery <andrew@aj.id.au> |
libpldm: Migrate to subproject
Organize files in libpldm to make it a subproject
In the current state, libpldm is not readily consumable as a subproject.This commit does all the necessary re-organi
libpldm: Migrate to subproject
Organize files in libpldm to make it a subproject
In the current state, libpldm is not readily consumable as a subproject.This commit does all the necessary re-organisation of the source code to make it work as a subproject.
There are no .c/.h files changes in this commit, only meson changes and re-organising the code structure.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: I20a71c0c972b1fd81fb359d604433618799102c6
show more ...
|