History log of /openbmc/phosphor-psu-code-mgmt/ (Results 1 – 25 of 113)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
20a045f618-Dec-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-19

clang-format-19 isn't compatible with the clang-format-18 output, so we
need to reformat the code with the latest version. A few parameters
in clang-tidy have b

clang-format: re-format for clang-19

clang-format-19 isn't compatible with the clang-format-18 output, so we
need to reformat the code with the latest version. A few parameters
in clang-tidy have been deprecated, so adjust the style file
accordingly.

See Ie2f6eb3b043f2d655c9df806815afd7971fd0947 for updated style.
See I88192b41ab7a95599a90915013579608af7bc56f for clang-19 enablement.

Change-Id: If6fd351c0ebc24f49fb2ecc86d9eebf94bc0b54c
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

17c2c94e10-Dec-2024 Shawn McCarney <shawnmm@us.ibm.com>

Set ExtendedVersion property on Activations

Activation objects are created by this application in three scenarios:
1. When an InterfacesAdded event notifies the application about a new
PSU image

Set ExtendedVersion property on Activations

Activation objects are created by this application in three scenarios:
1. When an InterfacesAdded event notifies the application about a new
PSU image that was uploaded to IMG_DIR (/tmp/images).
2. When getting the firmware version that is already running on a PSU
in the system.
3. When a firmware version is found in the file system (IMG_DIR_BUILTIN
or IMG_DIR_PERSIST).

In scenario #2, there are two Activation properties that are not set:
1. Path: the file system path to the image directory.
2. ExtendedVersion: contains the manufacturer and model.

In scenario #3, a firmware version may be found in the file system that
is the same as the version running on a PSU. In this case, the
Activation object has already been created. The Path property on the
existing Activation is set to the file system path.

However, the ExtendedVersion property of the existing Activation is not
set. Due to this, the Activation has no manufacturer or model
information. This means it cannot be used to update other PSUs.

Solve this problem by setting the ExtendedVersion property of the
existing Activation when a matching version is found in the file system.
This will enable the Activation to obtain the manufacturer and model
information. This in turn will allow the Activation to be used to update
other PSUs that are not running the latest version.

Tested:
* Verified that extendedVersion, manufacturer, and model data members
are set when the Activation constructor is called.
* Verified that extendedVersion, manufacturer, and model data members
are set when the new, overridden extendedVersion() method is called.
* Verified that the ExtendedVersion property is set by scanDirectory()
if an Activation already exists.
* For the complete test plan see:
https://gist.github.com/smccarney/2a3bf72c6faa436199a70968cd99e30e

Change-Id: I7107b8c1d631ada5cd55648f92cf2c1e5cd90778
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

46ea388c10-Dec-2024 Shawn McCarney <shawnmm@us.ibm.com>

Verify PSU is present before code update

When an Activation is set to the Activating state, it checks all the
PSUs in the system to see which ones are compatible. Compatibility is
determined based o

Verify PSU is present before code update

When an Activation is set to the Activating state, it checks all the
PSUs in the system to see which ones are compatible. Compatibility is
determined based on the Model and Manufacturer properties. It performs a
code update only on compatible PSUs.

Update the Activation class to also check whether a PSU is present. A
code update should not be attempted on a missing PSU. The attempt will
fail, and that will cause the remaining PSUs to be skipped.

Tested:
* Activation::startActivation()
* Test where PSU is not present
* Verify it is skipped
* Test where PSU is present
* Verify the compatibility is checked
* Test where PSU is not compatible
* Verify it is skipped
* Test where PSU is compatible
* Verify it is code updated
* Activation::isPresent()
* Test where PSU is present
* Test where PSU is not present
* Test where a D-Bus error occurs
* Verify error is written to the journal
* Verify false is returned

Change-Id: I5647e51177d84d22f6ae5a38afa970243fe9ecdd
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

487e2e1925-Nov-2024 Shawn McCarney <shawnmm@us.ibm.com>

Improve error handling for exceptions and asserts

The phosphor-psu-code-manager application currently exits abnormally due
to the following conditions:
* Uncaught exception
* False assert() statemen

Improve error handling for exceptions and asserts

