setup.sh: add PCI_BLACKLIST

Add PCI blacklist so we can skip only some devices.

Change-Id: I8600307dd53f32acb4dfeb3f57845e0b9d29fdb9
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442977 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448424
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Pawel Wodkowski 2019-02-01 10:10:17 +01:00 committed by Darek Stojaczyk
parent 7fea9d10a5
commit b60101300f

View File

@ -41,12 +41,16 @@ function usage()
echo "HUGENODE Specific NUMA node to allocate hugepages on. To allocate"
echo " hugepages on multiple nodes run this script multiple times -"
echo " once for each node."
echo "PCI_WHITELIST Whitespace separated list of PCI devices (NVMe, I/OAT, Virtio) to bind."
echo "PCI_WHITELIST"
echo "PCI_BLACKLIST Whitespace separated list of PCI devices (NVMe, I/OAT, Virtio)."
echo " Each device must be specified as a full PCI address."
echo " E.g. PCI_WHITELIST=\"0000:01:00.0 0000:02:00.0\""
echo " To blacklist all PCI devices use a non-valid address."
echo " E.g. PCI_WHITELIST=\"none\""
echo " If empty or unset, all PCI devices will be bound."
echo " If PCI_WHITELIST and PCI_BLACKLIST are empty or unset, all PCI devices"
echo " will be bound."
echo " Each device in PCI_BLACKLIST will be ignored (driver won't be changed)."
echo " PCI_BLACKLIST has precedence over PCI_WHITELIST."
echo "TARGET_USER User that will own hugepage mountpoint directory and vfio groups."
echo " By default the current user will be used."
echo "DRIVER_OVERRIDE Disable automatic vfio-pci/uio_pci_generic selection and forcefully"
@ -73,16 +77,22 @@ function check_for_driver {
}
function pci_can_bind() {
if [[ ${#PCI_WHITELIST[@]} == 0 ]]; then
# The '\ ' part is important
if [[ " $PCI_BLACKLIST " =~ \ $1\ ]] ; then
return 1
fi
if [[ -z "$PCI_WHITELIST" ]]; then
#no whitelist specified, bind all devices
return 0
fi
for i in ${PCI_WHITELIST[@]}; do
for i in $PCI_WHITELIST; do
if [ "$i" == "$1" ] ; then
return 0
return 0
fi
done
return 1
}
@ -576,6 +586,7 @@ fi
: ${HUGEMEM:=2048}
: ${PCI_WHITELIST:=""}
: ${PCI_BLACKLIST:=""}
if [ -n "$NVME_WHITELIST" ]; then
PCI_WHITELIST="$PCI_WHITELIST $NVME_WHITELIST"
@ -585,8 +596,6 @@ if [ -n "$SKIP_PCI" ]; then
PCI_WHITELIST="none"
fi
declare -a PCI_WHITELIST=(${PCI_WHITELIST})
if [ -z "$TARGET_USER" ]; then
TARGET_USER="$SUDO_USER"
if [ -z "$TARGET_USER" ]; then