Skip to contentSkip to conversation

DPC Removal from services

PATCH Applied Omar Ramirez Luna 1 participant 6 messages Jan 15, 2010 – Jan 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover DPC Removal from services

This patches remove the DPC custom implementation and wrappers.

They should be applied on top of "trivial cleanups" set and are part of the current patch queue.

Omar Ramirez Luna (4):
DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
DSPBRIDGE: Remove DPC module from SERVICES layer
DSPBRIDGE: Remove DPC object structure

 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |    1 -
 arch/arm/plat-omap/include/dspbridge/dpc.h      |  145 -------------
 arch/arm/plat-omap/include/dspbridge/io_sm.h    |    2 +-
 drivers/dsp/bridge/Makefile                     |    3 +-
 drivers/dsp/bridge/pmgr/chnl.c                  |    1 -
 drivers/dsp/bridge/services/dpc.c               |  246 -----------------------
 drivers/dsp/bridge/services/services.c          |   10 +-
 drivers/dsp/bridge/wmd/_deh.h                   |    5 +-
 drivers/dsp/bridge/wmd/io_sm.c                  |   86 ++++++--
 drivers/dsp/bridge/wmd/mmu_fault.c              |   12 +-
 drivers/dsp/bridge/wmd/mmu_fault.h              |    2 +-
 drivers/dsp/bridge/wmd/ue_deh.c                 |   13 +-
 12 files changed, 87 insertions(+), 439 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
 delete mode 100644 drivers/dsp/bridge/services/dpc.c
#1 lore raw

PATCH 1/4 DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers

Remove DPC wrappers and replace with direct Linux calls.

These changes apply to IO DPC and MMUfault DPC

---
 arch/arm/plat-omap/include/dspbridge/dpc.h |   90 +++--------------
 drivers/dsp/bridge/services/dpc.c          |  144 +---------------------------
 drivers/dsp/bridge/wmd/io_sm.c             |   71 +++++++++++++-
 drivers/dsp/bridge/wmd/mmu_fault.c         |   24 ++++-
 drivers/dsp/bridge/wmd/ue_deh.c            |   31 ++++++-
 5 files changed, 130 insertions(+), 230 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +16 -74
index 870a1b2..0c60342 100644
@@ -19,8 +19,6 @@
 #ifndef DPC_
 #define DPC_
 
-	struct DPC_OBJECT;
-
 /*
  *  ======== DPC_PROC ========
  *  Purpose:
@@ -40,64 +38,22 @@
  */
        typedef void(*DPC_PROC) (void *pRefData);
 
-/*
- *  ======== DPC_Cancel ========
- *  Purpose:
- *      Cancel a DPC previously scheduled by DPC_Schedule.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        Scheduled DPC, if any, is cancelled.
- *      DSP_SFALSE:     No DPC is currently scheduled for execution.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *  Ensures:
- *      If the DPC has already executed, is executing, or was not yet
- *      scheduled, this function will have no effect.
- */
-       extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
+/* The DPC object, passed to our priority event callback routine: */
+struct DPC_OBJECT {
+	u32 dwSignature;	/* Used for object validation.   */
+	void *pRefData;		/* Argument for client's DPC.    */
+	DPC_PROC pfnDPC;	/* Client's DPC.                 */
+	u32 numRequested;	/* Number of requested DPC's.      */
+	u32 numScheduled;	/* Number of executed DPC's.      */
+	struct tasklet_struct dpc_tasklet;
 
-/*
- *  ======== DPC_Create ========
- *  Purpose:
- *      Create a DPC object, allowing a client's own DPC procedure to be
- *      scheduled for a call with client reference data.
- *  Parameters:
- *      phDPC:          Pointer to location to store DPC object.
- *      pfnDPC:         Client's DPC procedure.
- *      pRefData:       Pointer to user-defined reference data.
- *  Returns:
- *      DSP_SOK:        DPC object created.
- *      DSP_EPOINTER:   phDPC == NULL or pfnDPC == NULL.
- *      DSP_EMEMORY:    Insufficient memory.
- *  Requires:
- *      Must not be called at interrupt time.
- *  Ensures:
- *      DSP_SOK: DPC object is created;
- *      else: *phDPC is set to NULL.
- */
-       extern DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC,
-					   IN DPC_PROC pfnDPC,
-					   IN void *pRefData);
+#ifdef DEBUG
+	u32 cEntryCount;	/* Number of times DPC reentered. */
+	u32 numRequestedMax;	/* Keep track of max pending DPC's. */
+#endif
 
