Commit 55ac2263 authored by GangCao's avatar GangCao Committed by Daniel Verkamp
Browse files

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: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/387265


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent e9ac7a72
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -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))