mctpreactor: support configuration for USB MCTP devices Add a reactor for the MCTPUSBDevice configuration defined in the entity-manager MCTP USB schema. For each exposed Configuration.MCTPUSBDevice object, resolve the kernel mctpusbX interface from its USB Port path and set up an endpoint via mctpd, then publish a configured_by association linking the endpoint back to its EM configuration. The configuration names a root hub position rather than a bus, because the bus number the kernel gives a root hub is not fixed. A position counts the SOC's USB host controllers only. Turning a position back into a bus means knowing the addresses of those controllers, and those belong to the SOC, so the position is resolved against the SOC that was found rather than before looking for it. Tested: Build an image for nvl32-obmc machine with the following patches cherry-picked: ``` 1. Align with upstream u-boot dts tree: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932 2. mctpd configuration: https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390 3. Remove MCTP over USB enumeration hacks (platform-init): https://gerrit.openbmc.org/c/openbmc/platform-init/+/85992 4. Entity Manager MCTP USB platform config https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85991 With ten MCTPUSBDevice configurations exposed by entity-manager, the reactor resolved each to its kernel mctpusbX interface, assigned an EID via mctpd, and published the configured_by association back to the originating configuration: journalctl -u xyz.openbmc_project.mctpreactor: Added MCTP endpoint to device: [ network: 1, EID: 9 | interface: mctpusb0 ] ... Added MCTP endpoint to device: [ network: 1, EID: 26 | interface: mctpusb8 ] busctl get-property xyz.openbmc_project.ObjectMapper \ /au/com/codeconstruct/mctp1/networks/1/endpoints/9/configured_by \ xyz.openbmc_project.Association endpoints as 1 ".../Nvidia_MGX_ConnectX8_SuperNIC_Server/GPU_SMA_0" ``` Change-Id: I2a2c30605b2738f64d30b3f3efcdefdece8e5652 Signed-off-by: Saptarsi Saha <saptarsis@nvidia.com> Signed-off-by: Deepak Kodihalli <deepak.kodihalli.83@gmail.com> Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.
runtime re-configurable from d-bus (entity-manager or the like)
isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible
async single-threaded: uses sdbusplus/asio bindings
multiple data inputs: hwmon, d-bus, direct driver access
A typical dbus-sensors object support the following dbus interfaces:
Path /xyz/openbmc_project/sensors/<type>/<sensor_name> Interfaces xyz.openbmc_project.Sensor.Value xyz.openbmc_project.Sensor.Threshold.Critical xyz.openbmc_project.Sensor.Threshold.Warning xyz.openbmc_project.State.Decorator.Availability xyz.openbmc_project.State.Decorator.OperationalStatus xyz.openbmc_project.Association.Definitions
Sensor interfaces collection are described in phosphor-dbus-interfaces.
Consumer examples of these interfaces are Redfish, Phosphor-Pid-Control, IPMI SDR.
dbus-sensor daemons are reactors that dynamically create and update sensors configuration when system configuration gets updated.
Using asio timers and async calls, dbus-sensor daemons read sensor values and check thresholds periodically. PropertiesChanged signals will be broadcasted for other services to consume when value or threshold status change. OperationStatus is set to false if the sensor is determined to be faulty.
A simple sensor example can be found in entity-manager examples.
Sensor devices are described using Exposes records in configuration file. Name and Type fields are required. Different sensor types have different fields. Refer to entity manager schema for complete list.
ADC sensors are sensors based on an Analog to Digital Converter. They are read via the Linux kernel Industrial I/O subsystem (IIO).
One of the more common use cases within OpenBMC is for reading these sensors from the ADC on the Aspeed ASTXX cards.
To utilize ADC sensors feature within OpenBMC you must first define and enable it within the kernel device tree.
When using a common OpenBMC device like the AST2600 you will find a “adc0” and “adc1” section in the aspeed-g6.dtsi file. These are disabled by default so in your system-specific dts you would enable and configure what you want with something like this:
iio-hwmon { compatible = "iio-hwmon"; io-channels = <&adc0 0>; ... } &adc0 { status = "okay"; ... }; &adc1 { status = "okay"; ... };
Note that this is not meant to be an exhaustive list on the nuances of configuring a device tree but really to point users in the general direction.
You will then create an entity-manager configuration file that is of type “ADC” A very simple example would like look this:
"Index": 0, "Name": "P12V", "PowerState": "Always", "ScaleFactor": 1.0, "Type": "ADC"
When your system is booted, a “in0_input” file will be created within the hwmon subsystem (/sys/class/hwmon/hwmonX). The adcsensor application will scan d-bus for any ADC entity-manager objects, look up their “Index” value, and try to match that with the hwmon inY_input files. When it finds a match it will create a d-bus sensor under the xyz.openbmc_project.ADCSensor service. The sensor will be periodically updated based on readings from the hwmon file.