From patchwork Sun May 16 15:45:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 99972 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4GFkQEC025271 for ; Sun, 16 May 2010 15:46:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753456Ab0EPPq0 (ORCPT ); Sun, 16 May 2010 11:46:26 -0400 Received: from fg-out-1718.google.com ([72.14.220.157]:34390 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753444Ab0EPPqZ (ORCPT ); Sun, 16 May 2010 11:46:25 -0400 Received: by fg-out-1718.google.com with SMTP id 22so178499fge.1 for ; Sun, 16 May 2010 08:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=nkdLN/0SZ5ECDDaMjMfIA6wXXgWqsVAMXW5ZTb8rOyE=; b=q9kSv/26YbnPUWiJTEQNLhdcvXw/GaZ/ZbegdC5gk2g2KOUoV6Qbogg/Iz8h+quXO+ /KlxQn30j0jnEbR+rjlLGWP9J+sjGNH05hOvnnkvb7PMNQH6KH3DFLSNj8AF3y/UZmo6 f1osDLcXTLf+eKf+hHbNye/KjMmN0c4w6wBTI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=s7yL9mgD7aUytskHcf5nM5jy5qsZVQLEfbFYX22zJIcTtCOoiZqZUQbLRGMa8KImp1 77O0vWKPZ0sMNjcoBjqaHikzD7+FVSeaQvvd3w9i5iQBRIDw8CvcxHV6SUT7TNVeXh8D mmSVQJ7egcB8aVK0KqfZJzxD6///9ZAw8txLw= Received: by 10.87.35.9 with SMTP id n9mr6779747fgj.45.1274024784504; Sun, 16 May 2010 08:46:24 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id 3sm3767472fge.10.2010.05.16.08.46.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 16 May 2010 08:46:24 -0700 (PDT) From: Felipe Contreras To: linux-omap Cc: Omar Ramirez Luna , Fernando Guzman Lugo , Felipe Contreras Subject: [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack() Date: Sun, 16 May 2010 18:45:59 +0300 Message-Id: <1274024765-21076-9-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274024765-21076-1-git-send-email-felipe.contreras@gmail.com> References: <1274024765-21076-1-git-send-email-felipe.contreras@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 16 May 2010 15:46:27 +0000 (UTC) diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c index f661aaf..1d1b87b 100644 --- a/drivers/dsp/bridge/core/ue_deh.c +++ b/drivers/dsp/bridge/core/ue_deh.c @@ -189,9 +189,8 @@ static void wait_for_timer(void) omap_dm_timer_disable(timer); } -void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo) +static void mmu_fault_print_stack(struct bridge_dev_context *dev_context) { - struct bridge_dev_context *dev_context; struct cfg_hostres *resources; struct hw_mmu_map_attrs_t map_attrs = { .endianism = HW_LITTLE_ENDIAN, @@ -200,12 +199,41 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo) }; void *dummy_va_addr; + resources = dev_context->resources; + dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC); + + /* + * Before acking the MMU fault, let's make sure MMU can only + * access entry #0. Then add a new entry so that the DSP OS + * can continue in order to dump the stack. + */ + hw_mmu_twl_disable(resources->dw_dmmu_base); + hw_mmu_tlb_flush_all(resources->dw_dmmu_base); + + hw_mmu_tlb_add(resources->dw_dmmu_base, + virt_to_phys(dummy_va_addr), fault_addr, + HW_PAGE_SIZE4KB, 1, + &map_attrs, HW_SET, HW_SET); + + wait_for_timer(); + /* Clear MMU interrupt */ + hw_mmu_event_ack(resources->dw_dmmu_base, + HW_MMU_TRANSLATION_FAULT); + dump_dsp_stack(dev_context); + + hw_mmu_disable(resources->dw_dmmu_base); + free_page((unsigned long)dummy_va_addr); +} + +void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo) +{ + struct bridge_dev_context *dev_context; + if (!deh_mgr) return; dev_info(bridge, "%s: device exception\n", __func__); dev_context = deh_mgr->hbridge_context; - resources = dev_context->resources; switch (ulEventMask) { case DSP_SYSERROR: @@ -230,32 +258,10 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo) (unsigned int) deh_mgr->err_info.dw_val1, (unsigned int) deh_mgr->err_info.dw_val2, (unsigned int) fault_addr); - dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC); print_dsp_trace_buffer(dev_context); dump_dl_modules(dev_context); - - /* - * Before acking the MMU fault, let's make sure MMU can only - * access entry #0. Then add a new entry so that the DSP OS - * can continue in order to dump the stack. - */ - hw_mmu_twl_disable(resources->dw_dmmu_base); - hw_mmu_tlb_flush_all(resources->dw_dmmu_base); - - hw_mmu_tlb_add(resources->dw_dmmu_base, - virt_to_phys(dummy_va_addr), fault_addr, - HW_PAGE_SIZE4KB, 1, - &map_attrs, HW_SET, HW_SET); - - wait_for_timer(); - /* Clear MMU interrupt */ - hw_mmu_event_ack(resources->dw_dmmu_base, - HW_MMU_TRANSLATION_FAULT); - dump_dsp_stack(dev_context); - - hw_mmu_disable(resources->dw_dmmu_base); - free_page((unsigned long)dummy_va_addr); + mmu_fault_print_stack(dev_context); break; #ifdef CONFIG_BRIDGE_NTFY_PWRERR case DSP_PWRERROR: