From patchwork Sun Jul 4 13:36:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 110146 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o64Dadsm004743 for ; Sun, 4 Jul 2010 13:36:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757867Ab0GDNgk (ORCPT ); Sun, 4 Jul 2010 09:36:40 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:65451 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757856Ab0GDNgk (ORCPT ); Sun, 4 Jul 2010 09:36:40 -0400 Received: by mail-bw0-f46.google.com with SMTP id 1so2295721bwz.19 for ; Sun, 04 Jul 2010 06:36:39 -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=LPeNkS53ajkIic3p/mTpJGaerbMV2GnA8vOPuMMRkBs=; b=vAu4AYYKLMqj0sx4OKqRa3RR/7gNyKknFapgX0xr3uv3NqUjxXnw1/7B24HkOjYDFr 3x8MRb6I+V1OwqIYeFfKU7O1bt5KSgKy/4S7g2ILvmafmzTANCZLCz8Ot3UCilQeegMz Pq/d2Lbt6LgYg9bjGs+odYTkU45WNNHK6+DZ4= 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=FzwQNh6W4y42s9BRewYe2Ojtj0zWWS1WUttSq8y3v0Wb0Llzlu+dMDbEgdGkD8GVDZ xZemH09UDIVVbcHAUu5/tWjWDFsE1nCs5mN04dsCVCx9ynK24esuL07h8NCkMSsYxZXI LF1qyQigK1xNGQ2FtSU8FvNAc79395Kmild5U= Received: by 10.204.48.75 with SMTP id q11mr1356859bkf.0.1278250599321; Sun, 04 Jul 2010 06:36:39 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id g11sm12808813bkw.22.2010.07.04.06.36.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 04 Jul 2010 06:36:38 -0700 (PDT) From: Felipe Contreras To: linux-omap Cc: Ohad Ben-Cohen , Omar Ramirez Luna , Greg KH , Felipe Contreras Subject: [PATCH 5/5] staging: ti dspbridge: add _BACKTRACE config Date: Sun, 4 Jul 2010 16:36:26 +0300 Message-Id: <1278250586-17062-6-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1278250586-17062-1-git-send-email-felipe.contreras@gmail.com> References: <1278250586-17062-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, 04 Jul 2010 13:36:42 +0000 (UTC) diff --git a/drivers/staging/tidspbridge/Kconfig b/drivers/staging/tidspbridge/Kconfig index 4d63b66..93de4f2 100644 --- a/drivers/staging/tidspbridge/Kconfig +++ b/drivers/staging/tidspbridge/Kconfig @@ -81,3 +81,10 @@ config TIDSPBRIDGE_NTFY_PWRERR Enable notifications to registered clients on the event of power errror trying to suspend bridge driver. Say Y, to signal this event as a fatal error, this will require a bridge restart to recover. + +config TIDSPBRIDGE_BACKTRACE + bool "Dump backtraces on fatal errors" + depends on TIDSPBRIDGE + help + Enable useful information to backtrace fatal errors. Say Y if you + want to dump information for testing purposes. diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c index 8909c41..1503968 100644 --- a/drivers/staging/tidspbridge/core/io_sm.c +++ b/drivers/staging/tidspbridge/core/io_sm.c @@ -114,7 +114,7 @@ struct io_mgr { struct mgr_processorextinfo ext_proc_info; struct cmm_object *hcmm_mgr; /* Shared Mem Mngr */ struct work_struct io_workq; /* workqueue */ -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) u32 ul_trace_buffer_begin; /* Trace message start address */ u32 ul_trace_buffer_end; /* Trace message end address */ u32 ul_trace_buffer_current; /* Trace message current address */ @@ -210,7 +210,7 @@ int bridge_io_create(OUT struct io_mgr **phIOMgr, } /* Initialize chnl_mgr object */ -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) pio_mgr->pmsg = NULL; #endif pio_mgr->hchnl_mgr = hchnl_mgr; @@ -265,7 +265,7 @@ int bridge_io_destroy(struct io_mgr *hio_mgr) /* Free IO DPC object */ tasklet_kill(&hio_mgr->dpc_tasklet); -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) kfree(hio_mgr->pmsg); #endif dsp_wdt_exit(); @@ -407,7 +407,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) status = -EFAULT; } if (DSP_SUCCEEDED(status)) { -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) status = cod_get_sym_value(cod_man, DSP_TRACESEC_END, &shm0_end); #else @@ -752,7 +752,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr) hmsg_mgr->max_msgs); memset((void *)hio_mgr->shared_mem, 0, sizeof(struct shm)); -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) /* Get the start address of trace buffer */ status = cod_get_sym_value(cod_man, SYS_PUTCBEG, &hio_mgr->ul_trace_buffer_begin); @@ -949,7 +949,7 @@ void io_dpc(IN OUT unsigned long pRefData) (pio_mgr->intr_val < DEH_LIMIT)) { /* Notify DSP/BIOS exception */ if (hdeh_mgr) { -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE print_dsp_debug_trace(pio_mgr); #endif bridge_deh_notify(hdeh_mgr, DSP_SYSERROR, @@ -1810,7 +1810,12 @@ int bridge_io_get_proc_load(IN struct io_mgr *hio_mgr, return 0; } -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +void io_sm_init(void) +{ + /* Do nothing */ +} + +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) void print_dsp_debug_trace(struct io_mgr *hio_mgr) { u32 ul_new_message_length = 0, ul_gpp_cur_pointer; @@ -1871,6 +1876,7 @@ void print_dsp_debug_trace(struct io_mgr *hio_mgr) } #endif +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /* * ======== print_dsp_trace_buffer ======== * Prints the trace buffer returned from the DSP (if DBG_Trace is enabled). @@ -2045,10 +2051,6 @@ func_end: return status; } -void io_sm_init(void) -{ - /* Do nothing */ -} /** * dump_dsp_stack() - This function dumps the data on the DSP stack. * @bridge_context: Bridge driver's device context pointer. @@ -2407,4 +2409,4 @@ void dump_dl_modules(struct bridge_dev_context *bridge_context) func_end: kfree(module_struct); } - +#endif diff --git a/drivers/staging/tidspbridge/core/ue_deh.c b/drivers/staging/tidspbridge/core/ue_deh.c index 2bdf92e..3430418 100644 --- a/drivers/staging/tidspbridge/core/ue_deh.c +++ b/drivers/staging/tidspbridge/core/ue_deh.c @@ -166,6 +166,7 @@ int bridge_deh_register_notify(struct deh_mgr *deh, u32 event_mask, return ntfy_unregister(deh->ntfy_obj, hnotification); } +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE static void mmu_fault_print_stack(struct bridge_dev_context *dev_context) { struct cfg_hostres *resources; @@ -205,6 +206,7 @@ static void mmu_fault_print_stack(struct bridge_dev_context *dev_context) hw_mmu_disable(resources->dw_dmmu_base); free_page((unsigned long)dummy_va_addr); } +#endif static inline const char *event_to_string(int event) { @@ -232,15 +234,19 @@ void bridge_deh_notify(struct deh_mgr *deh, int event, int info) case DSP_SYSERROR: dev_err(bridge, "%s: %s, info=0x%x", __func__, str, info); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE dump_dl_modules(dev_context); dump_dsp_stack(dev_context); +#endif break; case DSP_MMUFAULT: dev_err(bridge, "%s: %s, addr=0x%x", __func__, str, fault_addr); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE print_dsp_trace_buffer(dev_context); dump_dl_modules(dev_context); mmu_fault_print_stack(dev_context); +#endif break; default: dev_err(bridge, "%s: %s", __func__, str); diff --git a/drivers/staging/tidspbridge/gen/gh.c b/drivers/staging/tidspbridge/gen/gh.c index d1e7b38..44fad88 100644 --- a/drivers/staging/tidspbridge/gen/gh.c +++ b/drivers/staging/tidspbridge/gen/gh.c @@ -188,6 +188,7 @@ static void myfree(void *ptr, s32 size) gs_free(ptr); } +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /** * gh_iterate() - This function goes through all the elements in the hash table * looking for the dsp symbols. @@ -211,3 +212,4 @@ void gh_iterate(struct gh_t_hash_tab *hash_tab, } } } +#endif diff --git a/drivers/staging/tidspbridge/include/dspbridge/dbll.h b/drivers/staging/tidspbridge/include/dspbridge/dbll.h index 54c6219..0d03714 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/dbll.h +++ b/drivers/staging/tidspbridge/include/dspbridge/dbll.h @@ -53,7 +53,9 @@ extern void dbll_set_attrs(struct dbll_tar_obj *target, extern void dbll_unload(struct dbll_library_obj *lib, struct dbll_attrs *attrs); extern int dbll_unload_sect(struct dbll_library_obj *lib, char *sectName, struct dbll_attrs *attrs); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE bool dbll_find_dsp_symbol(struct dbll_library_obj *zl_lib, u32 address, u32 offset_range, u32 *sym_addr_output, char *name_output); +#endif #endif /* DBLL_ */ diff --git a/drivers/staging/tidspbridge/include/dspbridge/gh.h b/drivers/staging/tidspbridge/include/dspbridge/gh.h index 55c0489..9de291d 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/gh.h +++ b/drivers/staging/tidspbridge/include/dspbridge/gh.h @@ -27,6 +27,8 @@ extern void gh_exit(void); extern void *gh_find(struct gh_t_hash_tab *hash_tab, void *key); extern void gh_init(void); extern void *gh_insert(struct gh_t_hash_tab *hash_tab, void *key, void *value); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE void gh_iterate(struct gh_t_hash_tab *hash_tab, void (*callback)(void *, void *), void *user_data); +#endif #endif /* GH_ */ diff --git a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h index 6e67f10..0befe90 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h +++ b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h @@ -291,6 +291,7 @@ extern void io_intr_dsp2(IN struct io_mgr *pio_mgr, IN u16 mb_val); extern void io_sm_init(void); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /* * ========print_dsp_trace_buffer ======== * Print DSP tracebuffer. @@ -302,7 +303,8 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context); void dump_dl_modules(struct bridge_dev_context *bridge_context); -#ifdef CONFIG_TIDSPBRIDGE_DEBUG +#endif +#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG) void print_dsp_debug_trace(struct io_mgr *hio_mgr); #endif diff --git a/drivers/staging/tidspbridge/include/dspbridge/nldr.h b/drivers/staging/tidspbridge/include/dspbridge/nldr.h index 073aa9f..b1dbccd 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/nldr.h +++ b/drivers/staging/tidspbridge/include/dspbridge/nldr.h @@ -49,7 +49,9 @@ extern int nldr_load(struct nldr_nodeobject *nldr_node_obj, enum nldr_phase phase); extern int nldr_unload(struct nldr_nodeobject *nldr_node_obj, enum nldr_phase phase); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE int nldr_find_addr(struct nldr_nodeobject *nldr_node, u32 sym_addr, u32 offset_range, void *offset_output, char *sym_name); +#endif #endif /* NLDR_ */ diff --git a/drivers/staging/tidspbridge/include/dspbridge/node.h b/drivers/staging/tidspbridge/include/dspbridge/node.h index 7587213..e9d8439 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/node.h +++ b/drivers/staging/tidspbridge/include/dspbridge/node.h @@ -558,6 +558,7 @@ extern int node_get_uuid_props(void *hprocessor, OUT struct dsp_ndbprops *node_props); +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /** * node_find_addr() - Find the closest symbol to the given address. * @@ -575,5 +576,6 @@ int node_find_addr(struct node_mgr *node_mgr, u32 sym_addr, char *sym_name); enum node_state node_get_state(void *hnode); +#endif #endif /* NODE_ */ diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index 3619d53..3636aa3 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -1500,6 +1500,7 @@ static void release(struct dynamic_loader_initialize *this) { } +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /** * find_symbol_context - Basic symbol context structure * @address: Symbol Adress @@ -1583,3 +1584,4 @@ bool dbll_find_dsp_symbol(struct dbll_library_obj *zl_lib, u32 address, return status; } +#endif diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c index d0138af..53fd371 100644 --- a/drivers/staging/tidspbridge/rmgr/nldr.c +++ b/drivers/staging/tidspbridge/rmgr/nldr.c @@ -1919,6 +1919,7 @@ static u32 find_gcf(u32 a, u32 b) return b; } +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /** * nldr_find_addr() - Find the closest symbol to the given address based on * dynamic node object. @@ -1997,3 +1998,4 @@ int nldr_find_addr(struct nldr_nodeobject *nldr_node, u32 sym_addr, return status; } +#endif diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index 329fe5e..1870b80 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c @@ -3200,6 +3200,7 @@ static u32 mem_write(void *priv_ref, u32 ulDspAddr, void *pbuf, return ul_num_bytes; } +#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE /* * ======== node_find_addr ======== */ @@ -3229,4 +3230,4 @@ int node_find_addr(struct node_mgr *node_mgr, u32 sym_addr, return status; } - +#endif