setup: add the configure and reset pci functions in setup.sh

Introduce several new functions configure_linux_pci, reset_linux_pci and
configure_freebsd_pci for the PCI devices relatd operations.

Change-Id: Ifdaddd314ba01fd73ff700d231a6aeae5ec7c480
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/387265
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
GangCao 2017-11-14 15:05:47 -05:00 committed by Daniel Verkamp
parent e9ac7a7252
commit 55ac2263af

View File

@ -77,7 +77,7 @@ function get_nvme_name_from_bdf {
done
}
function configure_linux {
function configure_linux_pci {
driver_name=vfio-pci
if [ -z "$(ls /sys/kernel/iommu_groups)" ]; then
# No IOMMU. Use uio.
@ -101,7 +101,6 @@ function configure_linux {
fi
done
# IOAT
TMP=`mktemp`
#collect all the device_id info of ioat devices.
@ -129,6 +128,10 @@ function configure_linux {
rm $TMP
echo "1" > "/sys/bus/pci/rescan"
}
function configure_linux {
configure_linux_pci
hugetlbfs_mount=$(linux_hugetlbfs_mount)
@ -181,7 +184,7 @@ function configure_linux {
fi
}
function reset_linux {
function reset_linux_pci {
# NVMe
set +e
lsmod | grep nvme > /dev/null
@ -195,7 +198,6 @@ function reset_linux {
fi
done
# IOAT
TMP=`mktemp`
#collect all the device_id info of ioat devices.
@ -236,6 +238,10 @@ function reset_linux {
rm $TMP
echo "1" > "/sys/bus/pci/rescan"
}
function reset_linux {
reset_linux_pci
hugetlbfs_mount=$(linux_hugetlbfs_mount)
rm -f "$hugetlbfs_mount"/spdk*map_*
@ -286,7 +292,7 @@ function status_linux {
done
}
function configure_freebsd {
function configure_freebsd_pci {
TMP=`mktemp`
# NVMe
@ -308,6 +314,10 @@ function configure_freebsd {
kenv hw.nic_uio.bdfs=$BDFS
kldload nic_uio.ko
rm $TMP
}
function configure_freebsd {
configure_freebsd_pci
kldunload contigmem.ko || true
kenv hw.contigmem.num_buffers=$((HUGEMEM / 256))