| f9090f37 | 15-Jul-2025 |
Eric Yang <eric.yang.wiwynn@gmail.com> |
pldm: Use std::expected for instance ID allocation
Refactor InstanceIdDb::next() to return std::expected<uint8_t, InstanceIdError> instead of throwing exceptions. With this change, errors are no lon
pldm: Use std::expected for instance ID allocation
Refactor InstanceIdDb::next() to return std::expected<uint8_t, InstanceIdError> instead of throwing exceptions. With this change, errors are no longer thrown by default. Instead, the caller can inspect allocation errors as values, extract the error message or code as needed, or explicitly throw the error further up the stack if appropriate. This approach allows for more flexible and explicit error handling, and reduces reliance on exception-based control flow.
Motivation: This change aims to improve robustness by enabling explicit error handling and reducing the risk of uncaught exceptions that could lead to a pldmd core dump if an instance ID allocation fails for a single EID. Such a core dump could disrupt ongoing operations such as sensor polling or firmware updates for other EIDs
Note: Currently, some call sites are still void-returning functions and cannot propagate errors via return values. As a result, errors from InstanceIdDb::next() are thrown as InstanceIdError at these locations to avoid silent failures. Ideally, it would be preferable for these functions to propagate errors by value (for example, using std::expected), so that errors can always be handled explicitly without relying on exceptions.
Change-Id: I7189e97f206bae1eed5c8db44ebbbcd4393c8f8d Signed-off-by: Eric Yang <eric.yang.wiwynn@gmail.com>
show more ...
|
| a6046a7b | 11-Nov-2025 |
Alexander Hansen <alexander.hansen@9elements.com> |
fix ci: move to stdexec::inline_scheduler
Move from `exec::inline_scheduler` to `stdexec::inline_scheduler`.
Looks like the definition has been deprecated and is pointing to `stdexec::inline_schedu
fix ci: move to stdexec::inline_scheduler
Move from `exec::inline_scheduler` to `stdexec::inline_scheduler`.
Looks like the definition has been deprecated and is pointing to `stdexec::inline_scheduler` anyways.
the relevant header ```
namespace exec { // A simple scheduler that executes its continuation inline, on the // thread of the caller of start(). using inline_scheduler [[deprecated("Use stdexec::inline_scheduler instead")]] = stdexec::inline_scheduler; } // namespace exec ```
Tested: Inspection only.
Fixes: 10d0b4b7d1498cfd5c3d37edea271a54d1984e41 Change-Id: I1d23cb624e8902c541eeb31bd31155a3207a2da9 Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
show more ...
|
| 22bcb07d | 11-Jul-2025 |
ManojKiran Eda <manojkiran.eda@gmail.com> |
Revert "pldm: use std::expected for instance ID allocation"
This reverts commit 70262ed7bf854b25d4b65628bc3c892ddfe9380f.
Change-Id: I1f54d6b60bf3cfa9f00764140eec6167e1e182d6 Signed-off-by: Manojki
Revert "pldm: use std::expected for instance ID allocation"
This reverts commit 70262ed7bf854b25d4b65628bc3c892ddfe9380f.
Change-Id: I1f54d6b60bf3cfa9f00764140eec6167e1e182d6 Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
show more ...
|
| 70262ed7 | 02-Jul-2025 |
Eric Yang <eric.yang.wiwynn@gmail.com> |
pldm: use std::expected for instance ID allocation
Refactor InstanceIdDb::next() to return std::expected<uint8_t, InstanceIdError> instead of throwing exceptions. This change enables callers to expl
pldm: use std::expected for instance ID allocation
Refactor InstanceIdDb::next() to return std::expected<uint8_t, InstanceIdError> instead of throwing exceptions. This change enables callers to explicitly handle allocation errors via value inspection, rather than relying on exception handling.
This approach prevents core dumps from uncaught exceptions and eliminates the need for pervasive try-catch blocks. Callers can now access the error code and message directly, improving clarity and control of error propagation.
Note: Errors from InstanceIdDb::next() are currently handled via early return, which may silently discard failures. This is a temporary solution; APIs and callers will need to be updated in the future to propagate and handle errors explicitly.
Change-Id: Ibf2e0034b0ee725cb59adfd93b74e48db8c42cba Signed-off-by: Eric Yang <eric.yang.wiwynn@gmail.com>
show more ...
|
| 70eca96b | 10-May-2025 |
Eric Yang <eric.yang.wiwynn@gmail.com> |
Fix build issues after migrating to Clang 20
With the recent migration to Clang 20 in openbmc-build-scripts, the current PLDM codebase fails to compile due to stricter type checking and unused field
Fix build issues after migrating to Clang 20
With the recent migration to Clang 20 in openbmc-build-scripts, the current PLDM codebase fails to compile due to stricter type checking and unused field warnings introduced by the updated compiler.
This commit addresses the following issues to restore build stability:
1. Callback compatibility: Replaced std::bind_front with lambda expressions that explicitly capture this, resolving type mismatch errors when assigning member function callbacks to std::function. 2. Unused field warning: Removed the unused `bus` member variable from the `SoftPowerOff` class and updated its constructor accordingly to eliminate `-Wunused-private-field` warnings.
These changes are required to allow successful CI builds under the Clang 20 toolchain.
Change-Id: I8eb909c2b1263bf7b2dbf53cdfc0424d425d352b Signed-off-by: Eric Yang <eric.yang.wiwynn@gmail.com>
show more ...
|
| c40d4a68 | 11-Mar-2025 |
Unive Tien <unive.tien.wiwynn@gmail.com> |
requester: associate Entity Manager configs with MCTP endpoints
Currently, pldmd listens for new MCTP endpoint exposed by mctpd, but they only shows their EID, Network Id, and SupportedMessageTypes,
requester: associate Entity Manager configs with MCTP endpoints
Currently, pldmd listens for new MCTP endpoint exposed by mctpd, but they only shows their EID, Network Id, and SupportedMessageTypes, which cannot fulfill some requirements, e.g., get the device's name or which board it belongs to.
In openbmc, the additional information are exposed by Entity Manager[1][2], so add this ability to `MctpDiscovery, it queries the association between MCTP endpoints and Entity Manager configurations from MCTP Reactor, when a new MCTP endpoint has been register by mctpd.
Added unit test for this commit to validate the association does work, passed.
[1]: https://github.com/openbmc/entity-manager/blob/master/schemas/mctp.json [2]: https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/69111
Change-Id: Ibf1717f1840e527f21bd8397e747ae121e2dcd25 Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
show more ...
|
| 5ea72377 | 04-Feb-2025 |
Pavithra Barithaya <pavithrabarithaya07@gmail.com> |
tests: Migrate to placement_new from reinterpret casting
reinterpret_cast is prohibited by the C++ core guidelines because it takes the behavior outside the language definition and gives problems wi
tests: Migrate to placement_new from reinterpret casting
reinterpret_cast is prohibited by the C++ core guidelines because it takes the behavior outside the language definition and gives problems with type safety. Placement-new on the other-hand allows to control the object storage while still properly instantiating an object,keeping the behavior inside the C++ language specification.
Change-Id: Ifab9ea58b932db11d7af0b9def119bed1bfdc44d Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
show more ...
|
| 38e12aa2 | 21-Jan-2025 |
Thu Nguyen <thu@os.amperecomputing.com> |
Support `terminus_name` option in `dbus_to_terminus_effecter`
Support `terminus_name` configuration option in `dbus_to_terminus_effecter` to allow setting the destination terminus beside `mctp_eid`.
Support `terminus_name` option in `dbus_to_terminus_effecter`
Support `terminus_name` configuration option in `dbus_to_terminus_effecter` to allow setting the destination terminus beside `mctp_eid`. This is helpful when the mctp endpoint Eid is not static.
Change-Id: I8b1ed15741807086254146017c99c13ae667dac1 Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
show more ...
|
| 75e00422 | 19-Mar-2024 |
Chau Ly <chaul@amperecomputing.com> |
platform-mc: Handle `Connectivity` propertiesChanged signal
From Mctp codeConstruct version 2.0 [1], mctpd supports `.Connectivity` property under `au.com.CodeConstruct.MCTP.Endpoint` interface of t
platform-mc: Handle `Connectivity` propertiesChanged signal
From Mctp codeConstruct version 2.0 [1], mctpd supports `.Connectivity` property under `au.com.CodeConstruct.MCTP.Endpoint` interface of the endpoint. This commit handles the propertiesChanged signal from this interface, and updates the Availability of the MCTP Endpoint accordingly in the source to enable or disable message sending/receiving via that endpoint of the terminus.
[1] https://github.com/CodeConstruct/mctp/blob/v2.0/docs/endpoint-recovery.md#proposed-design
When the discovery process first starts, it will only handle the endpoints that have `Available` `.Connectivity`. It lets the propertiesChanged signal trigger the adding of the endpoints when they are back to` Available`.
On interfaceAdded signal, it assumes that mctpd only publishes available endpoints to D-Bus, so it adds the endpoints to the terminus anyway.
Tested: 1. Enable `unsafe-writable-connectivity` option in PACKAGECONFIG of mctp recipe. 2. After PLDM discovers all the endpoints, write `Degraded` to `.Connectivity` of one of the endpoint. 3. Write it back to `Available` to see how message is stopped from being sent/received via the endpoint.
Signed-off-by: Chau Ly <chaul@amperecomputing.com> Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I5b7a38ae72e655b60d71396a1118f2809aaa3838
show more ...
|
| 366507c8 | 03-Feb-2025 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: I95f756bab7f403af49a94011bbb1fe4e51f985ad Signed-off-by: Patrick Williams <p
clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: I95f756bab7f403af49a94011bbb1fe4e51f985ad Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 3012b632 | 22-Aug-2024 |
Manojkiran Eda <manojkiran.eda@gmail.com> |
Format meson files with meson.format
Meson 1.5.0 introduced a new feature to format all the meson files. Formatting all the meson files is now as simple as running `meson format -i -r` command in th
Format meson files with meson.format
Meson 1.5.0 introduced a new feature to format all the meson files. Formatting all the meson files is now as simple as running `meson format -i -r` command in the repository root folder.
more details : https://mesonbuild.com/Commands.html#format
Change-Id: I9c5468cc502ae78b7a055e2de2a10296930cb9ec Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
show more ...
|
| 16c2a0a0 | 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I8c84201cb2343a8c8a5507a49de0721a1bee7063 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 61be7347 | 30-Jul-2024 |
Patrick Williams <patrick@stwcx.xyz> |
stdexec: pass scheduler to default_task_context
The latest version of stdexec[1] does not allow a default constructed `default_task_context` but requires a scheduler to be passed in. The previous d
stdexec: pass scheduler to default_task_context
The latest version of stdexec[1] does not allow a default constructed `default_task_context` but requires a scheduler to be passed in. The previous default was to use an `inline_scheduler` so explicitly pass that in.
[1]: https://github.com/openbmc/sdbusplus/commit/5cee91570368554a7fcbbd9418f65efda449fa70
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib210b42ba5272e0176cd4423b156ca6372115a55
show more ...
|
| c14fb4bd | 25-Jul-2024 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
pldm: Drop pessimizing moves
Fixes issues such as:
``` ../host-bmc/host_pdr_handler.cpp:684:9: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] 684 | st
pldm: Drop pessimizing moves
Fixes issues such as:
``` ../host-bmc/host_pdr_handler.cpp:684:9: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] 684 | std::move(std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION)), | ^ ../host-bmc/host_pdr_handler.cpp:684:9: note: remove std::move call here 684 | std::move(std::vector<uint8_t>(1, PLDM_PDR_ENTITY_ASSOCIATION)), | ^~~~~~~~~~ ~ ```
Change-Id: Id26f0d6fc21837e1eb76ae3c294c222782a4e69f Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|
| 6b901e4a | 10-Jul-2024 |
Thu Nguyen <thu@os.amperecomputing.com> |
requester: Use return code instead of throwing exception
The coroutine API should only forward error code and response data to the caller when sends/receives PLDM message instead check the response
requester: Use return code instead of throwing exception
The coroutine API should only forward error code and response data to the caller when sends/receives PLDM message instead check the response and thrown exception.
The `sendRecvMsg` API will response tuple of error code, response and response length as below:
+ [error_code, _, _] if registerRequest fails with `error_code`. + [PLDM_ERROR_NOT_READY, nullptr, 0] if the request is timed out. + [PLDM_SUCCESS, resp, len] if succeeded.
Signed-off-by: Khang Nguyen Duy <khangng@amperecomputing.com> Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: Id8262d147e9fed50af8f55f1c611a3a3b153b6e3
show more ...
|
| a85c69d3 | 09-Jan-2024 |
Gilbert Chen <gilbert.chen@arm.com> |
requester: Add coroutine API
Added coroutine API to Handler using stdexec to help send and receive messages in one function call.
For example, to get all PDRs from terminus needs multiple getPDR co
requester: Add coroutine API
Added coroutine API to Handler using stdexec to help send and receive messages in one function call.
For example, to get all PDRs from terminus needs multiple getPDR commands. Except first getPDR commands, the following getPDR command request data(e.g. dataTransferHandle) needs the previous getPDR command response data(e.g. nextDataTransferHandle). By using C++ co_await, the code to get all PDRs can straightforward be implemented by a while loop.
Pseudo code example: do { auto rc = co_await getPDR(dataTransferHndl, ...);
// update dataTransferHndl for next getPDR command dataTransferHndl = nextDataTransferHndl;
} while(...);
Signed-off-by: Gilbert Chen <gilbert.chen@arm.com> Signed-off-by: Khang Nguyen <khangng@amperecomputing.com> Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I7b47d15ac15f6ae661ec94dca6a281844b939a44
show more ...
|
| 44524a5f | 14-Feb-2022 |
Gilbert Chen <gilbert.chen@arm.com> |
requester: Modified MctpDiscovery class
Modified MctpDiscovery class to take list of managers instead of single fwManager. The change is for adding platform-mc manager. Added loadStaticEndpoints API
requester: Modified MctpDiscovery class
Modified MctpDiscovery class to take list of managers instead of single fwManager. The change is for adding platform-mc manager. Added loadStaticEndpoints API for MCTP layer which doesn't implement /xyz/openbmc_project/MCTP/Endpoint.Interface
The patch is part of implementation of design document below. https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/47252
Signed-off-by: Gilbert Chen <gilbert.chen@arm.com> Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I1e1673504583a87f2a9bc3adf76fb49c2dc30254
show more ...
|
| 93f1e00f | 11-Jul-2023 |
Pavithra Barithaya <pavithra.b@ibm.com> |
Replace sizeof() with .size()
This change replaces the usage of sizeof() with .size() to calculate size of arrays and expressions of STL container types. Using .size() with containers like std::vect
Replace sizeof() with .size()
This change replaces the usage of sizeof() with .size() to calculate size of arrays and expressions of STL container types. Using .size() with containers like std::vector, std::array, and std::string improves code readability and adheres to modern C++ standards. This also helps in clang-tidy checks.
Change-Id: I1e9e6e453a3b9218682098887763a4908f186815 Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
show more ...
|
| ace4e14d | 24-Apr-2024 |
Manojkiran Eda <manojkiran.eda@gmail.com> |
Deprecate the support for x86 sdk
OpenBMC as a project has moved away from using yocto x86 sdks for unit testing. Instead now the preferred way to build and test code is by two ways:
1. Leveraging
Deprecate the support for x86 sdk
OpenBMC as a project has moved away from using yocto x86 sdks for unit testing. Instead now the preferred way to build and test code is by two ways:
1. Leveraging the meson subproject support 2. Using openbmc docker container
Since x86 sdks needed some weird hacks in the code base like figuring out the linker arguments ourselves & running custom bash commands from the meson build files. Also with changing yocto code base, its a large maintainer burden to make sure this support works.
Tested: Code builds & unit tests are passed with both the approaches mentioned above.
Change-Id: Iaf55e2c003ffd9ee1a295de5bdfd14d81222e94b Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
show more ...
|
| cf772846 | 07-Dec-2023 |
Patrick Williams <patrick@stwcx.xyz> |
meson: adjust nlohmann-json dependency
Simplify the meson dependency for nlohmann-json, use the consistent dependency name, and align the wrap file name with other repositories.
Signed-off-by: Patr
meson: adjust nlohmann-json dependency
Simplify the meson dependency for nlohmann-json, use the consistent dependency name, and align the wrap file name with other repositories.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I3a682a3e07e38d0a1bfe35858e24f1bb74b4ec34
show more ...
|
| 35535cf2 | 05-Dec-2023 |
Patrick Williams <patrick@stwcx.xyz> |
sdbusplus: avoid deprecated phosphor::Timer
sdbusplus had an older type named `phosphor::Timer` which was recently renamed to `sdbusplus::Timer`. Update the code to use the new type alias.
Change-
sdbusplus: avoid deprecated phosphor::Timer
sdbusplus had an older type named `phosphor::Timer` which was recently renamed to `sdbusplus::Timer`. Update the code to use the new type alias.
Change-Id: I68d3968bcb359bee5ea0c9e695572b68fcf34136 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 87bfacd2 | 29-Nov-2023 |
Patrick Williams <patrick@stwcx.xyz> |
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer retur
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer return true for auto features. Instead, the expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: I794c658531483266bfce6f9b28127a166ed01490 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 4ddee3a0 | 02-Aug-2023 |
Thu Nguyen <thu@os.amperecomputing.com> |
requestHandler: Queue the request messages to one endpoint
Section "Requirements for requesters" in DSP0240 details "A PLDM terminus that issues PLDM requests to another PLDM terminus shall wait unt
requestHandler: Queue the request messages to one endpoint
Section "Requirements for requesters" in DSP0240 details "A PLDM terminus that issues PLDM requests to another PLDM terminus shall wait until one of the following occurs before issuing a new PLDM request: it gets the response to a particular request, it times out waiting for the response, or it receives an indication that transmission of the particular request failed." So the registered request messages to one endpoint have to be queued before sending to meet the requester requirement. When a sensor manager is added to pldmd daemon to manage the sensors of one terminus, the sensor manager will support the sensor polling timers. The timers will poll the PLDM sensors with different intervals so there can be many `getSensorReading` requests to one endpoint to get the sensor values. Moreover, BMC also sends `PollForPlatformEventMessage` requests to get the event data when it receives the `pldmMessagePollEvent` event from the terminus. So those TX request messages have to be queued.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Change-Id: I9756e1029b41a297a8f73e2ab7be47bc143ef710
show more ...
|
| 1ed5f7a6 | 21-May-2023 |
Rashmica Gupta <rashmica@linux.ibm.com> |
pldm: Convert to using libpldm transport APIs
A significant amount of logic can be removed by exploiting the new transport APIs provided by libpldm. Switch the pldm repository over to use these by i
pldm: Convert to using libpldm transport APIs
A significant amount of logic can be removed by exploiting the new transport APIs provided by libpldm. Switch the pldm repository over to use these by introducing an RAII wrapper for the APIs. The current stance is to continue using the legacy mctp-demux transport implementation, but we also provide a build option to switch to the AF_MCTP transport.
We don't currently have the infrastructure in place to get the correct TIDs, so to keep everything working as before use the EID as the TID in the EID-to-TID mapping.
Change-Id: I366f079082b102cfc0e90db0f62208581eb8693e Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com> Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com> Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
show more ...
|
| 2abbce76 | 17-Oct-2023 |
Andrew Jeffery <andrew@codeconstruct.com.au> |
InstanceIdDb: Move header from pldmd/ to common/
The header is used across all executables produced by the project, which makes it "common".
Change-Id: I022b179fad1de8dba2ef39fd33bc240ec73a2d33 Sig
InstanceIdDb: Move header from pldmd/ to common/
The header is used across all executables produced by the project, which makes it "common".
Change-Id: I022b179fad1de8dba2ef39fd33bc240ec73a2d33 Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
show more ...
|