summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/uapi/linux/nvgpu.h96
1 files changed, 91 insertions, 5 deletions
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h
index 908e5c57..65e8427e 100644
--- a/include/uapi/linux/nvgpu.h
+++ b/include/uapi/linux/nvgpu.h
@@ -1857,13 +1857,99 @@ struct nvgpu_as_bind_channel_args {
1857#define NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL (1 << 8) 1857#define NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL (1 << 8)
1858 1858
1859/* 1859/*
1860 * Mapping dmabuf fds into an address space: 1860 * VM map buffer IOCTL
1861 * 1861 *
1862 * The caller requests a mapping to a particular page 'kind'. 1862 * This ioctl maps a buffer - generally a dma_buf FD - into the VM's address
1863 * space. Usage of this API is as follows.
1863 * 1864 *
1864 * If 'page_size' is set to 0 the dmabuf's alignment/sizing will be used to 1865 * @flags [IN]
1865 * determine the page size (largest possible). The page size chosen will be 1866 *
1866 * returned back to the caller in the 'page_size' parameter in that case. 1867 * These are the flags passed to the IOCTL to modify the IOCTL behavior. The
1868 * following flags are supported:
1869 *
1870 * %NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET
1871 *
1872 * Specify that the mapping already has an address. The mapping address
1873 * must reside in an area already reserved with the as_alloc_space IOCTL.
1874 * If this flag is set then the @offset field must be populated with the
1875 * address to map to.
1876 *
1877 * %NVGPU_AS_MAP_BUFFER_FLAGS_CACHEABLE
1878 *
1879 * Specify that a mapping shall be GPU cachable.
1880 *
1881 * %NVGPU_AS_MAP_BUFFER_FLAGS_IO_COHERENT
1882 *
1883 * Specify that a mapping shall be IO coherent.
1884 *
1885 * %NVGPU_AS_MAP_BUFFER_FLAGS_UNMAPPED_PTE
1886 *
1887 * Specify that a mapping shall be marked as invalid but otherwise
1888 * populated. This flag doesn't actually make a lot of sense. The
1889 * only reason to specify it is for testing replayable faults but
1890 * an actual useful implementation of such a feature would likely
1891 * not use this.
1892 *
1893 * DEPRECATED: do not use! This will be removed in a future update.
1894 *
1895 * %NVGPU_AS_MAP_BUFFER_FLAGS_MAPPABLE_COMPBITS
1896 *
1897 * Deprecated.
1898 *
1899 * %NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL
1900 *
1901 * Set when userspace plans to pass in @compr_kind and @incompr_kind
1902 * instead of letting the kernel work out kind fields.
1903 *
1904 * @kind [IN]
1905 *
1906 * Specify the kind to use for the mapping.
1907 *
1908 * @compr_kind [IN]
1909 * @incompr_kind [IN]
1910 *
1911 * Specify the compressible and incompressible kinds to be used for the
1912 * mapping. Requires that %NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is
1913 * set in @flags. The kernel will attempt to use @comp_kind and if for
1914 * some reason that is not possible will then fall back to using the
1915 * @incompr_kind.
1916 *
1917 * @dmabuf_fd [IN]
1918 *
1919 * FD pointing to the dmabuf that will be mapped into the GMMU.
1920 *
1921 * @page_size [IN]
1922 *
1923 * Specify the page size for the mapping. Must be set to a valid, supported
1924 * page size. If left unset this IOCTL will return -EINVAL. In general, a
1925 * small page size mapping will always be supported, but in certain cases of
1926 * compression this will not be the case.
1927 *
1928 * @buffer_offset [IN]
1929 *
1930 * Specify an offset into the physical buffer to being the mapping at. For
1931 * example imagine a DMA buffer 32KB long. However, you wish to only this
1932 * buffer starting at 8KB. In such a case you would pass 8KB as the
1933 * @buffer_offset. This is only available with fixed address mappings. All
1934 * regular (non-fixed) mappings require this field to be set to 0. This field
1935 * is in bytes.
1936 *
1937 * @mapping_size [IN]
1938 *
1939 * The size of the mapping in bytes. This is from the @buffer_offset position.
1940 * So for example, assuming you have a 32KB physical buffer and you want to
1941 * map only 8KB of it, starting at some offset, then you would specify 8192 in
1942 * this field. Of course this size + the buffer_offset must be less than the
1943 * length of the physical buffer; otherwise -EINVAL is returned. This is only
1944 * supported for fixed mappings.
1945 *
1946 * @offset [IN, OUT]
1947 *
1948 * The offset of the buffer in the GPU virtual address space. In other words
1949 * the virtual address of the buffer. If the
1950 * %NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET flag is set then this field must be
1951 * populated by userspace. In all cases the ultimate mapped address is
1952 * returned in this field. The field is in bytes.
1867 */ 1953 */
1868struct nvgpu_as_map_buffer_ex_args { 1954struct nvgpu_as_map_buffer_ex_args {
1869 /* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */ 1955 /* NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL must be set */