-/*
- *  ======== DPC_Destroy ========
- *  Purpose:
- *      Cancel the last scheduled DPC, and deallocate a DPC object previously
- *      allocated with DPC_Create().Frees the Object only if the thread and
- *      the events are terminated successfuly.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        Success.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *      All DPC's scheduled for the DPC object must have completed their
- *      processing.
- *  Ensures:
- *      (SUCCESS && hDPC is NULL) or DSP_EFAILED status
- */
-       extern DSP_STATUS DPC_Destroy(IN struct DPC_OBJECT *hDPC);
+	spinlock_t dpc_lock;
+};
 
 /*
  *  ======== DPC_Exit ========
@@ -125,21 +81,7 @@
  */
        extern bool DPC_Init(void);
 
-/*
- *  ======== DPC_Schedule ========
- *  Purpose:
- *      Schedule a deferred procedure call to be executed at a later time.
- *      Latency and order of DPC execution is platform specific.
- *  Parameters:
- *      hDPC:           A DPC object handle created in DPC_Create().
- *  Returns:
- *      DSP_SOK:        An event is scheduled for deferred processing.
- *      DSP_EHANDLE:    Invalid hDPC.
- *  Requires:
- *      See requirements for DPC_PROC.
- *  Ensures:
- *      DSP_SOK:        The DPC will not be called before this function returns.
- */
-       extern DSP_STATUS DPC_Schedule(IN struct DPC_OBJECT *hDPC);
+/*  ----------------------------------- Function Prototypes */
+ void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
 
 #endif				/* DPC_ */
drivers/dsp/bridge/services/dpc.c +1 -143

166 lines not on this page · raw message

drivers/dsp/bridge/wmd/io_sm.c +65 -6

104 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +20 -4
index 05a7f55..057fe65 100644
@@ -77,7 +77,7 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 	struct WMD_DEV_CONTEXT *pDevContext;
 	struct CFG_HOSTRES resources;
 	DSP_STATUS status = DSP_SOK;
-
+	unsigned long flags;
 
 	DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
        DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -98,14 +98,30 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 				"0x%x\n", dmmuEventMask);
 			printk(KERN_INFO "***** DSPMMU FAULT ***** faultAddr "
 				"0x%x\n", faultAddr);
-			/* Disable the MMU events, else once we clear it will
-			 * start to raise INTs again */
 			/*
 			 * Schedule a DPC directly. In the future, it may be
 			 * necessary to check if DSP MMU fault is intended for
 			 * Bridge.
 			 */
-			DPC_Schedule(pDehMgr->hMmuFaultDpc);
+			/* Increment count of DPC's pending. */
+			spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
+						flags);
+			pDehMgr->hMmuFaultDpc->numRequested++;
+			spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
+						flags);
+
+			/* Schedule DPC */
+			tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+#ifdef DEBUG
+			if (pDehMgr->hMmuFaultDpc->numRequested >
+			   pDehMgr->hMmuFaultDpc->numScheduled +
+			   pDehMgr->hMmuFaultDpc->numRequestedMax) {
+				pDehMgr->hMmuFaultDpc->numRequestedMax =
+					pDehMgr->hMmuFaultDpc->numRequested -
+					pDehMgr->hMmuFaultDpc->numScheduled;
+			}
+#endif
+
 			/* Reset errInfo structure before use. */
 			pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
 			pDehMgr->errInfo.dwVal1 = faultAddr >> 16;
