From 3429f97a8969ce5e1aedb0fbacbc4fba017aea40 Mon Sep 17 00:00:00 2001 From: paul luse Date: Tue, 7 Apr 2020 12:20:35 -0400 Subject: [PATCH] scripts/setup: add support for IDXD (aka DSA) Add bin/unbind support between the kernel idxd driver and VFIO. UIO not tested but tested this extensively on a system with valid idxd kernel driver and VFIO. Future patches in this series add the actual idxd low level library and bdev accel plug-in module. See those patches for more details on idxd. Signed-off-by: paul luse Change-Id: I09dd00b1aedcf88577335bde79d31cfd50ac4cde Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1721 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- scripts/setup.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/scripts/setup.sh b/scripts/setup.sh index 739533888..7d7f7e9c3 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -255,6 +255,25 @@ function configure_linux_pci { done < $TMP rm $TMP + # IDXD + TMP=$(mktemp) + #collect all the device_id info of idxd devices. + grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \ + | awk -F"x" '{print $2}' > $TMP + + while IFS= read -r dev_id + do + for bdf in $(iter_all_pci_dev_id 8086 $dev_id); do + if ! pci_can_use $bdf; then + pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device" + continue + fi + + linux_bind_driver "$bdf" "$driver_name" + done + done < $TMP + rm $TMP + # virtio TMP=$(mktemp) #collect all the device_id info of virtio devices. @@ -467,6 +486,31 @@ function reset_linux_pci { done < $TMP rm $TMP + # IDXD + TMP=$(mktemp) + #collect all the device_id info of idxd devices. + grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \ + | awk -F"x" '{print $2}' > $TMP + set +e + check_for_driver idxd + driver_loaded=$? + set -e + while IFS= read -r dev_id + do + for bdf in $(iter_all_pci_dev_id 8086 $dev_id); do + if ! pci_can_use $bdf; then + pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device" + continue + fi + if [ $driver_loaded -ne 0 ]; then + linux_bind_driver "$bdf" idxd + else + linux_unbind_driver "$bdf" + fi + done + done < $TMP + rm $TMP + # virtio TMP=$(mktemp) #collect all the device_id info of virtio devices. @@ -599,6 +643,27 @@ function status_linux { done done + echo "" + echo "IDXD DMA" + + #collect all the device_id info of idxd devices. + TMP=$(grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \ + | awk -F"x" '{print $2}') + echo -e "BDF\t\tVendor\tDevice\tNUMA\tDriver" + for dev_id in $TMP; do + for bdf in $(iter_all_pci_dev_id 8086 $dev_id); do + driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}') + if [ "$numa_nodes" = "0" ]; then + node="-" + else + node=$(cat /sys/bus/pci/devices/$bdf/numa_node) + fi + device=$(cat /sys/bus/pci/devices/$bdf/device) + vendor=$(cat /sys/bus/pci/devices/$bdf/vendor) + echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t${driver:--}" + done + done + echo "" echo "virtio" @@ -651,6 +716,14 @@ function configure_freebsd_pci { GREP_STR="${GREP_STR}\|chip=0x${dev_id}8086" done < $TMP + # IDXD + grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \ + | awk -F"x" '{print $2}' > $TMP + while IFS= read -r dev_id + do + GREP_STR="${GREP_STR}\|chip=0x${dev_id}8086" + done < $TMP + # VMD grep "PCI_DEVICE_ID_INTEL_VMD" $rootdir/include/spdk/pci_ids.h \ | awk -F"x" '{print $2}' > $TMP