# git rev-parse -q --verify 7f92891778dff62303c070ac81de7b7d80de331a^{commit} 7f92891778dff62303c070ac81de7b7d80de331a already have revision, skipping fetch # git checkout -q -f -B kisskb 7f92891778dff62303c070ac81de7b7d80de331a # git clean -qxdf # < git log -1 # commit 7f92891778dff62303c070ac81de7b7d80de331a # Author: Alexey Kardashevskiy # Date: Thu Dec 20 12:10:36 2018 +1100 # # vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver # # POWER9 Witherspoon machines come with 4 or 6 V100 GPUs which are not # pluggable PCIe devices but still have PCIe links which are used # for config space and MMIO. In addition to that the GPUs have 6 NVLinks # which are connected to other GPUs and the POWER9 CPU. POWER9 chips # have a special unit on a die called an NPU which is an NVLink2 host bus # adapter with p2p connections to 2 to 3 GPUs, 3 or 2 NVLinks to each. # These systems also support ATS (address translation services) which is # a part of the NVLink2 protocol. Such GPUs also share on-board RAM # (16GB or 32GB) to the system via the same NVLink2 so a CPU has # cache-coherent access to a GPU RAM. # # This exports GPU RAM to the userspace as a new VFIO device region. This # preregisters the new memory as device memory as it might be used for DMA. # This inserts pfns from the fault handler as the GPU memory is not onlined # until the vendor driver is loaded and trained the NVLinks so doing this # earlier causes low level errors which we fence in the firmware so # it does not hurt the host system but still better be avoided; for the same # reason this does not map GPU RAM into the host kernel (usual thing for # emulated access otherwise). # # This exports an ATSD (Address Translation Shootdown) register of NPU which # allows TLB invalidations inside GPU for an operating system. The register # conveniently occupies a single 64k page. It is also presented to # the userspace as a new VFIO device region. One NPU has 8 ATSD registers, # each of them can be used for TLB invalidation in a GPU linked to this NPU. # This allocates one ATSD register per an NVLink bridge allowing passing # up to 6 registers. Due to the host firmware bug (just recently fixed), # only 1 ATSD register per NPU was actually advertised to the host system # so this passes that alone register via the first NVLink bridge device in # the group which is still enough as QEMU collects them all back and # presents to the guest via vPHB to mimic the emulated NPU PHB on the host. # # In order to provide the userspace with the information about GPU-to-NVLink # connections, this exports an additional capability called "tgt" # (which is an abbreviated host system bus address). The "tgt" property # tells the GPU its own system address and allows the guest driver to # conglomerate the routing information so each GPU knows how to get directly # to the other GPUs. # # For ATS to work, the nest MMU (an NVIDIA block in a P9 CPU) needs to # know LPID (a logical partition ID or a KVM guest hardware ID in other # words) and PID (a memory context ID of a userspace process, not to be # confused with a linux pid). This assigns a GPU to LPID in the NPU and # this is why this adds a listener for KVM on an IOMMU group. A PID comes # via NVLink from a GPU and NPU uses a PID wildcard to pass it through. # # This requires coherent memory and ATSD to be available on the host as # the GPU vendor only supports configurations with both features enabled # and other configurations are known not to work. Because of this and # because of the ways the features are advertised to the host system # (which is a device tree with very platform specific properties), # this requires enabled POWERNV platform. # # The V100 GPUs do not advertise any of these capabilities via the config # space and there are more than just one device ID so this relies on # the platform to tell whether these GPUs have special abilities such as # NVLinks. # # Signed-off-by: Alexey Kardashevskiy # Acked-by: Alex Williamson # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-gcc --version # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-ld --version # < git log --format=%s --max-count=1 7f92891778dff62303c070ac81de7b7d80de331a # < make -s -j 120 ARCH=mips O=/kisskb/build/powerpc-next_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- defconfig # make -s -j 120 ARCH=mips O=/kisskb/build/powerpc-next_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- arch/mips/boot/dts/xilfpga/nexys4ddr.dtb: Warning (i2c_bus_reg): /i2c@10A00000/ad7420@4B: I2C bus unit address format error, expected "4b" FIT description: Linux 4.20.0-rc2-g7f92891778df Created: Fri Dec 21 22:01:23 2018 Image 0 (kernel@0) Description: Linux 4.20.0-rc2-g7f92891778df Created: Fri Dec 21 22:01:23 2018 Type: Kernel Image Compression: gzip compressed Data Size: 4505743 Bytes = 4400.14 KiB = 4.30 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x8085c670 Hash algo: sha1 Hash value: c27f7b084edeadcfb6861570c9ac8183323b4d9c Image 1 (fdt@boston) Description: img,boston Device Tree Created: Fri Dec 21 22:01:23 2018 Type: Flat Device Tree Compression: uncompressed Data Size: 3668 Bytes = 3.58 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 569c37cc891ce1e1f3a193cb41cc691a5d2debb5 Image 2 (fdt@ni169445) Description: NI 169445 device tree Created: Fri Dec 21 22:01:23 2018 Type: Flat Device Tree Compression: uncompressed Data Size: 1871 Bytes = 1.83 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 51b89b31605ee62038c8468c429af091dfc75ec7 Image 3 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Fri Dec 21 22:01:23 2018 Type: Flat Device Tree Compression: uncompressed Data Size: 2708 Bytes = 2.64 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 509ce58e44c561d54539e64e9d4b47054e696fc6 Default Configuration: 'conf@default' Configuration 0 (conf@default) Description: Generic Linux kernel Kernel: kernel@0 Configuration 1 (conf@boston) Description: Boston Linux kernel Kernel: kernel@0 FDT: fdt@boston Configuration 2 (conf@ni169445) Description: NI 169445 Linux Kernel Kernel: kernel@0 FDT: fdt@ni169445 Configuration 3 (conf@xilfpga) Description: MIPSfpga Linux kernel Kernel: kernel@0 FDT: fdt@xilfpga Completed OK # rm -rf /kisskb/build/powerpc-next_mips-defconfig_mipsel # Build took: 0:01:10.562372