Commit f9422819 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

lib/vmd: additional hotplug capability checks



Check PCIe Capability slot_implemented field before hotplug structures
instantiation.

Change-Id: Id40c10839e51b238a6ffd64592052604d50e2850
Signed-off-by: default avatarorden smith <orden.e.smith@intel.com>
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470649


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
parent dd936e07
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;
}