summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2017-08-22 09:14:56 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-15 18:45:45 -0400
commit5d09c908b0679f060bc89ae70eef681a6783ebbc (patch)
tree244177eb4425e765b9a043e66533ca624f0d3cbd /include
parent2b7e8a2c2a5df041c9a434804d0f3f6d9df82737 (diff)
gpu: nvgpu: Direct GMMU PTE kind control
Allow userspace to control directly the PTE kind for the mappings by supplying NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL for MAP_BUFFER_EX. In particular, in this mode, the userspace will tell the kernel whether the kind is compressible, and if so, what is the incompressible fallback kind. By supplying only the compressible kind, the userspace can require that the map kind will not be demoted to the incompressible fallback kind in case of comptag allocation failure. Add also a GPU characteristics flag NVGPU_GPU_FLAGS_SUPPORT_MAP_DIRECT_KIND_CTRL to signal whether direct kind control is supported. Fix indentation of nvgpu_as_map_buffer_ex_args header comment. Bug 1705731 Change-Id: I317ab474ae53b78eb8fdd31bd6bca0541fcba9a4 Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1543462 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/nvgpu.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h
index 5b1d606a..9c883a93 100644
--- a/include/uapi/linux/nvgpu.h
+++ b/include/uapi/linux/nvgpu.h
@@ -146,6 +146,9 @@ struct nvgpu_gpu_zbc_query_table_args {
146#define NVGPU_GPU_FLAGS_SUPPORT_IO_COHERENCE (1ULL << 20) 146#define NVGPU_GPU_FLAGS_SUPPORT_IO_COHERENCE (1ULL << 20)
147/* NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST is available */ 147/* NVGPU_SUBMIT_GPFIFO_FLAGS_RESCHEDULE_RUNLIST is available */
148#define NVGPU_GPU_FLAGS_SUPPORT_RESCHEDULE_RUNLIST (1ULL << 21) 148#define NVGPU_GPU_FLAGS_SUPPORT_RESCHEDULE_RUNLIST (1ULL << 21)
149/* Direct PTE kind control is supported (map_buffer_ex) */
150#define NVGPU_GPU_FLAGS_SUPPORT_MAP_DIRECT_KIND_CTRL (1ULL << 23)
151
149 152
150struct nvgpu_gpu_characteristics { 153struct nvgpu_gpu_characteristics {
151 __u32 arch; 154 __u32 arch;
@@ -1751,6 +1754,7 @@ struct nvgpu_as_map_buffer_args {
1751#define NVGPU_AS_MAP_BUFFER_FLAGS_IO_COHERENT (1 << 4) 1754#define NVGPU_AS_MAP_BUFFER_FLAGS_IO_COHERENT (1 << 4)
1752#define NVGPU_AS_MAP_BUFFER_FLAGS_UNMAPPED_PTE (1 << 5) 1755#define NVGPU_AS_MAP_BUFFER_FLAGS_UNMAPPED_PTE (1 << 5)
1753#define NVGPU_AS_MAP_BUFFER_FLAGS_MAPPABLE_COMPBITS (1 << 6) 1756#define NVGPU_AS_MAP_BUFFER_FLAGS_MAPPABLE_COMPBITS (1 << 6)
1757#define NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL (1 << 8)
1754 __u32 reserved; /* in */ 1758 __u32 reserved; /* in */
1755 __u32 dmabuf_fd; /* in */ 1759 __u32 dmabuf_fd; /* in */
1756 __u32 page_size; /* inout, 0:= best fit to buffer */ 1760 __u32 page_size; /* inout, 0:= best fit to buffer */
@@ -1760,7 +1764,7 @@ struct nvgpu_as_map_buffer_args {
1760 } o_a; 1764 } o_a;
1761}; 1765};
1762 1766
1763 /* 1767/*
1764 * Mapping dmabuf fds into an address space: 1768 * Mapping dmabuf fds into an address space:
1765 * 1769 *
1766 * The caller requests a mapping to a particular page 'kind'. 1770 * The caller requests a mapping to a particular page 'kind'.
@@ -1772,7 +1776,37 @@ struct nvgpu_as_map_buffer_args {
1772struct nvgpu_as_map_buffer_ex_args { 1776struct nvgpu_as_map_buffer_ex_args {
1773 __u32 flags; /* in/out */ 1777 __u32 flags; /* in/out */
1774#define NV_KIND_DEFAULT -1 1778#define NV_KIND_DEFAULT -1
1775 __s32 kind; /* in (-1 represents default) */ 1779 union {
1780 /*
1781 * Used if NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL
1782 * is not set.
1783 */
1784 __s32 kind; /* in (-1 represents default) */
1785
1786 /*
1787 * If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is
1788 * set, this is used, instead. The rules are:
1789 *
1790 * - If both compr_kind and incompr_kind are set
1791 * (i.e., value is other than NV_KIND_INVALID),
1792 * kernel attempts to use compr_kind first.
1793 *
1794 * - If compr_kind is set, kernel attempts to allocate
1795 * comptags for the buffer. If successful,
1796 * compr_kind is used as the PTE kind.
1797 *
1798 * - If incompr_kind is set, kernel uses incompr_kind
1799 * as the PTE kind. Comptags are not allocated.
1800 *
1801 * - If neither compr_kind or incompr_kind is set, the
1802 * map call will fail.
1803 */
1804#define NV_KIND_INVALID -1
1805 struct {
1806 __s16 compr_kind;
1807 __s16 incompr_kind;
1808 };
1809 };
1776 __u32 dmabuf_fd; /* in */ 1810 __u32 dmabuf_fd; /* in */
1777 __u32 page_size; /* inout, 0:= best fit to buffer */ 1811 __u32 page_size; /* inout, 0:= best fit to buffer */
1778 1812