[PATCH 2/3] DSPBRIDGE: less code nesting for MemUnMap
less code nesting for MemUnMap Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com --- drivers/dsp/bridge/wmd/tiomap3430.c | 271 +-- 1 files changed, 130 insertions(+), 141 deletions(-) diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c b/drivers/dsp/bridge/wmd/tiomap3430.c index 449de01..268de07 100644 --- a/drivers/dsp/bridge/wmd/tiomap3430.c +++ b/drivers/dsp/bridge/wmd/tiomap3430.c @@ -1612,157 +1612,146 @@ static DSP_STATUS WMD_BRD_MemUnMap(struct WMD_DEV_CONTEXT *hDevContext, pteAddrL1 = HW_MMU_PteAddrL1(L1BaseVa, vaCurr); pteVal = *(u32 *)pteAddrL1; pteSize = HW_MMU_PteSizeL1(pteVal); - if (pteSize == HW_MMU_COARSE_PAGE_SIZE) { - /* -* Get the L2 PA from the L1 PTE, and find -* corresponding L2 VA -*/ - L2BasePa = HW_MMU_PteCoarseL1(pteVal); - L2BaseVa = L2BasePa - pt-L2BasePa + pt-L2BaseVa; - L2PageNum = (L2BasePa - pt-L2BasePa) / - HW_MMU_COARSE_PAGE_SIZE; - /* -* Find the L2 PTE address from which we will start -* clearing, the number of PTEs to be cleared on this -* page, and the size of VA space that needs to be -* cleared on this L2 page -*/ - pteAddrL2 = HW_MMU_PteAddrL2(L2BaseVa, vaCurr); - pteCount = pteAddrL2 (HW_MMU_COARSE_PAGE_SIZE - 1); - pteCount = (HW_MMU_COARSE_PAGE_SIZE - pteCount) / - sizeof(u32); - if (remBytes (pteCount * PG_SIZE_4K)) - pteCount = remBytes / PG_SIZE_4K; - - remBytesL2 = pteCount * PG_SIZE_4K; - DBG_Trace(DBG_LEVEL1, WMD_BRD_MemUnMap L2BasePa %x, - L2BaseVa %x pteAddrL2 %x, remBytesL2 %x\n, - L2BasePa, L2BaseVa, pteAddrL2, remBytesL2); - /* -* Unmap the VA space on this L2 PT. A quicker way -* would be to clear pteCount entries starting from -* pteAddrL2. However, below code checks that we don't -* clear invalid entries or less than 64KB for a 64KB -* entry. Similar checking is done for L1 PTEs too -* below -*/ - while (remBytesL2 (DSP_SUCCEEDED(status))) { - pteVal = *(u32 *)pteAddrL2; - pteSize = HW_MMU_PteSizeL2(pteVal); - /* vaCurr aligned to pteSize? */ - if ((pteSize != 0) (remBytesL2 = pteSize) - !(vaCurr (pteSize - 1))) { - /* Collect Physical addresses from VA */ - pAddr = (pteVal ~(pteSize - 1)); - if (pteSize == HW_PAGE_SIZE_64KB) - numof4KPages = 16; - else - numof4KPages = 1; - temp = 0; - while (temp++ numof4KPages) { - if (!pfn_valid(__phys_to_pfn( - pAddr))) { - pAddr += - HW_PAGE_SIZE_4KB; - continue; - } - pg = phys_to_page(pAddr); - if (page_count(pg) 1) { - pr_info(DSPBRIDGE: - UNMAP function: - COUNT 0 FOR PA - 0x%x, size = - 0x%x\n, pAddr, - ulNumBytes); - bad_page_dump(pAddr, - pg); - } - SetPageDirty(pg); - page_cache_release(pg); -
[PATCH 1/3] DSPBRIDGE: Remove DMM physical addres table
From: Hari Kanigeri h-kanige...@ti.com Physical address is not needed anymore since Mapping migration to open source API, this patch removes the physical table entry. Signed-off-by: Hari Kanigeri h-kanige...@ti.com Signed-off-by: Fernando Guzman Lugo x0095...@ti.com --- arch/arm/plat-omap/include/dspbridge/dmm.h |1 - drivers/dsp/bridge/pmgr/dmm.c | 35 -- drivers/dsp/bridge/wmd/tiomap3430.c| 55 +--- 3 files changed, 34 insertions(+), 57 deletions(-) diff --git a/arch/arm/plat-omap/include/dspbridge/dmm.h b/arch/arm/plat-omap/include/dspbridge/dmm.h index ef37668..335edf8 100644 --- a/arch/arm/plat-omap/include/dspbridge/dmm.h +++ b/arch/arm/plat-omap/include/dspbridge/dmm.h @@ -81,5 +81,4 @@ extern DSP_STATUS DMM_CreateTables(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size); - extern u32 *DMM_GetPhysicalAddrTable(void); #endif /* DMM_ */ diff --git a/drivers/dsp/bridge/pmgr/dmm.c b/drivers/dsp/bridge/pmgr/dmm.c index 803de93..f4fc6ec 100644 --- a/drivers/dsp/bridge/pmgr/dmm.c +++ b/drivers/dsp/bridge/pmgr/dmm.c @@ -113,7 +113,6 @@ struct MapPage { static struct MapPage *pVirtualMappingTable; static u32 iFreeRegion; /* The index of free region */ static u32 iFreeSize; -static u32 *pPhysicalAddrTable; /* Physical address of MPU buffer */ static u32 dynMemMapBeg; /* The Beginning of dynamic memory mapping */ static u32 TableSize;/* The size of virtual and physical pages tables */ @@ -151,28 +150,11 @@ DSP_STATUS DMM_CreateTables(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size) if (pVirtualMappingTable == NULL) status = DSP_EMEMORY; else { - /* This table will be used - * to store the virtual to physical - * address translations - */ - pPhysicalAddrTable = (u32 *)MEM_Calloc - (TableSize*sizeof(u32), MEM_NONPAGED); - GT_1trace(DMM_debugMask, GT_4CLASS, - DMM_CreateTables: Allocate - memory for pPhysicalAddrTable=%d entries\n, - TableSize); - if (pPhysicalAddrTable == NULL) { - status = DSP_EMEMORY; - GT_0trace(DMM_debugMask, GT_7CLASS, - DMM_CreateTables: Memory allocation for - pPhysicalAddrTable failed\n); - } else { /* On successful allocation, * all entries are zero ('free') */ iFreeRegion = 0; iFreeSize = TableSize*PG_SIZE_4K; pVirtualMappingTable[0].RegionSize = TableSize; - } } SYNC_LeaveCS(pDmmObj-hDmmLock); } else @@ -275,9 +257,6 @@ DSP_STATUS DMM_DeleteTables(struct DMM_OBJECT *hDmmMgr) if (pVirtualMappingTable != NULL) MEM_Free(pVirtualMappingTable); - if (pPhysicalAddrTable != NULL) - MEM_Free(pPhysicalAddrTable); - SYNC_LeaveCS(pDmmObj-hDmmLock); } else status = DSP_EHANDLE; @@ -361,7 +340,6 @@ bool DMM_Init(void) DBC_Ensure((fRetval (cRefs 0)) || (!fRetval (cRefs = 0))); pVirtualMappingTable = NULL ; - pPhysicalAddrTable = NULL ; TableSize = 0; return fRetval; @@ -635,19 +613,6 @@ static struct MapPage *GetMappedRegion(u32 aAddr) return currRegion; } -/* - * DMM_GetPhysicalAddrTable - * Purpose: - * Returns the physical table address - */ -u32 *DMM_GetPhysicalAddrTable(void) -{ - GT_1trace(DMM_debugMask, GT_ENTER, Entered - DMM_GetPhysicalAddrTable()- pPhysicalAddrTable 0x%x\n, - pPhysicalAddrTable); - return pPhysicalAddrTable; -} - #ifdef DSP_DMM_DEBUG u32 DMM_MemMapDump(struct DMM_OBJECT *hDmmMgr) { diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c b/drivers/dsp/bridge/wmd/tiomap3430.c index b317015..449de01 100644 --- a/drivers/dsp/bridge/wmd/tiomap3430.c +++ b/drivers/dsp/bridge/wmd/tiomap3430.c @@ -1592,16 +1592,12 @@ static DSP_STATUS WMD_BRD_MemUnMap(struct WMD_DEV_CONTEXT *hDevContext, DSP_STATUS status = DSP_SOK; struct WMD_DEV_CONTEXT *pDevContext = hDevContext; struct PgTableAttrs *pt = pDevContext-pPtAttrs; - u32 pacount = 0; - u32 *pPhysAddrPageTbl = NULL; u32 temp; - u32 patemp = 0; u32 pAddr; u32 numof4KPages = 0; DBG_Trace(DBG_ENTER, WMD_BRD_MemUnMap hDevContext %x, va %x, NumBytes %x\n, hDevContext, ulVirtAddr,
[PATCH 3/3] DSPBRIDGE: NULL and safety checks
NULL and safety checks Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com --- drivers/dsp/bridge/pmgr/dev.c | 35 +-- drivers/dsp/bridge/pmgr/msg.c |4 +- drivers/dsp/bridge/rmgr/node.c | 33 +-- drivers/dsp/bridge/rmgr/proc.c | 10 ++- drivers/dsp/bridge/script.sh | 10 ++ drivers/dsp/bridge/services/list.c | 34 +++ drivers/dsp/bridge/services/mem.c |3 +- drivers/dsp/bridge/wmd/io_sm.c | 188 drivers/dsp/bridge/wmd/msg_sm.c| 81 ++- 9 files changed, 268 insertions(+), 130 deletions(-) create mode 100644 drivers/dsp/bridge/script.sh diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c index 5e4e30b..59eee7d 100644 --- a/drivers/dsp/bridge/pmgr/dev.c +++ b/drivers/dsp/bridge/pmgr/dev.c @@ -496,11 +496,15 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_OBJECT *hDevObject) GT_1trace(debugMask, GT_ENTER, Entered DEV_DestroyDevice, hDevObject: 0x%x\n, hDevObject); if (IsValidHandle(hDevObject)) { - if (pDevObject-hCodMgr) + if (pDevObject-hCodMgr) { COD_Delete(pDevObject-hCodMgr); + pDevObject-hCodMgr = NULL; + } - if (pDevObject-hNodeMgr) + if (pDevObject-hNodeMgr) { NODE_DeleteMgr(pDevObject-hNodeMgr); + pDevObject-hNodeMgr = NULL; + } /* Free the io, channel, and message managers for this board: */ if (pDevObject-hIOMgr) { @@ -511,28 +515,40 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_OBJECT *hDevObject) CHNL_Destroy(pDevObject-hChnlMgr); pDevObject-hChnlMgr = NULL; } - if (pDevObject-hMsgMgr) + if (pDevObject-hMsgMgr) { MSG_Delete(pDevObject-hMsgMgr); + pDevObject-hMsgMgr = NULL; + } if (pDevObject-hDehMgr) { /* Uninitialize DEH module. */ (*pDevObject-intfFxns.pfnDehDestroy) (pDevObject-hDehMgr); + pDevObject-hDehMgr = NULL; } - if (pDevObject-hCmmMgr) + if (pDevObject-hCmmMgr) { CMM_Destroy(pDevObject-hCmmMgr, true); + pDevObject-hCmmMgr = NULL; + } - if (pDevObject-hDmmMgr) + if (pDevObject-hDmmMgr) { DMM_Destroy(pDevObject-hDmmMgr); + pDevObject-hDmmMgr = NULL; + } /* Call the driver's WMD_DEV_Destroy() function: */ /* Require of DevDestroy */ - DBC_Assert(pDevObject-hWmdContext != NULL); - status = (*pDevObject-intfFxns.pfnDevDestroy) -(pDevObject-hWmdContext); + if (pDevObject-hWmdContext) { + status = (*pDevObject-intfFxns.pfnDevDestroy) + (pDevObject-hWmdContext); + pDevObject-hWmdContext = NULL; + } else + status = DSP_EFAIL; if (DSP_SUCCEEDED(status)) { - if (pDevObject-procList) + if (pDevObject-procList) { LST_Delete(pDevObject-procList); + pDevObject-procList = NULL; + } /* Remove this DEV_Object from the global list: */ DRV_RemoveDevObject(pDevObject-hDrvObject, pDevObject); @@ -540,6 +556,7 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_OBJECT *hDevObject) * (pDevObject-hModule);*/ /* Free this dev object: */ MEM_FreeObject(pDevObject); + pDevObject = NULL; } } else { GT_0trace(debugMask, GT_7CLASS, DEV_Destroy: Invlaid handle); diff --git a/drivers/dsp/bridge/pmgr/msg.c b/drivers/dsp/bridge/pmgr/msg.c index be4acdb..d9e4fc6 100644 --- a/drivers/dsp/bridge/pmgr/msg.c +++ b/drivers/dsp/bridge/pmgr/msg.c @@ -134,7 +134,9 @@ void MSG_Delete(struct MSG_MGR *hMsgMgr) /* Let WMD message module destroy the MSG_MGR: */ (*pIntfFxns-pfnMsgDelete)(hMsgMgr); - DBC_Ensure(!MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE)); + if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE)) + GT_1trace(MSG_debugMask, GT_7CLASS, MSG_Delete: Error hMsgMgr + Valid Handle: 0x%x\n, hMsgMgr); } /* diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c index 53a42bf..8ed9046 100644 --- a/drivers/dsp/bridge/rmgr/node.c +++ b/drivers/dsp/bridge/rmgr/node.c @@ -1833,11
Re: [PATCH 1/3] DSPBRIDGE: Remove DMM physical addres table
On Sun, Jul 19, 2009 at 7:15 AM, Omar Ramirez Lunaomar.rami...@ti.com wrote: From: Hari Kanigeri h-kanige...@ti.com Physical address is not needed anymore since Mapping migration to open source API, this patch removes the physical table entry. You mean Linux API? -- Felipe Contreras -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2] OMAP3: PM: USBHOST: clear wakeup events on both hosts
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- ow...@vger.kernel.org] On Behalf Of Pandita, Vikram Sent: Friday, July 17, 2009 7:33 PM USBHOST module has 2 fclocks (for HOST1 and HOST2), only one iclock and only a single bit in the WKST register to indicate a wakeup event. Because of the single WKST bit, we cannot know whether a wakeup event was on HOST1 or HOST2, so enable both fclocks before clearing the wakeup event to ensure both hosts can properly clear the event. Yes, if you need to clear bits clocks must be on. Question which comes to mind is if the wakeup bit should have been set for target mode. Ideally when this status is set the f-clk should have been already on. Does USB framework even export good control of possible sleep modes... Most WKST bits are used in conjunction with INACTIVE mode wakeup. The exception to this is WAKUP-domain WKSTs which are also used in wakes from RET or OFF mode. So point is... for USB having this WKST status bit set and NOT having the F-Clk enabled points to an issue in the OFF mode transition code in the USB driver. Since the driver won't have access to PRCM registers the only places which can fix this issue today is the PRCM irq (like being proposed) or inside the clock-frame-work at the F-Clk shutdown point. Generally if status is hanging around when you try to sleep, you will have a failed sleep. Today what is happening is the prcm-irq will come and sweep up the status at some later time. This will allow an eventual sleep success. .. A - Sleeps states which don't require enumeration TARGET: INACTIVE mode+wakeup-capable-to-usb-resume (mstandby asserted dpll still requested) :: For USB, when it goes to USB-bus-suspend, if you want to wake on usb-bus-resume from the usb wake path, probably you would leave on the fclk. TARGET: RET/OFF mode+wakeup-capapble+USB-SAR (mstandby asserted no dpll requests) :: If you want to go to OFF or RET mode then you first move to usb-bus-suspend, then shut down f-clk, then setup for some io-ring wake event. B - Sleep states which require enumeration on wake -- mstandby must be asserted, however you can cheat to get there by using force-standby, forced-idle, then expect a full path reset and enumeration at wake up time. ... USB has a few state choices around sleep which it doesn't seem are well specified in code. Just hooking to existing suspend/resume handlers which are meant more for 'B' handling caused issues if people are going for the 'A' behavior. Regards, Richard W. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2] OMAP3: PM: USBHOST: clear wakeup events on both hosts
So point is... for USB having this WKST status bit set and NOT having the F- Clk enabled points to an issue in the OFF mode transition code in the USB driver. Or if this is on 1st boot, then issue can be init code needing to clean up whatever damage the boot loader may have done. Prcm_init should really have done this as you don't always have a controlling USB driver. Regards, Richard W. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Problems configuring OMAP35x ISP driver
Eino-Ville Talvala wrote: Zach, We've gotten a Aptina MT9P031 driver working with the latest ISP patchset, both with YUV and RAW data. I don't know what the problem might be with YUYV data - we get useful YUYV data without any changes to the ISP defaults. However, to request RAW data, that simply uses the CCDC and bypasses all the processing in the ISP, request the pixelformat of V4L2_PIX_FMT_SGRBG10. This will give you two bytes per pixel, at least in our case (although we have a 12-bit sensor cut down to 10 bits), so be prepared to throw out every other byte. Hope this helps, Eino-Ville (Eddy) Talvala Computer Graphics Lab Stanford University I've been working on this same issue, using a Micron MT9T001 sensor, without much success. Could you share your tree and/or patches (against what?)?? This would be most helpful. Thanks On 7/14/2009 9:49 AM, Zach LeRoy wrote: Hello Sergio, I spoke with you earlier about using the ISP and omap34xxcam drivers with a micron mt9d111 SOC sensor. I have since been able to take pictures, but the sensor data is not making it through the ISP data-path correctly. I know the problem is in the ISP data-path because I am configuring the sensor the exact same way as I have been on my working PXA system. I am expecting 4:2:2 packed YUV data, but all of the U and V data is no more than 2 bits where it should be 8. I know the ISP has a lot of capabilities, but all I want to use it for is grabbing 8-bit data from my sensor and putting it in a buffer untouched using the CCDC interface (and of course clocking and timing). What are the key steps to take to get this type of configuration? Other Questions: Is there any processing done on YUV data in the ISP driver by default that I am missing? Has any one else experienced similar problems while adding new sensor support? Any help here would be greatly appreciated. Thank you, Zach LeRoy -- Gary Thomas | Consulting for the MLB Associates |Embedded world -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/10] arch/arm/plat-omap: Drop unnecessary NULL test
From: Julia Lawall ju...@diku.dk The function map_iovm_area is static and is only called from one place, at which the new argument cannot be NULL. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @@ type T; expression E,E1; identifier i,fld; statement S; @@ - T i = E-fld; + T i; ... when != E=E1 when != i if (E == NULL||...) S + i = E-fld; // /smpl Signed-off-by: Julia Lawall ju...@diku.dk --- arch/arm/plat-omap/iovmm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c index 2fce2c1..04e2286 100644 --- a/arch/arm/plat-omap/iovmm.c +++ b/arch/arm/plat-omap/iovmm.c @@ -447,7 +447,7 @@ static int map_iovm_area(struct iommu *obj, struct iovm_struct *new, struct scatterlist *sg; u32 da = new-da_start; - if (!obj || !new || !sgt) + if (!obj || !sgt) return -EINVAL; BUG_ON(!sgtable_ok(sgt)); -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/10] drivers/mmc: Move a dereference below a NULL test
From: Julia Lawall ju...@diku.dk If the NULL test is necessary, then the dereference should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @@ type T; expression E,E1; identifier i,fld; statement S; @@ - T i = E-fld; + T i; ... when != E=E1 when != i BUG_ON (E == NULL|| - i + E-fld == NULL || ...); + i = E-fld; // /smpl Signed-off-by: Julia Lawall ju...@diku.dk --- drivers/mmc/host/omap.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index e7a331d..89281ab 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c @@ -255,11 +255,12 @@ static void mmc_omap_slot_release_work(struct work_struct *work) static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled) { - struct mmc_omap_host *host = slot-host; + struct mmc_omap_host *host; unsigned long flags; int i; - BUG_ON(slot == NULL || host-mmc == NULL); + BUG_ON(slot == NULL || slot-host-mmc == NULL); + host = slot-host; if (clk_enabled) /* Keeps clock running for at least 8 cycles on valid freq */ -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: N8x0 to mainline patches
When the rx44 keymap support is added back in your quilt set, can we discuss it. IIRC, the same kind of value (i.e. 255) is also in the rx-51. Any specific reason? I presume the reason is that the standard code for the Fn key is 464... so it is only correct to map Fn to KEY_FN. ;) There is a software Fn key on some Mac laptops as well. Do they work? Why/how? Note: before I installed KDE 4 on my N810, Fn was working in X with its usual keycode... -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 01/13] DSPBRIDGE: Heuristic fixes of strlen/malloc out by one
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 01/13] DSPBRIDGE: Heuristic fixes of strlen/malloc out by one From: Phil Carmody ext-phil.2.carm...@nokia.com I say 'heuristic', as I can't prove they're wrong, they just look wrong, and for that reason should be given extra close scrutiny. These are basically just the old malloc-one-more-than-strlen. Signed-off-by: Phil Carmody ext-phil.2.carm...@nokia.com Acked-by: Fernando Guzman Lugo x0095...@ti.com --- drivers/dsp/bridge/pmgr/wcd.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Pushed to d.o-z - omar -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 02/13] DSPBRIDGE: PROCWRAP_Load function cleanup in a complete mess
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 02/13] DSPBRIDGE: PROCWRAP_Load function cleanup in a complete mess If you followed some failure paths, it was entirely possible that you'd attempt to MEM_Free a user-space pointer, because it wouldn't have been replaced with a kernel-space copy yet. Now ensure there's a NULL pointer to stop the cleanup at the position of the first error. Signed-off-by: Phil Carmody ext-phil.2.carm...@nokia.com Signed-off-by: Ameya Palande ameya.pala...@nokia.com Acked-by: Fernando Guzman Lugo x0095...@ti.com --- drivers/dsp/bridge/pmgr/wcd.c | 114 +++- 1 files changed, 65 insertions(+), 49 deletions(-) Small rework to apply, original file (on which the patch is based) had spaces instead of tabs. Pushed to d.o-z - omar -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 03/13] DSPBRIDGE: Remove unnecessary conditions from some for loops
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Ameya Palande Subject: [PATCH 03/13] DSPBRIDGE: Remove unnecessary conditions from some for loops The status cannot be a failure value at the start of the loops, and the only changes to a failure state are accompanied by a break or goto, so these conditions are always true. Signed-off-by: Phil Carmody ext-phil.2.carm...@nokia.com Acked-by: Fernando Guzman Lugo x0095...@ti.com --- drivers/dsp/bridge/pmgr/wcd.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Pushed to d.o-z - omar -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 06/13] DSPBRIDGE: avoid to dump unnecessary registers without debug
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 06/13] DSPBRIDGE: avoid to dump unnecessary registers without debug Make GetHWRegs() available only with CONFIG_BRIDGE_DEBUG. [Hiroshi DOYU: split the original to logical ones] Signed-off-by: Ameya Palande ameya.pala...@nokia.com Acked-by: Omar Ramirez Luna omar.rami...@ti.com --- drivers/dsp/bridge/wmd/tiomap3430.c | 57 +++ 1 files changed, 31 insertions(+), 26 deletions(-) Pushed to d.o-z - omar -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 04/13] DSPBRIDGE: fix macros that break when inside an if/else
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 04/13] DSPBRIDGE: fix macros that break when inside an if/else From: Doyu Hiroshi (Nokia-D/Helsinki) hiroshi.d...@nokia.com Based on the following discussion: http://marc.info/?l=linux-omapm=124697893724881w=2 Signed-off-by: Hiroshi DOYU hiroshi.d...@nokia.com --- drivers/dsp/bridge/pmgr/wcd.c | 60 ++-- 1 files changed, 39 insertions(+), 21 deletions(-) Fixed compiler error with debug enabled: WCD_debugMask undeclared... Pushed to d.o-z - omar -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
DSPBRIDGE: create DMM table using vmalloc instead of kmalloc
Replace the physical contiguos allocation for DMM tables as the required space might not available after some time, use virtual memory allocation instead. Signed-off-by: Omar Ramirez Luna omar.rami...@ti.com --- arch/arm/plat-omap/include/dspbridge/mem.h | 17 + drivers/dsp/bridge/pmgr/dmm.c |6 ++-- drivers/dsp/bridge/services/mem.c | 55 +--- 3 files changed, 62 insertions(+), 16 deletions(-) diff --git a/arch/arm/plat-omap/include/dspbridge/mem.h b/arch/arm/plat-omap/include/dspbridge/mem.h index 535ac3a..38c760b 100644 --- a/arch/arm/plat-omap/include/dspbridge/mem.h +++ b/arch/arm/plat-omap/include/dspbridge/mem.h @@ -203,6 +203,23 @@ extern void MEM_Free(IN void *pMemBuf); /* + * MEM_VFree + * Purpose: + * Free the given block of system memory in virtual space. + * Parameters: + * pMemBuf:Pointer to memory allocated by MEM_Calloc/Alloc() + * using vmalloc. + * Returns: + * Requires: + * MEM initialized. + * pMemBuf is a valid memory address returned by MEM_Calloc/Alloc() + * using vmalloc. + * Ensures: + * pMemBuf is no longer a valid pointer to memory. + */ + extern void MEM_VFree(IN void *pMemBuf); + +/* * MEM_FreePhysMem * Purpose: * Free the given block of physically contiguous memory. diff --git a/drivers/dsp/bridge/pmgr/dmm.c b/drivers/dsp/bridge/pmgr/dmm.c index 0f82935..f878855 100644 --- a/drivers/dsp/bridge/pmgr/dmm.c +++ b/drivers/dsp/bridge/pmgr/dmm.c @@ -143,10 +143,10 @@ DSP_STATUS DMM_CreateTables(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size) if (DSP_SUCCEEDED(status)) { SYNC_EnterCS(pDmmObj-hDmmLock); dynMemMapBeg = addr; - TableSize = (size/PG_SIZE_4K) + 1; + TableSize = PG_ALIGN_HIGH(size, PG_SIZE_4K)/PG_SIZE_4K; /* Create the free list */ pVirtualMappingTable = (struct MapPage *) MEM_Calloc - (TableSize*sizeof(struct MapPage), MEM_NONPAGED); + (TableSize * sizeof(struct MapPage), MEM_LARGEVIRTMEM); if (pVirtualMappingTable == NULL) status = DSP_EMEMORY; else { @@ -255,7 +255,7 @@ DSP_STATUS DMM_DeleteTables(struct DMM_OBJECT *hDmmMgr) SYNC_EnterCS(pDmmObj-hDmmLock); if (pVirtualMappingTable != NULL) - MEM_Free(pVirtualMappingTable); + MEM_VFree(pVirtualMappingTable); SYNC_LeaveCS(pDmmObj-hDmmLock); } else diff --git a/drivers/dsp/bridge/services/mem.c b/drivers/dsp/bridge/services/mem.c index 47ec09b..22f382b 100644 --- a/drivers/dsp/bridge/services/mem.c +++ b/drivers/dsp/bridge/services/mem.c @@ -303,13 +303,9 @@ void *MEM_Alloc(u32 cBytes, enum MEM_POOLATTRS type) break; case MEM_LARGEVIRTMEM: #ifndef MEM_CHECK - /* FIXME - Replace with 'vmalloc' after BP fix */ - pMem = __vmalloc(cBytes, - (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL, PAGE_KERNEL); + pMem = vmalloc(cBytes); #else - /* FIXME - Replace with 'vmalloc' after BP fix */ - pMem = __vmalloc((cBytes + sizeof(struct memInfo)), - (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL, PAGE_KERNEL); + pMem = vmalloc(cBytes + sizeof(struct memInfo)); if (pMem) { pMem-size = cBytes; pMem-caller = __builtin_return_address(0); @@ -416,16 +412,11 @@ void *MEM_Calloc(u32 cBytes, enum MEM_POOLATTRS type) break; case MEM_LARGEVIRTMEM: #ifndef MEM_CHECK - /* FIXME - Replace with 'vmalloc' after BP fix */ - pMem = __vmalloc(cBytes, - (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL, PAGE_KERNEL); + pMem = vmalloc(cBytes); if (pMem) memset(pMem, 0, cBytes); - #else - /* FIXME - Replace with 'vmalloc' after BP fix */ - pMem = __vmalloc(cBytes + sizeof(struct memInfo), - (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL, PAGE_KERNEL); + pMem = vmalloc(cBytes + sizeof(struct memInfo)); if (pMem) { memset((void *)((u32)pMem + sizeof(struct memInfo)), 0, cBytes); @@ -509,6 +500,44 @@ void MEM_FlushCache(void *pMemBuf, u32 cBytes, s32 FlushType) } +/* + * MEM_VFree + * Purpose: + * Free the given block of system memory in virtual space. + */ +void MEM_VFree(IN void
RE: [PATCH 08/13] DSPBRIDGE: Prevent memory access during hibernation
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 08/13] DSPBRIDGE: Prevent memory access during hibernation If DSP is in hibernated then WakeDSP() returns without waking it up, which results in flush_all function access IVA MMU while IVA is hibernated. [Hiroshi DOYU: split the original to logical ones] Signed-off-by: Ameya Palande ameya.pala...@nokia.com Acked-by: Omar Ramirez Luna omar.rami...@ti.com --- drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 65 +++ drivers/dsp/bridge/wmd/tiomap_sm.c | 32 +++ 2 files changed, 38 insertions(+), 59 deletions(-) diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c index a725548..7cc29b7 100644 --- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c +++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c @@ -295,59 +295,40 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTEXT *pDevContext, IN u32 dwCmd, */ DSP_STATUS WakeDSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs) { - DSP_STATUS status = DSP_SOK; #ifdef CONFIG_PM - struct CFG_HOSTRES resources; + DSP_STATUS status = DSP_SOK; +#ifdef CONFIG_BRIDGE_DEBUG enum HW_PwrState_t pwrState; - u32 temp; + struct CFG_HOSTRES resources; status = CFG_GetHostResources( (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), resources); if (DSP_FAILED(status)) return status; - /* check the BRD/WMD state, if it is not 'SLEEP' then return failure */ +#endif /* CONFIG_BRIDGE_DEBUG */ + + /* Check the BRD/WMD state, if it is not 'SLEEP' then return failure */ if (pDevContext-dwBrdState == BRD_RUNNING || - pDevContext-dwBrdState == BRD_STOPPED || - pDevContext-dwBrdState == BRD_DSP_HIBERNATION) { + pDevContext-dwBrdState == BRD_STOPPED) { /* The Device is in 'RET' or 'OFF' state and WMD state is not * 'SLEEP', this means state inconsistency, so return */ - status = DSP_SOK; - return status; - } - /* Enable the DSP peripheral clocks and load monitor timer - * before waking the DSP */ - DBG_Trace(DBG_LEVEL6, WakeDSP: enable DSP Peripheral Clks = 0x%x \n, - pDevContext-uDspPerClks); - status = DSP_PeripheralClocks_Enable(pDevContext, NULL); - - /* Enabling Dppll in lock mode */ - temp = (u32) *((REG_UWORD32 *) - ((u32) (resources.dwCmBase) + 0x34)); - temp = (temp 0xFFFE) | 0x1; - *((REG_UWORD32 *) ((u32) (resources.dwCmBase) + 0x34)) = - (u32) temp; - temp = (u32) *((REG_UWORD32 *) - ((u32) (resources.dwCmBase) + 0x4)); - temp = (temp 0xFC8) | 0x37; - - *((REG_UWORD32 *) ((u32) (resources.dwCmBase) + 0x4)) = - (u32) temp; - - udelay(10); - if (DSP_SUCCEEDED(status)) { - /* Send a message to DSP to wake up */ - CHNLSM_InterruptDSP2(pDevContext, MBX_PM_DSPWAKEUP); - HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP, - pwrState); - DBG_Trace(DBG_LEVEL7, - \nWakeDSP: Power State After sending Interrupt - to DSP %x\n, pwrState); - /* set the device state to RUNNIG */ - pDevContext-dwBrdState = BRD_RUNNING; - } else { - DBG_Trace(DBG_LEVEL6, WakeDSP: FAILED\n); + return DSP_SOK; } -#endif + + /* Send a wakeup message to DSP */ + CHNLSM_InterruptDSP2(pDevContext, MBX_PM_DSPWAKEUP); + +#ifdef CONFIG_BRIDGE_DEBUG + HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP, + pwrState); + DBG_Trace(DBG_LEVEL7, + \nWakeDSP: Power State After sending Interrupt + to DSP %x\n, pwrState); +#endif /* CONFIG_BRIDGE_DEBUG */ + + /* Set the device state to RUNNIG */ + pDevContext-dwBrdState = BRD_RUNNING; +#endif /* CONFIG_PM */ return status; } Reworked compiler error ifndef CONFIG_PM: undeclared status diff --git a/drivers/dsp/bridge/wmd/tiomap_sm.c b/drivers/dsp/bridge/wmd/tiomap_sm.c index a6d5d62..b5d3d6d 100644 --- a/drivers/dsp/bridge/wmd/tiomap_sm.c +++ b/drivers/dsp/bridge/wmd/tiomap_sm.c @@ -126,24 +126,22 @@ DSP_STATUS CHNLSM_InterruptDSP2(struct WMD_DEV_CONTEXT *pDevContext, if (pDevContext-dwBrdState == BRD_DSP_HIBERNATION || pDevContext-dwBrdState == BRD_HIBERNATION) { + /* Restart the peripheral clocks */ + DSP_PeripheralClocks_Enable(pDevContext, NULL); + /* Restore mailbox settings */ - /* Restart the peripheral clocks that were disabled only - * in DSP initiated Hibernation case.*/ - if
RE: [PATCH 09/13] DSPBRIDGE: fix incorrect mask of DPLL in CHNLSM_InterruptDSP2()
From: Ameya Palande [mailto:ameya.pala...@nokia.com] Subject: [PATCH 09/13] DSPBRIDGE: fix incorrect mask of DPLL in CHNLSM_InterruptDSP2() This patch also contains indentation fixes and cleanups for CHNLSM_InterruptDSP2(). [Hiroshi DOYU: split the original to logical ones] Reported-by: Roman Tereshonkov roman.tereshon...@nokia.com Signed-off-by: Ameya Palande ameya.pala...@nokia.com Acked-by: Omar Ramirez Luna omar.rami...@ti.com --- drivers/dsp/bridge/wmd/tiomap_sm.c | 56 +-- 1 files changed, 27 insertions(+), 29 deletions(-) Pushed to d.o-z -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html