The phosphor-psu-code-manager application currently exits abnormally due
to the following conditions:
* Uncaught exception
* False assert() statement

An abnormal exit can result in a core dump and/or a BMC dump. It also
causes the service to be restarted. If the failure condition remains,
the restarts will fail repeatedly, and systemd will stop trying to start
the service.

Improve error handling for exceptions in the following ways:
* Add try/catch blocks to the following locations:
* Code that calls functions that throw and needs to handle exceptions.
* For example, code looping over PSU objects may need to handle an
exception for one PSU and then continue to the remaining PSUs.
* D-Bus PropertiesChanged and InterfacesAdded event handlers.
* Do not allow exceptions to escape to the sdbusplus stack frames.
* main()
* Last line of defense; catching avoids a core dump.
* Write exception error message to the journal if appropriate

Replace assert statements with exceptions or error messages to the
journal.

Tested:
* Tested all modified functions/methods.
* Verified that all exceptions were caught and logged to the journal if
appropriate.
* Verified that asserts were replaced by exceptions and logging.
* See complete test plan at
https://gist.github.com/smccarney/b4bf568639fedd269c9737234fa2803d

Change-Id: I933386e94f43a915b301d6aef7d91691816a0548
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

d57bd2f202-Dec-2024 Shawn McCarney <shawnmm@us.ibm.com>

Rename getPSUInventoryPath to getPSUInventoryPaths

Rename the utils method/function getPSUInventoryPath() to
getPSUInventoryPaths(). The method/function returns multiple paths in a
vector, so the n

Rename getPSUInventoryPath to getPSUInventoryPaths

Rename the utils method/function getPSUInventoryPath() to
getPSUInventoryPaths(). The method/function returns multiple paths in a
vector, so the name should be plural. This will make the return type
more clear. Currently the name implies only one path will be returned.

Tested:
* Verified all automated tests build and run successfully
* Verified getPSUInventoryPaths() returns correct data

Change-Id: I7e215c37e3ce1eb27313bc51348c7f7335c8f67a
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

cdf86de226-Nov-2024 Shawn McCarney <shawnmm@us.ibm.com>

Convert from log() to lg2()

Convert from the old log() API to the new lg2() API for logging journal
messages. The new API is simpler to use, and the old API may be
deprecated in the future.

Tested:

Convert from log() to lg2()

Convert from the old log() API to the new lg2() API for logging journal
messages. The new API is simpler to use, and the old API may be
deprecated in the future.

Tested:
* Tested all lg2() calls to verify the resulting journal message was
correct.
* For the complete test plan, see
https://gist.github.com/smccarney/f4ed140bf7a46773b31c76b488e739dc

Change-Id: Ieb46c5d1481ceb51e5b0d51392b1c32596d8eac8
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

783406e617-Nov-2024 Shawn McCarney <shawnmm@us.ibm.com>

Get model using command line tool

Get the PSU model using a command line tool specified in the meson
options. The default tool is 'psutils --get-model'. The tool should
get the model data directly

Get model using command line tool

Get the PSU model using a command line tool specified in the meson
options. The default tool is 'psutils --get-model'. The tool should
get the model data directly from the PSU.

This is more accurate than getting the Model property of the Asset
interface on D-Bus. Inventory Manager saves its state to files. When
the BMC is booted, Inventory Manager initializes itself using the saved
state. This is necessary to handle the scenario where the BMC is
rebooted while the rest of the system is powered on (such as a
concurrent BMC code update).

However, if all power was removed from the system, a PSU may have been
added/removed/replaced while the BMC was offline. When the BMC boots,
the Inventory Manager saved state is not correct.

Eventually the PSU monitoring application will update the model on
D-Bus, but this can take a non-trivial amount of time. This is
especially true if EntityManager is used to provide the PSU bus and
address information to the PSU monitoring application.

Tested:
* Verified all automated tests build and run successfully
* Verified application uses command line tool to obtain model
* Verified command line tool was returning the correct model
* Test where command line tool fails with non-zero exit code
* Tested where all PSU information available when application starts
* Tested where PSU information is obtained after application starts
using the InterfacesAdded handler
* Tested where PSU presence changes and is obtained by the
PropertiesChanged handler
* Full test plan is available at
https://gist.github.com/smccarney/87bd821a6d317ec0915d1f162028ff01

