All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] dspbridge: rewrite deh
@ 2010-05-16 15:45 Felipe Contreras
  2010-05-16 15:45 ` [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer() Felipe Contreras
                   ` (14 more replies)
  0 siblings, 15 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Hi,

Investigating the MMU fault corruption issue I found a lot of areas of
improvements of the exception handling code.

Moreover, even though the obvious memory corruption is fixed on kernel side,
there are still some rare cases where corruption in user-space might be
possible if some buffers are still mapped. This came up in a discussion with
Fernando Lugo, and we both agreed on a fix (patch #7).

The rest is mostly reorganization.

These apply on top of the MMU fault fix patch.

Felipe Contreras (14):
  dspbridge: deh: refactor into wait_for_timer()
  dspbridge: deh: trivial cleanups
  dspbridge: mmufault: trivial cleanups
  dspbridge: deh: free dummy page immediately
  dspbridge: remove unused code
  dspbridge: mmu: add hw_mmu_tlb_flush_all()
  dspbridge: deh: ensure only tlb #0 is enabled
  dspbridge: deh: refactor in mmu_fault_print_stack()
  dspbridge: deh: remove get_info
  dspbridge: deh: remove err_info
  dspbridge: access deh directly
  dspbridge: move mmufault to deh
  dspbridge: deh: tidying up
  dspbridge: deh: update copyright notice

 arch/arm/plat-omap/include/dspbridge/dbdefs.h  |    1 -
 arch/arm/plat-omap/include/dspbridge/dspdefs.h |   75 -----
 arch/arm/plat-omap/include/dspbridge/dspdeh.h  |   20 +-
 drivers/dsp/bridge/Makefile                    |    2 +-
 drivers/dsp/bridge/core/_deh.h                 |    2 +-
 drivers/dsp/bridge/core/_tiomap.h              |    6 +-
 drivers/dsp/bridge/core/mmu_fault.c            |  141 --------
 drivers/dsp/bridge/core/mmu_fault.h            |   36 --
 drivers/dsp/bridge/core/tiomap3430.c           |   17 +-
 drivers/dsp/bridge/core/ue_deh.c               |  407 +++++++++++-------------
 drivers/dsp/bridge/hw/hw_mmu.c                 |    6 +
 drivers/dsp/bridge/hw/hw_mmu.h                 |    2 +
 drivers/dsp/bridge/pmgr/dev.c                  |   17 +-
 drivers/dsp/bridge/rmgr/node.c                 |    5 +-
 drivers/dsp/bridge/rmgr/proc.c                 |   29 +--
 15 files changed, 215 insertions(+), 551 deletions(-)
 delete mode 100644 drivers/dsp/bridge/core/mmu_fault.c
 delete mode 100644 drivers/dsp/bridge/core/mmu_fault.h


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer()
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-17 19:08   ` Guzman Lugo, Fernando
  2010-05-16 15:45 ` [PATCH 02/14] dspbridge: deh: trivial cleanups Felipe Contreras
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Self-documenting code is better.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/ue_deh.c |   65 +++++++++++++++++++------------------
 1 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index ab95916..48c11e9 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -185,6 +185,38 @@ dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32 event_mask,
 	return status;
 }
 
+static void wait_for_timer(void)
+{
+	u32 cnt = 0;
+
+	omap_dm_timer_enable(timer);
+
+	/* Enable overflow interrupt */
+	omap_dm_timer_set_int_enable(timer,
+			GPTIMER_IRQ_OVERFLOW);
+	/*
+	 * Set counter value to overflow counter after
+	 * one tick and start timer.
+	 */
+	omap_dm_timer_set_load_start(timer, 0, 0xfffffffe);
+
+	/* Wait 80us for timer to overflow */
+	udelay(80);
+
+	/* Check interrupt status and wait for interrupt */
+	cnt = 0;
+	while (!(omap_dm_timer_read_status(timer) &
+				GPTIMER_IRQ_OVERFLOW)) {
+		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
+			pr_err("%s: GPTimer interrupt failed\n",
+					__func__);
+			break;
+		}
+	}
+
+	omap_dm_timer_disable(timer);
+}
+
 void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 {
 	struct bridge_dev_context *dev_context;
@@ -192,7 +224,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 	u32 hw_mmu_max_tlb_count = 31;
 	struct cfg_hostres *resources;
 	hw_status hw_status_obj;
-	u32 cnt = 0;
 
 	if (!deh_mgr)
 		return;
@@ -249,42 +280,12 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 						&map_attrs, HW_SET, HW_SET);
 		}
 
-		/*
-		 * Send a GP Timer interrupt to DSP.
-		 * The DSP expects a GP timer interrupt after an
-		 * MMU-Fault Request GPTimer.
-		 */
-		if (timer) {
-			omap_dm_timer_enable(timer);
-			/* Enable overflow interrupt */
-			omap_dm_timer_set_int_enable(timer,
-						     GPTIMER_IRQ_OVERFLOW);
-			/*
-			 * Set counter value to overflow counter after
-			 * one tick and start timer.
-			 */
-			omap_dm_timer_set_load_start(timer, 0, 0xfffffffe);
-
-			/* Wait 80us for timer to overflow */
-			udelay(80);
-
-			/* Check interrupt status and wait for interrupt */
-			cnt = 0;
-			while (!(omap_dm_timer_read_status(timer) &
-				GPTIMER_IRQ_OVERFLOW)) {
-				if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
-					pr_err("%s: GPTimer interrupt failed\n",
-								__func__);
-					break;
-				}
-			}
-		}
+		wait_for_timer();
 
 		/* Clear MMU interrupt */
 		hw_mmu_event_ack(resources->dw_dmmu_base,
 				HW_MMU_TRANSLATION_FAULT);
 		dump_dsp_stack(deh_mgr->hbridge_context);
-		omap_dm_timer_disable(timer);
 		break;
 #ifdef CONFIG_BRIDGE_NTFY_PWRERR
 	case DSP_PWRERROR:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
  2010-05-16 15:45 ` [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer() Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-16 22:02   ` Guzman Lugo, Fernando
  2010-05-17 19:09   ` Guzman Lugo, Fernando
  2010-05-16 15:45 ` [PATCH 03/14] dspbridge: mmufault: " Felipe Contreras
                   ` (12 subsequent siblings)
  14 siblings, 2 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/ue_deh.c |  112 ++++++++++++++------------------------
 1 files changed, 41 insertions(+), 71 deletions(-)

diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 48c11e9..605cec7 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -60,11 +60,6 @@
 /* Max time to check for GP Timer IRQ */
 #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
 
-static struct hw_mmu_map_attrs_t map_attrs = { HW_LITTLE_ENDIAN,
-	HW_ELEM_SIZE16BIT,
-	HW_MMU_CPUES
-};
-
 static void *dummy_va_addr;
 
 static struct omap_dm_timer *timer;
@@ -72,7 +67,7 @@ static struct omap_dm_timer *timer;
 dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 		struct dev_object *hdev_obj)
 {
-	dsp_status status = DSP_SOK;
+	dsp_status status;
 	struct deh_mgr *deh_mgr;
 	struct bridge_dev_context *hbridge_context = NULL;
 
@@ -81,23 +76,20 @@ dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 	 *  the base image. */
 	/* Get WMD context info. */
 	dev_get_bridge_context(hdev_obj, &hbridge_context);
-	DBC_ASSERT(hbridge_context);
-	dummy_va_addr = NULL;
 	/* Allocate IO manager object: */
 	deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
 	if (!deh_mgr) {
 		status = -ENOMEM;
-		goto leave;
+		goto err;
 	}
 
 	/* Create an NTFY object to manage notifications */
 	deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
-	if (deh_mgr->ntfy_obj) {
-		ntfy_init(deh_mgr->ntfy_obj);
-	} else {
+	if (!deh_mgr->ntfy_obj) {
 		status = -ENOMEM;
 		goto err;
 	}
+	ntfy_init(deh_mgr->ntfy_obj);
 
 	/* Create a MMUfault DPC */
 	tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
@@ -110,32 +102,25 @@ dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 	deh_mgr->err_info.dw_val3 = 0L;
 
 	/* Install ISR function for DSP MMU fault */
-	if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
-					"DspBridge\tiommu fault",
-					(void *)deh_mgr)) == 0)
-		status = DSP_SOK;
-	else
-		status = -EPERM;
+	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
+			"DspBridge\tiommu fault", deh_mgr);
+	if (status < 0)
+		goto err;
 
-err:
-	if (DSP_FAILED(status)) {
-		/* If create failed, cleanup */
-		bridge_deh_destroy(deh_mgr);
-		deh_mgr = NULL;
-	} else {
-		timer = omap_dm_timer_request_specific(
-					GPTIMER_FOR_DSP_MMU_FAULT);
-		if (timer) {
-			omap_dm_timer_disable(timer);
-		} else {
-			pr_err("%s: GPTimer not available\n", __func__);
-			return -ENODEV;
-		}
+	timer = omap_dm_timer_request_specific(GPTIMER_FOR_DSP_MMU_FAULT);
+	if (!timer) {
+		pr_err("%s: GPTimer not available\n", __func__);
+		status = -ENODEV;
+		goto err;
 	}
+	omap_dm_timer_disable(timer);
 
-leave:
 	*ret_deh_mgr = deh_mgr;
+	return 0;
 
+err:
+	bridge_deh_destroy(deh_mgr);
+	*ret_deh_mgr = NULL;
 	return status;
 }
 
@@ -164,36 +149,31 @@ dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr)
 	omap_dm_timer_free(timer);
 	timer = NULL;
 
-	return DSP_SOK;
+	return 0;
 }
 
 dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32 event_mask,
 		u32 notify_type,
 		struct dsp_notification *hnotification)
 {
-	dsp_status status = DSP_SOK;
-
 	if (!deh_mgr)
 		return -EFAULT;
 
 	if (event_mask)
-		status = ntfy_register(deh_mgr->ntfy_obj, hnotification,
-					event_mask, notify_type);
+		return ntfy_register(deh_mgr->ntfy_obj, hnotification,
+				event_mask, notify_type);
 	else
-		status = ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
-
-	return status;
+		return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
 }
 
 static void wait_for_timer(void)
 {
-	u32 cnt = 0;
+	int c;
 
 	omap_dm_timer_enable(timer);
 
 	/* Enable overflow interrupt */
-	omap_dm_timer_set_int_enable(timer,
-			GPTIMER_IRQ_OVERFLOW);
+	omap_dm_timer_set_int_enable(timer, GPTIMER_IRQ_OVERFLOW);
 	/*
 	 * Set counter value to overflow counter after
 	 * one tick and start timer.
@@ -204,15 +184,11 @@ static void wait_for_timer(void)
 	udelay(80);
 
 	/* Check interrupt status and wait for interrupt */
-	cnt = 0;
-	while (!(omap_dm_timer_read_status(timer) &
-				GPTIMER_IRQ_OVERFLOW)) {
-		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
-			pr_err("%s: GPTimer interrupt failed\n",
-					__func__);
-			break;
-		}
-	}
+	for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
+		if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
+			return;
+
+	pr_err("%s: GPTimer interrupt failed\n", __func__);
 
 	omap_dm_timer_disable(timer);
 }
@@ -220,16 +196,19 @@ static void wait_for_timer(void)
 void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 {
 	struct bridge_dev_context *dev_context;
-	dsp_status status = DSP_SOK;
 	u32 hw_mmu_max_tlb_count = 31;
 	struct cfg_hostres *resources;
-	hw_status hw_status_obj;
+	struct hw_mmu_map_attrs_t map_attrs = {
+		.endianism = HW_LITTLE_ENDIAN,
+		.element_size = HW_ELEM_SIZE16BIT,
+		.mixed_size = HW_MMU_CPUES,
+	};
 
 	if (!deh_mgr)
 		return;
 
 	dev_info(bridge, "%s: device exception\n", __func__);
-	dev_context = (struct bridge_dev_context *)deh_mgr->hbridge_context;
+	dev_context = deh_mgr->hbridge_context;
 	resources = dev_context->resources;
 
 	switch (ulEventMask) {
@@ -256,8 +235,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 			(unsigned int) deh_mgr->err_info.dw_val2,
 			(unsigned int) fault_addr);
 		dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
-		dev_context = (struct bridge_dev_context *)
-			deh_mgr->hbridge_context;
 
 		print_dsp_trace_buffer(dev_context);
 		dump_dl_modules(dev_context);
@@ -272,20 +249,16 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 			dev_context->num_tlb_entries =
 				dev_context->fixed_tlb_entries;
 		}
-		if (DSP_SUCCEEDED(status)) {
-			hw_status_obj =
-				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);
-		}
+		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(deh_mgr->hbridge_context);
+		dump_dsp_stack(dev_context);
 		break;
 #ifdef CONFIG_BRIDGE_NTFY_PWRERR
 	case DSP_PWRERROR:
@@ -334,9 +307,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
 		struct dsp_errorinfo *pErrInfo)
 {
-	DBC_REQUIRE(deh_mgr);
-	DBC_REQUIRE(pErrInfo);
-
 	if (!deh_mgr)
 		return -EFAULT;
 
@@ -346,7 +316,7 @@ dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
 	pErrInfo->dw_val2 = deh_mgr->err_info.dw_val2;
 	pErrInfo->dw_val3 = deh_mgr->err_info.dw_val3;
 
-	return DSP_SOK;
+	return 0;
 }
 
 void bridge_deh_release_dummy_mem(void)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 03/14] dspbridge: mmufault: trivial cleanups
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
  2010-05-16 15:45 ` [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer() Felipe Contreras
  2010-05-16 15:45 ` [PATCH 02/14] dspbridge: deh: trivial cleanups Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-16 15:45 ` [PATCH 04/14] dspbridge: deh: free dummy page immediately Felipe Contreras
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/mmu_fault.c |  102 ++++++++++++-----------------------
 1 files changed, 34 insertions(+), 68 deletions(-)

diff --git a/drivers/dsp/bridge/core/mmu_fault.c b/drivers/dsp/bridge/core/mmu_fault.c
index 883f45d..1de9cb4 100644
--- a/drivers/dsp/bridge/core/mmu_fault.c
+++ b/drivers/dsp/bridge/core/mmu_fault.c
@@ -42,11 +42,8 @@
 #include "_tiomap.h"
 #include "mmu_fault.h"
 
-static u32 dmmu_event_mask;
 u32 fault_addr;
 
-static bool mmu_check_if_fault(struct bridge_dev_context *dev_context);
-
 /*
  *  ======== mmu_fault_dpc ========
  *      Deferred procedure call to handle DSP MMU fault.
@@ -55,9 +52,10 @@ void mmu_fault_dpc(IN unsigned long pRefData)
 {
 	struct deh_mgr *hdeh_mgr = (struct deh_mgr *)pRefData;
 
-	if (hdeh_mgr)
-		bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0L);
+	if (!hdeh_mgr)
+		return;
 
+	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0L);
 }
 
 /*
@@ -66,76 +64,44 @@ void mmu_fault_dpc(IN unsigned long pRefData)
  */
 irqreturn_t mmu_fault_isr(int irq, IN void *pRefData)
 {
-	struct deh_mgr *deh_mgr_obj = (struct deh_mgr *)pRefData;
-	struct bridge_dev_context *dev_context;
+	struct deh_mgr *deh_mgr_obj = pRefData;
 	struct cfg_hostres *resources;
+	u32 dmmu_event_mask;
 
-	DBC_REQUIRE(irq == INT_DSP_MMU_IRQ);
-	DBC_REQUIRE(deh_mgr_obj);
-
-	if (deh_mgr_obj) {
-
-		dev_context =
-		    (struct bridge_dev_context *)deh_mgr_obj->hbridge_context;
-
-		resources = dev_context->resources;
+	if (!deh_mgr_obj)
+		return IRQ_HANDLED;
 
-		if (!resources) {
-			dev_dbg(bridge, "%s: Failed to get Host Resources\n",
+	resources = deh_mgr_obj->hbridge_context->resources;
+	if (!resources) {
+		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
 				__func__);
-			return IRQ_HANDLED;
-		}
-		if (mmu_check_if_fault(dev_context)) {
-			printk(KERN_INFO "***** DSPMMU FAULT ***** IRQStatus "
-			       "0x%x\n", dmmu_event_mask);
-			printk(KERN_INFO "***** DSPMMU FAULT ***** fault_addr "
-			       "0x%x\n", fault_addr);
-			/*
-			 * Schedule a DPC directly. In the future, it may be
-			 * necessary to check if DSP MMU fault is intended for
-			 * Bridge.
-			 */
-			tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
-
-			/* Reset err_info structure before use. */
-			deh_mgr_obj->err_info.dw_err_mask = DSP_MMUFAULT;
-			deh_mgr_obj->err_info.dw_val1 = fault_addr >> 16;
-			deh_mgr_obj->err_info.dw_val2 = fault_addr & 0xFFFF;
-			deh_mgr_obj->err_info.dw_val3 = 0L;
-			/* Disable the MMU events, else once we clear it will
-			 * start to raise INTs again */
-			hw_mmu_event_disable(resources->dw_dmmu_base,
-					     HW_MMU_TRANSLATION_FAULT);
-		} else {
-			hw_mmu_event_disable(resources->dw_dmmu_base,
-					     HW_MMU_ALL_INTERRUPTS);
-		}
+		return IRQ_HANDLED;
 	}
-	return IRQ_HANDLED;
-}
 
-/*
- *  ======== mmu_check_if_fault ========
- *      Check to see if MMU Fault is valid TLB miss from DSP
- *  Note: This function is called from an ISR
- */
-static bool mmu_check_if_fault(struct bridge_dev_context *dev_context)
-{
-
-	bool ret = false;
-	hw_status hw_status_obj;
-	struct cfg_hostres *resources = dev_context->resources;
-
-	if (!resources) {
-		dev_dbg(bridge, "%s: Failed to get Host Resources in\n",
-			__func__);
-		return ret;
-	}
-	hw_status_obj =
-	    hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
+	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
 	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
 		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &fault_addr);
-		ret = true;
+		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n", __func__,
+				dmmu_event_mask, fault_addr);
+		/*
+		 * Schedule a DPC directly. In the future, it may be
+		 * necessary to check if DSP MMU fault is intended for
+		 * Bridge.
+		 */
+		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
+
+		/* Reset err_info structure before use. */
+		deh_mgr_obj->err_info.dw_err_mask = DSP_MMUFAULT;
+		deh_mgr_obj->err_info.dw_val1 = fault_addr >> 16;
+		deh_mgr_obj->err_info.dw_val2 = fault_addr & 0xFFFF;
+		deh_mgr_obj->err_info.dw_val3 = 0L;
+		/* Disable the MMU events, else once we clear it will
+		 * start to raise INTs again */
+		hw_mmu_event_disable(resources->dw_dmmu_base,
+				HW_MMU_TRANSLATION_FAULT);
+	} else {
+		hw_mmu_event_disable(resources->dw_dmmu_base,
+				HW_MMU_ALL_INTERRUPTS);
 	}
