gpu: nvgpu: define uapi for buffer info query ioctl

Userspace applications will need to query buffer information such as
buffer metadata registered, size, comptags allocation status for
enabling newer IPC mechanisms. Add support for this new ioctl.

Bug 200586313

Change-Id: I14960081c65d0e4f72e418e4ec2acce1ddd69d96
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2481883
Reviewed-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-by: Lakshmanan M <lm@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-02-08 16:29:24 +05:30
committed by mobile promotions
parent 7e7d36f8e5
commit d03bd05c90

View File

@@ -486,18 +486,41 @@ struct nvgpu_gpu_vsms_mapping {
__u64 vsms_map_buf_addr; __u64 vsms_map_buf_addr;
}; };
/*
* If the buffer registration is done, this flag is set in the output flags in
* the buffer info query ioctl.
*/
#define NVGPU_GPU_BUFFER_INFO_FLAGS_METADATA_REGISTERED (1ULL << 0)
/*
* If the comptags are allocated for the buffer, this flag is set in the output
* flags in the buffer info query ioctl.
*/
#define NVGPU_GPU_BUFFER_INFO_FLAGS_COMPTAGS_ALLOCATED (1ULL << 1)
struct nvgpu_gpu_get_buffer_info_args { struct nvgpu_gpu_get_buffer_info_args {
union { union {
struct { struct {
__u32 dmabuf_fd; /* dma-buf fd */ /* [in] dma-buf fd */
__s32 dmabuf_fd;
/* [in] size reserved by the user space. */
__u32 metadata_size;
/* [in] Pointer to receive the buffer metadata. */
__u64 metadata_addr;
} in; } in;
struct { struct {
__u64 id; /* Unique within live /* [out] buffer information flags. */
* buffers */ __u64 flags;
__u64 length; /* Allocated length of the
* buffer */ /*
__u64 reserved0; * [out] buffer metadata size registered.
__u64 reserved1; * this is always 0 for unregistered buffers.
*/
__u32 metadata_size;
__u32 reserved;
/* [out] allocated size of the buffer */
__u64 size;
} out; } out;
}; };
}; };
@@ -1059,8 +1082,10 @@ struct nvgpu_gpu_register_buffer_args {
struct nvgpu_gpu_set_deterministic_opts_args) struct nvgpu_gpu_set_deterministic_opts_args)
#define NVGPU_GPU_IOCTL_REGISTER_BUFFER \ #define NVGPU_GPU_IOCTL_REGISTER_BUFFER \
_IOWR(NVGPU_GPU_IOCTL_MAGIC, 41, struct nvgpu_gpu_register_buffer_args) _IOWR(NVGPU_GPU_IOCTL_MAGIC, 41, struct nvgpu_gpu_register_buffer_args)
#define NVGPU_GPU_IOCTL_GET_BUFFER_INFO \
_IOWR(NVGPU_GPU_IOCTL_MAGIC, 42, struct nvgpu_gpu_get_buffer_info_args)
#define NVGPU_GPU_IOCTL_LAST \ #define NVGPU_GPU_IOCTL_LAST \
_IOC_NR(NVGPU_GPU_IOCTL_REGISTER_BUFFER) _IOC_NR(NVGPU_GPU_IOCTL_GET_BUFFER_INFO)
#define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \ #define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \
sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args) sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args)