drivers/dsp/bridge/wmd/ue_deh.c +28 -3
index c480f62..d4d45d4 100644
@@ -91,8 +91,27 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 			status = NTFY_Create(&pDehMgr->hNtfy);
 
 		/* Create a DPC object. */
-		status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
-				   (void *)pDehMgr);
+		MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
+				SIGNATURE);
+		if (pDehMgr->hMmuFaultDpc) {
+			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
+				DPC_DeferredProcedure,
+				(u32)pDehMgr->hMmuFaultDpc);
+			/* Fill out DPC Object */
+			pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
+			pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
+			pDehMgr->hMmuFaultDpc->numRequested = 0;
+			pDehMgr->hMmuFaultDpc->numScheduled = 0;
+#ifdef DEBUG
+			pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
+			pDehMgr->hMmuFaultDpc->cEntryCount = 0;
+#endif
+			spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
+		} else {
+			DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
+			status = DSP_EMEMORY;
+		}
+
 		if (DSP_SUCCEEDED(status))
 			status = DEV_GetDevNode(hDevObject, &hDevNode);
 
@@ -144,7 +163,13 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
 			(void)NTFY_Delete(pDehMgr->hNtfy);
 		/* Disable DSP MMU fault */
 		free_irq(INT_DSP_MMU_IRQ, pDehMgr);
-		(void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
+
+		/* Free DPC object */
+		tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+		MEM_FreeObject(pDehMgr->hMmuFaultDpc);
+		pDehMgr->hMmuFaultDpc = NULL;
+		DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
 		/* Deallocate the DEH manager object */
 		MEM_FreeObject(pDehMgr);
 	}
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 2/4 DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault

Remove DeferredProcedure which is used as a wrapper to call either IO or MMUfault DPCs. This also removes a custom typedef.

---
 arch/arm/plat-omap/include/dspbridge/dpc.h   |   23 ---------------
 arch/arm/plat-omap/include/dspbridge/io_sm.h |    2 +-
 drivers/dsp/bridge/services/dpc.c            |   36 -----------------------
 drivers/dsp/bridge/wmd/io_sm.c               |   40 +++++++++++++++++--------
 drivers/dsp/bridge/wmd/mmu_fault.c           |    2 +-
 drivers/dsp/bridge/wmd/mmu_fault.h           |    2 +-
 drivers/dsp/bridge/wmd/ue_deh.c              |    5 +--
 7 files changed, 31 insertions(+), 79 deletions(-)
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -23
index 0c60342..b22140f 100644
@@ -19,30 +19,10 @@
 #ifndef DPC_
 #define DPC_
 