Change-Id: Ia9d35850aa6ac27dd006679991272232d67390ff
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

73a6f0d830-Oct-2024 Shawn McCarney <shawnmm@us.ibm.com>

Update PSU if version cannot be obtained

Currently this application will ignore a PSU if the PSU code version
cannot be obtained.

However, there are several scenarios where this could occur:
* A co

Update PSU if version cannot be obtained

Currently this application will ignore a PSU if the PSU code version
cannot be obtained.

However, there are several scenarios where this could occur:
* A code update was previously attempted on the PSU, and the update
failed. The PSU is now in a bad state, and the update needs to be
performed again.
* The PSU is running old code that does not support reading the code
version.

In these scenarios performing a code update on the PSU is desired.

Enhance this application so that a PSU with an unknown code version will
be updated provided that it is the correct model.

Tested:
* Verified code update was still performed if version could not be
obtained.
* Tested where PSU information is found at start of application
* Tested where PSU information is found from InterfacesAdded event
* Tested where PSU information is found from PropertiesChanged event
* For the complete test plan, see
https://gist.github.com/smccarney/3846a97fef590eb69181edc669555a00

Change-Id: I6e60761fa20eeb4500529c00f33de16d69a8d84d
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

ddf525f227-Sep-2024 Shawn McCarney <shawnmm@us.ibm.com>

Only store images from IMG_DIR

New PSU images are uploaded/downloaded to IMG_DIR (normally
/tmp/images). After all PSUs have been updated with the new image, the
image is copied to IMG_DIR_PERSIST

Only store images from IMG_DIR

New PSU images are uploaded/downloaded to IMG_DIR (normally
/tmp/images). After all PSUs have been updated with the new image, the
image is copied to IMG_DIR_PERSIST (normally /var/lib/obmc/psu). This
stores the image in a persistent location that will exist beyond a BMC
reboot. If a PSU is replaced in the future, and the new PSU has old
code, the PSU image from IMG_DIR_PERSIST is used to update it.

The application currently also copies PSU images from IMG_DIR_BUILTIN
(normally /usr/share/obmc/psu) to IMG_DIR_PERSIST. This is undesirable
for two reasons:
* Wastes flash space since IMG_DIR_BUILTIN is already persistent.
* IMG_DIR_PERSIST is located in a directory that is shared between both
BMC images ("A" side and "B" side). This means the PSU image will be
found by both BMC images. This may be undesirable behavior, such as
if the other BMC image has not been tested with this PSU image.

Modify the storing logic so that only PSU images from IMG_DIR are copied
to IMG_DIR_PERSIST.

Tested:
* Verified that a PSU image in IMG_DIR is copied to IMG_DIR_PERSIST
* Verified that a PSU image in IMG_DIR_PERSIST is not copied to
IMG_DIR_PERSIST
* Verified that a PSU image in IMG_DIR_BUILTIN is not copied to
IMG_DIR_PERSIST

Change-Id: I69fbbefffb08374cffcb86b9037780b7a312c459
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

799f514926-Sep-2024 Shawn McCarney <shawnmm@us.ibm.com>

Support ALWAYS_USE_BUILTIN_IMG_DIR in IA handler

Support the new ALWAYS_USE_BUILTIN_IMG_DIR meson option in the
InterfacesAdded handler for software versions.

This handler notifies the application

Support ALWAYS_USE_BUILTIN_IMG_DIR in IA handler

Support the new ALWAYS_USE_BUILTIN_IMG_DIR meson option in the
InterfacesAdded handler for software versions.

This handler notifies the application when a new software version is
created on D-Bus. When a new PSU image is uploaded to the IMG_DIR
(/tmp/images) directory, the xyz.openbmc_project.Software.Version
service creates a new D-Bus object with the Version interface.

If the ALWAYS_USE_BUILTIN_IMG_DIR option is specified, the new PSU image
in IMG_DIR should be ignored. Only PSU images stored in IMG_DIR_BUILTIN
(/usr/share/obmc/psu) are used to update PSUs.

