![LPAR mode](lpar.png)
Use PCIe hotplug to change the availability of a shared
PCIe device.
About this task
Only one LPAR can access a PCIe device. Other LPARs can be candidates for access. Use the HMC or
SE to define which LPAR is connected and which LPARs are on the candidate list. A PCIe device that
is defined, but not yet used, is shown as a PCIe slot in Linux®.
On Linux, you use the power
sysfs attribute of a PCIe slot to connect the device to
the LPAR where Linux runs. While a PCIe
device is connected to one LPAR, it is in the reserved state for
all other LPARs that are in the candidates
list. A reserved PCIe device is invisible
to the operating system. The slot is removed from sysfs.
Procedure
The power attribute
of a slot contains 0 if a PCIe device is in stand-by
state, or 1 if the device is configured and usable.
- Locate the slot for the card you want to work with.
To locate the slot, read the function_id attribute
of the PCIe device from sysfs.
For example, to read the
/sys/bus/pci/devices/0000:00:00.0/function_id
issue:
# cat /sys/bus/pci/devices/0000:00:00.0/function_id
0x00000011
where
00000011
is the slot. Alternatively, you can use the
lspci
-v command to find the slot.
- Write the value that you want to the power attribute:
- Write 1 to power to connect the PCIe
device to the LPAR in which your Linux instance
is running. Linux automatically scans the device, registers
it, and brings it online. For example:
echo 1 > /sys/bus/pci/slots/00000011/power
- Write 0 to power to stop using the PCIe
device. The device state changes to stand-by.
The PCIe device is set offline automatically. For example:
echo 0 > /sys/bus/pci/slots/00000011/power
A
PCIe device in standby is also in the
standby state to all other LPARs in the
candidates list. A standby PCIe device appears as a slot, but
without a PCIe device.