-	return ret;
+	return IRQ_HANDLED;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 04/14] dspbridge: deh: free dummy page immediately
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (2 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 03/14] dspbridge: mmufault: " Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-17 19:09   ` Guzman Lugo, Fernando
  2010-05-16 15:45 ` [PATCH 05/14] dspbridge: remove unused code Felipe Contreras
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

There's no need to keep it around. DSP should stop trying to access
system memory.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/ue_deh.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 605cec7..593a0e3 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -60,8 +60,6 @@
 /* Max time to check for GP Timer IRQ */
 #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
 
-static void *dummy_va_addr;
-
 static struct omap_dm_timer *timer;
 
 dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
@@ -203,6 +201,7 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 		.element_size = HW_ELEM_SIZE16BIT,
 		.mixed_size = HW_MMU_CPUES,
 	};
+	void *dummy_va_addr;
 
 	if (!deh_mgr)
 		return;
@@ -259,6 +258,9 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 		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);
 		break;
 #ifdef CONFIG_BRIDGE_NTFY_PWRERR
 	case DSP_PWRERROR:
@@ -321,6 +323,4 @@ dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
 
 void bridge_deh_release_dummy_mem(void)
 {
-	free_page((unsigned long)dummy_va_addr);
-	dummy_va_addr = NULL;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 05/14] dspbridge: remove unused code
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (3 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 04/14] dspbridge: deh: free dummy page immediately Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-16 15:45 ` [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all() Felipe Contreras
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dspdeh.h |    1 -
 drivers/dsp/bridge/core/_tiomap.h             |    6 +-----
 drivers/dsp/bridge/core/tiomap3430.c          |    2 --
 drivers/dsp/bridge/core/ue_deh.c              |   17 -----------------
 drivers/dsp/bridge/rmgr/proc.c                |    5 -----
 5 files changed, 1 insertions(+), 30 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dspdeh.h b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
index 33cce90..e263184 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdeh.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
@@ -43,5 +43,4 @@ extern dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr,
 extern void bridge_deh_notify(struct deh_mgr *deh_mgr,
 		u32 ulEventMask, u32 dwErrInfo);
 
-extern void bridge_deh_release_dummy_mem(void);
 #endif /* DSPDEH_ */
diff --git a/drivers/dsp/bridge/core/_tiomap.h b/drivers/dsp/bridge/core/_tiomap.h
index df73964..7021fce 100644
--- a/drivers/dsp/bridge/core/_tiomap.h
+++ b/drivers/dsp/bridge/core/_tiomap.h
@@ -339,11 +339,7 @@ struct bridge_dev_context {
 	 */
 	/* DMMU TLB entries */
 	struct bridge_ioctl_extproc atlb_entry[BRDIOCTL_NUMOFMMUTLB];
-	u32 dw_brd_state;	/* Last known board state. */
-	u32 ul_int_mask;	/* int mask */
-	u16 io_base;		/* Board I/O base */
-	u32 num_tlb_entries;	/* DSP MMU TLB entry counter */
-	u32 fixed_tlb_entries;	/* Fixed DSPMMU TLB entry count */
+	u32 dw_brd_state;       /* Last known board state. */
 
 	/* TC Settings */
 	bool tc_word_swap_on;	/* Traffic Controller Word Swap */
diff --git a/drivers/dsp/bridge/core/tiomap3430.c b/drivers/dsp/bridge/core/tiomap3430.c
index c7b0d83..8a3eff9 100644
--- a/drivers/dsp/bridge/core/tiomap3430.c
+++ b/drivers/dsp/bridge/core/tiomap3430.c
@@ -844,7 +844,6 @@ static dsp_status bridge_dev_create(OUT struct bridge_dev_context
 		dev_context->atlb_entry[entry_ndx].ul_gpp_pa =
 		    dev_context->atlb_entry[entry_ndx].ul_dsp_va = 0;
 	}
-	dev_context->num_tlb_entries = 0;
 	dev_context->dw_dsp_base_addr = (u32) MEM_LINEAR_ADDRESS((void *)
 								 (pConfig->
 								  dw_mem_base
@@ -947,7 +946,6 @@ static dsp_status bridge_dev_create(OUT struct bridge_dev_context
 	}
 	if (DSP_SUCCEEDED(status)) {
 		dev_context->hdev_obj = hdev_obj;
-		dev_context->ul_int_mask = 0;
 		/* Store current board state. */
 		dev_context->dw_brd_state = BRD_STOPPED;
 		dev_context->resources = resources;
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 593a0e3..61e5e4e 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -127,8 +127,6 @@ dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr)
 	if (!deh_mgr)
 		return -EFAULT;
 
-	/* Release dummy VA buffer */
-	bridge_deh_release_dummy_mem();
 	/* If notification object exists, delete it */
 	if (deh_mgr->ntfy_obj) {
 		ntfy_delete(deh_mgr->ntfy_obj);
@@ -194,7 +192,6 @@ static void wait_for_timer(void)
 void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 {
 	struct bridge_dev_context *dev_context;
-	u32 hw_mmu_max_tlb_count = 31;
 	struct cfg_hostres *resources;
 	struct hw_mmu_map_attrs_t map_attrs = {
 		.endianism = HW_LITTLE_ENDIAN,
@@ -238,16 +235,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 		print_dsp_trace_buffer(dev_context);
 		dump_dl_modules(dev_context);
 
-		/*
-		 * Reset the dynamic mmu index to fixed count if it exceeds
-		 * 31. So that the dynmmuindex is always between the range of
-		 * standard/fixed entries and 31.
-		 */
-		if (dev_context->num_tlb_entries >
-				hw_mmu_max_tlb_count) {
-			dev_context->num_tlb_entries =
-				dev_context->fixed_tlb_entries;
-		}
 		hw_mmu_tlb_add(resources->dw_dmmu_base,
 				virt_to_phys(dummy_va_addr), fault_addr,
 				HW_PAGE_SIZE4KB, 1,
@@ -320,7 +307,3 @@ dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
 
 	return 0;
 }
-
-void bridge_deh_release_dummy_mem(void)
-{
-}
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index 7dc9b5c..f9efe6a 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -1362,11 +1362,6 @@ dsp_status proc_stop(void *hprocessor)
 		status = -EFAULT;
 		goto func_end;
 	}
-	if (DSP_SUCCEEDED((*p_proc_object->intf_fxns->pfn_brd_status)
-			  (p_proc_object->hbridge_context, &brd_state))) {
-		if (brd_state == BRD_ERROR)
-			bridge_deh_release_dummy_mem();
-	}
 	/* check if there are any running nodes */
 	status = dev_get_node_manager(p_proc_object->hdev_obj, &hnode_mgr);
 	if (DSP_SUCCEEDED(status) && hnode_mgr) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all()
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (4 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 05/14] dspbridge: remove unused code Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-17 19:10   ` Guzman Lugo, Fernando
  2010-05-16 15:45 ` [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled Felipe Contreras
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

So that it can be used in more than one place.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/tiomap3430.c |    9 +--------
 drivers/dsp/bridge/hw/hw_mmu.c       |    6 ++++++
 drivers/dsp/bridge/hw/hw_mmu.h       |    2 ++
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/dsp/bridge/core/tiomap3430.c b/drivers/dsp/bridge/core/tiomap3430.c
index 8a3eff9..d00eaaa 100644
--- a/drivers/dsp/bridge/core/tiomap3430.c
+++ b/drivers/dsp/bridge/core/tiomap3430.c
@@ -74,8 +74,6 @@
 #define PAGES_II_LVL_TABLE   512
 #define PHYS_TO_PAGE(phys)      pfn_to_page((phys) >> PAGE_SHIFT)
 
-#define MMU_GFLUSH 0x60
-
 /* Forward Declarations: */
 static dsp_status bridge_brd_monitor(struct bridge_dev_context *dev_context);
 static dsp_status bridge_brd_read(struct bridge_dev_context *dev_context,
@@ -216,18 +214,13 @@ static struct bridge_drv_interface drv_interface_fxns = {
 	bridge_msg_set_queue_id,
 };
 
-static inline void tlb_flush_all(const void __iomem *base)
-{
-	__raw_writeb(__raw_readb(base + MMU_GFLUSH) | 1, base + MMU_GFLUSH);
-}
-
 static inline void flush_all(struct bridge_dev_context *dev_context)
 {
 	if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION ||
 	    dev_context->dw_brd_state == BRD_HIBERNATION)
 		wake_dsp(dev_context, NULL);
 
-	tlb_flush_all(dev_context->dw_dsp_mmu_base);
+	hw_mmu_tlb_flush_all(dev_context->dw_dsp_mmu_base);
 }
 
 static void bad_page_dump(u32 pa, struct page *pg)
diff --git a/drivers/dsp/bridge/hw/hw_mmu.c b/drivers/dsp/bridge/hw/hw_mmu.c
index 965b659..e593358 100644
--- a/drivers/dsp/bridge/hw/hw_mmu.c
+++ b/drivers/dsp/bridge/hw/hw_mmu.c
@@ -35,6 +35,7 @@
 #define MMU_SMALL_PAGE_MASK      0xFFFFF000
 
 #define MMU_LOAD_TLB	0x00000001
+#define MMU_GFLUSH	0x60
 
 /*
  * hw_mmu_page_size_t: Enumerated Type used to specify the MMU Page Size(SLSS)
@@ -585,3 +586,8 @@ static hw_status mmu_set_ram_entry(const void __iomem *baseAddress,
 	return status;
 
 }
+
+void hw_mmu_tlb_flush_all(const void __iomem *base)
+{
+	__raw_writeb(1, base + MMU_GFLUSH);
+}
diff --git a/drivers/dsp/bridge/hw/hw_mmu.h b/drivers/dsp/bridge/hw/hw_mmu.h
index 9b13468..0436974 100644
--- a/drivers/dsp/bridge/hw/hw_mmu.h
+++ b/drivers/dsp/bridge/hw/hw_mmu.h
@@ -97,6 +97,8 @@ extern hw_status hw_mmu_pte_set(const u32 pg_tbl_va,
 extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va,
 				  u32 page_size, u32 virtualAddr);
 
+void hw_mmu_tlb_flush_all(const void __iomem *base);
+
 static inline u32 hw_mmu_pte_addr_l1(u32 L1_base, u32 va)
 {
 	u32 pte_addr;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (5 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all() Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-17 19:10   ` Guzman Lugo, Fernando
  2010-05-16 15:45 ` [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack() Felipe Contreras
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

We don't want the DSP to continue writing into other mapped pages, no
matter how unlikely.

Based on extensive discussion with Fernando Guzman Lugo.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/ue_deh.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 61e5e4e..f661aaf 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -235,6 +235,14 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 		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,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack()
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (6 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled Felipe Contreras
@ 2010-05-16 15:45 ` Felipe Contreras
  2010-05-17 19:11   ` Guzman Lugo, Fernando
  2010-05-16 15:46 ` [PATCH 09/14] dspbridge: deh: remove get_info Felipe Contreras
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

All this code is just to print the stack, so make it clearer.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/core/ue_deh.c |   58 +++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 26 deletions(-)

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:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 09/14] dspbridge: deh: remove get_info
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (7 preceding siblings ...)
  2010-05-16 15:45 ` [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack() Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-16 15:46 ` [PATCH 10/14] dspbridge: deh: remove err_info Felipe Contreras
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Nobody is using it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dspdefs.h |   19 -------------------
 arch/arm/plat-omap/include/dspbridge/dspdeh.h  |    3 ---
 drivers/dsp/bridge/core/tiomap3430.c           |    1 -
 drivers/dsp/bridge/core/ue_deh.c               |   15 ---------------
 drivers/dsp/bridge/pmgr/dev.c                  |    2 --
 drivers/dsp/bridge/rmgr/proc.c                 |    6 ------
 6 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dspdefs.h b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
index 3dfe406..a5d410f 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
@@ -782,24 +782,6 @@ typedef dsp_status(*fxn_deh_registernotify)
   u32 event_mask, u32 notify_type, struct dsp_notification *hnotification);
 
 /*
- *  ======== bridge_deh_get_info ========
- *  Purpose:
- *      Get DSP exception info.
- *  Parameters:
- *      phDehMgr:       Location to store DEH manager on output.
- *      pErrInfo:       Ptr to error info structure.
- *  Returns:
- *      DSP_SOK:        Success.
- *      -EPERM:      Creation failed.
- *  Requires:
- *      phDehMgr != NULL;
- *      pErrorInfo != NULL;
- *  Ensures:
- */
-typedef dsp_status(*fxn_deh_getinfo) (struct deh_mgr *phDehMgr,
-				      struct dsp_errorinfo *pErrInfo);
-
-/*
  *  ======== bridge_io_create ========
  *  Purpose:
  *      Create an object that manages I/O between CHNL and msg_ctrl.
@@ -1089,7 +1071,6 @@ struct bridge_drv_interface {
 	fxn_deh_notify pfn_deh_notify;	/* Notify of DSP error */
 	/* register for deh notif. */
 	fxn_deh_registernotify pfn_deh_register_notify;
-	fxn_deh_getinfo pfn_deh_get_info;	/* register for deh notif. */
 	fxn_io_create pfn_io_create;	/* Create IO manager */
 	fxn_io_destroy pfn_io_destroy;	/* Destroy IO manager */
 	fxn_io_onloaded pfn_io_on_loaded;	/* Notify of program loaded */
diff --git a/arch/arm/plat-omap/include/dspbridge/dspdeh.h b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
index e263184..4c4d577 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdeh.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
@@ -32,9 +32,6 @@ extern dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 
 extern dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr);
 
-extern dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
-		struct dsp_errorinfo *pErrInfo);
-
 extern dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr,
 		u32 event_mask,
 		u32 notify_type,
diff --git a/drivers/dsp/bridge/core/tiomap3430.c b/drivers/dsp/bridge/core/tiomap3430.c
index d00eaaa..99bf966 100644
--- a/drivers/dsp/bridge/core/tiomap3430.c
+++ b/drivers/dsp/bridge/core/tiomap3430.c
@@ -197,7 +197,6 @@ static struct bridge_drv_interface drv_interface_fxns = {
 	bridge_deh_destroy,
 	bridge_deh_notify,
 	bridge_deh_register_notify,
-	bridge_deh_get_info,
 	/* The following IO functions are provided by chnl_io.lib: */
 	bridge_io_create,
 	bridge_io_destroy,
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 1d1b87b..2388780 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -306,18 +306,3 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 	 */
 	dsp_wdt_enable(false);
 }
-
-dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
-		struct dsp_errorinfo *pErrInfo)
-{
-	if (!deh_mgr)
-		return -EFAULT;
-
-	/* Copy DEH error info structure to PROC error info structure. */
-	pErrInfo->dw_err_mask = deh_mgr->err_info.dw_err_mask;
-	pErrInfo->dw_val1 = deh_mgr->err_info.dw_val1;
-	pErrInfo->dw_val2 = deh_mgr->err_info.dw_val2;
-	pErrInfo->dw_val3 = deh_mgr->err_info.dw_val3;
-
-	return 0;
-}
diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c
index c85a4fa..b1c8d8b 100644
--- a/drivers/dsp/bridge/pmgr/dev.c
+++ b/drivers/dsp/bridge/pmgr/dev.c
@@ -1121,7 +1121,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
 		STORE_FXN(fxn_deh_destroy, pfn_deh_destroy);
 		STORE_FXN(fxn_deh_notify, pfn_deh_notify);
 		STORE_FXN(fxn_deh_registernotify, pfn_deh_register_notify);
-		STORE_FXN(fxn_deh_getinfo, pfn_deh_get_info);
 		STORE_FXN(fxn_io_create, pfn_io_create);
 		STORE_FXN(fxn_io_destroy, pfn_io_destroy);
 		STORE_FXN(fxn_io_onloaded, pfn_io_on_loaded);
@@ -1162,7 +1161,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
 	DBC_ENSURE(intf_fxns->pfn_deh_destroy != NULL);
 	DBC_ENSURE(intf_fxns->pfn_deh_notify != NULL);
 	DBC_ENSURE(intf_fxns->pfn_deh_register_notify != NULL);
-	DBC_ENSURE(intf_fxns->pfn_deh_get_info != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_create != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_destroy != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_on_loaded != NULL);
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index f9efe6a..f86958a 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -706,7 +706,6 @@ dsp_status proc_get_state(void *hprocessor,
 	dsp_status status = DSP_SOK;
 	struct proc_object *p_proc_object = (struct proc_object *)hprocessor;
 	int brd_status;
-	struct deh_mgr *hdeh_mgr;
 
 	DBC_REQUIRE(refs > 0);
 	DBC_REQUIRE(proc_state_obj != NULL);
@@ -739,11 +738,6 @@ dsp_status proc_get_state(void *hprocessor,
 				break;
 			}
 		}
-		/* Next, retrieve error information, if any */
-		status = dev_get_deh_mgr(p_proc_object->hdev_obj, &hdeh_mgr);
-		if (DSP_SUCCEEDED(status) && hdeh_mgr)
-			status = (*p_proc_object->intf_fxns->pfn_deh_get_info)
-			    (hdeh_mgr, &(proc_state_obj->err_info));
 	} else {
 		status = -EFAULT;
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 10/14] dspbridge: deh: remove err_info
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (8 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 09/14] dspbridge: deh: remove get_info Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-16 15:46 ` [PATCH 11/14] dspbridge: access deh directly Felipe Contreras
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

We only use it to pass the MMU fault address.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dbdefs.h |    1 -
 drivers/dsp/bridge/core/_deh.h                |    2 +-
 drivers/dsp/bridge/core/mmu_fault.c           |   11 +------
 drivers/dsp/bridge/core/mmu_fault.h           |    2 -
 drivers/dsp/bridge/core/ue_deh.c              |   34 +++---------------------
 5 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dbdefs.h b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
index c6703a2..3c337e4 100644
--- a/arch/arm/plat-omap/include/dspbridge/dbdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/dbdefs.h
@@ -431,7 +431,6 @@ struct dsp_errorinfo {
 struct dsp_processorstate {
 	u32 cb_struct;
 	enum dsp_procstate proc_state;
-	struct dsp_errorinfo err_info;
 };
 
 /*
diff --git a/drivers/dsp/bridge/core/_deh.h b/drivers/dsp/bridge/core/_deh.h
index 8da2212..32b84f3 100644
--- a/drivers/dsp/bridge/core/_deh.h
+++ b/drivers/dsp/bridge/core/_deh.h
@@ -26,7 +26,7 @@
 struct deh_mgr {
 	struct bridge_dev_context *hbridge_context;	/* Bridge context. */
 	struct ntfy_object *ntfy_obj;	/* NTFY object */
-	struct dsp_errorinfo err_info;	/* DSP exception info. */
+	u32 fault_addr;
 
 	/* MMU Fault DPC */
 	struct tasklet_struct dpc_tasklet;
diff --git a/drivers/dsp/bridge/core/mmu_fault.c b/drivers/dsp/bridge/core/mmu_fault.c
index 1de9cb4..49034cf 100644
--- a/drivers/dsp/bridge/core/mmu_fault.c
+++ b/drivers/dsp/bridge/core/mmu_fault.c
@@ -42,8 +42,6 @@
 #include "_tiomap.h"
 #include "mmu_fault.h"
 
-u32 fault_addr;
-
 /*
  *  ======== mmu_fault_dpc ========
  *      Deferred procedure call to handle DSP MMU fault.
@@ -80,9 +78,9 @@ irqreturn_t mmu_fault_isr(int irq, IN void *pRefData)
 
 	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
 	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
-		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &fault_addr);
+		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj->fault_addr);
 		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n", __func__,
-				dmmu_event_mask, fault_addr);
+				dmmu_event_mask, deh_mgr_obj->fault_addr);
 		/*
 		 * Schedule a DPC directly. In the future, it may be
 		 * necessary to check if DSP MMU fault is intended for
@@ -90,11 +88,6 @@ irqreturn_t mmu_fault_isr(int irq, IN void *pRefData)
 		 */
 		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
 
-		/* Reset err_info structure before use. */
-		deh_mgr_obj->err_info.dw_err_mask = DSP_MMUFAULT;
-		deh_mgr_obj->err_info.dw_val1 = fault_addr >> 16;
-		deh_mgr_obj->err_info.dw_val2 = fault_addr & 0xFFFF;
-		deh_mgr_obj->err_info.dw_val3 = 0L;
 		/* Disable the MMU events, else once we clear it will
 		 * start to raise INTs again */
 		hw_mmu_event_disable(resources->dw_dmmu_base,
diff --git a/drivers/dsp/bridge/core/mmu_fault.h b/drivers/dsp/bridge/core/mmu_fault.h
index 74db489..537e6e7 100644
--- a/drivers/dsp/bridge/core/mmu_fault.h
+++ b/drivers/dsp/bridge/core/mmu_fault.h
@@ -19,8 +19,6 @@
 #ifndef MMU_FAULT_
 #define MMU_FAULT_
 
-extern u32 fault_addr;
-
 /*
  *  ======== mmu_fault_dpc ========
  *      Deferred procedure call to handle DSP MMU fault.
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 2388780..6035757 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -94,10 +94,6 @@ dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 
 	/* Fill in context structure */
 	deh_mgr->hbridge_context = hbridge_context;
-	deh_mgr->err_info.dw_err_mask = 0L;
-	deh_mgr->err_info.dw_val1 = 0L;
-	deh_mgr->err_info.dw_val2 = 0L;
-	deh_mgr->err_info.dw_val3 = 0L;
 
 	/* Install ISR function for DSP MMU fault */
 	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
@@ -189,7 +185,8 @@ static void wait_for_timer(void)
 	omap_dm_timer_disable(timer);
 }
 
-static void mmu_fault_print_stack(struct bridge_dev_context *dev_context)
+static void mmu_fault_print_stack(struct bridge_dev_context *dev_context,
+		u32 fault_addr)
 {
 	struct cfg_hostres *resources;
 	struct hw_mmu_map_attrs_t map_attrs = {
@@ -237,49 +234,28 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
 
 	switch (ulEventMask) {
 	case DSP_SYSERROR:
-		/* reset err_info structure before use */
-		deh_mgr->err_info.dw_err_mask = DSP_SYSERROR;
-		deh_mgr->err_info.dw_val1 = 0L;
-		deh_mgr->err_info.dw_val2 = 0L;
-		deh_mgr->err_info.dw_val3 = 0L;
-		deh_mgr->err_info.dw_val1 = dwErrInfo;
 		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
 				__func__, "DSP_SYSERROR", dwErrInfo);
 		dump_dl_modules(dev_context);
 		dump_dsp_stack(dev_context);
 		break;
 	case DSP_MMUFAULT:
-		/* MMU fault routine should have set err info structure. */
-		deh_mgr->err_info.dw_err_mask = DSP_MMUFAULT;
 		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
 				__func__, "DSP_MMUFAULT", dwErrInfo);
-		dev_info(bridge, "%s: %s, high=0x%x, low=0x%x, "
-			"fault=0x%x\n", __func__, "DSP_MMUFAULT",
-			(unsigned int) deh_mgr->err_info.dw_val1,
-			(unsigned int) deh_mgr->err_info.dw_val2,
-			(unsigned int) fault_addr);
+		dev_info(bridge, "%s: %s, fault=0x%x\n", __func__, "DSP_MMUFAULT",
+				deh_mgr->fault_addr);
 
 		print_dsp_trace_buffer(dev_context);
 		dump_dl_modules(dev_context);
-		mmu_fault_print_stack(dev_context);
+		mmu_fault_print_stack(dev_context, deh_mgr->fault_addr);
 		break;
 #ifdef CONFIG_BRIDGE_NTFY_PWRERR
 	case DSP_PWRERROR:
-		/* reset err_info structure before use */
-		deh_mgr->err_info.dw_err_mask = DSP_PWRERROR;
-		deh_mgr->err_info.dw_val1 = 0L;
-		deh_mgr->err_info.dw_val2 = 0L;
-		deh_mgr->err_info.dw_val3 = 0L;
-		deh_mgr->err_info.dw_val1 = dwErrInfo;
 		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
 				__func__, "DSP_PWRERROR", dwErrInfo);
 		break;
 #endif /* CONFIG_BRIDGE_NTFY_PWRERR */
 	case DSP_WDTOVERFLOW:
-		deh_mgr->err_info.dw_err_mask = DSP_WDTOVERFLOW;
-		deh_mgr->err_info.dw_val1 = 0L;
-		deh_mgr->err_info.dw_val2 = 0L;
-		deh_mgr->err_info.dw_val3 = 0L;
 		dev_err(bridge, "%s: DSP_WDTOVERFLOW\n", __func__);
 		break;
 	default:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 11/14] dspbridge: access deh directly
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (9 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 10/14] dspbridge: deh: remove err_info Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-17 19:11   ` Guzman Lugo, Fernando
  2010-05-16 15:46 ` [PATCH 12/14] dspbridge: move mmufault to deh Felipe Contreras
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dspdefs.h |   56 ------------------------
 drivers/dsp/bridge/core/tiomap3430.c           |    5 --
 drivers/dsp/bridge/pmgr/dev.c                  |   15 +-----
 drivers/dsp/bridge/rmgr/node.c                 |    5 +-
 drivers/dsp/bridge/rmgr/proc.c                 |   18 +++----
 5 files changed, 14 insertions(+), 85 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dspdefs.h b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
index a5d410f..268c217 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdefs.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
@@ -731,57 +731,6 @@ typedef dsp_status(*fxn_dev_ctrl) (struct bridge_dev_context *hDevContext,
 typedef dsp_status(*fxn_dev_destroy) (struct bridge_dev_context *hDevContext);
 
 /*
- *  ======== bridge_deh_create ========
- *  Purpose:
- *      Create an object that manages DSP exceptions from the GPP.
- *  Parameters:
- *      phDehMgr:       Location to store DEH manager on output.
- *      hdev_obj:     Handle to DEV object.
- *  Returns:
- *      DSP_SOK:        Success.
- *      -ENOMEM:    Memory allocation failure.
- *      -EPERM:      Creation failed.
- *  Requires:
- *      hdev_obj != NULL;
- *      phDehMgr != NULL;
- *  Ensures:
- */
-typedef dsp_status(*fxn_deh_create) (OUT struct deh_mgr
-				     **phDehMgr, struct dev_object *hdev_obj);
-
-/*
- *  ======== bridge_deh_destroy ========
- *  Purpose:
- *      Destroy the DEH object.
- *  Parameters:
- *      hdeh_mgr:        Handle to DEH manager object.
- *  Returns:
- *      DSP_SOK:        Success.
- *      -EPERM:      Destroy failed.
- *  Requires:
- *      hdeh_mgr != NULL;
- *  Ensures:
- */
-typedef dsp_status(*fxn_deh_destroy) (struct deh_mgr *hdeh_mgr);
-
-/*
- *  ======== bridge_deh_register_notify ========
- *  Purpose:
- *      Register for DEH event notification.
- *  Parameters:
- *      hdeh_mgr:        Handle to DEH manager object.
- *  Returns:
- *      DSP_SOK:        Success.
- *      -EPERM:      Destroy failed.
- *  Requires:
- *      hdeh_mgr != NULL;
- *  Ensures:
- */
-typedef dsp_status(*fxn_deh_registernotify)
- (struct deh_mgr *hdeh_mgr,
-  u32 event_mask, u32 notify_type, struct dsp_notification *hnotification);
-
-/*
  *  ======== bridge_io_create ========
  *  Purpose:
  *      Create an object that manages I/O between CHNL and msg_ctrl.
@@ -1066,11 +1015,6 @@ struct bridge_drv_interface {
 	fxn_chnl_idle pfn_chnl_idle;	/* Idle the channel */
 	/* Register for notif. */
 	fxn_chnl_registernotify pfn_chnl_register_notify;
-	fxn_deh_create pfn_deh_create;	/* Create DEH manager */
-	fxn_deh_destroy pfn_deh_destroy;	/* Destroy DEH manager */
-	fxn_deh_notify pfn_deh_notify;	/* Notify of DSP error */
-	/* register for deh notif. */
-	fxn_deh_registernotify pfn_deh_register_notify;
 	fxn_io_create pfn_io_create;	/* Create IO manager */
 	fxn_io_destroy pfn_io_destroy;	/* Destroy IO manager */
 	fxn_io_onloaded pfn_io_on_loaded;	/* Notify of program loaded */
diff --git a/drivers/dsp/bridge/core/tiomap3430.c b/drivers/dsp/bridge/core/tiomap3430.c
index 99bf966..f6b421e 100644
--- a/drivers/dsp/bridge/core/tiomap3430.c
+++ b/drivers/dsp/bridge/core/tiomap3430.c
@@ -192,11 +192,6 @@ static struct bridge_drv_interface drv_interface_fxns = {
 	bridge_chnl_get_mgr_info,
 	bridge_chnl_idle,
 	bridge_chnl_register_notify,
-	/* The following DEH functions are provided by tihelen_ue_deh.c */
-	bridge_deh_create,
-	bridge_deh_destroy,
-	bridge_deh_notify,
-	bridge_deh_register_notify,
 	/* The following IO functions are provided by chnl_io.lib: */
 	bridge_io_create,
 	bridge_io_destroy,
diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c
index b1c8d8b..3f7eb47 100644
--- a/drivers/dsp/bridge/pmgr/dev.c
+++ b/drivers/dsp/bridge/pmgr/dev.c
@@ -49,6 +49,7 @@
 #include <dspbridge/io.h>
 #include <dspbridge/msg.h>
 #include <dspbridge/cmm.h>
+#include <dspbridge/dspdeh.h>
 
 /*  ----------------------------------- This */
 #include <dspbridge/dev.h>
@@ -235,8 +236,7 @@ dsp_status dev_create_device(OUT struct dev_object **phDevObject,
 		/* Only create DEH manager if we have an IO manager */
 		if (DSP_SUCCEEDED(status)) {
 			/* Instantiate the DEH module */
-			status = (*dev_obj->bridge_interface.pfn_deh_create)
-			    (&dev_obj->hdeh_mgr, dev_obj);
+			status = bridge_deh_create(&dev_obj->hdeh_mgr, dev_obj);
 		}
 		/* Create DMM mgr . */
 		status = dmm_create(&dev_obj->dmm_mgr,
@@ -371,8 +371,7 @@ dsp_status dev_destroy_device(struct dev_object *hdev_obj)
 
 		if (dev_obj->hdeh_mgr) {
 			/* Uninitialize DEH module. */
-			(*dev_obj->bridge_interface.pfn_deh_destroy)
-			    (dev_obj->hdeh_mgr);
+			bridge_deh_destroy(dev_obj->hdeh_mgr);
 			dev_obj->hdeh_mgr = NULL;
 		}
 		if (dev_obj->hcmm_mgr) {
@@ -1117,10 +1116,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
 		STORE_FXN(fxn_chnl_getmgrinfo, pfn_chnl_get_mgr_info);
 		STORE_FXN(fxn_chnl_idle, pfn_chnl_idle);
 		STORE_FXN(fxn_chnl_registernotify, pfn_chnl_register_notify);
-		STORE_FXN(fxn_deh_create, pfn_deh_create);
-		STORE_FXN(fxn_deh_destroy, pfn_deh_destroy);
-		STORE_FXN(fxn_deh_notify, pfn_deh_notify);
-		STORE_FXN(fxn_deh_registernotify, pfn_deh_register_notify);
 		STORE_FXN(fxn_io_create, pfn_io_create);
 		STORE_FXN(fxn_io_destroy, pfn_io_destroy);
 		STORE_FXN(fxn_io_onloaded, pfn_io_on_loaded);
@@ -1157,10 +1152,6 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns,
 	DBC_ENSURE(intf_fxns->pfn_chnl_get_mgr_info != NULL);
 	DBC_ENSURE(intf_fxns->pfn_chnl_idle != NULL);
 	DBC_ENSURE(intf_fxns->pfn_chnl_register_notify != NULL);
-	DBC_ENSURE(intf_fxns->pfn_deh_create != NULL);
-	DBC_ENSURE(intf_fxns->pfn_deh_destroy != NULL);
-	DBC_ENSURE(intf_fxns->pfn_deh_notify != NULL);
-	DBC_ENSURE(intf_fxns->pfn_deh_register_notify != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_create != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_destroy != NULL);
 	DBC_ENSURE(intf_fxns->pfn_io_on_loaded != NULL);
diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c
index cdd60e6..23aed68 100644
--- a/drivers/dsp/bridge/rmgr/node.c
+++ b/drivers/dsp/bridge/rmgr/node.c
@@ -69,6 +69,8 @@
 #include <dspbridge/resourcecleanup.h>
 #include <_tiomap.h>
 
+#include <dspbridge/dspdeh.h>
+
 #define HOSTPREFIX	  "/host"
 #define PIPEPREFIX	  "/dbpipe"
 
@@ -2470,8 +2472,7 @@ dsp_status node_terminate(struct node_object *hnode, OUT dsp_status *pstatus)
 			if (!hdeh_mgr)
 				goto func_cont;
 
-			(*intf_fxns->pfn_deh_notify)(hdeh_mgr, DSP_SYSERROR,
-							DSP_EXCEPTIONABORT);
+			bridge_deh_notify(hdeh_mgr, DSP_SYSERROR, DSP_EXCEPTIONABORT);
 		}
 	}
 func_cont:
diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
index f86958a..1cccc89 100644
--- a/drivers/dsp/bridge/rmgr/proc.c
+++ b/drivers/dsp/bridge/rmgr/proc.c
@@ -1192,22 +1192,20 @@ dsp_status proc_register_notify(void *hprocessor, u32 event_mask,
 				status =
 				    dev_get_deh_mgr(p_proc_object->hdev_obj,
 						    &hdeh_mgr);
-				DBC_ASSERT(p_proc_object->
-					   intf_fxns->pfn_deh_register_notify);
 				status =
-				    (*p_proc_object->
-				     intf_fxns->pfn_deh_register_notify)
-				    (hdeh_mgr, event_mask, notify_type,
-				     hnotification);
+					bridge_deh_register_notify(hdeh_mgr,
+							event_mask,
+							notify_type,
+							hnotification);
 			}
 		} else {
 			status = dev_get_deh_mgr(p_proc_object->hdev_obj,
 						 &hdeh_mgr);
-			DBC_ASSERT(p_proc_object->
-				   intf_fxns->pfn_deh_register_notify);
 			status =
-			    (*p_proc_object->intf_fxns->pfn_deh_register_notify)
-			    (hdeh_mgr, event_mask, notify_type, hnotification);
+			    bridge_deh_register_notify(hdeh_mgr,
+					    event_mask,
+					    notify_type,
+					    hnotification);
 
 		}
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 12/14] dspbridge: move mmufault to deh
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (10 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 11/14] dspbridge: access deh directly Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-17 19:11   ` Guzman Lugo, Fernando
  2010-05-16 15:46 ` [PATCH 13/14] dspbridge: deh: tidying up Felipe Contreras
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 drivers/dsp/bridge/Makefile         |    2 +-
 drivers/dsp/bridge/core/mmu_fault.c |  100 -----------------------------------
 drivers/dsp/bridge/core/mmu_fault.h |   34 ------------
 drivers/dsp/bridge/core/ue_deh.c    |   50 +++++++++++++++++-
 4 files changed, 50 insertions(+), 136 deletions(-)
 delete mode 100644 drivers/dsp/bridge/core/mmu_fault.c
 delete mode 100644 drivers/dsp/bridge/core/mmu_fault.h

diff --git a/drivers/dsp/bridge/Makefile b/drivers/dsp/bridge/Makefile
index 4c2f923..39624d4 100644
--- a/drivers/dsp/bridge/Makefile
+++ b/drivers/dsp/bridge/Makefile
@@ -5,7 +5,7 @@ libservices = services/sync.o services/cfg.o \
 		services/ntfy.o services/services.o
 libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
 		core/tiomap3430_pwr.o core/tiomap_io.o \
-		core/mmu_fault.o core/ue_deh.o core/wdt.o core/dsp-clock.o
+		core/ue_deh.o core/wdt.o core/dsp-clock.o
 libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/dspapi.o \
 		pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
 librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
diff --git a/drivers/dsp/bridge/core/mmu_fault.c b/drivers/dsp/bridge/core/mmu_fault.c
deleted file mode 100644
index 49034cf..0000000
--- a/drivers/dsp/bridge/core/mmu_fault.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * mmu_fault.c
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Implements DSP MMU fault handling functions.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*  ----------------------------------- DSP/BIOS Bridge */
-#include <dspbridge/std.h>
-#include <dspbridge/dbdefs.h>
-#include <dspbridge/errbase.h>
-
-/*  ----------------------------------- Trace & Debug */
-#include <dspbridge/host_os.h>
-#include <dspbridge/dbc.h>
-
-/*  ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/drv.h>
-
-/*  ----------------------------------- Link Driver */
-#include <dspbridge/dspdeh.h>
-
-/* ------------------------------------ Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
-/*  ----------------------------------- This */
-#include "_deh.h"
-#include <dspbridge/cfg.h>
-#include "_tiomap_mmu.h"
-#include "_tiomap.h"
-#include "mmu_fault.h"
-
-/*
- *  ======== mmu_fault_dpc ========
- *      Deferred procedure call to handle DSP MMU fault.
- */
-void mmu_fault_dpc(IN unsigned long pRefData)
-{
-	struct deh_mgr *hdeh_mgr = (struct deh_mgr *)pRefData;
-
-	if (!hdeh_mgr)
-		return;
-
-	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0L);
-}
-
-/*
- *  ======== mmu_fault_isr ========
- *      ISR to be triggered by a DSP MMU fault interrupt.
- */
-irqreturn_t mmu_fault_isr(int irq, IN void *pRefData)
-{
-	struct deh_mgr *deh_mgr_obj = pRefData;
-	struct cfg_hostres *resources;
-	u32 dmmu_event_mask;
-
-	if (!deh_mgr_obj)
-		return IRQ_HANDLED;
-
-	resources = deh_mgr_obj->hbridge_context->resources;
-	if (!resources) {
-		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
-				__func__);
-		return IRQ_HANDLED;
-	}
-
-	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
-	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
-		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj->fault_addr);
-		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n", __func__,
-				dmmu_event_mask, deh_mgr_obj->fault_addr);
-		/*
-		 * Schedule a DPC directly. In the future, it may be
-		 * necessary to check if DSP MMU fault is intended for
-		 * Bridge.
-		 */
-		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
-
-		/* Disable the MMU events, else once we clear it will
-		 * start to raise INTs again */
-		hw_mmu_event_disable(resources->dw_dmmu_base,
-				HW_MMU_TRANSLATION_FAULT);
-	} else {
-		hw_mmu_event_disable(resources->dw_dmmu_base,
-				HW_MMU_ALL_INTERRUPTS);
-	}
-	return IRQ_HANDLED;
-}
diff --git a/drivers/dsp/bridge/core/mmu_fault.h b/drivers/dsp/bridge/core/mmu_fault.h
deleted file mode 100644
index 537e6e7..0000000
--- a/drivers/dsp/bridge/core/mmu_fault.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * mmu_fault.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Defines DSP MMU fault handling functions.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef MMU_FAULT_
-#define MMU_FAULT_
-
-/*
- *  ======== mmu_fault_dpc ========
- *      Deferred procedure call to handle DSP MMU fault.
- */
-void mmu_fault_dpc(IN unsigned long pRefData);
-
-/*
- *  ======== mmu_fault_isr ========
- *      ISR to be triggered by a DSP MMU fault interrupt.
- */
-irqreturn_t mmu_fault_isr(int irq, IN void *pRefData);
-
-#endif /* MMU_FAULT_ */
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 6035757..d44c895 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -46,7 +46,6 @@
 #include <hw_mmu.h>
 
 /*  ----------------------------------- This */
-#include "mmu_fault.h"
 #include "_tiomap.h"
 #include "_deh.h"
 #include "_tiomap_mmu.h"
@@ -62,6 +61,55 @@
 
 static struct omap_dm_timer *timer;
 
+static void mmu_fault_dpc(unsigned long data)
+{
+	struct deh_mgr *hdeh_mgr = (void *)data;
+
+	if (!hdeh_mgr)
+		return;
+
+	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0);
+}
+
+static irqreturn_t mmu_fault_isr(int irq, void *data)
+{
+	struct deh_mgr *deh_mgr_obj = data;
+	struct cfg_hostres *resources;
+	u32 dmmu_event_mask;
+
+	if (!deh_mgr_obj)
+		return IRQ_HANDLED;
+
+	resources = deh_mgr_obj->hbridge_context->resources;
+	if (!resources) {
+		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
+				__func__);
+		return IRQ_HANDLED;
+	}
+
+	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
+	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
+		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj->fault_addr);
+		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n", __func__,
+				dmmu_event_mask, deh_mgr_obj->fault_addr);
+		/*
+		 * Schedule a DPC directly. In the future, it may be
+		 * necessary to check if DSP MMU fault is intended for
+		 * Bridge.
+		 */
+		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
+
+		/* Disable the MMU events, else once we clear it will
+		 * start to raise INTs again */
+		hw_mmu_event_disable(resources->dw_dmmu_base,
+				HW_MMU_TRANSLATION_FAULT);
+	} else {
+		hw_mmu_event_disable(resources->dw_dmmu_base,
+				HW_MMU_ALL_INTERRUPTS);
+	}
+	return IRQ_HANDLED;
+}
+
 dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 		struct dev_object *hdev_obj)
 {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 13/14] dspbridge: deh: tidying up
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (11 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 12/14] dspbridge: move mmufault to deh Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-16 15:46 ` [PATCH 14/14] dspbridge: deh: update copyright notice Felipe Contreras
  2010-05-17 19:08 ` [PATCH 00/14] dspbridge: rewrite deh Guzman Lugo, Fernando
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dspdeh.h |   15 +--
 drivers/dsp/bridge/core/_deh.h                |    1 -
 drivers/dsp/bridge/core/ue_deh.c              |  163 +++++++++++--------------
 3 files changed, 77 insertions(+), 102 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dspdeh.h b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
index 4c4d577..e5e83b4 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdeh.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
@@ -23,21 +23,20 @@
 #ifndef DSPDEH_
 #define DSPDEH_
 
-#include <dspbridge/devdefs.h>
+struct deh_mgr;
+struct dev_object;
+struct dsp_notification;
 
-#include <dspbridge/dehdefs.h>
-
-extern dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
+int bridge_deh_create(struct deh_mgr **ret_deh,
 		struct dev_object *hdev_obj);
 
-extern dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr);
+int bridge_deh_destroy(struct deh_mgr *deh);
 
-extern dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr,
+int bridge_deh_register_notify(struct deh_mgr *deh,
 		u32 event_mask,
 		u32 notify_type,
 		struct dsp_notification *hnotification);
 
-extern void bridge_deh_notify(struct deh_mgr *deh_mgr,
-		u32 ulEventMask, u32 dwErrInfo);
+void bridge_deh_notify(struct deh_mgr *deh, int event, int info);
 
 #endif /* DSPDEH_ */
diff --git a/drivers/dsp/bridge/core/_deh.h b/drivers/dsp/bridge/core/_deh.h
index 32b84f3..9fb727b 100644
--- a/drivers/dsp/bridge/core/_deh.h
+++ b/drivers/dsp/bridge/core/_deh.h
@@ -26,7 +26,6 @@
 struct deh_mgr {
 	struct bridge_dev_context *hbridge_context;	/* Bridge context. */
 	struct ntfy_object *ntfy_obj;	/* NTFY object */
-	u32 fault_addr;
 
 	/* MMU Fault DPC */
 	struct tasklet_struct dpc_tasklet;
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index d44c895..6ff73a2 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -16,41 +16,19 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-/*  ----------------------------------- Host OS */
-#include <dspbridge/host_os.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
 #include <plat/dmtimer.h>
 
-/*  ----------------------------------- DSP/BIOS Bridge */
-#include <dspbridge/std.h>
 #include <dspbridge/dbdefs.h>
-#include <dspbridge/errbase.h>
-
-/*  ----------------------------------- Trace & Debug */
-#include <dspbridge/dbc.h>
-
-/*  ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/cfg.h>
-#include <dspbridge/ntfy.h>
-#include <dspbridge/drv.h>
-
-/*  ----------------------------------- Link Driver */
 #include <dspbridge/dspdeh.h>
-
-/*  ----------------------------------- Platform Manager */
 #include <dspbridge/dev.h>
-#include <dspbridge/dspapi.h>
-#include <dspbridge/wdt.h>
-
-/* ------------------------------------ Hardware Abstraction Layer */
-#include <hw_defs.h>
-#include <hw_mmu.h>
-
-/*  ----------------------------------- This */
 #include "_tiomap.h"
 #include "_deh.h"
-#include "_tiomap_mmu.h"
-#include "_tiomap_pwr.h"
+
 #include <dspbridge/io_sm.h>
+#include <dspbridge/drv.h>
+#include <dspbridge/wdt.h>
 
 /* GP Timer number to trigger interrupt for MMU-fault ISR on DSP */
 #define GPTIMER_FOR_DSP_MMU_FAULT      8
@@ -60,44 +38,45 @@
 #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
 
 static struct omap_dm_timer *timer;
+static u32 fault_addr;
 
 static void mmu_fault_dpc(unsigned long data)
 {
-	struct deh_mgr *hdeh_mgr = (void *)data;
+	struct deh_mgr *deh = (void *)data;
 
-	if (!hdeh_mgr)
+	if (!deh)
 		return;
 
-	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0);
+	bridge_deh_notify(deh, DSP_MMUFAULT, 0);
 }
 
 static irqreturn_t mmu_fault_isr(int irq, void *data)
 {
-	struct deh_mgr *deh_mgr_obj = data;
+	struct deh_mgr *deh = data;
 	struct cfg_hostres *resources;
-	u32 dmmu_event_mask;
+	u32 event;
 
-	if (!deh_mgr_obj)
+	if (!deh)
 		return IRQ_HANDLED;
 
-	resources = deh_mgr_obj->hbridge_context->resources;
+	resources = deh->hbridge_context->resources;
 	if (!resources) {
 		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
 				__func__);
 		return IRQ_HANDLED;
 	}
 
-	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
-	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
-		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj->fault_addr);
-		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n", __func__,
-				dmmu_event_mask, deh_mgr_obj->fault_addr);
+	hw_mmu_event_status(resources->dw_dmmu_base, &event);
+	if (event == HW_MMU_TRANSLATION_FAULT) {
+		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &fault_addr);
+		dev_dbg(bridge, "%s: event=0x%x, fault_addr=0x%x\n", __func__,
+				event, fault_addr);
 		/*
 		 * Schedule a DPC directly. In the future, it may be
 		 * necessary to check if DSP MMU fault is intended for
 		 * Bridge.
 		 */
-		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
+		tasklet_schedule(&deh->dpc_tasklet);
 
 		/* Disable the MMU events, else once we clear it will
 		 * start to raise INTs again */
@@ -110,11 +89,11 @@ static irqreturn_t mmu_fault_isr(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
+int bridge_deh_create(struct deh_mgr **ret_deh,
 		struct dev_object *hdev_obj)
 {
-	dsp_status status;
-	struct deh_mgr *deh_mgr;
+	int status;
+	struct deh_mgr *deh;
 	struct bridge_dev_context *hbridge_context = NULL;
 
 	/*  Message manager will be created when a file is loaded, since
@@ -123,29 +102,29 @@ dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 	/* Get WMD context info. */
 	dev_get_bridge_context(hdev_obj, &hbridge_context);
 	/* Allocate IO manager object: */
-	deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
-	if (!deh_mgr) {
+	deh = kzalloc(sizeof(*deh), GFP_KERNEL);
+	if (!deh) {
 		status = -ENOMEM;
 		goto err;
 	}
 
 	/* Create an NTFY object to manage notifications */
-	deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
-	if (!deh_mgr->ntfy_obj) {
+	deh->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
+	if (!deh->ntfy_obj) {
 		status = -ENOMEM;
 		goto err;
 	}
-	ntfy_init(deh_mgr->ntfy_obj);
+	ntfy_init(deh->ntfy_obj);
 
 	/* Create a MMUfault DPC */
-	tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
+	tasklet_init(&deh->dpc_tasklet, mmu_fault_dpc, (u32) deh);
 
 	/* Fill in context structure */
-	deh_mgr->hbridge_context = hbridge_context;
+	deh->hbridge_context = hbridge_context;
 
 	/* Install ISR function for DSP MMU fault */
 	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
-			"DspBridge\tiommu fault", deh_mgr);
+			"DspBridge\tiommu fault", deh);
 	if (status < 0)
 		goto err;
 
@@ -157,33 +136,33 @@ dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
 	}
 	omap_dm_timer_disable(timer);
 
-	*ret_deh_mgr = deh_mgr;
+	*ret_deh = deh;
 	return 0;
 
 err:
-	bridge_deh_destroy(deh_mgr);
-	*ret_deh_mgr = NULL;
+	bridge_deh_destroy(deh);
+	*ret_deh = NULL;
 	return status;
 }
 
-dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr)
+int bridge_deh_destroy(struct deh_mgr *deh)
 {
-	if (!deh_mgr)
+	if (!deh)
 		return -EFAULT;
 
 	/* If notification object exists, delete it */
-	if (deh_mgr->ntfy_obj) {
-		ntfy_delete(deh_mgr->ntfy_obj);
-		kfree(deh_mgr->ntfy_obj);
+	if (deh->ntfy_obj) {
+		ntfy_delete(deh->ntfy_obj);
+		kfree(deh->ntfy_obj);
 	}
 	/* Disable DSP MMU fault */
-	free_irq(INT_DSP_MMU_IRQ, deh_mgr);
+	free_irq(INT_DSP_MMU_IRQ, deh);
 
 	/* Free DPC object */
-	tasklet_kill(&deh_mgr->dpc_tasklet);
+	tasklet_kill(&deh->dpc_tasklet);
 
 	/* Deallocate the DEH manager object */
-	kfree(deh_mgr);
+	kfree(deh);
 
 	/* The GPTimer is no longer needed */
 	omap_dm_timer_free(timer);
@@ -192,18 +171,18 @@ dsp_status bridge_deh_destroy(struct deh_mgr *deh_mgr)
 	return 0;
 }
 
-dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32 event_mask,
+int bridge_deh_register_notify(struct deh_mgr *deh, u32 event_mask,
 		u32 notify_type,
 		struct dsp_notification *hnotification)
 {
-	if (!deh_mgr)
+	if (!deh)
 		return -EFAULT;
 
 	if (event_mask)
-		return ntfy_register(deh_mgr->ntfy_obj, hnotification,
+		return ntfy_register(deh->ntfy_obj, hnotification,
 				event_mask, notify_type);
 	else
-		return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
+		return ntfy_unregister(deh->ntfy_obj, hnotification);
 }
 
 static void wait_for_timer(void)
@@ -233,8 +212,7 @@ static void wait_for_timer(void)
 	omap_dm_timer_disable(timer);
 }
 
-static void mmu_fault_print_stack(struct bridge_dev_context *dev_context,
-		u32 fault_addr)
+static void mmu_fault_print_stack(struct bridge_dev_context *dev_context)
 {
 	struct cfg_hostres *resources;
 	struct hw_mmu_map_attrs_t map_attrs = {
@@ -270,51 +248,50 @@ static void mmu_fault_print_stack(struct bridge_dev_context *dev_context,
 	free_page((unsigned long)dummy_va_addr);
 }
 
-void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
+static inline const char *event_to_string(int event)
+{
+	switch (event) {
+	case DSP_SYSERROR: return "DSP_SYSERROR"; break;
+	case DSP_MMUFAULT: return "DSP_MMUFAULT"; break;
+	case DSP_PWRERROR: return "DSP_PWRERROR"; break;
+	case DSP_WDTOVERFLOW: return "DSP_WDTOVERFLOW"; break;
+	default: return "unkown event"; break;
+	}
+}
+
+void bridge_deh_notify(struct deh_mgr *deh, int event, int info)
 {
 	struct bridge_dev_context *dev_context;
+	const char *str = event_to_string(event);
 
-	if (!deh_mgr)
+	if (!deh)
 		return;
 
-	dev_info(bridge, "%s: device exception\n", __func__);
-	dev_context = deh_mgr->hbridge_context;
+	dev_dbg(bridge, "%s: device exception", __func__);
+	dev_context = deh->hbridge_context;
 
-	switch (ulEventMask) {
+	switch (event) {
 	case DSP_SYSERROR:
-		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
-				__func__, "DSP_SYSERROR", dwErrInfo);
+		dev_err(bridge, "%s: %s, info=0x%x", __func__,
+				str, info);
 		dump_dl_modules(dev_context);
 		dump_dsp_stack(dev_context);
 		break;
 	case DSP_MMUFAULT:
-		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
-				__func__, "DSP_MMUFAULT", dwErrInfo);
-		dev_info(bridge, "%s: %s, fault=0x%x\n", __func__, "DSP_MMUFAULT",
-				deh_mgr->fault_addr);
-
+		dev_err(bridge, "%s: %s, addr=0x%x", __func__,
+				str, fault_addr);
 		print_dsp_trace_buffer(dev_context);
 		dump_dl_modules(dev_context);
-		mmu_fault_print_stack(dev_context, deh_mgr->fault_addr);
-		break;
-#ifdef CONFIG_BRIDGE_NTFY_PWRERR
-	case DSP_PWRERROR:
-		dev_err(bridge, "%s: %s, err_info = 0x%x\n",
-				__func__, "DSP_PWRERROR", dwErrInfo);
-		break;
-#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
-	case DSP_WDTOVERFLOW:
-		dev_err(bridge, "%s: DSP_WDTOVERFLOW\n", __func__);
+		mmu_fault_print_stack(dev_context);
 		break;
 	default:
-		dev_dbg(bridge, "%s: Unknown Error, err_info = 0x%x\n",
-				__func__, dwErrInfo);
+		dev_err(bridge, "%s: %s", __func__, str);
 		break;
 	}
 
 	/* Filter subsequent notifications when an error occurs */
 	if (dev_context->dw_brd_state != BRD_ERROR) {
-		ntfy_notify(deh_mgr->ntfy_obj, ulEventMask);
+		ntfy_notify(deh->ntfy_obj, event);
 #ifdef CONFIG_BRIDGE_RECOVERY
 		bridge_recover_schedule();
 #endif
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* [PATCH 14/14] dspbridge: deh: update copyright notice
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (12 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 13/14] dspbridge: deh: tidying up Felipe Contreras
@ 2010-05-16 15:46 ` Felipe Contreras
  2010-05-17 19:08 ` [PATCH 00/14] dspbridge: rewrite deh Guzman Lugo, Fernando
  14 siblings, 0 replies; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 15:46 UTC (permalink / raw)
  To: linux-omap; +Cc: Omar Ramirez Luna, Fernando Guzman Lugo, Felipe Contreras

Add myself... git blame seems to agree :)

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 arch/arm/plat-omap/include/dspbridge/dspdeh.h |    1 +
 drivers/dsp/bridge/core/_deh.h                |    1 +
 drivers/dsp/bridge/core/ue_deh.c              |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/dspbridge/dspdeh.h b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
index e5e83b4..28734f2 100644
--- a/arch/arm/plat-omap/include/dspbridge/dspdeh.h
+++ b/arch/arm/plat-omap/include/dspbridge/dspdeh.h
@@ -10,6 +10,7 @@
  *   Function comment headers reside with the function typedefs in dspdefs.h.
  *
  * Copyright (C) 2005-2006 Texas Instruments, Inc.
+ * Copyright (C) 2010 Felipe Contreras
  *
  * This package is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
diff --git a/drivers/dsp/bridge/core/_deh.h b/drivers/dsp/bridge/core/_deh.h
index 9fb727b..16723cd 100644
--- a/drivers/dsp/bridge/core/_deh.h
+++ b/drivers/dsp/bridge/core/_deh.h
@@ -6,6 +6,7 @@
  * Private header for DEH module.
  *
  * Copyright (C) 2005-2006 Texas Instruments, Inc.
+ * Copyright (C) 2010 Felipe Contreras
  *
  * This package is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
diff --git a/drivers/dsp/bridge/core/ue_deh.c b/drivers/dsp/bridge/core/ue_deh.c
index 6ff73a2..315672b 100644
--- a/drivers/dsp/bridge/core/ue_deh.c
+++ b/drivers/dsp/bridge/core/ue_deh.c
@@ -6,6 +6,7 @@
  * Implements upper edge DSP exception handling (DEH) functions.
  *
  * Copyright (C) 2005-2006 Texas Instruments, Inc.
+ * Copyright (C) 2010 Felipe Contreras
  *
  * This package is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-16 15:45 ` [PATCH 02/14] dspbridge: deh: trivial cleanups Felipe Contreras
@ 2010-05-16 22:02   ` Guzman Lugo, Fernando
  2010-05-16 22:13     ` Felipe Contreras
  2010-05-17 19:09   ` Guzman Lugo, Fernando
  1 sibling, 1 reply; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-16 22:02 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap; +Cc: Ramirez Luna, Omar



Hi,

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 02/14] dspbridge: deh: trivial cleanups
> 
> No functional changes.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |  112 ++++++++++++++-------------------
> -----
>  1 files changed, 41 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 48c11e9..605cec7 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -60,11 +60,6 @@
>  /* Max time to check for GP Timer IRQ */
>  #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
> 
> -static struct hw_mmu_map_attrs_t map_attrs = { HW_LITTLE_ENDIAN,
> -	HW_ELEM_SIZE16BIT,
> -	HW_MMU_CPUES
> -};
> -
>  static void *dummy_va_addr;
> 
>  static struct omap_dm_timer *timer;
> @@ -72,7 +67,7 @@ static struct omap_dm_timer *timer;
>  dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
>  		struct dev_object *hdev_obj)
>  {
> -	dsp_status status = DSP_SOK;
> +	dsp_status status;
>  	struct deh_mgr *deh_mgr;
>  	struct bridge_dev_context *hbridge_context = NULL;
> 
> @@ -81,23 +76,20 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	 *  the base image. */
>  	/* Get WMD context info. */
>  	dev_get_bridge_context(hdev_obj, &hbridge_context);
> -	DBC_ASSERT(hbridge_context);
> -	dummy_va_addr = NULL;
>  	/* Allocate IO manager object: */
>  	deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
>  	if (!deh_mgr) {
>  		status = -ENOMEM;
> -		goto leave;
> +		goto err;
>  	}
> 
>  	/* Create an NTFY object to manage notifications */
>  	deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
> -	if (deh_mgr->ntfy_obj) {
> -		ntfy_init(deh_mgr->ntfy_obj);
> -	} else {
> +	if (!deh_mgr->ntfy_obj) {
>  		status = -ENOMEM;
>  		goto err;
>  	}
> +	ntfy_init(deh_mgr->ntfy_obj);
> 
>  	/* Create a MMUfault DPC */
>  	tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
> @@ -110,32 +102,25 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	deh_mgr->err_info.dw_val3 = 0L;
> 
>  	/* Install ISR function for DSP MMU fault */
> -	if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> -					"DspBridge\tiommu fault",
> -					(void *)deh_mgr)) == 0)
> -		status = DSP_SOK;
> -	else
> -		status = -EPERM;
> +	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> +			"DspBridge\tiommu fault", deh_mgr);
> +	if (status < 0)
> +		goto err;
> 
> -err:
> -	if (DSP_FAILED(status)) {
> -		/* If create failed, cleanup */
> -		bridge_deh_destroy(deh_mgr);
> -		deh_mgr = NULL;
> -	} else {
> -		timer = omap_dm_timer_request_specific(
> -					GPTIMER_FOR_DSP_MMU_FAULT);
> -		if (timer) {
> -			omap_dm_timer_disable(timer);
> -		} else {
> -			pr_err("%s: GPTimer not available\n", __func__);
> -			return -ENODEV;
> -		}
> +	timer = omap_dm_timer_request_specific(GPTIMER_FOR_DSP_MMU_FAULT);
> +	if (!timer) {
> +		pr_err("%s: GPTimer not available\n", __func__);
> +		status = -ENODEV;
> +		goto err;
>  	}
> +	omap_dm_timer_disable(timer);
> 
> -leave:
>  	*ret_deh_mgr = deh_mgr;
> +	return 0;
> 
> +err:
> +	bridge_deh_destroy(deh_mgr);
> +	*ret_deh_mgr = NULL;
>  	return status;
>  }
> 
> @@ -164,36 +149,31 @@ dsp_status bridge_deh_destroy(struct deh_mgr
> *deh_mgr)
>  	omap_dm_timer_free(timer);
>  	timer = NULL;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32
> event_mask,
>  		u32 notify_type,
>  		struct dsp_notification *hnotification)
>  {
> -	dsp_status status = DSP_SOK;
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
>  	if (event_mask)
> -		status = ntfy_register(deh_mgr->ntfy_obj, hnotification,
> -					event_mask, notify_type);
> +		return ntfy_register(deh_mgr->ntfy_obj, hnotification,
> +				event_mask, notify_type);
>  	else
> -		status = ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
> -
> -	return status;
> +		return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
>  }
> 
>  static void wait_for_timer(void)
>  {
> -	u32 cnt = 0;
> +	int c;
> 
>  	omap_dm_timer_enable(timer);
> 
>  	/* Enable overflow interrupt */
> -	omap_dm_timer_set_int_enable(timer,
> -			GPTIMER_IRQ_OVERFLOW);
> +	omap_dm_timer_set_int_enable(timer, GPTIMER_IRQ_OVERFLOW);
>  	/*
>  	 * Set counter value to overflow counter after
>  	 * one tick and start timer.
> @@ -204,15 +184,11 @@ static void wait_for_timer(void)
>  	udelay(80);
> 
>  	/* Check interrupt status and wait for interrupt */
> -	cnt = 0;
> -	while (!(omap_dm_timer_read_status(timer) &
> -				GPTIMER_IRQ_OVERFLOW)) {
> -		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
> -			pr_err("%s: GPTimer interrupt failed\n",
> -					__func__);
> -			break;
> -		}
> -	}
> +	for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
> +		if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
> +			return;
> +
> +	pr_err("%s: GPTimer interrupt failed\n", __func__);

In case of not timeout the timer is not disabled, that could prevent power transition to off. It should be disable as soon as it is not needed which is after calling dump_dsp_stack.

Regards,
Fernando.

> 
>  	omap_dm_timer_disable(timer);
>  }
> @@ -220,16 +196,19 @@ static void wait_for_timer(void)
>  void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32
> dwErrInfo)
>  {
>  	struct bridge_dev_context *dev_context;
> -	dsp_status status = DSP_SOK;
>  	u32 hw_mmu_max_tlb_count = 31;
>  	struct cfg_hostres *resources;
> -	hw_status hw_status_obj;
> +	struct hw_mmu_map_attrs_t map_attrs = {
> +		.endianism = HW_LITTLE_ENDIAN,
> +		.element_size = HW_ELEM_SIZE16BIT,
> +		.mixed_size = HW_MMU_CPUES,
> +	};
> 
>  	if (!deh_mgr)
>  		return;
> 
>  	dev_info(bridge, "%s: device exception\n", __func__);
> -	dev_context = (struct bridge_dev_context *)deh_mgr->hbridge_context;
> +	dev_context = deh_mgr->hbridge_context;
>  	resources = dev_context->resources;
> 
>  	switch (ulEventMask) {
> @@ -256,8 +235,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			(unsigned int) deh_mgr->err_info.dw_val2,
>  			(unsigned int) fault_addr);
>  		dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
> -		dev_context = (struct bridge_dev_context *)
> -			deh_mgr->hbridge_context;
> 
>  		print_dsp_trace_buffer(dev_context);
>  		dump_dl_modules(dev_context);
> @@ -272,20 +249,16 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			dev_context->num_tlb_entries =
>  				dev_context->fixed_tlb_entries;
>  		}
> -		if (DSP_SUCCEEDED(status)) {
> -			hw_status_obj =
> -				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);
> -		}
> +		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(deh_mgr->hbridge_context);
> +		dump_dsp_stack(dev_context);
>  		break;
>  #ifdef CONFIG_BRIDGE_NTFY_PWRERR
>  	case DSP_PWRERROR:
> @@ -334,9 +307,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
>  		struct dsp_errorinfo *pErrInfo)
>  {
> -	DBC_REQUIRE(deh_mgr);
> -	DBC_REQUIRE(pErrInfo);
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
> @@ -346,7 +316,7 @@ dsp_status bridge_deh_get_info(struct deh_mgr
> *deh_mgr,
>  	pErrInfo->dw_val2 = deh_mgr->err_info.dw_val2;
>  	pErrInfo->dw_val3 = deh_mgr->err_info.dw_val3;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  void bridge_deh_release_dummy_mem(void)
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-16 22:02   ` Guzman Lugo, Fernando
@ 2010-05-16 22:13     ` Felipe Contreras
  2010-05-17  2:31       ` Guzman Lugo, Fernando
  0 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-16 22:13 UTC (permalink / raw)
  To: Guzman Lugo, Fernando; +Cc: linux-omap, Ramirez Luna, Omar

On Mon, May 17, 2010 at 1:02 AM, Guzman Lugo, Fernando
<fernando.lugo@ti.com> wrote:

>> +     for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
>> +             if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
>> +                     return;
>> +
>> +     pr_err("%s: GPTimer interrupt failed\n", __func__);
>
> In case of not timeout the timer is not disabled, that could prevent power transition to off. It should be disable as soon as it is not needed which is after calling dump_dsp_stack.

Right, I originally had timer_disable() outside of wait_for_timeout(),
and only later decided to put it in. However, do we still need to let
the timer on? Can't we disable the timer always before dumping the
stack? The rest of the code seems to run fine with the timer disabled.

>>       omap_dm_timer_disable(timer);
>>  }

Cheers.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-16 22:13     ` Felipe Contreras
@ 2010-05-17  2:31       ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17  2:31 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: linux-omap, Ramirez Luna, Omar


Hi,

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 5:13 PM
> To: Guzman Lugo, Fernando
> Cc: linux-omap; Ramirez Luna, Omar
> Subject: Re: [PATCH 02/14] dspbridge: deh: trivial cleanups
> 
> On Mon, May 17, 2010 at 1:02 AM, Guzman Lugo, Fernando
> <fernando.lugo@ti.com> wrote:
> 
> >> +     for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
> >> +             if ((omap_dm_timer_read_status(timer) &
> GPTIMER_IRQ_OVERFLOW))
> >> +                     return;
> >> +
> >> +     pr_err("%s: GPTimer interrupt failed\n", __func__);
> >
> > In case of not timeout the timer is not disabled, that could prevent
> power transition to off. It should be disable as soon as it is not needed
> which is after calling dump_dsp_stack.
> 
> Right, I originally had timer_disable() outside of wait_for_timeout(),
> and only later decided to put it in. However, do we still need to let
> the timer on? Can't we disable the timer always before dumping the
> stack? The rest of the code seems to run fine with the timer disabled.

If there is no f/i clock the DSP cannot ack the interruption, maybe reading the register without the clocks not cause a fatal in the DSP. But you will have issues if the ack is not done.

Regards,
Fernando.

> 
> >>       omap_dm_timer_disable(timer);
> >>  }
> 
> Cheers.
> 
> --
> Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 00/14] dspbridge: rewrite deh
  2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
                   ` (13 preceding siblings ...)
  2010-05-16 15:46 ` [PATCH 14/14] dspbridge: deh: update copyright notice Felipe Contreras
@ 2010-05-17 19:08 ` Guzman Lugo, Fernando
  14 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:08 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.


> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 00/14] dspbridge: rewrite deh
> 
> Hi,
> 
> Investigating the MMU fault corruption issue I found a lot of areas of
> improvements of the exception handling code.
> 
> Moreover, even though the obvious memory corruption is fixed on kernel
> side,
> there are still some rare cases where corruption in user-space might be
> possible if some buffers are still mapped. This came up in a discussion
> with
> Fernando Lugo, and we both agreed on a fix (patch #7).
> 
> The rest is mostly reorganization.
> 
> These apply on top of the MMU fault fix patch.
> 
> Felipe Contreras (14):
>   dspbridge: deh: refactor into wait_for_timer()
>   dspbridge: deh: trivial cleanups
>   dspbridge: mmufault: trivial cleanups
>   dspbridge: deh: free dummy page immediately
>   dspbridge: remove unused code
>   dspbridge: mmu: add hw_mmu_tlb_flush_all()
>   dspbridge: deh: ensure only tlb #0 is enabled
>   dspbridge: deh: refactor in mmu_fault_print_stack()
>   dspbridge: deh: remove get_info
>   dspbridge: deh: remove err_info
>   dspbridge: access deh directly
>   dspbridge: move mmufault to deh
>   dspbridge: deh: tidying up
>   dspbridge: deh: update copyright notice
> 
>  arch/arm/plat-omap/include/dspbridge/dbdefs.h  |    1 -
>  arch/arm/plat-omap/include/dspbridge/dspdefs.h |   75 -----
>  arch/arm/plat-omap/include/dspbridge/dspdeh.h  |   20 +-
>  drivers/dsp/bridge/Makefile                    |    2 +-
>  drivers/dsp/bridge/core/_deh.h                 |    2 +-
>  drivers/dsp/bridge/core/_tiomap.h              |    6 +-
>  drivers/dsp/bridge/core/mmu_fault.c            |  141 --------
>  drivers/dsp/bridge/core/mmu_fault.h            |   36 --
>  drivers/dsp/bridge/core/tiomap3430.c           |   17 +-
>  drivers/dsp/bridge/core/ue_deh.c               |  407 +++++++++++--------
> -----
>  drivers/dsp/bridge/hw/hw_mmu.c                 |    6 +
>  drivers/dsp/bridge/hw/hw_mmu.h                 |    2 +
>  drivers/dsp/bridge/pmgr/dev.c                  |   17 +-
>  drivers/dsp/bridge/rmgr/node.c                 |    5 +-
>  drivers/dsp/bridge/rmgr/proc.c                 |   29 +--
>  15 files changed, 215 insertions(+), 551 deletions(-)
>  delete mode 100644 drivers/dsp/bridge/core/mmu_fault.c
>  delete mode 100644 drivers/dsp/bridge/core/mmu_fault.h


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer()
  2010-05-16 15:45 ` [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer() Felipe Contreras
@ 2010-05-17 19:08   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:08 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer()
> 
> Self-documenting code is better.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |   65 +++++++++++++++++++--------------
> ----
>  1 files changed, 33 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index ab95916..48c11e9 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -185,6 +185,38 @@ dsp_status bridge_deh_register_notify(struct deh_mgr
> *deh_mgr, u32 event_mask,
>  	return status;
>  }
> 
> +static void wait_for_timer(void)
> +{
> +	u32 cnt = 0;
> +
> +	omap_dm_timer_enable(timer);
> +
> +	/* Enable overflow interrupt */
> +	omap_dm_timer_set_int_enable(timer,
> +			GPTIMER_IRQ_OVERFLOW);
> +	/*
> +	 * Set counter value to overflow counter after
> +	 * one tick and start timer.
> +	 */
> +	omap_dm_timer_set_load_start(timer, 0, 0xfffffffe);
> +
> +	/* Wait 80us for timer to overflow */
> +	udelay(80);
> +
> +	/* Check interrupt status and wait for interrupt */
> +	cnt = 0;
> +	while (!(omap_dm_timer_read_status(timer) &
> +				GPTIMER_IRQ_OVERFLOW)) {
> +		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
> +			pr_err("%s: GPTimer interrupt failed\n",
> +					__func__);
> +			break;
> +		}
> +	}
> +
> +	omap_dm_timer_disable(timer);
> +}
> +
>  void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32
> dwErrInfo)
>  {
>  	struct bridge_dev_context *dev_context;
> @@ -192,7 +224,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  	u32 hw_mmu_max_tlb_count = 31;
>  	struct cfg_hostres *resources;
>  	hw_status hw_status_obj;
> -	u32 cnt = 0;
> 
>  	if (!deh_mgr)
>  		return;
> @@ -249,42 +280,12 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  						&map_attrs, HW_SET, HW_SET);
>  		}
> 
> -		/*
> -		 * Send a GP Timer interrupt to DSP.
> -		 * The DSP expects a GP timer interrupt after an
> -		 * MMU-Fault Request GPTimer.
> -		 */
> -		if (timer) {
> -			omap_dm_timer_enable(timer);
> -			/* Enable overflow interrupt */
> -			omap_dm_timer_set_int_enable(timer,
> -						     GPTIMER_IRQ_OVERFLOW);
> -			/*
> -			 * Set counter value to overflow counter after
> -			 * one tick and start timer.
> -			 */
> -			omap_dm_timer_set_load_start(timer, 0, 0xfffffffe);
> -
> -			/* Wait 80us for timer to overflow */
> -			udelay(80);
> -
> -			/* Check interrupt status and wait for interrupt */
> -			cnt = 0;
> -			while (!(omap_dm_timer_read_status(timer) &
> -				GPTIMER_IRQ_OVERFLOW)) {
> -				if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
> -					pr_err("%s: GPTimer interrupt failed\n",
> -								__func__);
> -					break;
> -				}
> -			}
> -		}
> +		wait_for_timer();
> 
>  		/* Clear MMU interrupt */
>  		hw_mmu_event_ack(resources->dw_dmmu_base,
>  				HW_MMU_TRANSLATION_FAULT);
>  		dump_dsp_stack(deh_mgr->hbridge_context);
> -		omap_dm_timer_disable(timer);
>  		break;
>  #ifdef CONFIG_BRIDGE_NTFY_PWRERR
>  	case DSP_PWRERROR:
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-16 15:45 ` [PATCH 02/14] dspbridge: deh: trivial cleanups Felipe Contreras
  2010-05-16 22:02   ` Guzman Lugo, Fernando
@ 2010-05-17 19:09   ` Guzman Lugo, Fernando
  2010-05-17 19:39     ` Jansson, Cris
  1 sibling, 1 reply; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:09 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar



+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 02/14] dspbridge: deh: trivial cleanups
> 
> No functional changes.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |  112 ++++++++++++++-------------------
> -----
>  1 files changed, 41 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 48c11e9..605cec7 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -60,11 +60,6 @@
>  /* Max time to check for GP Timer IRQ */
>  #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
> 
> -static struct hw_mmu_map_attrs_t map_attrs = { HW_LITTLE_ENDIAN,
> -	HW_ELEM_SIZE16BIT,
> -	HW_MMU_CPUES
> -};
> -
>  static void *dummy_va_addr;
> 
>  static struct omap_dm_timer *timer;
> @@ -72,7 +67,7 @@ static struct omap_dm_timer *timer;
>  dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
>  		struct dev_object *hdev_obj)
>  {
> -	dsp_status status = DSP_SOK;
> +	dsp_status status;
>  	struct deh_mgr *deh_mgr;
>  	struct bridge_dev_context *hbridge_context = NULL;
> 
> @@ -81,23 +76,20 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	 *  the base image. */
>  	/* Get WMD context info. */
>  	dev_get_bridge_context(hdev_obj, &hbridge_context);
> -	DBC_ASSERT(hbridge_context);
> -	dummy_va_addr = NULL;
>  	/* Allocate IO manager object: */
>  	deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
>  	if (!deh_mgr) {
>  		status = -ENOMEM;
> -		goto leave;
> +		goto err;
>  	}
> 
>  	/* Create an NTFY object to manage notifications */
>  	deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
> -	if (deh_mgr->ntfy_obj) {
> -		ntfy_init(deh_mgr->ntfy_obj);
> -	} else {
> +	if (!deh_mgr->ntfy_obj) {
>  		status = -ENOMEM;
>  		goto err;
>  	}
> +	ntfy_init(deh_mgr->ntfy_obj);
> 
>  	/* Create a MMUfault DPC */
>  	tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
> @@ -110,32 +102,25 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	deh_mgr->err_info.dw_val3 = 0L;
> 
>  	/* Install ISR function for DSP MMU fault */
> -	if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> -					"DspBridge\tiommu fault",
> -					(void *)deh_mgr)) == 0)
> -		status = DSP_SOK;
> -	else
> -		status = -EPERM;
> +	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> +			"DspBridge\tiommu fault", deh_mgr);
> +	if (status < 0)
> +		goto err;
> 
> -err:
> -	if (DSP_FAILED(status)) {
> -		/* If create failed, cleanup */
> -		bridge_deh_destroy(deh_mgr);
> -		deh_mgr = NULL;
> -	} else {
> -		timer = omap_dm_timer_request_specific(
> -					GPTIMER_FOR_DSP_MMU_FAULT);
> -		if (timer) {
> -			omap_dm_timer_disable(timer);
> -		} else {
> -			pr_err("%s: GPTimer not available\n", __func__);
> -			return -ENODEV;
> -		}
> +	timer = omap_dm_timer_request_specific(GPTIMER_FOR_DSP_MMU_FAULT);
> +	if (!timer) {
> +		pr_err("%s: GPTimer not available\n", __func__);
> +		status = -ENODEV;
> +		goto err;
>  	}
> +	omap_dm_timer_disable(timer);
> 
> -leave:
>  	*ret_deh_mgr = deh_mgr;
> +	return 0;
> 
> +err:
> +	bridge_deh_destroy(deh_mgr);
> +	*ret_deh_mgr = NULL;
>  	return status;
>  }
> 
> @@ -164,36 +149,31 @@ dsp_status bridge_deh_destroy(struct deh_mgr
> *deh_mgr)
>  	omap_dm_timer_free(timer);
>  	timer = NULL;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32
> event_mask,
>  		u32 notify_type,
>  		struct dsp_notification *hnotification)
>  {
> -	dsp_status status = DSP_SOK;
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
>  	if (event_mask)
> -		status = ntfy_register(deh_mgr->ntfy_obj, hnotification,
> -					event_mask, notify_type);
> +		return ntfy_register(deh_mgr->ntfy_obj, hnotification,
> +				event_mask, notify_type);
>  	else
> -		status = ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
> -
> -	return status;
> +		return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
>  }
> 
>  static void wait_for_timer(void)
>  {
> -	u32 cnt = 0;
> +	int c;
> 
>  	omap_dm_timer_enable(timer);
> 
>  	/* Enable overflow interrupt */
> -	omap_dm_timer_set_int_enable(timer,
> -			GPTIMER_IRQ_OVERFLOW);
> +	omap_dm_timer_set_int_enable(timer, GPTIMER_IRQ_OVERFLOW);
>  	/*
>  	 * Set counter value to overflow counter after
>  	 * one tick and start timer.
> @@ -204,15 +184,11 @@ static void wait_for_timer(void)
>  	udelay(80);
> 
>  	/* Check interrupt status and wait for interrupt */
> -	cnt = 0;
> -	while (!(omap_dm_timer_read_status(timer) &
> -				GPTIMER_IRQ_OVERFLOW)) {
> -		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
> -			pr_err("%s: GPTimer interrupt failed\n",
> -					__func__);
> -			break;
> -		}
> -	}
> +	for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
> +		if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
> +			return;
> +
> +	pr_err("%s: GPTimer interrupt failed\n", __func__);
> 
>  	omap_dm_timer_disable(timer);
>  }
> @@ -220,16 +196,19 @@ static void wait_for_timer(void)
>  void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32
> dwErrInfo)
>  {
>  	struct bridge_dev_context *dev_context;
> -	dsp_status status = DSP_SOK;
>  	u32 hw_mmu_max_tlb_count = 31;
>  	struct cfg_hostres *resources;
> -	hw_status hw_status_obj;
> +	struct hw_mmu_map_attrs_t map_attrs = {
> +		.endianism = HW_LITTLE_ENDIAN,
> +		.element_size = HW_ELEM_SIZE16BIT,
> +		.mixed_size = HW_MMU_CPUES,
> +	};
> 
>  	if (!deh_mgr)
>  		return;
> 
>  	dev_info(bridge, "%s: device exception\n", __func__);
> -	dev_context = (struct bridge_dev_context *)deh_mgr->hbridge_context;
> +	dev_context = deh_mgr->hbridge_context;
>  	resources = dev_context->resources;
> 
>  	switch (ulEventMask) {
> @@ -256,8 +235,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			(unsigned int) deh_mgr->err_info.dw_val2,
>  			(unsigned int) fault_addr);
>  		dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
> -		dev_context = (struct bridge_dev_context *)
> -			deh_mgr->hbridge_context;
> 
>  		print_dsp_trace_buffer(dev_context);
>  		dump_dl_modules(dev_context);
> @@ -272,20 +249,16 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			dev_context->num_tlb_entries =
>  				dev_context->fixed_tlb_entries;
>  		}
> -		if (DSP_SUCCEEDED(status)) {
> -			hw_status_obj =
> -				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);
> -		}
> +		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(deh_mgr->hbridge_context);
> +		dump_dsp_stack(dev_context);
>  		break;
>  #ifdef CONFIG_BRIDGE_NTFY_PWRERR
>  	case DSP_PWRERROR:
> @@ -334,9 +307,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
>  		struct dsp_errorinfo *pErrInfo)
>  {
> -	DBC_REQUIRE(deh_mgr);
> -	DBC_REQUIRE(pErrInfo);
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
> @@ -346,7 +316,7 @@ dsp_status bridge_deh_get_info(struct deh_mgr
> *deh_mgr,
>  	pErrInfo->dw_val2 = deh_mgr->err_info.dw_val2;
>  	pErrInfo->dw_val3 = deh_mgr->err_info.dw_val3;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  void bridge_deh_release_dummy_mem(void)
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 04/14] dspbridge: deh: free dummy page immediately
  2010-05-16 15:45 ` [PATCH 04/14] dspbridge: deh: free dummy page immediately Felipe Contreras
@ 2010-05-17 19:09   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:09 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 04/14] dspbridge: deh: free dummy page immediately
> 
> There's no need to keep it around. DSP should stop trying to access
> system memory.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 605cec7..593a0e3 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -60,8 +60,6 @@
>  /* Max time to check for GP Timer IRQ */
>  #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
> 
> -static void *dummy_va_addr;
> -
>  static struct omap_dm_timer *timer;
> 
>  dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
> @@ -203,6 +201,7 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  		.element_size = HW_ELEM_SIZE16BIT,
>  		.mixed_size = HW_MMU_CPUES,
>  	};
> +	void *dummy_va_addr;
> 
>  	if (!deh_mgr)
>  		return;
> @@ -259,6 +258,9 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  		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);
>  		break;
>  #ifdef CONFIG_BRIDGE_NTFY_PWRERR
>  	case DSP_PWRERROR:
> @@ -321,6 +323,4 @@ dsp_status bridge_deh_get_info(struct deh_mgr
> *deh_mgr,
> 
>  void bridge_deh_release_dummy_mem(void)
>  {
> -	free_page((unsigned long)dummy_va_addr);
> -	dummy_va_addr = NULL;
>  }
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all()
  2010-05-16 15:45 ` [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all() Felipe Contreras
@ 2010-05-17 19:10   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:10 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all()
> 
> So that it can be used in more than one place.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/tiomap3430.c |    9 +--------
>  drivers/dsp/bridge/hw/hw_mmu.c       |    6 ++++++
>  drivers/dsp/bridge/hw/hw_mmu.h       |    2 ++
>  3 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/tiomap3430.c
> b/drivers/dsp/bridge/core/tiomap3430.c
> index 8a3eff9..d00eaaa 100644
> --- a/drivers/dsp/bridge/core/tiomap3430.c
> +++ b/drivers/dsp/bridge/core/tiomap3430.c
> @@ -74,8 +74,6 @@
>  #define PAGES_II_LVL_TABLE   512
>  #define PHYS_TO_PAGE(phys)      pfn_to_page((phys) >> PAGE_SHIFT)
> 
> -#define MMU_GFLUSH 0x60
> -
>  /* Forward Declarations: */
>  static dsp_status bridge_brd_monitor(struct bridge_dev_context
> *dev_context);
>  static dsp_status bridge_brd_read(struct bridge_dev_context *dev_context,
> @@ -216,18 +214,13 @@ static struct bridge_drv_interface
> drv_interface_fxns = {
>  	bridge_msg_set_queue_id,
>  };
> 
> -static inline void tlb_flush_all(const void __iomem *base)
> -{
> -	__raw_writeb(__raw_readb(base + MMU_GFLUSH) | 1, base + MMU_GFLUSH);
> -}
> -
>  static inline void flush_all(struct bridge_dev_context *dev_context)
>  {
>  	if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION ||
>  	    dev_context->dw_brd_state == BRD_HIBERNATION)
>  		wake_dsp(dev_context, NULL);
> 
> -	tlb_flush_all(dev_context->dw_dsp_mmu_base);
> +	hw_mmu_tlb_flush_all(dev_context->dw_dsp_mmu_base);
>  }
> 
>  static void bad_page_dump(u32 pa, struct page *pg)
> diff --git a/drivers/dsp/bridge/hw/hw_mmu.c
> b/drivers/dsp/bridge/hw/hw_mmu.c
> index 965b659..e593358 100644
> --- a/drivers/dsp/bridge/hw/hw_mmu.c
> +++ b/drivers/dsp/bridge/hw/hw_mmu.c
> @@ -35,6 +35,7 @@
>  #define MMU_SMALL_PAGE_MASK      0xFFFFF000
> 
>  #define MMU_LOAD_TLB	0x00000001
> +#define MMU_GFLUSH	0x60
> 
>  /*
>   * hw_mmu_page_size_t: Enumerated Type used to specify the MMU Page
> Size(SLSS)
> @@ -585,3 +586,8 @@ static hw_status mmu_set_ram_entry(const void __iomem
> *baseAddress,
>  	return status;
> 
>  }
> +
> +void hw_mmu_tlb_flush_all(const void __iomem *base)
> +{
> +	__raw_writeb(1, base + MMU_GFLUSH);
> +}
> diff --git a/drivers/dsp/bridge/hw/hw_mmu.h
> b/drivers/dsp/bridge/hw/hw_mmu.h
> index 9b13468..0436974 100644
> --- a/drivers/dsp/bridge/hw/hw_mmu.h
> +++ b/drivers/dsp/bridge/hw/hw_mmu.h
> @@ -97,6 +97,8 @@ extern hw_status hw_mmu_pte_set(const u32 pg_tbl_va,
>  extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va,
>  				  u32 page_size, u32 virtualAddr);
> 
> +void hw_mmu_tlb_flush_all(const void __iomem *base);
> +
>  static inline u32 hw_mmu_pte_addr_l1(u32 L1_base, u32 va)
>  {
>  	u32 pte_addr;
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled
  2010-05-16 15:45 ` [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled Felipe Contreras
@ 2010-05-17 19:10   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:10 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled
> 
> We don't want the DSP to continue writing into other mapped pages, no
> matter how unlikely.
> 
> Based on extensive discussion with Fernando Guzman Lugo.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 61e5e4e..f661aaf 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -235,6 +235,14 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  		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,
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack()
  2010-05-16 15:45 ` [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack() Felipe Contreras
@ 2010-05-17 19:11   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:11 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack()
> 
> All this code is just to print the stack, so make it clearer.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |   58 +++++++++++++++++++++------------
> -----
>  1 files changed, 32 insertions(+), 26 deletions(-)
> 
> 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:
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 11/14] dspbridge: access deh directly
  2010-05-16 15:46 ` [PATCH 11/14] dspbridge: access deh directly Felipe Contreras
@ 2010-05-17 19:11   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:11 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 11/14] dspbridge: access deh directly
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  arch/arm/plat-omap/include/dspbridge/dspdefs.h |   56 -------------------
> -----
>  drivers/dsp/bridge/core/tiomap3430.c           |    5 --
>  drivers/dsp/bridge/pmgr/dev.c                  |   15 +-----
>  drivers/dsp/bridge/rmgr/node.c                 |    5 +-
>  drivers/dsp/bridge/rmgr/proc.c                 |   18 +++----
>  5 files changed, 14 insertions(+), 85 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/include/dspbridge/dspdefs.h
> b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
> index a5d410f..268c217 100644
> --- a/arch/arm/plat-omap/include/dspbridge/dspdefs.h
> +++ b/arch/arm/plat-omap/include/dspbridge/dspdefs.h
> @@ -731,57 +731,6 @@ typedef dsp_status(*fxn_dev_ctrl) (struct
> bridge_dev_context *hDevContext,
>  typedef dsp_status(*fxn_dev_destroy) (struct bridge_dev_context
> *hDevContext);
> 
>  /*
> - *  ======== bridge_deh_create ========
> - *  Purpose:
> - *      Create an object that manages DSP exceptions from the GPP.
> - *  Parameters:
> - *      phDehMgr:       Location to store DEH manager on output.
> - *      hdev_obj:     Handle to DEV object.
> - *  Returns:
> - *      DSP_SOK:        Success.
> - *      -ENOMEM:    Memory allocation failure.
> - *      -EPERM:      Creation failed.
> - *  Requires:
> - *      hdev_obj != NULL;
> - *      phDehMgr != NULL;
> - *  Ensures:
> - */
> -typedef dsp_status(*fxn_deh_create) (OUT struct deh_mgr
> -				     **phDehMgr, struct dev_object *hdev_obj);
> -
> -/*
> - *  ======== bridge_deh_destroy ========
> - *  Purpose:
> - *      Destroy the DEH object.
> - *  Parameters:
> - *      hdeh_mgr:        Handle to DEH manager object.
> - *  Returns:
> - *      DSP_SOK:        Success.
> - *      -EPERM:      Destroy failed.
> - *  Requires:
> - *      hdeh_mgr != NULL;
> - *  Ensures:
> - */
> -typedef dsp_status(*fxn_deh_destroy) (struct deh_mgr *hdeh_mgr);
> -
> -/*
> - *  ======== bridge_deh_register_notify ========
> - *  Purpose:
> - *      Register for DEH event notification.
> - *  Parameters:
> - *      hdeh_mgr:        Handle to DEH manager object.
> - *  Returns:
> - *      DSP_SOK:        Success.
> - *      -EPERM:      Destroy failed.
> - *  Requires:
> - *      hdeh_mgr != NULL;
> - *  Ensures:
> - */
> -typedef dsp_status(*fxn_deh_registernotify)
> - (struct deh_mgr *hdeh_mgr,
> -  u32 event_mask, u32 notify_type, struct dsp_notification
> *hnotification);
> -
> -/*
>   *  ======== bridge_io_create ========
>   *  Purpose:
>   *      Create an object that manages I/O between CHNL and msg_ctrl.
> @@ -1066,11 +1015,6 @@ struct bridge_drv_interface {
>  	fxn_chnl_idle pfn_chnl_idle;	/* Idle the channel */
>  	/* Register for notif. */
>  	fxn_chnl_registernotify pfn_chnl_register_notify;
> -	fxn_deh_create pfn_deh_create;	/* Create DEH manager */
> -	fxn_deh_destroy pfn_deh_destroy;	/* Destroy DEH manager */
> -	fxn_deh_notify pfn_deh_notify;	/* Notify of DSP error */
> -	/* register for deh notif. */
> -	fxn_deh_registernotify pfn_deh_register_notify;
>  	fxn_io_create pfn_io_create;	/* Create IO manager */
>  	fxn_io_destroy pfn_io_destroy;	/* Destroy IO manager */
>  	fxn_io_onloaded pfn_io_on_loaded;	/* Notify of program loaded */
> diff --git a/drivers/dsp/bridge/core/tiomap3430.c
> b/drivers/dsp/bridge/core/tiomap3430.c
> index 99bf966..f6b421e 100644
> --- a/drivers/dsp/bridge/core/tiomap3430.c
> +++ b/drivers/dsp/bridge/core/tiomap3430.c
> @@ -192,11 +192,6 @@ static struct bridge_drv_interface drv_interface_fxns
> = {
>  	bridge_chnl_get_mgr_info,
>  	bridge_chnl_idle,
>  	bridge_chnl_register_notify,
> -	/* The following DEH functions are provided by tihelen_ue_deh.c */
> -	bridge_deh_create,
> -	bridge_deh_destroy,
> -	bridge_deh_notify,
> -	bridge_deh_register_notify,
>  	/* The following IO functions are provided by chnl_io.lib: */
>  	bridge_io_create,
>  	bridge_io_destroy,
> diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c
> index b1c8d8b..3f7eb47 100644
> --- a/drivers/dsp/bridge/pmgr/dev.c
> +++ b/drivers/dsp/bridge/pmgr/dev.c
> @@ -49,6 +49,7 @@
>  #include <dspbridge/io.h>
>  #include <dspbridge/msg.h>
>  #include <dspbridge/cmm.h>
> +#include <dspbridge/dspdeh.h>
> 
>  /*  ----------------------------------- This */
>  #include <dspbridge/dev.h>
> @@ -235,8 +236,7 @@ dsp_status dev_create_device(OUT struct dev_object
> **phDevObject,
>  		/* Only create DEH manager if we have an IO manager */
>  		if (DSP_SUCCEEDED(status)) {
>  			/* Instantiate the DEH module */
> -			status = (*dev_obj->bridge_interface.pfn_deh_create)
> -			    (&dev_obj->hdeh_mgr, dev_obj);
> +			status = bridge_deh_create(&dev_obj->hdeh_mgr, dev_obj);
>  		}
>  		/* Create DMM mgr . */
>  		status = dmm_create(&dev_obj->dmm_mgr,
> @@ -371,8 +371,7 @@ dsp_status dev_destroy_device(struct dev_object
> *hdev_obj)
> 
>  		if (dev_obj->hdeh_mgr) {
>  			/* Uninitialize DEH module. */
> -			(*dev_obj->bridge_interface.pfn_deh_destroy)
> -			    (dev_obj->hdeh_mgr);
> +			bridge_deh_destroy(dev_obj->hdeh_mgr);
>  			dev_obj->hdeh_mgr = NULL;
>  		}
>  		if (dev_obj->hcmm_mgr) {
> @@ -1117,10 +1116,6 @@ static void store_interface_fxns(struct
> bridge_drv_interface *drv_fxns,
>  		STORE_FXN(fxn_chnl_getmgrinfo, pfn_chnl_get_mgr_info);
>  		STORE_FXN(fxn_chnl_idle, pfn_chnl_idle);
>  		STORE_FXN(fxn_chnl_registernotify, pfn_chnl_register_notify);
> -		STORE_FXN(fxn_deh_create, pfn_deh_create);
> -		STORE_FXN(fxn_deh_destroy, pfn_deh_destroy);
> -		STORE_FXN(fxn_deh_notify, pfn_deh_notify);
> -		STORE_FXN(fxn_deh_registernotify, pfn_deh_register_notify);
>  		STORE_FXN(fxn_io_create, pfn_io_create);
>  		STORE_FXN(fxn_io_destroy, pfn_io_destroy);
>  		STORE_FXN(fxn_io_onloaded, pfn_io_on_loaded);
> @@ -1157,10 +1152,6 @@ static void store_interface_fxns(struct
> bridge_drv_interface *drv_fxns,
>  	DBC_ENSURE(intf_fxns->pfn_chnl_get_mgr_info != NULL);
>  	DBC_ENSURE(intf_fxns->pfn_chnl_idle != NULL);
>  	DBC_ENSURE(intf_fxns->pfn_chnl_register_notify != NULL);
> -	DBC_ENSURE(intf_fxns->pfn_deh_create != NULL);
> -	DBC_ENSURE(intf_fxns->pfn_deh_destroy != NULL);
> -	DBC_ENSURE(intf_fxns->pfn_deh_notify != NULL);
> -	DBC_ENSURE(intf_fxns->pfn_deh_register_notify != NULL);
>  	DBC_ENSURE(intf_fxns->pfn_io_create != NULL);
>  	DBC_ENSURE(intf_fxns->pfn_io_destroy != NULL);
>  	DBC_ENSURE(intf_fxns->pfn_io_on_loaded != NULL);
> diff --git a/drivers/dsp/bridge/rmgr/node.c
> b/drivers/dsp/bridge/rmgr/node.c
> index cdd60e6..23aed68 100644
> --- a/drivers/dsp/bridge/rmgr/node.c
> +++ b/drivers/dsp/bridge/rmgr/node.c
> @@ -69,6 +69,8 @@
>  #include <dspbridge/resourcecleanup.h>
>  #include <_tiomap.h>
> 
> +#include <dspbridge/dspdeh.h>
> +
>  #define HOSTPREFIX	  "/host"
>  #define PIPEPREFIX	  "/dbpipe"
> 
> @@ -2470,8 +2472,7 @@ dsp_status node_terminate(struct node_object *hnode,
> OUT dsp_status *pstatus)
>  			if (!hdeh_mgr)
>  				goto func_cont;
> 
> -			(*intf_fxns->pfn_deh_notify)(hdeh_mgr, DSP_SYSERROR,
> -							DSP_EXCEPTIONABORT);
> +			bridge_deh_notify(hdeh_mgr, DSP_SYSERROR,
> DSP_EXCEPTIONABORT);
>  		}
>  	}
>  func_cont:
> diff --git a/drivers/dsp/bridge/rmgr/proc.c
> b/drivers/dsp/bridge/rmgr/proc.c
> index f86958a..1cccc89 100644
> --- a/drivers/dsp/bridge/rmgr/proc.c
> +++ b/drivers/dsp/bridge/rmgr/proc.c
> @@ -1192,22 +1192,20 @@ dsp_status proc_register_notify(void *hprocessor,
> u32 event_mask,
>  				status =
>  				    dev_get_deh_mgr(p_proc_object->hdev_obj,
>  						    &hdeh_mgr);
> -				DBC_ASSERT(p_proc_object->
> -					   intf_fxns->pfn_deh_register_notify);
>  				status =
> -				    (*p_proc_object->
> -				     intf_fxns->pfn_deh_register_notify)
> -				    (hdeh_mgr, event_mask, notify_type,
> -				     hnotification);
> +					bridge_deh_register_notify(hdeh_mgr,
> +							event_mask,
> +							notify_type,
> +							hnotification);
>  			}
>  		} else {
>  			status = dev_get_deh_mgr(p_proc_object->hdev_obj,
>  						 &hdeh_mgr);
> -			DBC_ASSERT(p_proc_object->
> -				   intf_fxns->pfn_deh_register_notify);
>  			status =
> -			    (*p_proc_object->intf_fxns->pfn_deh_register_notify)
> -			    (hdeh_mgr, event_mask, notify_type, hnotification);
> +			    bridge_deh_register_notify(hdeh_mgr,
> +					    event_mask,
> +					    notify_type,
> +					    hnotification);
> 
>  		}
>  	}
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 12/14] dspbridge: move mmufault to deh
  2010-05-16 15:46 ` [PATCH 12/14] dspbridge: move mmufault to deh Felipe Contreras
@ 2010-05-17 19:11   ` Guzman Lugo, Fernando
  0 siblings, 0 replies; 31+ messages in thread
From: Guzman Lugo, Fernando @ 2010-05-17 19:11 UTC (permalink / raw)
  To: Felipe Contreras, linux-omap, Liu, Stanley, Jansson, Cris
  Cc: Ramirez Luna, Omar


+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 12/14] dspbridge: move mmufault to deh
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/Makefile         |    2 +-
>  drivers/dsp/bridge/core/mmu_fault.c |  100 ------------------------------
> -----
>  drivers/dsp/bridge/core/mmu_fault.h |   34 ------------
>  drivers/dsp/bridge/core/ue_deh.c    |   50 +++++++++++++++++-
>  4 files changed, 50 insertions(+), 136 deletions(-)
>  delete mode 100644 drivers/dsp/bridge/core/mmu_fault.c
>  delete mode 100644 drivers/dsp/bridge/core/mmu_fault.h
> 
> diff --git a/drivers/dsp/bridge/Makefile b/drivers/dsp/bridge/Makefile
> index 4c2f923..39624d4 100644
> --- a/drivers/dsp/bridge/Makefile
> +++ b/drivers/dsp/bridge/Makefile
> @@ -5,7 +5,7 @@ libservices = services/sync.o services/cfg.o \
>  		services/ntfy.o services/services.o
>  libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
>  		core/tiomap3430_pwr.o core/tiomap_io.o \
> -		core/mmu_fault.o core/ue_deh.o core/wdt.o core/dsp-clock.o
> +		core/ue_deh.o core/wdt.o core/dsp-clock.o
>  libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o
> pmgr/dspapi.o \
>  		pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
>  librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
> diff --git a/drivers/dsp/bridge/core/mmu_fault.c
> b/drivers/dsp/bridge/core/mmu_fault.c
> deleted file mode 100644
> index 49034cf..0000000
> --- a/drivers/dsp/bridge/core/mmu_fault.c
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -/*
> - * mmu_fault.c
> - *
> - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
> - *
> - * Implements DSP MMU fault handling functions.
> - *
> - * Copyright (C) 2005-2006 Texas Instruments, Inc.
> - *
> - * This package is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
> - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
> - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
> - */
> -
> -/*  ----------------------------------- DSP/BIOS Bridge */
> -#include <dspbridge/std.h>
> -#include <dspbridge/dbdefs.h>
> -#include <dspbridge/errbase.h>
> -
> -/*  ----------------------------------- Trace & Debug */
> -#include <dspbridge/host_os.h>
> -#include <dspbridge/dbc.h>
> -
> -/*  ----------------------------------- OS Adaptation Layer */
> -#include <dspbridge/drv.h>
> -
> -/*  ----------------------------------- Link Driver */
> -#include <dspbridge/dspdeh.h>
> -
> -/* ------------------------------------ Hardware Abstraction Layer */
> -#include <hw_defs.h>
> -#include <hw_mmu.h>
> -
> -/*  ----------------------------------- This */
> -#include "_deh.h"
> -#include <dspbridge/cfg.h>
> -#include "_tiomap_mmu.h"
> -#include "_tiomap.h"
> -#include "mmu_fault.h"
> -
> -/*
> - *  ======== mmu_fault_dpc ========
> - *      Deferred procedure call to handle DSP MMU fault.
> - */
> -void mmu_fault_dpc(IN unsigned long pRefData)
> -{
> -	struct deh_mgr *hdeh_mgr = (struct deh_mgr *)pRefData;
> -
> -	if (!hdeh_mgr)
> -		return;
> -
> -	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0L);
> -}
> -
> -/*
> - *  ======== mmu_fault_isr ========
> - *      ISR to be triggered by a DSP MMU fault interrupt.
> - */
> -irqreturn_t mmu_fault_isr(int irq, IN void *pRefData)
> -{
> -	struct deh_mgr *deh_mgr_obj = pRefData;
> -	struct cfg_hostres *resources;
> -	u32 dmmu_event_mask;
> -
> -	if (!deh_mgr_obj)
> -		return IRQ_HANDLED;
> -
> -	resources = deh_mgr_obj->hbridge_context->resources;
> -	if (!resources) {
> -		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
> -				__func__);
> -		return IRQ_HANDLED;
> -	}
> -
> -	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
> -	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
> -		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj-
> >fault_addr);
> -		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n",
> __func__,
> -				dmmu_event_mask, deh_mgr_obj->fault_addr);
> -		/*
> -		 * Schedule a DPC directly. In the future, it may be
> -		 * necessary to check if DSP MMU fault is intended for
> -		 * Bridge.
> -		 */
> -		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
> -
> -		/* Disable the MMU events, else once we clear it will
> -		 * start to raise INTs again */
> -		hw_mmu_event_disable(resources->dw_dmmu_base,
> -				HW_MMU_TRANSLATION_FAULT);
> -	} else {
> -		hw_mmu_event_disable(resources->dw_dmmu_base,
> -				HW_MMU_ALL_INTERRUPTS);
> -	}
> -	return IRQ_HANDLED;
> -}
> diff --git a/drivers/dsp/bridge/core/mmu_fault.h
> b/drivers/dsp/bridge/core/mmu_fault.h
> deleted file mode 100644
> index 537e6e7..0000000
> --- a/drivers/dsp/bridge/core/mmu_fault.h
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -/*
> - * mmu_fault.h
> - *
> - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
> - *
> - * Defines DSP MMU fault handling functions.
> - *
> - * Copyright (C) 2005-2006 Texas Instruments, Inc.
> - *
> - * This package is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
> - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
> - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
> - */
> -
> -#ifndef MMU_FAULT_
> -#define MMU_FAULT_
> -
> -/*
> - *  ======== mmu_fault_dpc ========
> - *      Deferred procedure call to handle DSP MMU fault.
> - */
> -void mmu_fault_dpc(IN unsigned long pRefData);
> -
> -/*
> - *  ======== mmu_fault_isr ========
> - *      ISR to be triggered by a DSP MMU fault interrupt.
> - */
> -irqreturn_t mmu_fault_isr(int irq, IN void *pRefData);
> -
> -#endif /* MMU_FAULT_ */
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 6035757..d44c895 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -46,7 +46,6 @@
>  #include <hw_mmu.h>
> 
>  /*  ----------------------------------- This */
> -#include "mmu_fault.h"
>  #include "_tiomap.h"
>  #include "_deh.h"
>  #include "_tiomap_mmu.h"
> @@ -62,6 +61,55 @@
> 
>  static struct omap_dm_timer *timer;
> 
> +static void mmu_fault_dpc(unsigned long data)
> +{
> +	struct deh_mgr *hdeh_mgr = (void *)data;
> +
> +	if (!hdeh_mgr)
> +		return;
> +
> +	bridge_deh_notify(hdeh_mgr, DSP_MMUFAULT, 0);
> +}
> +
> +static irqreturn_t mmu_fault_isr(int irq, void *data)
> +{
> +	struct deh_mgr *deh_mgr_obj = data;
> +	struct cfg_hostres *resources;
> +	u32 dmmu_event_mask;
> +
> +	if (!deh_mgr_obj)
> +		return IRQ_HANDLED;
> +
> +	resources = deh_mgr_obj->hbridge_context->resources;
> +	if (!resources) {
> +		dev_dbg(bridge, "%s: Failed to get Host Resources\n",
> +				__func__);
> +		return IRQ_HANDLED;
> +	}
> +
> +	hw_mmu_event_status(resources->dw_dmmu_base, &dmmu_event_mask);
> +	if (dmmu_event_mask == HW_MMU_TRANSLATION_FAULT) {
> +		hw_mmu_fault_addr_read(resources->dw_dmmu_base, &deh_mgr_obj-
> >fault_addr);
> +		dev_info(bridge, "%s: status=0x%x, fault_addr=0x%x\n",
> __func__,
> +				dmmu_event_mask, deh_mgr_obj->fault_addr);
> +		/*
> +		 * Schedule a DPC directly. In the future, it may be
> +		 * necessary to check if DSP MMU fault is intended for
> +		 * Bridge.
> +		 */
> +		tasklet_schedule(&deh_mgr_obj->dpc_tasklet);
> +
> +		/* Disable the MMU events, else once we clear it will
> +		 * start to raise INTs again */
> +		hw_mmu_event_disable(resources->dw_dmmu_base,
> +				HW_MMU_TRANSLATION_FAULT);
> +	} else {
> +		hw_mmu_event_disable(resources->dw_dmmu_base,
> +				HW_MMU_ALL_INTERRUPTS);
> +	}
> +	return IRQ_HANDLED;
> +}
> +
>  dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
>  		struct dev_object *hdev_obj)
>  {
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-17 19:09   ` Guzman Lugo, Fernando
@ 2010-05-17 19:39     ` Jansson, Cris
  2010-05-17 21:13       ` Felipe Contreras
  0 siblings, 1 reply; 31+ messages in thread
From: Jansson, Cris @ 2010-05-17 19:39 UTC (permalink / raw)
  To: Guzman Lugo, Fernando, Felipe Contreras, linux-omap, Liu, Stanley
  Cc: Ramirez Luna, Omar

Fernando,

Thanks for forwarding the thread.

In wait_for_timer(), should return be used inside the loop?  It will result in omap_dm_timer_disable(timer) not being called.  I believe it should be called in all outcomes.

> +	for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
> +		if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
> +			return;
> +
> +	pr_err("%s: GPTimer interrupt failed\n", __func__);
> 
>  	omap_dm_timer_disable(timer);
>  }

Best Regards,
 
Cris

-----Original Message-----
From: Guzman Lugo, Fernando 
Sent: Monday, May 17, 2010 2:09 PM
To: Felipe Contreras; linux-omap; Liu, Stanley; Jansson, Cris
Cc: Ramirez Luna, Omar
Subject: RE: [PATCH 02/14] dspbridge: deh: trivial cleanups



+Cris
+Stanley
Loop in DSP guys in case they would have something to add.

> -----Original Message-----
> From: Felipe Contreras [mailto:felipe.contreras@gmail.com]
> Sent: Sunday, May 16, 2010 10:46 AM
> To: linux-omap
> Cc: Ramirez Luna, Omar; Guzman Lugo, Fernando; Felipe Contreras
> Subject: [PATCH 02/14] dspbridge: deh: trivial cleanups
> 
> No functional changes.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  drivers/dsp/bridge/core/ue_deh.c |  112 ++++++++++++++-------------------
> -----
>  1 files changed, 41 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/core/ue_deh.c
> b/drivers/dsp/bridge/core/ue_deh.c
> index 48c11e9..605cec7 100644
> --- a/drivers/dsp/bridge/core/ue_deh.c
> +++ b/drivers/dsp/bridge/core/ue_deh.c
> @@ -60,11 +60,6 @@
>  /* Max time to check for GP Timer IRQ */
>  #define GPTIMER_IRQ_WAIT_MAX_CNT       1000
> 
> -static struct hw_mmu_map_attrs_t map_attrs = { HW_LITTLE_ENDIAN,
> -	HW_ELEM_SIZE16BIT,
> -	HW_MMU_CPUES
> -};
> -
>  static void *dummy_va_addr;
> 
>  static struct omap_dm_timer *timer;
> @@ -72,7 +67,7 @@ static struct omap_dm_timer *timer;
>  dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
>  		struct dev_object *hdev_obj)
>  {
> -	dsp_status status = DSP_SOK;
> +	dsp_status status;
>  	struct deh_mgr *deh_mgr;
>  	struct bridge_dev_context *hbridge_context = NULL;
> 
> @@ -81,23 +76,20 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	 *  the base image. */
>  	/* Get WMD context info. */
>  	dev_get_bridge_context(hdev_obj, &hbridge_context);
> -	DBC_ASSERT(hbridge_context);
> -	dummy_va_addr = NULL;
>  	/* Allocate IO manager object: */
>  	deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
>  	if (!deh_mgr) {
>  		status = -ENOMEM;
> -		goto leave;
> +		goto err;
>  	}
> 
>  	/* Create an NTFY object to manage notifications */
>  	deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
> -	if (deh_mgr->ntfy_obj) {
> -		ntfy_init(deh_mgr->ntfy_obj);
> -	} else {
> +	if (!deh_mgr->ntfy_obj) {
>  		status = -ENOMEM;
>  		goto err;
>  	}
> +	ntfy_init(deh_mgr->ntfy_obj);
> 
>  	/* Create a MMUfault DPC */
>  	tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
> @@ -110,32 +102,25 @@ dsp_status bridge_deh_create(struct deh_mgr
> **ret_deh_mgr,
>  	deh_mgr->err_info.dw_val3 = 0L;
> 
>  	/* Install ISR function for DSP MMU fault */
> -	if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> -					"DspBridge\tiommu fault",
> -					(void *)deh_mgr)) == 0)
> -		status = DSP_SOK;
> -	else
> -		status = -EPERM;
> +	status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
> +			"DspBridge\tiommu fault", deh_mgr);
> +	if (status < 0)
> +		goto err;
> 
> -err:
> -	if (DSP_FAILED(status)) {
> -		/* If create failed, cleanup */
> -		bridge_deh_destroy(deh_mgr);
> -		deh_mgr = NULL;
> -	} else {
> -		timer = omap_dm_timer_request_specific(
> -					GPTIMER_FOR_DSP_MMU_FAULT);
> -		if (timer) {
> -			omap_dm_timer_disable(timer);
> -		} else {
> -			pr_err("%s: GPTimer not available\n", __func__);
> -			return -ENODEV;
> -		}
> +	timer = omap_dm_timer_request_specific(GPTIMER_FOR_DSP_MMU_FAULT);
> +	if (!timer) {
> +		pr_err("%s: GPTimer not available\n", __func__);
> +		status = -ENODEV;
> +		goto err;
>  	}
> +	omap_dm_timer_disable(timer);
> 
> -leave:
>  	*ret_deh_mgr = deh_mgr;
> +	return 0;
> 
> +err:
> +	bridge_deh_destroy(deh_mgr);
> +	*ret_deh_mgr = NULL;
>  	return status;
>  }
> 
> @@ -164,36 +149,31 @@ dsp_status bridge_deh_destroy(struct deh_mgr
> *deh_mgr)
>  	omap_dm_timer_free(timer);
>  	timer = NULL;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  dsp_status bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32
> event_mask,
>  		u32 notify_type,
>  		struct dsp_notification *hnotification)
>  {
> -	dsp_status status = DSP_SOK;
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
>  	if (event_mask)
> -		status = ntfy_register(deh_mgr->ntfy_obj, hnotification,
> -					event_mask, notify_type);
> +		return ntfy_register(deh_mgr->ntfy_obj, hnotification,
> +				event_mask, notify_type);
>  	else
> -		status = ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
> -
> -	return status;
> +		return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
>  }
> 
>  static void wait_for_timer(void)
>  {
> -	u32 cnt = 0;
> +	int c;
> 
>  	omap_dm_timer_enable(timer);
> 
>  	/* Enable overflow interrupt */
> -	omap_dm_timer_set_int_enable(timer,
> -			GPTIMER_IRQ_OVERFLOW);
> +	omap_dm_timer_set_int_enable(timer, GPTIMER_IRQ_OVERFLOW);
>  	/*
>  	 * Set counter value to overflow counter after
>  	 * one tick and start timer.
> @@ -204,15 +184,11 @@ static void wait_for_timer(void)
>  	udelay(80);
> 
>  	/* Check interrupt status and wait for interrupt */
> -	cnt = 0;
> -	while (!(omap_dm_timer_read_status(timer) &
> -				GPTIMER_IRQ_OVERFLOW)) {
> -		if (cnt++ >= GPTIMER_IRQ_WAIT_MAX_CNT) {
> -			pr_err("%s: GPTimer interrupt failed\n",
> -					__func__);
> -			break;
> -		}
> -	}
> +	for (c = 0; c < GPTIMER_IRQ_WAIT_MAX_CNT; c++)
> +		if ((omap_dm_timer_read_status(timer) & GPTIMER_IRQ_OVERFLOW))
> +			return;
> +
> +	pr_err("%s: GPTimer interrupt failed\n", __func__);
> 
>  	omap_dm_timer_disable(timer);
>  }
> @@ -220,16 +196,19 @@ static void wait_for_timer(void)
>  void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32
> dwErrInfo)
>  {
>  	struct bridge_dev_context *dev_context;
> -	dsp_status status = DSP_SOK;
>  	u32 hw_mmu_max_tlb_count = 31;
>  	struct cfg_hostres *resources;
> -	hw_status hw_status_obj;
> +	struct hw_mmu_map_attrs_t map_attrs = {
> +		.endianism = HW_LITTLE_ENDIAN,
> +		.element_size = HW_ELEM_SIZE16BIT,
> +		.mixed_size = HW_MMU_CPUES,
> +	};
> 
>  	if (!deh_mgr)
>  		return;
> 
>  	dev_info(bridge, "%s: device exception\n", __func__);
> -	dev_context = (struct bridge_dev_context *)deh_mgr->hbridge_context;
> +	dev_context = deh_mgr->hbridge_context;
>  	resources = dev_context->resources;
> 
>  	switch (ulEventMask) {
> @@ -256,8 +235,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			(unsigned int) deh_mgr->err_info.dw_val2,
>  			(unsigned int) fault_addr);
>  		dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
> -		dev_context = (struct bridge_dev_context *)
> -			deh_mgr->hbridge_context;
> 
>  		print_dsp_trace_buffer(dev_context);
>  		dump_dl_modules(dev_context);
> @@ -272,20 +249,16 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  			dev_context->num_tlb_entries =
>  				dev_context->fixed_tlb_entries;
>  		}
> -		if (DSP_SUCCEEDED(status)) {
> -			hw_status_obj =
> -				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);
> -		}
> +		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(deh_mgr->hbridge_context);
> +		dump_dsp_stack(dev_context);
>  		break;
>  #ifdef CONFIG_BRIDGE_NTFY_PWRERR
>  	case DSP_PWRERROR:
> @@ -334,9 +307,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32
> ulEventMask, u32 dwErrInfo)
>  dsp_status bridge_deh_get_info(struct deh_mgr *deh_mgr,
>  		struct dsp_errorinfo *pErrInfo)
>  {
> -	DBC_REQUIRE(deh_mgr);
> -	DBC_REQUIRE(pErrInfo);
> -
>  	if (!deh_mgr)
>  		return -EFAULT;
> 
> @@ -346,7 +316,7 @@ dsp_status bridge_deh_get_info(struct deh_mgr
> *deh_mgr,
>  	pErrInfo->dw_val2 = deh_mgr->err_info.dw_val2;
>  	pErrInfo->dw_val3 = deh_mgr->err_info.dw_val3;
> 
> -	return DSP_SOK;
> +	return 0;
>  }
> 
>  void bridge_deh_release_dummy_mem(void)
> --
> 1.7.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-17 19:39     ` Jansson, Cris
@ 2010-05-17 21:13       ` Felipe Contreras
  2010-05-17 21:52         ` Jansson, Cris
  0 siblings, 1 reply; 31+ messages in thread
From: Felipe Contreras @ 2010-05-17 21:13 UTC (permalink / raw)
  To: Jansson, Cris
  Cc: Guzman Lugo, Fernando, linux-omap, Liu, Stanley, Ramirez Luna, Omar

Hi Cris,

On Mon, May 17, 2010 at 10:39 PM, Jansson, Cris <cjansson@ti.com> wrote:
> Thanks for forwarding the thread.
>
> In wait_for_timer(), should return be used inside the loop?  It will result in omap_dm_timer_disable(timer) not being called.  I believe it should be called in all outcomes.

Yes, that's a mistake I already acknowledged. The question is: can we
disable the timer _before_ the DSP has finished dumping the stack?

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-17 21:13       ` Felipe Contreras
@ 2010-05-17 21:52         ` Jansson, Cris
  2010-05-17 22:10           ` Liu, Stanley
  0 siblings, 1 reply; 31+ messages in thread
From: Jansson, Cris @ 2010-05-17 21:52 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Guzman Lugo, Fernando, linux-omap, Liu, Stanley, Ramirez Luna, Omar

The safe thing to do is disable the timer after the DSP has completed the dump.  During the dump processing, the DSP will clear the timer interrupt. I don't know what would happen if the timer were disabled prior to that.

Best Regards,
 
Cris

-----Original Message-----
From: Felipe Contreras [mailto:felipe.contreras@gmail.com] 
Sent: Monday, May 17, 2010 4:14 PM
To: Jansson, Cris
Cc: Guzman Lugo, Fernando; linux-omap; Liu, Stanley; Ramirez Luna, Omar
Subject: Re: [PATCH 02/14] dspbridge: deh: trivial cleanups

Hi Cris,

On Mon, May 17, 2010 at 10:39 PM, Jansson, Cris <cjansson@ti.com> wrote:
> Thanks for forwarding the thread.
>
> In wait_for_timer(), should return be used inside the loop?  It will result in omap_dm_timer_disable(timer) not being called.  I believe it should be called in all outcomes.

Yes, that's a mistake I already acknowledged. The question is: can we
disable the timer _before_ the DSP has finished dumping the stack?

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

* RE: [PATCH 02/14] dspbridge: deh: trivial cleanups
  2010-05-17 21:52         ` Jansson, Cris
@ 2010-05-17 22:10           ` Liu, Stanley
  0 siblings, 0 replies; 31+ messages in thread
From: Liu, Stanley @ 2010-05-17 22:10 UTC (permalink / raw)
  To: Jansson, Cris, Felipe Contreras
  Cc: Guzman Lugo, Fernando, linux-omap, Ramirez Luna, Omar

If "disable" means cutting off the clock of the timer, then no.
The clock for the timer is needed so DSP can clear the timer IRQ status register.

If it is to stop the timer from counting, then it is fine.

-----Original Message-----
From: Jansson, Cris 
Sent: Monday, May 17, 2010 4:53 PM
To: Felipe Contreras
Cc: Guzman Lugo, Fernando; linux-omap; Liu, Stanley; Ramirez Luna, Omar
Subject: RE: [PATCH 02/14] dspbridge: deh: trivial cleanups

The safe thing to do is disable the timer after the DSP has completed the dump.  During the dump processing, the DSP will clear the timer interrupt. I don't know what would happen if the timer were disabled prior to that.

Best Regards,
 
Cris

-----Original Message-----
From: Felipe Contreras [mailto:felipe.contreras@gmail.com] 
Sent: Monday, May 17, 2010 4:14 PM
To: Jansson, Cris
Cc: Guzman Lugo, Fernando; linux-omap; Liu, Stanley; Ramirez Luna, Omar
Subject: Re: [PATCH 02/14] dspbridge: deh: trivial cleanups

Hi Cris,

On Mon, May 17, 2010 at 10:39 PM, Jansson, Cris <cjansson@ti.com> wrote:
> Thanks for forwarding the thread.
>
> In wait_for_timer(), should return be used inside the loop?  It will result in omap_dm_timer_disable(timer) not being called.  I believe it should be called in all outcomes.

Yes, that's a mistake I already acknowledged. The question is: can we
disable the timer _before_ the DSP has finished dumping the stack?

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2010-05-17 22:10 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-16 15:45 [PATCH 00/14] dspbridge: rewrite deh Felipe Contreras
2010-05-16 15:45 ` [PATCH 01/14] dspbridge: deh: refactor into wait_for_timer() Felipe Contreras
2010-05-17 19:08   ` Guzman Lugo, Fernando
2010-05-16 15:45 ` [PATCH 02/14] dspbridge: deh: trivial cleanups Felipe Contreras
2010-05-16 22:02   ` Guzman Lugo, Fernando
2010-05-16 22:13     ` Felipe Contreras
2010-05-17  2:31       ` Guzman Lugo, Fernando
2010-05-17 19:09   ` Guzman Lugo, Fernando
2010-05-17 19:39     ` Jansson, Cris
2010-05-17 21:13       ` Felipe Contreras
2010-05-17 21:52         ` Jansson, Cris
2010-05-17 22:10           ` Liu, Stanley
2010-05-16 15:45 ` [PATCH 03/14] dspbridge: mmufault: " Felipe Contreras
2010-05-16 15:45 ` [PATCH 04/14] dspbridge: deh: free dummy page immediately Felipe Contreras
2010-05-17 19:09   ` Guzman Lugo, Fernando
2010-05-16 15:45 ` [PATCH 05/14] dspbridge: remove unused code Felipe Contreras
2010-05-16 15:45 ` [PATCH 06/14] dspbridge: mmu: add hw_mmu_tlb_flush_all() Felipe Contreras
2010-05-17 19:10   ` Guzman Lugo, Fernando
2010-05-16 15:45 ` [PATCH 07/14] dspbridge: deh: ensure only tlb #0 is enabled Felipe Contreras
2010-05-17 19:10   ` Guzman Lugo, Fernando
2010-05-16 15:45 ` [PATCH 08/14] dspbridge: deh: refactor in mmu_fault_print_stack() Felipe Contreras
2010-05-17 19:11   ` Guzman Lugo, Fernando
2010-05-16 15:46 ` [PATCH 09/14] dspbridge: deh: remove get_info Felipe Contreras
2010-05-16 15:46 ` [PATCH 10/14] dspbridge: deh: remove err_info Felipe Contreras
2010-05-16 15:46 ` [PATCH 11/14] dspbridge: access deh directly Felipe Contreras
2010-05-17 19:11   ` Guzman Lugo, Fernando
2010-05-16 15:46 ` [PATCH 12/14] dspbridge: move mmufault to deh Felipe Contreras
2010-05-17 19:11   ` Guzman Lugo, Fernando
2010-05-16 15:46 ` [PATCH 13/14] dspbridge: deh: tidying up Felipe Contreras
2010-05-16 15:46 ` [PATCH 14/14] dspbridge: deh: update copyright notice Felipe Contreras
2010-05-17 19:08 ` [PATCH 00/14] dspbridge: rewrite deh Guzman Lugo, Fernando

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.