mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: define preemption modes in common code
We use linux specific graphics/compute preemption modes defined in uapi header (and of below form) in all over common code NVGPU_GRAPHICS_PREEMPTION_MODE_* NVGPU_COMPUTE_PREEMPTION_MODE_* Since common code should be independent of linux specific code, define new modes of the form in common code and used them everywhere NVGPU_PREEMPTION_MODE_GRAPHICS_* NVGPU_PREEMPTION_MODE_COMPUTE_* Add required parser functions to convert both the modes into each other For linux IOCTL NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE, we need to convert linux specific modes into common modes first before passing them to common code And to pass gpu characteristics to user space we need to first convert common modes into linux specific modes and then pass them to user space Jira NVGPU-392 Change-Id: I8c62c6859bdc1baa5b44eb31c7020e42d2462c8c Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1596930 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
fd2cac59f3
commit
90aeab9dee
@@ -194,6 +194,28 @@ static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g)
|
||||
return ioctl_flags;
|
||||
}
|
||||
|
||||
static void nvgpu_set_preemption_mode_flags(struct gk20a *g,
|
||||
struct nvgpu_gpu_characteristics *gpu)
|
||||
{
|
||||
struct nvgpu_preemption_modes_rec preemption_mode_rec;
|
||||
|
||||
g->ops.gr.get_preemption_mode_flags(g, &preemption_mode_rec);
|
||||
|
||||
gpu->graphics_preemption_mode_flags =
|
||||
nvgpu_get_ioctl_graphics_preempt_mode_flags(
|
||||
preemption_mode_rec.graphics_preemption_mode_flags);
|
||||
gpu->compute_preemption_mode_flags =
|
||||
nvgpu_get_ioctl_compute_preempt_mode_flags(
|
||||
preemption_mode_rec.compute_preemption_mode_flags);
|
||||
|
||||
gpu->default_graphics_preempt_mode =
|
||||
nvgpu_get_ioctl_graphics_preempt_mode(
|
||||
preemption_mode_rec.default_graphics_preempt_mode);
|
||||
gpu->default_compute_preempt_mode =
|
||||
nvgpu_get_ioctl_compute_preempt_mode(
|
||||
preemption_mode_rec.default_compute_preempt_mode);
|
||||
}
|
||||
|
||||
static long
|
||||
gk20a_ctrl_ioctl_gpu_characteristics(
|
||||
struct gk20a *g,
|
||||
@@ -235,6 +257,8 @@ gk20a_ctrl_ioctl_gpu_characteristics(
|
||||
|
||||
pgpu->max_css_buffer_size = g->gr.max_css_buffer_size;
|
||||
|
||||
nvgpu_set_preemption_mode_flags(g, pgpu);
|
||||
|
||||
if (request->gpu_characteristics_buf_size > 0) {
|
||||
size_t write_size = sizeof(*pgpu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user