Tested:
* Built with ALWAYS_USE_BUILTIN_IMG_DIR set to false (the default)
* Verified that a new PSU image uploaded to /tmp/images is installed
on all PSUs.
* Verified new PSU image is copied to /var/lib/obmc/psu
* Verified new PSU image is removed from /tmp/images
* Verified that after BMC is rebooted new PSU image still exists in
/var/lib/obmc/psu
* Built with ALWAYS_USE_BUILTIN_IMG_DIR set to true
* Verified that a new PSU image uploaded to /tmp/images is ignored and
no PSUs are updated.
* Verified new PSU image is not copied to /var/lib/obmc/psu
* Verified new PSU image is not removed from /tmp/images
* Verified that after BMC is rebooted new PSU image no longer exists
in /tmp/images

Change-Id: I2f71593f786eac86bdf6f484cc0220e0e6b0f4b7
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

fb86e79411-Sep-2024 Faisal Awada <faisal@us.ibm.com>

Retrieve FW version from IMG_BUILTIN_DIR

Added method to retrieve firmware level found in IMG_BUILTIN_DIR. This
is required behavior on some systems types.

Tested:
Installed openbmc image on syst

Retrieve FW version from IMG_BUILTIN_DIR

Added method to retrieve firmware level found in IMG_BUILTIN_DIR. This
is required behavior on some systems types.

Tested:
Installed openbmc image on system and verified the function returns
the version available in IMG_BUILT_DIR.

Change-Id: I10166a1412fb9de421bd304c40916a81c1ca0558
Signed-off-by: Faisal Awada <faisal@us.ibm.com>

show more ...

80c2daae23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable readability-convert-member-functions-to-static

This check finds non-static member functions that can be made
static because the functions don’t use this.
This check also triggers

clang-tidy: Enable readability-convert-member-functions-to-static

This check finds non-static member functions that can be made
static because the functions don’t use this.
This check also triggers readability-static-accessed-through
-instance check as we are trying to access a static member
function through an instance.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I6c06c61e8f199247e74aca3443741683e3853274

show more ...

a5205e4023-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable readability-string-compare check

This check finds string comparisons using the compare method.
A common mistake is to use the string’s compare method instead of
using the equality

clang-tidy: Enable readability-string-compare check

This check finds string comparisons using the compare method.
A common mistake is to use the string’s compare method instead of
using the equality or inequality operators.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I9d4b8aad27fa34345d08d2ba326b8a31cd3d99c6

show more ...

22c2fbd823-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable readability-uppercase-literal-suffix check

