Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3b3f4c3 authored by Dhaval Patel's avatar Dhaval Patel Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent d171201f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
{
+5 −1
Original line number Diff line number Diff line
@@ -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;

+13 −1
Original line number Diff line number Diff line

/* 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;
}