scripts/setup: Check if VMD controllers are allowed to be used

Recent refactors removed the behavior introduced with a6edaa9600.
Bring it back and don't try to rebind the VMD devices if they were
not explicitliy allowed in the setup.

Also, shuffle the code a bit and put verification pieces under one
block where $mode is being determined.

Change-Id: Ie2cc41e402f20147b98ab288d623ac76a4472839
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4398
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>
This commit is contained in:
Michal Berger 2020-09-25 10:13:50 +02:00 committed by Tomasz Zawadzki
parent ebc227d9b2
commit b9ba32aa63

View File

@ -190,14 +190,22 @@ function collect_devices() {
[[ $dev_type =~ (NVME|IOAT|IDXD|VIRTIO|VMD) ]] && dev_type=${BASH_REMATCH[1],,}
for bdf in "${bdfs[@]}"; do
in_use=0
if [[ $1 != status ]] && ! pci_can_use "$bdf"; then
pci_dev_echo "$bdf" "Skipping un-whitelisted controller at $bdf"
in_use=1
fi
if [[ $1 != status ]] && [[ $dev_type == nvme || $dev_type == virtio ]]; then
if ! verify_bdf_mounts "$bdf"; then
if [[ $1 != status ]]; then
if ! pci_can_use "$bdf"; then
pci_dev_echo "$bdf" "Skipping denied controller at $bdf"
in_use=1
fi
if [[ $dev_type == nvme || $dev_type == virtio ]]; then
if ! verify_bdf_mounts "$bdf"; then
in_use=1
fi
fi
if [[ $dev_type == vmd ]]; then
if [[ $PCI_WHITELIST != *"$bdf"* ]]; then
pci_dev_echo "$bdf" "Skipping not allowed VMD controller at $bdf"
in_use=1
fi
fi
fi
eval "${dev_type}_d[$bdf]=$in_use"
all_devices_d["$bdf"]=$in_use