Files
linux-nvgpu/drivers/gpu/nvgpu/hal/pmu/pmu_gk20a_fusa.c
Sagar Kamble fba516ffae gpu: nvgpu: enable PMU ECC interrupt early
PMU IRQs were not enabled assuming entire functionality for LS PMU.
Debugging early init issues of PMU falcon ECC errors triggered
during nvgpu power-on will be cumbersome if interrupts are not
enabled early. FMEA analysis of the nvgpu init path also
requires this interrupt be enabled earlier.

Hence, Enable the PMU ECC IRQ early during nvgpu_finalize_poweron.
pmu_enable_irq is updated to enable interrupts differently for
safety and non-safety. PMU interrupts disabling is moved out
of nvgpu_pmu_destroy to nvgpu_prepare_poweroff. Prepared new
wrapper API nvgpu_pmu_enable_irq.

PMU ECC init and isr mutex init is moved to the beginning of
nvgpu_pmu_early_init as for safety, ls pmu code path is
disabled. Fixed the pmu_early_init dependent and mc
interrupt related unit tests.

Update the doxygen for changed functions.

JIRA NVGPU-4439

Change-Id: I1a1e792d2ad2cc7a926c8c1456d4d0d6d1f14d1a
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2251732
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00

75 lines
2.2 KiB
C

/*
* Copyright (c) 2011-2019, 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <nvgpu/pmu/debug.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/io.h>
#include <nvgpu/hw/gk20a/hw_pwr_gk20a.h>
#include "pmu_gk20a.h"
void gk20a_pmu_isr(struct gk20a *g)
{
struct nvgpu_pmu *pmu = g->pmu;
u32 intr, mask;
nvgpu_log_fn(g, " ");
nvgpu_mutex_acquire(&pmu->isr_mutex);
if (!pmu->isr_enabled) {
nvgpu_mutex_release(&pmu->isr_mutex);
return;
}
mask = nvgpu_readl(g, pwr_falcon_irqmask_r());
mask &= nvgpu_readl(g, pwr_falcon_irqdest_r());
intr = nvgpu_readl(g, pwr_falcon_irqstat_r());
nvgpu_pmu_dbg(g, "received falcon interrupt: 0x%08x", intr);
intr = nvgpu_readl(g, pwr_falcon_irqstat_r()) & mask;
if (intr == 0U) {
nvgpu_mutex_release(&pmu->isr_mutex);
return;
}
if (g->ops.pmu.handle_ext_irq != NULL) {
g->ops.pmu.handle_ext_irq(g, intr);
}
nvgpu_writel(g, pwr_falcon_irqsclr_r(), intr);
#ifdef CONFIG_NVGPU_LS_PMU
if (nvgpu_pmu_get_fw_state(g, pmu) == PMU_FW_STATE_OFF) {
nvgpu_mutex_release(&pmu->isr_mutex);
return;
}
gk20a_pmu_handle_interrupts(g, intr);
#endif
nvgpu_mutex_release(&pmu->isr_mutex);
}