diff --git a/drivers/gpu/nvgpu/common/mc/mc.c b/drivers/gpu/nvgpu/common/mc/mc.c index 80cbf2863..b286ce7e6 100644 --- a/drivers/gpu/nvgpu/common/mc/mc.c +++ b/drivers/gpu/nvgpu/common/mc/mc.c @@ -25,14 +25,6 @@ #include #include -/** - * nvgpu_wait_for_deferred_interrupts - Wait for interrupts to complete - * - * @g - The GPU to wait on. - * - * Waits until all interrupt handlers that have been scheduled to run have - * completed. - */ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g) { /* wait until all stalling irqs are handled */ diff --git a/drivers/gpu/nvgpu/hal/mc/mc_gp10b_fusa.c b/drivers/gpu/nvgpu/hal/mc/mc_gp10b_fusa.c index 91ee01a18..a71418590 100644 --- a/drivers/gpu/nvgpu/hal/mc/mc_gp10b_fusa.c +++ b/drivers/gpu/nvgpu/hal/mc/mc_gp10b_fusa.c @@ -182,7 +182,7 @@ void mc_gp10b_isr_stall(struct gk20a *g) u32 engine_id = 0U; enum nvgpu_fifo_engine engine_enum; - mc_intr_0 = nvgpu_readl(g, mc_intr_r(0)); + mc_intr_0 = nvgpu_readl(g, mc_intr_r(NVGPU_MC_INTR_STALLING)); nvgpu_log(g, gpu_dbg_intr, "stall intr 0x%08x", mc_intr_0); diff --git a/drivers/gpu/nvgpu/hal/mc/mc_gv100.c b/drivers/gpu/nvgpu/hal/mc/mc_gv100.c index 1e4a6f205..63eb78095 100644 --- a/drivers/gpu/nvgpu/hal/mc/mc_gv100.c +++ b/drivers/gpu/nvgpu/hal/mc/mc_gv100.c @@ -1,7 +1,7 @@ /* * GV100 master * - * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -42,7 +42,7 @@ bool gv100_mc_is_intr_nvlink_pending(struct gk20a *g, u32 mc_intr_0) bool gv100_mc_is_stall_and_eng_intr_pending(struct gk20a *g, u32 engine_id, u32 *eng_intr_pending) { - u32 mc_intr_0 = nvgpu_readl(g, mc_intr_r(0)); + u32 mc_intr_0 = nvgpu_readl(g, mc_intr_r(NVGPU_MC_INTR_STALLING)); u32 stall_intr, eng_intr_mask; eng_intr_mask = nvgpu_engine_act_interrupt_mask(g, engine_id); diff --git a/drivers/gpu/nvgpu/hal/mc/mc_gv11b_fusa.c b/drivers/gpu/nvgpu/hal/mc/mc_gv11b_fusa.c index ba8dbfb49..401e99028 100644 --- a/drivers/gpu/nvgpu/hal/mc/mc_gv11b_fusa.c +++ b/drivers/gpu/nvgpu/hal/mc/mc_gv11b_fusa.c @@ -1,7 +1,7 @@ /* * GV11B master * - * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -40,7 +40,7 @@ bool gv11b_mc_is_intr_hub_pending(struct gk20a *g, u32 mc_intr_0) bool gv11b_mc_is_stall_and_eng_intr_pending(struct gk20a *g, u32 engine_id, u32 *eng_intr_pending) { - u32 mc_intr_0 = nvgpu_readl(g, mc_intr_r(0)); + u32 mc_intr_0 = nvgpu_readl(g, mc_intr_r(NVGPU_MC_INTR_STALLING)); u32 stall_intr, eng_intr_mask; eng_intr_mask = nvgpu_engine_act_interrupt_mask(g, engine_id); diff --git a/drivers/gpu/nvgpu/include/nvgpu/mc.h b/drivers/gpu/nvgpu/include/nvgpu/mc.h index 50f6423e0..1f0d9f101 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/mc.h +++ b/drivers/gpu/nvgpu/include/nvgpu/mc.h @@ -120,9 +120,15 @@ struct gk20a; /** - * Enumeration of all units intended to be used by any HAL that requires - * unit as parameter. Units are added to the enumeration as needed, so - * it is not complete. + * @defgroup NVGPU_MC_UNIT_ENUMS + * + * Enumeration of all units intended to be used by enabling/disabling HAL + * that requires unit as parameter. Units are added to the enumeration as + * needed, so it is not complete. + */ + +/** + * @ingroup NVGPU_MC_UNIT_ENUMS */ enum nvgpu_unit { /** FIFO Engine */ @@ -144,15 +150,39 @@ enum nvgpu_unit { /** Bit offset of the Architecture field in the HW version register */ #define NVGPU_GPU_ARCHITECTURE_SHIFT 4U -/** Index for accessing registers corresponding to stalling interrupts */ +/** + * @defgroup NVGPU_MC_INTR_TYPE_DEFINES + * + * Defines of all MC unit interrupt types. + */ + +/** + * @ingroup NVGPU_MC_INTR_TYPE_DEFINES + */ +/** + * Index for accessing registers corresponding to stalling interrupts. + */ #define NVGPU_MC_INTR_STALLING 0U -/** Index for accessing registers corresponding to non-stalling interrupts */ +/** + * Index for accessing registers corresponding to non-stalling + * interrupts. + */ #define NVGPU_MC_INTR_NONSTALLING 1U /** Operations that will need to be executed on non stall workqueue. */ #define NVGPU_NONSTALL_OPS_WAKEUP_SEMAPHORE BIT32(0) #define NVGPU_NONSTALL_OPS_POST_EVENTS BIT32(1) +/** + * @defgroup NVGPU_MC_INTR_UNIT_DEFINES + * + * Defines of all units intended to be used by any interrupt related + * HAL that requires unit as parameter. + */ + +/** + * @ingroup NVGPU_MC_INTR_UNIT_DEFINES + */ /** MC interrupt for Bus unit. */ #define MC_INTR_UNIT_BUS 0 /** MC interrupt for PRIV_RING unit. */ @@ -174,9 +204,22 @@ enum nvgpu_unit { /** MC interrupt for FBPA unit. */ #define MC_INTR_UNIT_FBPA 9 -/** Value to be passed to mc.intr_*_unit_config to enable the interrupt. */ +/** + * @defgroup NVGPU_MC_INTR_ENABLE_DEFINES + * + * Defines for MC unit interrupt enabling/disabling. + */ + +/** + * @ingroup NVGPU_MC_INTR_ENABLE_DEFINES + * Value to be passed to mc.intr_*_unit_config to enable the interrupt. + */ #define MC_INTR_ENABLE true -/** Value to be passed to mc.intr_*_unit_config to disable the interrupt. */ + +/** + * @ingroup NVGPU_MC_INTR_ENABLE_DEFINES + * Value to be passed to mc.intr_*_unit_config to disable the interrupt. + */ #define MC_INTR_DISABLE false /** @@ -184,6 +227,7 @@ enum nvgpu_unit { * interrupt handling of the units/engines. */ struct nvgpu_mc { + /** Lock to access the MC interrupt registers */ struct nvgpu_spinlock intr_lock; /** Lock to access the mc_enable_r */ @@ -265,7 +309,7 @@ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g); * * @param g [in] The GPU driver struct. * - * This function is invoked before powering off or finishing + * This function is invoked before powering on, powering off or finishing * SW quiesce of nvgpu driver. * * Steps: diff --git a/userspace/units/mc/nvgpu-mc.c b/userspace/units/mc/nvgpu-mc.c index c5e408da9..fbaae9b4c 100644 --- a/userspace/units/mc/nvgpu-mc.c +++ b/userspace/units/mc/nvgpu-mc.c @@ -784,6 +784,9 @@ int test_wait_for_deferred_interrupts(struct unit_module *m, struct gk20a *g, nvgpu_atomic_set(&g->mc.sw_irq_nonstall_pending, 1); nvgpu_wait_for_deferred_interrupts(g); + /* disable the fault injection */ + nvgpu_posix_enable_fault_injection(cond_fi, false, 0); + return UNIT_SUCCESS; } diff --git a/userspace/units/mc/nvgpu-mc.h b/userspace/units/mc/nvgpu-mc.h index e48b33309..c01064b48 100644 --- a/userspace/units/mc/nvgpu-mc.h +++ b/userspace/units/mc/nvgpu-mc.h @@ -332,7 +332,7 @@ int test_reset_mask(struct unit_module *m, struct gk20a *g, void *args); /** * Test specification for: test_wait_for_deferred_interrupts * - * Description: Validate functionality of HAL to get reset mask for a unit. + * Description: Validate functionality of waiting for deferred interrupts. * * Test Type: Feature * @@ -351,6 +351,7 @@ int test_reset_mask(struct unit_module *m, struct gk20a *g, void *args); * - Call the API. * - Set the irq count states in the gk20a struct to simulate pending non-stall * interrupts. + * - Disable cond fault injection. * * Output: Returns PASS if expected result is met, FAIL otherwise. */ @@ -361,4 +362,4 @@ int test_wait_for_deferred_interrupts(struct unit_module *m, struct gk20a *g, * @} */ -#endif /* UNIT_NVGPU_CE_H */ \ No newline at end of file +#endif /* UNIT_NVGPU_CE_H */