From b9ba32aa63123783561cb8c07c16b166742e8b51 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Fri, 25 Sep 2020 10:13:50 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4398 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- scripts/setup.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 0f9b160d9..cd0ff4037 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -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