msm: mdss: check intr line status before handling isr

Hardware might return/call the pending interrupt
on one CPU when same interrupt is disabled from other
core. Such parallel processing may lead to unclocked
register access in interrupt context followed by
panic. It is safe to check the interrupt line status
before handling isr to avoid crash in such race
condition.

Change-Id: I460550cb5188c7f77b9f741682917010f9231a50
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
This commit is contained in:
Dhaval Patel 2015-12-22 14:22:33 -08:00 committed by David Keitel
parent 6c8c0f62d3
commit 23249cac8f
3 changed files with 19 additions and 2 deletions

View file

@ -496,6 +496,7 @@ struct mdss_util_intf {
};
struct mdss_util_intf *mdss_get_util_intf(void);
bool mdss_get_irq_enable_state(struct mdss_hw *hw);
static inline int mdss_get_sd_client_cnt(void)
{

View file

@ -176,10 +176,14 @@ u32 mdss_mdp_fb_stride(u32 fb_index, u32 xres, int bpp)
static irqreturn_t mdss_irq_handler(int irq, void *ptr)
{
struct mdss_data_type *mdata = ptr;
u32 intr = MDSS_REG_READ(mdata, MDSS_REG_HW_INTR_STATUS);
u32 intr;
if (!mdata)
return IRQ_NONE;
else if (!mdss_get_irq_enable_state(&mdss_mdp_hw))
return IRQ_HANDLED;
intr = MDSS_REG_READ(mdata, MDSS_REG_HW_INTR_STATUS);
mdss_mdp_hw.irq_info->irq_buzy = true;

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2007-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2007-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -160,3 +160,15 @@ struct mdss_util_intf *mdss_get_util_intf()
return &mdss_util;
}
EXPORT_SYMBOL(mdss_get_util_intf);
/* This routine should only be called from interrupt context */
bool mdss_get_irq_enable_state(struct mdss_hw *hw)
{
bool is_irq_enabled;
spin_lock(&mdss_lock);
is_irq_enabled = hw->irq_info->irq_ena;
spin_unlock(&mdss_lock);
return is_irq_enabled;
}