mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 09:57:08 +03:00
gpu: nvgpu: isolate common & hal falcon_reset functions
nvgpu_falcon_reset should handle engine specific falcon reset or resort to falcon CPU reset. gk20a_falcon_reset is supposed to be hal API that will reset the falcon CPU. Hence move the dependent engine reset to nvgpu_falcon_reset. JIRA NVGPU-1459 Change-Id: I1b15f31a8bbb515736af5b0122ce206be0811bbc Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2015590 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Mahantesh Kumbar <mkumbar@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>
This commit is contained in:
committed by
mobile promotions
parent
69dd2ce8be
commit
b6b56bd556
@@ -109,24 +109,29 @@ exit:
|
|||||||
int nvgpu_falcon_reset(struct nvgpu_falcon *flcn)
|
int nvgpu_falcon_reset(struct nvgpu_falcon *flcn)
|
||||||
{
|
{
|
||||||
struct nvgpu_falcon_ops *flcn_ops;
|
struct nvgpu_falcon_ops *flcn_ops;
|
||||||
|
struct gk20a *g;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
if (flcn == NULL) {
|
if (flcn == NULL) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g = flcn->g;
|
||||||
flcn_ops = &flcn->flcn_ops;
|
flcn_ops = &flcn->flcn_ops;
|
||||||
|
|
||||||
if (flcn_ops->reset != NULL) {
|
if (flcn->flcn_engine_dep_ops.reset_eng != NULL) {
|
||||||
status = flcn_ops->reset(flcn);
|
/* falcon & engine reset */
|
||||||
|
status = flcn->flcn_engine_dep_ops.reset_eng(g);
|
||||||
|
} else if (flcn_ops->reset != NULL) {
|
||||||
|
flcn_ops->reset(flcn);
|
||||||
|
} else {
|
||||||
|
nvgpu_warn(g, "Invalid op on falcon 0x%x ", flcn->flcn_id);
|
||||||
|
status = -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
status = nvgpu_falcon_mem_scrub_wait(flcn);
|
status = nvgpu_falcon_mem_scrub_wait(flcn);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ",
|
|
||||||
flcn->flcn_id);
|
|
||||||
status = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,17 +28,12 @@
|
|||||||
|
|
||||||
#include <nvgpu/hw/gm20b/hw_falcon_gm20b.h>
|
#include <nvgpu/hw/gm20b/hw_falcon_gm20b.h>
|
||||||
|
|
||||||
static int gk20a_falcon_reset(struct nvgpu_falcon *flcn)
|
static void gk20a_falcon_reset(struct nvgpu_falcon *flcn)
|
||||||
{
|
{
|
||||||
struct gk20a *g = flcn->g;
|
struct gk20a *g = flcn->g;
|
||||||
u32 base_addr = flcn->flcn_base;
|
u32 base_addr = flcn->flcn_base;
|
||||||
u32 unit_status = 0;
|
u32 unit_status = 0;
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
if (flcn->flcn_engine_dep_ops.reset_eng != NULL) {
|
|
||||||
/* falcon & engine reset */
|
|
||||||
status = flcn->flcn_engine_dep_ops.reset_eng(g);
|
|
||||||
} else {
|
|
||||||
/* do falcon CPU hard reset */
|
/* do falcon CPU hard reset */
|
||||||
unit_status = gk20a_readl(g, base_addr +
|
unit_status = gk20a_readl(g, base_addr +
|
||||||
falcon_falcon_cpuctl_r());
|
falcon_falcon_cpuctl_r());
|
||||||
@@ -46,9 +41,6 @@ static int gk20a_falcon_reset(struct nvgpu_falcon *flcn)
|
|||||||
(unit_status | falcon_falcon_cpuctl_hreset_f(1)));
|
(unit_status | falcon_falcon_cpuctl_hreset_f(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool gk20a_falcon_clear_halt_interrupt_status(struct nvgpu_falcon *flcn)
|
static bool gk20a_falcon_clear_halt_interrupt_status(struct nvgpu_falcon *flcn)
|
||||||
{
|
{
|
||||||
struct gk20a *g = flcn->g;
|
struct gk20a *g = flcn->g;
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ struct nvgpu_falcon_engine_dependency_ops {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct nvgpu_falcon_ops {
|
struct nvgpu_falcon_ops {
|
||||||
int (*reset)(struct nvgpu_falcon *flcn);
|
void (*reset)(struct nvgpu_falcon *flcn);
|
||||||
void (*set_irq)(struct nvgpu_falcon *flcn, bool enable,
|
void (*set_irq)(struct nvgpu_falcon *flcn, bool enable,
|
||||||
u32 intr_mask, u32 intr_dest);
|
u32 intr_mask, u32 intr_dest);
|
||||||
bool (*clear_halt_interrupt_status)(struct nvgpu_falcon *flcn);
|
bool (*clear_halt_interrupt_status)(struct nvgpu_falcon *flcn);
|
||||||
|
|||||||
Reference in New Issue
Block a user