lib/vmd: additional hotplug capability checks

Check PCIe Capability slot_implemented field before hotplug structures
instantiation.

Change-Id: Id40c10839e51b238a6ffd64592052604d50e2850
Signed-off-by: orden smith <orden.e.smith@intel.com>
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470649
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
This commit is contained in:
Konrad Sztyber 2019-10-03 13:11:43 +02:00 committed by Jim Harris
parent dd936e07f8
commit f942281913
2 changed files with 11 additions and 4 deletions

View File

@ -843,7 +843,8 @@ vmd_scan_single_bus(struct vmd_pci_bus *bus, struct vmd_pci_device *parent_bridg
new_bus->self = new_dev;
new_dev->bus_object = new_bus;
if (slot_cap.bit_field.hotplug_capable) {
if (slot_cap.bit_field.hotplug_capable &&
new_dev->pcie_cap->express_cap_register.bit_field.slot_implemented) {
new_bus->hotplug_buses = vmd_get_hotplug_bus_numbers(new_dev);
new_bus->subordinate_bus += new_bus->hotplug_buses;
}
@ -856,8 +857,14 @@ vmd_scan_single_bus(struct vmd_pci_bus *bus, struct vmd_pci_device *parent_bridg
vmd_add_bus_to_list(bus->vmd, new_bus);
/* Attach hot plug instance if HP is supported */
if (slot_cap.bit_field.hotplug_capable) {
new_dev->hp = vmd_new_hotplug(new_bus, new_bus->hotplug_buses);
/* Hot inserted SSDs can be assigned port bus of sub-ordinate + 1 */
SPDK_DEBUGLOG(SPDK_LOG_VMD, "bit_field.hotplug_capable:slot_implemented = %x:%x\n",
slot_cap.bit_field.hotplug_capable,
new_dev->pcie_cap->express_cap_register.bit_field.slot_implemented);
if (slot_cap.bit_field.hotplug_capable &&
new_dev->pcie_cap->express_cap_register.bit_field.slot_implemented) {
new_dev->hp = vmd_new_hotplug(new_bus);
}
vmd_dev_init(new_dev);

View File

@ -190,7 +190,7 @@ vmd_hp_enable_hotplug(struct vmd_hot_plug *hp)
}
static inline struct vmd_hot_plug *
vmd_new_hotplug(struct vmd_pci_bus *newBus, uint8_t reservedBuses)
vmd_new_hotplug(struct vmd_pci_bus *newBus)
{
return NULL;
}