From 28b53fbb7280486a9b783fd47dc8eac13f199edd Mon Sep 17 00:00:00 2001 From: Mahesh Sivasubramanian Date: Wed, 8 Mar 2017 15:38:23 -0700 Subject: [PATCH] drivers: soc: qcom: Remove prints from the idle path The system runs into a "undefined instruction" error when first core waking out of power collapse tries to wakeup a core by writing to a GIC register. When waking out of reset, the GIC SRE bit is reset, and any accesses to the GIC ICC registers would result in a "undefined instructions". When a first waking out of reset writes to a console, the console task is now marked as unnable by the scheduler. If the console task is running on a different CPU, this would trigger a IRQ_WORK IPI to the target CPU. Since the core is waking out of reset, its SRE bit is cleared and any access to the GIC ICC registers results in an undefined instruction abort. Fix by removing logging from the idle path. Change-Id: I476d4a4d082bb115128e1f54c931558e79fec567 Signed-off-by: Mahesh Sivasubramanian --- drivers/soc/qcom/mpm-of.c | 45 ++++------------------------------------- drivers/soc/qcom/rpm-smd.c | 50 +--------------------------------------------- 2 files changed, 5 insertions(+), 90 deletions(-) diff --git a/drivers/soc/qcom/mpm-of.c b/drivers/soc/qcom/mpm-of.c index 93f2de8a59dd..77c50528be4b 100644 --- a/drivers/soc/qcom/mpm-of.c +++ b/drivers/soc/qcom/mpm-of.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2017, 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 @@ -129,18 +129,6 @@ static uint32_t *msm_mpm_falling_edge; static uint32_t *msm_mpm_rising_edge; static uint32_t *msm_mpm_polarity; -enum { - MSM_MPM_DEBUG_NON_DETECTABLE_IRQ = BIT(0), - MSM_MPM_DEBUG_PENDING_IRQ = BIT(1), - MSM_MPM_DEBUG_WRITE = BIT(2), - MSM_MPM_DEBUG_NON_DETECTABLE_IRQ_IDLE = BIT(3), -}; - -static int msm_mpm_debug_mask = 1; -module_param_named( - debug_mask, msm_mpm_debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP -); - enum mpm_state { MSM_MPM_GIC_IRQ_MAPPING_DONE = BIT(0), MSM_MPM_GPIO_IRQ_MAPPING_DONE = BIT(1), @@ -174,9 +162,6 @@ static inline void msm_mpm_write( unsigned int offset = reg * MSM_MPM_REG_WIDTH + subreg_index + 2; __raw_writel(value, msm_mpm_dev_data.mpm_request_reg_base + offset * 4); - if (MSM_MPM_DEBUG_WRITE & msm_mpm_debug_mask) - pr_info("%s: reg %u.%u: 0x%08x\n", - __func__, reg, subreg_index, value); } static inline void msm_mpm_send_interrupt(void) @@ -513,37 +498,19 @@ int msm_mpm_set_pin_type(unsigned int pin, unsigned int flow_type) static bool msm_mpm_interrupts_detectable(int d, bool from_idle) { unsigned long *irq_bitmap; - bool debug_mask, ret = false; + bool ret = false; struct mpm_irqs *unlisted = &unlisted_irqs[d]; if (!msm_mpm_is_initialized()) return false; - if (from_idle) { + if (from_idle) irq_bitmap = unlisted->enabled_irqs; - debug_mask = msm_mpm_debug_mask & - MSM_MPM_DEBUG_NON_DETECTABLE_IRQ_IDLE; - } else { + else irq_bitmap = unlisted->wakeup_irqs; - debug_mask = msm_mpm_debug_mask & - MSM_MPM_DEBUG_NON_DETECTABLE_IRQ; - } ret = (bool) bitmap_empty(irq_bitmap, unlisted->size); - if (debug_mask && !ret) { - int i = 0; - i = find_first_bit(irq_bitmap, unlisted->size); - pr_info("%s(): %s preventing system sleep modes during %s\n", - __func__, unlisted->domain_name, - from_idle ? "idle" : "suspend"); - - while (i < unlisted->size) { - pr_info("\thwirq: %d\n", i); - i = find_next_bit(irq_bitmap, unlisted->size, i + 1); - } - } - return ret; } @@ -601,10 +568,6 @@ void msm_mpm_exit_sleep(bool from_idle) pending = msm_mpm_read(MSM_MPM_REG_STATUS, i); pending &= enabled_intr[i]; - if (MSM_MPM_DEBUG_PENDING_IRQ & msm_mpm_debug_mask) - pr_info("%s: enabled_intr.%d pending.%d: 0x%08x 0x%08lx\n", - __func__, i, i, enabled_intr[i], pending); - k = find_first_bit(&pending, 32); while (k < 32) { unsigned int mpm_irq = 32 * i + k; diff --git a/drivers/soc/qcom/rpm-smd.c b/drivers/soc/qcom/rpm-smd.c index 20f406b9a2f7..f2784dedbc7a 100644 --- a/drivers/soc/qcom/rpm-smd.c +++ b/drivers/soc/qcom/rpm-smd.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, 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 @@ -716,51 +716,6 @@ int msm_rpm_smd_buffer_request(struct msm_rpm_request *cdata, return 0; } -static void msm_rpm_print_sleep_buffer(struct slp_buf *s) -{ - char buf[DEBUG_PRINT_BUFFER_SIZE] = {0}; - int pos; - int buflen = DEBUG_PRINT_BUFFER_SIZE; - char ch[5] = {0}; - struct kvp *e; - uint32_t type; - unsigned int id; - - if (!s) - return; - - if (!s->valid) - return; - - type = get_rsc_type(s->buf); - id = get_rsc_id(s->buf); - - memcpy(ch, &type, sizeof(u32)); - - pos = scnprintf(buf, buflen, - "Sleep request type = 0x%08x(%s)", - type, ch); - pos += scnprintf(buf + pos, buflen - pos, " id = 0%x", - id); - for_each_kvp(s->buf, e) { - uint32_t i; - char *data = get_data(e); - - memcpy(ch, &e->k, sizeof(u32)); - - pos += scnprintf(buf + pos, buflen - pos, - "\n\t\tkey = 0x%08x(%s)", - e->k, ch); - pos += scnprintf(buf + pos, buflen - pos, - " sz= %d data =", e->s); - - for (i = 0; i < e->s; i++) - pos += scnprintf(buf + pos, buflen - pos, - " 0x%02X", data[i]); - } - pos += scnprintf(buf + pos, buflen - pos, "\n"); - printk(buf); -} static struct msm_rpm_driver_data msm_rpm_data = { .smd_open = COMPLETION_INITIALIZER(msm_rpm_data.smd_open), @@ -821,9 +776,6 @@ static int msm_rpm_flush_requests(bool print) if (!s->valid) continue; - if (print) - msm_rpm_print_sleep_buffer(s); - set_msg_id(s->buf, msm_rpm_get_next_msg_id()); if (!glink_enabled) -- 2.11.0