-/*
- *  ======== DPC_PROC ========
- *  Purpose:
- *      Deferred processing routine.  Typically scheduled from an ISR to
- *      complete I/O processing.
- *  Parameters:
- *      pRefData:   Ptr to user data: passed in via ISR_ScheduleDPC.
- *  Returns:
- *  Requires:
- *      The DPC should not block, or otherwise acquire resources.
- *      Interrupts to the processor are enabled.
- *      DPC_PROC executes in a critical section.
- *  Ensures:
- *      This DPC will not be reenterred on the same thread.
- *      However, the DPC may take hardware interrupts during execution.
- *      Interrupts to the processor are enabled.
- */
-       typedef void(*DPC_PROC) (void *pRefData);
-
 /* The DPC object, passed to our priority event callback routine: */
 struct DPC_OBJECT {
 	u32 dwSignature;	/* Used for object validation.   */
 	void *pRefData;		/* Argument for client's DPC.    */
-	DPC_PROC pfnDPC;	/* Client's DPC.                 */
 	u32 numRequested;	/* Number of requested DPC's.      */
 	u32 numScheduled;	/* Number of executed DPC's.      */
 	struct tasklet_struct dpc_tasklet;
@@ -81,7 +61,4 @@ struct DPC_OBJECT {
  */
        extern bool DPC_Init(void);
 
-/*  ----------------------------------- Function Prototypes */
- void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
-
 #endif				/* DPC_ */
arch/arm/plat-omap/include/dspbridge/io_sm.h +1 -1
index 77f9e25..67e3834 100644
@@ -77,7 +77,7 @@
  *  Ensures:
  *      Non-preemptible (but interruptible).
  */
-	extern void IO_DPC(IN OUT void *pRefData);
+	extern void IO_DPC(IN OUT unsigned long pRefData);
 
 /*
  *  ======== IO_ISR ========
drivers/dsp/bridge/services/dpc.c +0 -36
index 10bd792..bbb2d47 100644
@@ -66,39 +66,3 @@ bool DPC_Init(void)
 	return true;
 }
 
-/*
- *  ======== DeferredProcedure ========
- *  Purpose:
- *      Main DPC routine.  This is called by host OS DPC callback
- *      mechanism with interrupts enabled.
- */
-void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
-{
-	struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
-	/* read numRequested in local variable */
-	u32 requested;
-	u32 serviced;
-
-	DBC_Require(pDPCObject != NULL);
-	requested = pDPCObject->numRequested;
-	serviced = pDPCObject->numScheduled;
-
-	GT_1trace(DPC_DebugMask, GT_ENTER, "> DPC_DeferredProcedure "
-		  "pDeferredContext=%x\n", pDeferredContext);
-	/* Rollover taken care of using != instead of < */
-	if (serviced != requested) {
-		if (pDPCObject->pfnDPC != NULL) {
-			/* Process pending DPC's: */
-			do {
-				/* Call client's DPC: */
-				(*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
-				serviced++;
-			} while (serviced != requested);
-		}
-		pDPCObject->numScheduled = requested;
-	}
-	GT_2trace(DPC_DebugMask, GT_ENTER,
-		  "< DPC_DeferredProcedure requested %d"
-		  " serviced %d\n", requested, serviced);
-}
-
drivers/dsp/bridge/wmd/io_sm.c +27 -13
index b7b7bd9..470c83b 100644
@@ -252,10 +252,8 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
 				IO_MGRSIGNATURE);
 		if (pIOMgr->hDPC) {
 			tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
-				DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+				IO_DPC, (u32)pIOMgr);
 			/* Fill out our DPC Object */
-			pIOMgr->hDPC->pRefData = (void *)pIOMgr;
-			pIOMgr->hDPC->pfnDPC = IO_DPC;
 			pIOMgr->hDPC->numRequested = 0;
 			pIOMgr->hDPC->numScheduled = 0;
 #ifdef DEBUG
@@ -1010,12 +1008,14 @@ static void IO_DispatchPM(struct work_struct *work)
  *      out the dispatch of I/O as a non-preemptible event.It can only be
  *      pre-empted      by an ISR.
  */
-void IO_DPC(IN OUT void *pRefData)
+void IO_DPC(IN OUT unsigned long pRefData)
 {
 	struct IO_MGR *pIOMgr = (struct IO_MGR *)pRefData;
 	struct CHNL_MGR *pChnlMgr;
 	struct MSG_MGR *pMsgMgr;
 	struct DEH_MGR *hDehMgr;
+	u32 requested;
+	u32 serviced;
 
 	if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
 		goto func_end;
@@ -1025,16 +1025,27 @@ void IO_DPC(IN OUT void *pRefData)
 	if (!MEM_IsValidHandle(pChnlMgr, CHNL_MGRSIGNATURE))
 		goto func_end;
 	DBG_Trace(DBG_LEVEL7, "Entering IO_DPC(0x%x)\n", pRefData);
-	/* Check value of interrupt register to ensure it is a valid error */
-	if ((pIOMgr->wIntrVal > DEH_BASE) && (pIOMgr->wIntrVal < DEH_LIMIT)) {
-		/* Notify DSP/BIOS exception */
-		if (hDehMgr)
-			WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
-	}
-	IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
+
+	requested = pIOMgr->hDPC->numRequested;
+	serviced = pIOMgr->hDPC->numScheduled;
+
+	if (serviced == requested)
+		goto func_end;
+
+	/* Process pending DPC's */
+	do {
+		/* Check value of interrupt reg to ensure it's a valid error */
+		if ((pIOMgr->wIntrVal > DEH_BASE) &&
+		   (pIOMgr->wIntrVal < DEH_LIMIT)) {
+			/* Notify DSP/BIOS exception */
+			if (hDehMgr)
+				WMD_DEH_Notify(hDehMgr, DSP_SYSERROR,
+						pIOMgr->wIntrVal);
+		}
+		IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
 #ifdef CHNL_MESSAGES
-	if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
-		IO_DispatchMsg(pIOMgr, pMsgMgr);
+		if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
+			IO_DispatchMsg(pIOMgr, pMsgMgr);
 #endif
 #ifndef DSP_TRACEBUF_DISABLED
 	if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF) {
@@ -1042,6 +1053,9 @@ void IO_DPC(IN OUT void *pRefData)
 		PrintDSPDebugTrace(pIOMgr);
 	}
 #endif
+		serviced++;
+	} while (serviced != requested);
+	pIOMgr->hDPC->numScheduled = requested;
 func_end:
 	return;
 }
drivers/dsp/bridge/wmd/mmu_fault.c +1 -1
index 057fe65..d3807ac 100644
@@ -54,7 +54,7 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-void MMU_FaultDpc(IN void *pRefData)
+void MMU_FaultDpc(IN unsigned long pRefData)
 {
 	struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
 	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
drivers/dsp/bridge/wmd/mmu_fault.h +1 -1
index bed466c..d3849b5 100644
@@ -23,7 +23,7 @@
  *  ======== MMU_FaultDpc ========
  *      Deferred procedure call to handle DSP MMU fault.
  */
-	void MMU_FaultDpc(IN void *pRefData);
+	void MMU_FaultDpc(IN unsigned long pRefData);
 
 /*
  *  ======== MMU_FaultIsr ========
drivers/dsp/bridge/wmd/ue_deh.c +1 -4
index d4d45d4..cd2d220 100644
@@ -95,11 +95,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 				SIGNATURE);
 		if (pDehMgr->hMmuFaultDpc) {
 			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
-				DPC_DeferredProcedure,
-				(u32)pDehMgr->hMmuFaultDpc);
+				MMU_FaultDpc, (u32)pDehMgr);
 			/* Fill out DPC Object */
-			pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
-			pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
 			pDehMgr->hMmuFaultDpc->numRequested = 0;
 			pDehMgr->hMmuFaultDpc->numScheduled = 0;
 #ifdef DEBUG
Signature · 1 line
1.6.2.4
#3 lore raw

PATCH 3/4 DSPBRIDGE: Remove DPC module from SERVICES layer

This patch removes init and exit functions for DPC module. It also deletes dpc source file and takes out the module from Makefile.

---
 arch/arm/plat-omap/include/dspbridge/dpc.h |   26 -----------
 drivers/dsp/bridge/Makefile                |    3 +-
 drivers/dsp/bridge/services/dpc.c          |   68 ----------------------------
 drivers/dsp/bridge/services/services.c     |    9 +---
 4 files changed, 3 insertions(+), 103 deletions(-)
 delete mode 100644 drivers/dsp/bridge/services/dpc.c
arch/arm/plat-omap/include/dspbridge/dpc.h +0 -26
index b22140f..aee910d 100644
@@ -35,30 +35,4 @@ struct DPC_OBJECT {
 	spinlock_t dpc_lock;
 };
 
-/*
- *  ======== DPC_Exit ========
- *  Purpose:
- *      Discontinue usage of the DPC module.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      DPC_Init(void) was previously called.
- *  Ensures:
- *      Resources acquired in DPC_Init(void) are freed.
- */
-       extern void DPC_Exit(void);
-
-/*
- *  ======== DPC_Init ========
- *  Purpose:
- *      Initialize the DPC module's private state.
- *  Parameters:
- *  Returns:
- *      TRUE if initialized; FALSE if error occured.
- *  Requires:
- *  Ensures:
- *      A requirement for each of the other public DPC functions.
- */
-       extern bool DPC_Init(void);
-
 #endif				/* DPC_ */
drivers/dsp/bridge/Makefile +1 -2
index cb6d1ce..df870c9 100644
@@ -1,8 +1,7 @@
 obj-$(CONFIG_MPU_BRIDGE)	+= bridgedriver.o
 
 libgen = gen/gb.o gen/gt.o gen/gs.o gen/gh.o gen/_gt_para.o gen/uuidutil.o
-libservices = services/mem.o services/list.o services/dpc.o \
-		services/sync.o \
+libservices = services/mem.o services/list.o services/sync.o \
 		services/clk.o services/cfg.o services/reg.o \
                services/regsup.o services/ntfy.o \
 		services/dbg.o services/services.o
drivers/dsp/bridge/services/dpc.c deleted +0 -68

68 lines not on this page · raw message

drivers/dsp/bridge/services/services.c +2 -7
index 7d35f03..e337cf3 100644
@@ -68,7 +68,6 @@ void SERVICES_Exit(void)
 		CLK_Exit();
 		REG_Exit();
 		LST_Exit();
-		DPC_Exit();
 		DBG_Exit();
 		CFG_Exit();
 		MEM_Exit();
@@ -87,7 +86,7 @@ void SERVICES_Exit(void)
 bool SERVICES_Init(void)
 {
 	bool fInit = true;
-	bool fCFG, fDBG, fDPC, fLST, fMEM;
+	bool fCFG, fDBG, fLST, fMEM;
 	bool fREG, fSYNC, fCLK, fNTFY;
 
 	DBC_Require(cRefs >= 0);
@@ -105,13 +104,12 @@ bool SERVICES_Init(void)
 		fREG = REG_Init();
 		fCFG = CFG_Init();
 		fDBG = DBG_Init();
-		fDPC = DPC_Init();
 		fLST = LST_Init();
 		fSYNC = SYNC_Init();
 		fCLK  = CLK_Init();
 		fNTFY = NTFY_Init();
 
-		fInit = fCFG && fDBG && fDPC &&
+		fInit = fCFG && fDBG &&
 			fLST && fMEM && fREG && fSYNC && fCLK;
 
 		if (!fInit) {
@@ -130,9 +128,6 @@ bool SERVICES_Init(void)
 			if (fLST)
 				LST_Exit();
 
-			if (fDPC)
-				DPC_Exit();
-
 			if (fDBG)
 				DBG_Exit();
 
Signature · 1 line
1.6.2.4
#4 lore raw

PATCH 4/4 DSPBRIDGE: Remove DPC object structure

Remove DPC object structure and declare required members for each tasklet inside their correspondent modules.

Remove dpc header file.

---
 arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |    1 -
 arch/arm/plat-omap/include/dspbridge/dpc.h      |   38 -----------
 drivers/dsp/bridge/pmgr/chnl.c                  |    1 -
 drivers/dsp/bridge/services/services.c          |    1 -
 drivers/dsp/bridge/wmd/_deh.h                   |    5 +-
 drivers/dsp/bridge/wmd/io_sm.c                  |   79 ++++++++---------------
 drivers/dsp/bridge/wmd/mmu_fault.c              |   24 +------
 drivers/dsp/bridge/wmd/ue_deh.c                 |   25 +------
 8 files changed, 35 insertions(+), 139 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
arch/arm/plat-omap/include/dspbridge/_chnl_sm.h +0 -1
index f22b2cb..eb5adc2 100644
@@ -25,7 +25,6 @@
 
 #include <dspbridge/wcd.h>
 #include <dspbridge/wmd.h>
-#include <dspbridge/dpc.h>
 
 #include <dspbridge/list.h>
 #include <dspbridge/ntfy.h>
arch/arm/plat-omap/include/dspbridge/dpc.h deleted +0 -38
deleted file mode 100644
index aee910d..0000000
@@ -1,38 +0,0 @@
-/*
- * dpc.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Deferred Procedure Call(DPC) Services.
- *
- * 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 DPC_
-#define DPC_
-
-/* The DPC object, passed to our priority event callback routine: */
-struct DPC_OBJECT {
-	u32 dwSignature;	/* Used for object validation.   */
-	void *pRefData;		/* Argument for client's DPC.    */
-	u32 numRequested;	/* Number of requested DPC's.      */
-	u32 numScheduled;	/* Number of executed DPC's.      */
-	struct tasklet_struct dpc_tasklet;
-
-#ifdef DEBUG
-	u32 cEntryCount;	/* Number of times DPC reentered. */
-	u32 numRequestedMax;	/* Keep track of max pending DPC's. */
-#endif
-
-	spinlock_t dpc_lock;
-};
-
-#endif				/* DPC_ */
drivers/dsp/bridge/pmgr/chnl.c +0 -1
index f4d0fc1..fd487f0 100644
@@ -31,7 +31,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/sync.h>
drivers/dsp/bridge/services/services.c +0 -1
index e337cf3..efedb00 100644
@@ -29,7 +29,6 @@
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
 #include <dspbridge/dbg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/ntfy.h>
drivers/dsp/bridge/wmd/_deh.h +3 -2
index 2b364b5..aadb9fa 100644
@@ -19,7 +19,6 @@
 #ifndef _DEH_
 #define _DEH_
 
-#include <dspbridge/dpc.h>
 #include <dspbridge/ntfy.h>
 #include <dspbridge/wmd.h>
 
@@ -30,8 +29,10 @@ struct DEH_MGR {
 	u32 dwSignature;	/* Used for object validation.  */
 	struct WMD_DEV_CONTEXT *hWmdContext;	/* WMD device context. */
 	struct NTFY_OBJECT *hNtfy;	/* NTFY object                  */
-	struct DPC_OBJECT *hMmuFaultDpc;	/* DPC object handle.  */
 	struct DSP_ERRORINFO errInfo;	/* DSP exception info.          */
+
+	/* MMU Fault DPC */
+	struct tasklet_struct dpc_tasklet;
 } ;
 
 #endif				/* _DEH_ */
drivers/dsp/bridge/wmd/io_sm.c +27 -52

137 lines not on this page · raw message

drivers/dsp/bridge/wmd/mmu_fault.c +2 -22
index d3807ac..ef6ea77 100644
@@ -27,7 +27,6 @@
 #include <dspbridge/dbg.h>
 
 /*  ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/dpc.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/drv.h>
 
@@ -57,11 +56,10 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
 void MMU_FaultDpc(IN unsigned long pRefData)
 {
 	struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
-	struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
 
 	DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Enter: 0x%x\n", pRefData);
 
-	if (pDehMgr)
+	if (hDehMgr)
 		WMD_DEH_Notify(hDehMgr, DSP_MMUFAULT, 0L);
 
 	DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Exit: 0x%x\n", pRefData);
@@ -77,7 +75,6 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 	struct WMD_DEV_CONTEXT *pDevContext;
 	struct CFG_HOSTRES resources;
 	DSP_STATUS status = DSP_SOK;
-	unsigned long flags;
 
 	DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
        DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -103,24 +100,7 @@ irqreturn_t  MMU_FaultIsr(int irq, IN void *pRefData)
 			 * necessary to check if DSP MMU fault is intended for
 			 * Bridge.
 			 */
-			/* Increment count of DPC's pending. */
-			spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
-						flags);
-			pDehMgr->hMmuFaultDpc->numRequested++;
-			spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
-						flags);
-
-			/* Schedule DPC */
-			tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
-#ifdef DEBUG
-			if (pDehMgr->hMmuFaultDpc->numRequested >
-			   pDehMgr->hMmuFaultDpc->numScheduled +
-			   pDehMgr->hMmuFaultDpc->numRequestedMax) {
-				pDehMgr->hMmuFaultDpc->numRequestedMax =
-					pDehMgr->hMmuFaultDpc->numRequested -
-					pDehMgr->hMmuFaultDpc->numScheduled;
-			}
-#endif
+			tasklet_schedule(&pDehMgr->dpc_tasklet);
 
 			/* Reset errInfo structure before use. */
 			pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
drivers/dsp/bridge/wmd/ue_deh.c +3 -22
index cd2d220..daf75b6 100644
@@ -30,7 +30,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/ntfy.h>
 #include <dspbridge/drv.h>
@@ -90,24 +89,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
 		if (DSP_SUCCEEDED(status))
 			status = NTFY_Create(&pDehMgr->hNtfy);
 
-		/* Create a DPC object. */
-		MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
-				SIGNATURE);
-		if (pDehMgr->hMmuFaultDpc) {
-			tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
-				MMU_FaultDpc, (u32)pDehMgr);
-			/* Fill out DPC Object */
-			pDehMgr->hMmuFaultDpc->numRequested = 0;
-			pDehMgr->hMmuFaultDpc->numScheduled = 0;
-#ifdef DEBUG
-			pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
-			pDehMgr->hMmuFaultDpc->cEntryCount = 0;
-#endif
-			spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
-		} else {
-			DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
-			status = DSP_EMEMORY;
-		}
+		/* Create a MMUfault DPC */
+		tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);
 
 		if (DSP_SUCCEEDED(status))
 			status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -162,9 +145,7 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
 		free_irq(INT_DSP_MMU_IRQ, pDehMgr);
 
 		/* Free DPC object */
