mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: add supported preemptions to gpu characteristics
Add below flag fields to gpu characteristics to indicate supported and default preemption modes on platform for graphics and compute __u32 graphics_preemption_mode_flags; __u32 compute_preemption_mode_flags; __u32 default_graphics_preempt_mode; __u32 default_compute_preempt_mode; Add struct nvgpu_preemption_modes_rec to struct gr_gk20a to store these values locally Use platform specific get_preemption_mode_flags() to get the flags and define gk20a/gm20b specific get_preemption_mode_flags() API Bug 1646259 Change-Id: I80193c0d988dc93bd96585f9aa631fd817f4dfa3 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1133595 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Terje Bergstrom
parent
d868b65441
commit
771f742703
@@ -2142,6 +2142,17 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
|
|||||||
if (platform->clk_round_rate)
|
if (platform->clk_round_rate)
|
||||||
gpu->max_freq = platform->clk_round_rate(g->dev, UINT_MAX);
|
gpu->max_freq = platform->clk_round_rate(g->dev, UINT_MAX);
|
||||||
|
|
||||||
|
g->ops.gr.get_preemption_mode_flags(g, &g->gr.preemption_mode_rec);
|
||||||
|
gpu->graphics_preemption_mode_flags =
|
||||||
|
g->gr.preemption_mode_rec.graphics_preemption_mode_flags;
|
||||||
|
gpu->compute_preemption_mode_flags =
|
||||||
|
g->gr.preemption_mode_rec.compute_preemption_mode_flags;
|
||||||
|
gpu->default_graphics_preempt_mode =
|
||||||
|
g->gr.preemption_mode_rec.default_graphics_preempt_mode;
|
||||||
|
gpu->default_compute_preempt_mode =
|
||||||
|
g->gr.preemption_mode_rec.default_compute_preempt_mode;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ struct gpu_ops {
|
|||||||
int (*set_preemption_mode)(struct channel_gk20a *ch,
|
int (*set_preemption_mode)(struct channel_gk20a *ch,
|
||||||
u32 graphics_preempt_mode,
|
u32 graphics_preempt_mode,
|
||||||
u32 compute_preempt_mode);
|
u32 compute_preempt_mode);
|
||||||
|
int (*get_preemption_mode_flags)(struct gk20a *g,
|
||||||
|
struct nvgpu_preemption_modes_rec *preemption_modes_rec);
|
||||||
} gr;
|
} gr;
|
||||||
const char *name;
|
const char *name;
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@@ -8659,6 +8659,22 @@ clean_up:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gr_gk20a_get_preemption_mode_flags(struct gk20a *g,
|
||||||
|
struct nvgpu_preemption_modes_rec *preemption_modes_rec)
|
||||||
|
{
|
||||||
|
preemption_modes_rec->graphics_preemption_mode_flags =
|
||||||
|
NVGPU_GRAPHICS_PREEMPTION_MODE_WFI;
|
||||||
|
preemption_modes_rec->compute_preemption_mode_flags =
|
||||||
|
NVGPU_COMPUTE_PREEMPTION_MODE_WFI;
|
||||||
|
|
||||||
|
preemption_modes_rec->default_graphics_preempt_mode =
|
||||||
|
NVGPU_GRAPHICS_PREEMPTION_MODE_WFI;
|
||||||
|
preemption_modes_rec->default_compute_preempt_mode =
|
||||||
|
NVGPU_COMPUTE_PREEMPTION_MODE_WFI;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void gk20a_init_gr_ops(struct gpu_ops *gops)
|
void gk20a_init_gr_ops(struct gpu_ops *gops)
|
||||||
{
|
{
|
||||||
gops->gr.access_smpc_reg = gr_gk20a_access_smpc_reg;
|
gops->gr.access_smpc_reg = gr_gk20a_access_smpc_reg;
|
||||||
@@ -8726,4 +8742,5 @@ void gk20a_init_gr_ops(struct gpu_ops *gops)
|
|||||||
gops->gr.update_sm_error_state = gk20a_gr_update_sm_error_state;
|
gops->gr.update_sm_error_state = gk20a_gr_update_sm_error_state;
|
||||||
gops->gr.clear_sm_error_state = gk20a_gr_clear_sm_error_state;
|
gops->gr.clear_sm_error_state = gk20a_gr_clear_sm_error_state;
|
||||||
gops->gr.suspend_contexts = gr_gk20a_suspend_contexts;
|
gops->gr.suspend_contexts = gr_gk20a_suspend_contexts;
|
||||||
|
gops->gr.get_preemption_mode_flags = gr_gk20a_get_preemption_mode_flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,14 @@ struct gr_gk20a_isr_data {
|
|||||||
u32 class_num;
|
u32 class_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct nvgpu_preemption_modes_rec {
|
||||||
|
u32 graphics_preemption_mode_flags; /* supported preemption modes */
|
||||||
|
u32 compute_preemption_mode_flags; /* supported preemption modes */
|
||||||
|
|
||||||
|
u32 default_graphics_preempt_mode; /* default mode */
|
||||||
|
u32 default_compute_preempt_mode; /* default mode */
|
||||||
|
};
|
||||||
|
|
||||||
struct gr_gk20a {
|
struct gr_gk20a {
|
||||||
struct gk20a *g;
|
struct gk20a *g;
|
||||||
struct {
|
struct {
|
||||||
@@ -325,6 +333,7 @@ struct gr_gk20a {
|
|||||||
bool sw_ready;
|
bool sw_ready;
|
||||||
bool skip_ucode_init;
|
bool skip_ucode_init;
|
||||||
|
|
||||||
|
struct nvgpu_preemption_modes_rec preemption_mode_rec;
|
||||||
#ifdef CONFIG_ARCH_TEGRA_18x_SOC
|
#ifdef CONFIG_ARCH_TEGRA_18x_SOC
|
||||||
struct gr_t18x t18x;
|
struct gr_t18x t18x;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1345,6 +1345,23 @@ fail:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gr_gm20b_get_preemption_mode_flags(struct gk20a *g,
|
||||||
|
struct nvgpu_preemption_modes_rec *preemption_modes_rec)
|
||||||
|
{
|
||||||
|
preemption_modes_rec->graphics_preemption_mode_flags =
|
||||||
|
NVGPU_GRAPHICS_PREEMPTION_MODE_WFI;
|
||||||
|
preemption_modes_rec->compute_preemption_mode_flags = (
|
||||||
|
NVGPU_COMPUTE_PREEMPTION_MODE_WFI |
|
||||||
|
NVGPU_COMPUTE_PREEMPTION_MODE_CTA);
|
||||||
|
|
||||||
|
preemption_modes_rec->default_graphics_preempt_mode =
|
||||||
|
NVGPU_GRAPHICS_PREEMPTION_MODE_WFI;
|
||||||
|
preemption_modes_rec->default_compute_preempt_mode =
|
||||||
|
NVGPU_COMPUTE_PREEMPTION_MODE_CTA;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void gm20b_init_gr(struct gpu_ops *gops)
|
void gm20b_init_gr(struct gpu_ops *gops)
|
||||||
{
|
{
|
||||||
gops->gr.init_gpc_mmu = gr_gm20b_init_gpc_mmu;
|
gops->gr.init_gpc_mmu = gr_gm20b_init_gpc_mmu;
|
||||||
@@ -1417,4 +1434,5 @@ void gm20b_init_gr(struct gpu_ops *gops)
|
|||||||
gops->gr.update_sm_error_state = gm20b_gr_update_sm_error_state;
|
gops->gr.update_sm_error_state = gm20b_gr_update_sm_error_state;
|
||||||
gops->gr.clear_sm_error_state = gm20b_gr_clear_sm_error_state;
|
gops->gr.clear_sm_error_state = gm20b_gr_clear_sm_error_state;
|
||||||
gops->gr.suspend_contexts = gr_gk20a_suspend_contexts;
|
gops->gr.suspend_contexts = gr_gk20a_suspend_contexts;
|
||||||
|
gops->gr.get_preemption_mode_flags = gr_gm20b_get_preemption_mode_flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,6 +187,13 @@ struct nvgpu_gpu_characteristics {
|
|||||||
|
|
||||||
__u64 max_freq;
|
__u64 max_freq;
|
||||||
|
|
||||||
|
/* supported preemption modes */
|
||||||
|
__u32 graphics_preemption_mode_flags; /* NVGPU_GRAPHICS_PREEMPTION_MODE_* */
|
||||||
|
__u32 compute_preemption_mode_flags; /* NVGPU_COMPUTE_PREEMPTION_MODE_* */
|
||||||
|
/* default preemption modes */
|
||||||
|
__u32 default_graphics_preempt_mode; /* NVGPU_GRAPHICS_PREEMPTION_MODE_* */
|
||||||
|
__u32 default_compute_preempt_mode; /* NVGPU_COMPUTE_PREEMPTION_MODE_* */
|
||||||
|
|
||||||
/* Notes:
|
/* Notes:
|
||||||
- This struct can be safely appended with new fields. However, always
|
- This struct can be safely appended with new fields. However, always
|
||||||
keep the structure size multiple of 8 and make sure that the binary
|
keep the structure size multiple of 8 and make sure that the binary
|
||||||
|
|||||||
Reference in New Issue
Block a user