cert-dcl16-c redirects here as an alias for this check. By default,
only the suffixes that begin with l (l, ll, lu, llu, but not u, ul,

clang-tidy: Enable readability-uppercase-literal-suffix check

cert-dcl16-c redirects here as an alias for this check. By default,
only the suffixes that begin with l (l, ll, lu, llu, but not u, ul,
ull) are diagnosed by that alias.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I180ee3e3274899c63181f69a14f158319f178f0c

show more ...

71ae535c23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable readability-make-member-function-const check

Finds non-static member functions that can be made const because the
functions don’t use this in a non-const way.

Signed-off-by: Geor

clang-tidy: Enable readability-make-member-function-const check

Finds non-static member functions that can be made const because the
functions don’t use this in a non-const way.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Iff3a367401d571f9fcff90539aaab59e2c66e627

show more ...

cb6bbfd423-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable readability checks on repo

The readability-* checks in Clang-Tidy focus on improving code
readability by enforcing guidelines and suggesting improvements
that can enhance the clar

clang-tidy: Enable readability checks on repo

The readability-* checks in Clang-Tidy focus on improving code
readability by enforcing guidelines and suggesting improvements
that can enhance the clarity and maintainability of C++ code.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: If69d468f6303df4ec782a3b7c7453a60ddae1e4e

show more ...

a31e568e23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable performance-unnecessary-value-param check

This check flags value parameter declarations of expensive to copy
types that are copied for each invocation but it would suffice to
pass

clang-tidy: Enable performance-unnecessary-value-param check

This check flags value parameter declarations of expensive to copy
types that are copied for each invocation but it would suffice to
pass them by const reference.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Ia287488c3bbe1a64e05760cbece119456d8f82f3

show more ...

af025bcf23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable performance-inefficient-vector-operation check

Finds possible inefficient std::vector operations (e.g. push_back,
emplace_back) that may cause unnecessary memory reallocations.

I

clang-tidy: Enable performance-inefficient-vector-operation check

Finds possible inefficient std::vector operations (e.g. push_back,
emplace_back) that may cause unnecessary memory reallocations.

It can also find calls that add element to protobuf repeated field in
a loop without calling Reserve() before the loop. Calling Reserve()
first can avoid unnecessary memory reallocations.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I442c3aac7e3c71abbb125ae6bcdbe3f8995d14e9

show more ...

a0f2cf7d23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable performance-faster-string-find check

This check optimizes the calls to std::string::find() when the
input passed is a single character string literal. The character
literal overlo

clang-tidy: Enable performance-faster-string-find check

This check optimizes the calls to std::string::find() when the
input passed is a single character string literal. The character
literal overload is more efficient.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I72ae6f1506d2298a067e6463bd3718d64d23fdb2

show more ...

6c86e63123-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Add performance checks

The checks are valuable for improving the runtime efficiency and
resource utilization of your programs.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-

clang-tidy: Add performance checks

The checks are valuable for improving the runtime efficiency and
resource utilization of your programs.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: If3750c67d40ce482e3f68bad384395b166ed07c9

show more ...

d9cc939923-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: clang-tidy: Add few misc checks

Checks that encompass various miscellaneous guidelines and rules
that don't fall into more specific categories like readability,
performance, or correctne

clang-tidy: clang-tidy: Add few misc checks

Checks that encompass various miscellaneous guidelines and rules
that don't fall into more specific categories like readability,
performance, or correctness. These checks often focus on code
quality, stylistic preferences, or potential pitfalls that are
not covered by other specific checks.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I4074c495a61e0804ed375e402756ac84abdfc598

show more ...

66a54ad423-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable cppcoreguidelines-special-member-functions

The check finds classes where some but not all of the special member
functions are defined.

By default the compiler defines a copy cons

clang-tidy: Enable cppcoreguidelines-special-member-functions

The check finds classes where some but not all of the special member
functions are defined.

By default the compiler defines a copy constructor, copy assignment
operator, move constructor, move assignment operator and destructor.
The default can be suppressed by explicit user-definitions. The
relationship between which functions will be suppressed by
definitions of other functions is complicated and it is advised that
all five are defaulted or explicitly defined.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Icbfd448b2bf78ebf99ec07b55220871e093cb899

show more ...

047d994423-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions

Adds override (introduced in C++11) to overridden virtual functions
and removes virtual from those functions as it is not required.

v

clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions

Adds override (introduced in C++11) to overridden virtual functions
and removes virtual from those functions as it is not required.

virtual on non base class implementations was used to help indicate
to the user that a function was virtual. C++ compilers did not use
the presence of this to signify an overridden function.

In C++11 override and final keywords were introduced to allow
overridden functions to be marked appropriately. Their presence
allows compilers to verify that an overridden function correctly
overrides a base class implementation.

This can be useful as compilers can generate a compile time error
when:
- The base class implementation function signature changes.
- The user has not created the override with the correct signature.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I428f69c11b071a1a50e7f93f7bcc29c8300dcddb

show more ...

ca8a7d6e22-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Add few cppcoreguidelines check

These checks cover a wide range of best practices and
recommendations aimed at improving the safety, readability,
maintainability, and performance of our

clang-tidy: Add few cppcoreguidelines check

These checks cover a wide range of best practices and
recommendations aimed at improving the safety, readability,
maintainability, and performance of our C++ codebase according
to the C++ Core Guidelines.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I605971bfa0c8126e9b5f7bfa9591e26b09f27460

show more ...

dcb0110922-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Add clang-analyzer checks

This checks primary purpose is to identify potential bugs,security
vulnerabilities, and adherence to coding standards by examining
the source code without execu

clang-tidy: Add clang-analyzer checks

This checks primary purpose is to identify potential bugs,security
vulnerabilities, and adherence to coding standards by examining
the source code without executing it.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I20e57618262f337886d191d092d8f3606fe70641

show more ...

12345