[Skiboot] [PATCH v11 22/23] core/opal: Extend opal_pci_set_power_state()

Andrew Donnellan andrew.donnellan at au1.ibm.com
Fri Jun 3 16:54:09 AEST 2016

On 20/05/16 16:32, Gavin Shan wrote:
> The API opal_pci_set_power_state() applied PCI hotplug on target
> slot. The power supply to the slot is changed accordingly. It's
> not the expected behaviour for CAPI developers. They want one
> specific slot offline or online without affecting the power supply.
> This extends opal_pci_set_power_state() to meet the requirement.
> Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>

This could probably be rolled into patch 21.

The reason the IBM CAPI team needs this is to deal with ASIC cards which 
may be either dynamically switched from normal mode to CAPI mode and 
reset, or (potentially later down the track) FPGA cards reflashed with a 
different FPGA image and reset, and which come back up with a different 
set of PCI functions than before.

As such, we want to update the skiboot device tree by "removing" and 
"inserting" the card in that slot, without actually powering off the 
card (in the case of the Mellanox CX-4, cutting the power will wipe the 
config registers that we've updated when switching to CAPI mode).

In this context, taking a slot "offline" or putting it "online" simply 
means updating the skiboot device tree. The terms "offline" and "online" 
aren't great, but there aren't many better terms that I can think of.

This isn't necessarily CAPI-specific - there's no reason why a non-CAPI 
PCI card couldn't exhibit similar behaviour - however CAPI mode 
switching is the main reason for this.

One further comment below.

Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

> --- a/doc/opal-api/opal-pci-set-power-state-121.txt
> +++ b/doc/opal-api/opal-pci-set-power-state-121.txt
> @@ -18,6 +18,11 @@ contains the API completion status: event (Power off or on), device node's
>   phandle identifying the PCI slot, errcode (e.g. OPAL_SUCCESS). The API returns
>   OPAL_ASYNC_COMPLETION for the case.
> +User (e.g. CAPI developers) might make a specified slot offline or online
> +without affecting its power state. User should use OPAL_PCI_SLOT_OFFLINE
> +or OPAL_PCI_SLOT_ONLINE in the parameter. The API should returns OPAL_SUCCESS
> +immediately without further asynchronous message sent.

This description could be a bit clearer. Something like:

"The states OPAL_PCI_SLOT_OFFLINE and OPAL_PCI_SLOT_ONLINE are used for 
removing or adding nodes for devices in the slot to the device tree, 
without actually changing the slot's power state. The API call will 
return OPAL_SUCCESS immediately and no further asynchronous message will 
be sent."

Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited

More information about the Skiboot mailing list