-		tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
-		MEM_FreeObject(pDehMgr->hMmuFaultDpc);
-		pDehMgr->hMmuFaultDpc = NULL;
+		tasklet_kill(&pDehMgr->dpc_tasklet);
 		DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
 
 		/* Deallocate the DEH manager object */
Signature · 1 line
1.6.2.4
author Applied
#5 lore raw
In reply to Omar Ramirez Luna
Quoted 26 lines

From: Ramirez Luna, Omar on Friday, January 15, 2010 5:35 PM

This patches remove the DPC custom implementation and wrappers.

They should be applied on top of "trivial cleanups" set and are part of the current patch queue.

Omar Ramirez Luna (4):
DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
DSPBRIDGE: Remove DPC module from SERVICES layer
DSPBRIDGE: Remove DPC object structure

arch/arm/plat-omap/include/dspbridge/_chnl_sm.h |    1 -
arch/arm/plat-omap/include/dspbridge/dpc.h      |  145 -------------
arch/arm/plat-omap/include/dspbridge/io_sm.h    |    2 +-
drivers/dsp/bridge/Makefile                     |    3 +-
drivers/dsp/bridge/pmgr/chnl.c                  |    1 -
drivers/dsp/bridge/services/dpc.c               |  246 -----------------------
drivers/dsp/bridge/services/services.c          |   10 +-
drivers/dsp/bridge/wmd/_deh.h                   |    5 +-
drivers/dsp/bridge/wmd/io_sm.c                  |   86 ++++++--
drivers/dsp/bridge/wmd/mmu_fault.c              |   12 +-
drivers/dsp/bridge/wmd/mmu_fault.h              |    2 +-
drivers/dsp/bridge/wmd/ue_deh.c                 |   13 +-
12 files changed, 87 insertions(+), 439 deletions(-)
Quoted 2 lines

delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h delete mode 100644 drivers/dsp/bridge/services/dpc.c

Pushed to dspbridge

- omar