Commit b9ba32aa authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

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



Recent refactors removed the behavior introduced with a6edaa96.
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: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4398


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>
parent ebc227d9
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -190,15 +190,23 @@ 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"
			if [[ $1 != status ]]; then
				if ! pci_can_use "$bdf"; then
					pci_dev_echo "$bdf" "Skipping denied controller at $bdf"
					in_use=1
				fi
			if [[ $1 != status ]] && [[ $dev_type == nvme || $dev_type == virtio ]]; then
				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
			if [[ -e /sys/bus/pci/devices/$bdf/driver ]]; then