diff options
author | Alistair Strachan <alistair.strachan@imgtec.com> | 2011-11-16 20:35:35 +0000 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 18:09:18 -0800 |
commit | 4c037e4b0f951065d30f3520803c2d82b00fc240 (patch) | |
tree | be62d408376cc259636e3725853a788ab9d64530 /drivers/gpu/pvr | |
parent | 75676e14f89997dfa9ee5023156b348ad4b5fd40 (diff) | |
download | kernel_samsung_crespo-4c037e4b0f951065d30f3520803c2d82b00fc240.zip kernel_samsung_crespo-4c037e4b0f951065d30f3520803c2d82b00fc240.tar.gz kernel_samsung_crespo-4c037e4b0f951065d30f3520803c2d82b00fc240.tar.bz2 |
gpu: pvr: Update to DDK 1.8@779202
- Dump SGX page tables if corruption is detected.
- Fix a security issue found in various PVR ioctls
Change-Id: Ic62f4671ab66b7be53a913e5023eb79342e223db
Diffstat (limited to 'drivers/gpu/pvr')
-rw-r--r-- | drivers/gpu/pvr/deviceclass.c | 7 | ||||
-rw-r--r-- | drivers/gpu/pvr/kerneldisplay.h | 2 | ||||
-rw-r--r-- | drivers/gpu/pvr/osfunc.c | 12 | ||||
-rw-r--r-- | drivers/gpu/pvr/osfunc.h | 13 | ||||
-rw-r--r-- | drivers/gpu/pvr/pvr_bridge_k.c | 30 | ||||
-rw-r--r-- | drivers/gpu/pvr/pvr_uaccess.h | 2 | ||||
-rw-r--r-- | drivers/gpu/pvr/pvrversion.h | 10 | ||||
-rw-r--r-- | drivers/gpu/pvr/queue.c | 16 | ||||
-rw-r--r-- | drivers/gpu/pvr/sgx/mmu.c | 23 | ||||
-rw-r--r-- | drivers/gpu/pvr/sgxerrata.h | 3 |
10 files changed, 99 insertions, 19 deletions
diff --git a/drivers/gpu/pvr/deviceclass.c b/drivers/gpu/pvr/deviceclass.c index f8c83f6..2ebd810 100644 --- a/drivers/gpu/pvr/deviceclass.c +++ b/drivers/gpu/pvr/deviceclass.c @@ -2012,6 +2012,12 @@ PVRSRVDCMemInfoGetByteSize(PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo, return PVRSRV_OK; } +static IMG_BOOL +PVRSRVDCMemInfoIsPhysContig(PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) +{ + return OSMemHandleIsPhysContig(psKernelMemInfo->sMemBlk.hOSMemHandle); +} + IMG_EXPORT IMG_BOOL PVRGetDisplayClassJTable(PVRSRV_DC_DISP2SRV_KMJTABLE *psJTable) { @@ -2034,6 +2040,7 @@ IMG_BOOL PVRGetDisplayClassJTable(PVRSRV_DC_DISP2SRV_KMJTABLE *psJTable) psJTable->pfnPVRSRVDCMemInfoGetCpuVAddr = &PVRSRVDCMemInfoGetCpuVAddr; psJTable->pfnPVRSRVDCMemInfoGetCpuPAddr = &PVRSRVDCMemInfoGetCpuPAddr; psJTable->pfnPVRSRVDCMemInfoGetByteSize = &PVRSRVDCMemInfoGetByteSize; + psJTable->pfnPVRSRVDCMemInfoIsPhysContig = &PVRSRVDCMemInfoIsPhysContig; return IMG_TRUE; } diff --git a/drivers/gpu/pvr/kerneldisplay.h b/drivers/gpu/pvr/kerneldisplay.h index 7e9ba51..55111d3 100644 --- a/drivers/gpu/pvr/kerneldisplay.h +++ b/drivers/gpu/pvr/kerneldisplay.h @@ -111,6 +111,7 @@ typedef struct _PVRSRV_KERNEL_MEM_INFO_* PDC_MEM_INFO; typedef PVRSRV_ERROR (*PFN_DC_MEMINFO_GET_CPU_VADDR)(PDC_MEM_INFO, IMG_CPU_VIRTADDR *pVAddr); typedef PVRSRV_ERROR (*PFN_DC_MEMINFO_GET_CPU_PADDR)(PDC_MEM_INFO, IMG_SIZE_T uByteOffset, IMG_CPU_PHYADDR *pPAddr); typedef PVRSRV_ERROR (*PFN_DC_MEMINFO_GET_BYTE_SIZE)(PDC_MEM_INFO, IMG_SIZE_T *uByteSize); +typedef IMG_BOOL (*PFN_DC_MEMINFO_IS_PHYS_CONTIG)(PDC_MEM_INFO); typedef struct PVRSRV_DC_DISP2SRV_KMJTABLE_TAG { @@ -127,6 +128,7 @@ typedef struct PVRSRV_DC_DISP2SRV_KMJTABLE_TAG PFN_DC_MEMINFO_GET_CPU_VADDR pfnPVRSRVDCMemInfoGetCpuVAddr; PFN_DC_MEMINFO_GET_CPU_PADDR pfnPVRSRVDCMemInfoGetCpuPAddr; PFN_DC_MEMINFO_GET_BYTE_SIZE pfnPVRSRVDCMemInfoGetByteSize; + PFN_DC_MEMINFO_IS_PHYS_CONTIG pfnPVRSRVDCMemInfoIsPhysContig; } PVRSRV_DC_DISP2SRV_KMJTABLE, *PPVRSRV_DC_DISP2SRV_KMJTABLE; diff --git a/drivers/gpu/pvr/osfunc.c b/drivers/gpu/pvr/osfunc.c index 6adfb55..13e4dd9 100644 --- a/drivers/gpu/pvr/osfunc.c +++ b/drivers/gpu/pvr/osfunc.c @@ -371,6 +371,18 @@ OSMemHandleToCpuPAddr(IMG_VOID *hOSMemHandle, IMG_UINT32 ui32ByteOffset) } +IMG_BOOL OSMemHandleIsPhysContig(IMG_VOID *hOSMemHandle) +{ + LinuxMemArea *psLinuxMemArea = (LinuxMemArea *)hOSMemHandle; + + PVR_ASSERT(psLinuxMemArea); + + if(psLinuxMemArea->eAreaType == LINUX_MEM_AREA_EXTERNAL_KV) + return psLinuxMemArea->uData.sExternalKV.bPhysContig; + + return IMG_FALSE; +} + IMG_VOID OSMemCopy(IMG_VOID *pvDst, IMG_VOID *pvSrc, IMG_UINT32 ui32Size) { diff --git a/drivers/gpu/pvr/osfunc.h b/drivers/gpu/pvr/osfunc.h index 7195a07..3d76ba8 100644 --- a/drivers/gpu/pvr/osfunc.h +++ b/drivers/gpu/pvr/osfunc.h @@ -401,6 +401,19 @@ static INLINE IMG_CPU_PHYADDR OSMemHandleToCpuPAddr(IMG_HANDLE hOSMemHandle, IMG return sCpuPAddr; } #endif + +#if defined(__linux__) +IMG_BOOL OSMemHandleIsPhysContig(IMG_VOID *hOSMemHandle); +#else +#ifdef INLINE_IS_PRAGMA +#pragma inline(OSMemHandleIsPhysContig) +#endif +static INLINE IMG_BOOL OSMemHandleIsPhysContig(IMG_HANDLE hOSMemHandle) +{ + return IMG_FALSE; +} +#endif + PVRSRV_ERROR OSInitEnvData(IMG_PVOID *ppvEnvSpecificData); PVRSRV_ERROR OSDeInitEnvData(IMG_PVOID pvEnvSpecificData); IMG_CHAR* OSStringCopy(IMG_CHAR *pszDest, const IMG_CHAR *pszSrc); diff --git a/drivers/gpu/pvr/pvr_bridge_k.c b/drivers/gpu/pvr/pvr_bridge_k.c index 91a75a9..1605314 100644 --- a/drivers/gpu/pvr/pvr_bridge_k.c +++ b/drivers/gpu/pvr/pvr_bridge_k.c @@ -35,6 +35,7 @@ #include "private_data.h" #include "linkage.h" #include "pvr_bridge_km.h" +#include "pvr_uaccess.h" #if defined(SUPPORT_DRI_DRM) #include <drm/drmP.h> @@ -296,7 +297,11 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig goto unlock_and_return; } - psMapDevMemIN->hKernelMemInfo = psPrivateData->hKernelMemInfo; + if (pvr_put_user(psPrivateData->hKernelMemInfo, &psMapDevMemIN->hKernelMemInfo) != 0) + { + err = -EFAULT; + goto unlock_and_return; + } break; } @@ -394,9 +399,14 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig psPrivateData->hKernelMemInfo = psExportDeviceMemOUT->hMemInfo; #if defined(SUPPORT_MEMINFO_IDS) - psKernelMemInfo->ui64Stamp = - psExportDeviceMemOUT->ui64Stamp = - psPrivateData->ui64Stamp = ++ui64Stamp; + psPrivateData->ui64Stamp = ++ui64Stamp; + + psKernelMemInfo->ui64Stamp = psPrivateData->ui64Stamp; + if (pvr_put_user(psPrivateData->ui64Stamp, &psExportDeviceMemOUT->ui64Stamp) != 0) + { + err = -EFAULT; + goto unlock_and_return; + } #endif break; } @@ -408,7 +418,11 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig PVRSRV_BRIDGE_OUT_MAP_DEV_MEMORY *psMapDeviceMemoryOUT = (PVRSRV_BRIDGE_OUT_MAP_DEV_MEMORY *)psBridgePackageKM->pvParamOut; PVRSRV_FILE_PRIVATE_DATA *psPrivateData = PRIVATE_DATA(pFile); - psMapDeviceMemoryOUT->sDstClientMemInfo.ui64Stamp = psPrivateData->ui64Stamp; + if (pvr_put_user(psPrivateData->ui64Stamp, &psMapDeviceMemoryOUT->sDstClientMemInfo.ui64Stamp) != 0) + { + err = -EFAULT; + goto unlock_and_return; + } break; } @@ -416,7 +430,11 @@ PVRSRV_BridgeDispatchKM(struct file *pFile, unsigned int unref__ ioctlCmd, unsig { PVRSRV_BRIDGE_OUT_MAP_DEVICECLASS_MEMORY *psDeviceClassMemoryOUT = (PVRSRV_BRIDGE_OUT_MAP_DEVICECLASS_MEMORY *)psBridgePackageKM->pvParamOut; - psDeviceClassMemoryOUT->sClientMemInfo.ui64Stamp = ++ui64Stamp; + if (pvr_put_user(++ui64Stamp, &psDeviceClassMemoryOUT->sClientMemInfo.ui64Stamp) != 0) + { + err = -EFAULT; + goto unlock_and_return; + } break; } #endif diff --git a/drivers/gpu/pvr/pvr_uaccess.h b/drivers/gpu/pvr/pvr_uaccess.h index bacafe9..4b7114e 100644 --- a/drivers/gpu/pvr/pvr_uaccess.h +++ b/drivers/gpu/pvr/pvr_uaccess.h @@ -64,5 +64,7 @@ static inline unsigned long pvr_copy_from_user(void *pvTo, const void __user *pv #endif } +#define pvr_put_user put_user + #endif diff --git a/drivers/gpu/pvr/pvrversion.h b/drivers/gpu/pvr/pvrversion.h index c887f58..6db898a 100644 --- a/drivers/gpu/pvr/pvrversion.h +++ b/drivers/gpu/pvr/pvrversion.h @@ -36,16 +36,16 @@ #define PVRVERSION_FAMILY "sgxddk" #define PVRVERSION_BRANCHNAME "1.8" -#define PVRVERSION_BUILD 550175 -#define PVRVERSION_BSCONTROL "CustomerGoogle_Android_ogles1_ogles2_GPL" +#define PVRVERSION_BUILD 779202 +#define PVRVERSION_BSCONTROL "blaze_android_sgx_ogles1_ogles2_GPL" -#define PVRVERSION_STRING "CustomerGoogle_Android_ogles1_ogles2_GPL sgxddk 18 1.8@" PVR_STR2(PVRVERSION_BUILD) +#define PVRVERSION_STRING "blaze_android_sgx_ogles1_ogles2_GPL sgxddk 18 1.8@" PVR_STR2(PVRVERSION_BUILD) #define PVRVERSION_STRING_SHORT "1.8@" PVR_STR2(PVRVERSION_BUILD) #define COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved." -#define PVRVERSION_BUILD_HI 55 -#define PVRVERSION_BUILD_LO 175 +#define PVRVERSION_BUILD_HI 77 +#define PVRVERSION_BUILD_LO 9202 #define PVRVERSION_STRING_NUMERIC PVR_STR2(PVRVERSION_MAJ) "." PVR_STR2(PVRVERSION_MIN) "." PVR_STR2(PVRVERSION_BUILD_HI) "." PVR_STR2(PVRVERSION_BUILD_LO) #endif /* _PVRVERSION_H_ */ diff --git a/drivers/gpu/pvr/queue.c b/drivers/gpu/pvr/queue.c index 4682094..92a4713 100644 --- a/drivers/gpu/pvr/queue.c +++ b/drivers/gpu/pvr/queue.c @@ -25,6 +25,7 @@ ******************************************************************************/ #include "services_headers.h" +#include "pvr_bridge_km.h" #include "lists.h" #include "ttrace.h" @@ -625,6 +626,8 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, psCommand->psDstSync[i].ui32WriteOpsPending = PVRSRVGetWriteOpsPending(apsDstSync[i], IMG_FALSE); psCommand->psDstSync[i].ui32ReadOps2Pending = PVRSRVGetReadOpsPending(apsDstSync[i], IMG_FALSE); + apsDstSync[i]->ui32RefCount++; + PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVInsertCommandKM: Dst %u RO-VA:0x%x WO-VA:0x%x ROP:0x%x WOP:0x%x", i, psCommand->psDstSync[i].psKernelSyncInfoKM->sReadOps2CompleteDevVAddr.uiAddr, psCommand->psDstSync[i].psKernelSyncInfoKM->sWriteOpsCompleteDevVAddr.uiAddr, @@ -642,6 +645,8 @@ PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO *psQueue, psCommand->psSrcSync[i].ui32WriteOpsPending = PVRSRVGetWriteOpsPending(apsSrcSync[i], IMG_TRUE); psCommand->psSrcSync[i].ui32ReadOps2Pending = PVRSRVGetReadOpsPending(apsSrcSync[i], IMG_TRUE); + apsSrcSync[i]->ui32RefCount++; + PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVInsertCommandKM: Src %u RO-VA:0x%x WO-VA:0x%x ROP:0x%x WOP:0x%x", i, psCommand->psSrcSync[i].psKernelSyncInfoKM->sReadOps2CompleteDevVAddr.uiAddr, psCommand->psSrcSync[i].psKernelSyncInfoKM->sWriteOpsCompleteDevVAddr.uiAddr, @@ -1003,6 +1008,11 @@ IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, { psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM->psSyncData->ui32WriteOpsComplete++; + if (--psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM->ui32RefCount == 0) + { + PVRSRVFreeSyncInfoKM(psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM); + } + PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_QUEUE, QUEUE_TOKEN_UPDATE_DST, psCmdCompleteData->psDstSync[i].psKernelSyncInfoKM, PVRSRV_SYNCOP_COMPLETE); @@ -1019,6 +1029,11 @@ IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, { psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM->psSyncData->ui32ReadOps2Complete++; + if (--psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM->ui32RefCount == 0) + { + PVRSRVFreeSyncInfoKM(psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM); + } + PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_QUEUE, QUEUE_TOKEN_UPDATE_SRC, psCmdCompleteData->psSrcSync[i].psKernelSyncInfoKM, PVRSRV_SYNCOP_COMPLETE); @@ -1185,6 +1200,7 @@ PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32 ui32DevIndex, if (psCmdCompleteData != IMG_NULL) { + PVR_ASSERT(psCmdCompleteData->bInUse == IMG_FALSE); OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP, psCmdCompleteData->ui32AllocSize, psCmdCompleteData, IMG_NULL); psDeviceCommandData[ui32CmdTypeCounter].apsCmdCompleteData[ui32CmdCounter] = IMG_NULL; diff --git a/drivers/gpu/pvr/sgx/mmu.c b/drivers/gpu/pvr/sgx/mmu.c index fbda31c..774026d 100644 --- a/drivers/gpu/pvr/sgx/mmu.c +++ b/drivers/gpu/pvr/sgx/mmu.c @@ -197,8 +197,10 @@ MMU_PDumpPageTables (MMU_HEAP *pMMUHeap, static IMG_VOID PageTest(IMG_VOID* pMem, IMG_DEV_PHYADDR sDevPAddr); #endif +#define PT_DUMP 1 + #define PT_DEBUG 0 -#if PT_DEBUG +#if (PT_DEBUG || PT_DUMP) && defined(PVRSRV_NEED_PVR_DPF) static IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) { IMG_UINT32 *p = (IMG_UINT32*)psPTInfoList->PTPageCpuVAddr; @@ -207,13 +209,20 @@ static IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) for(i = 0; i < 1024; i += 8) { - PVR_DPF((PVR_DBG_WARNING, + PVR_DPF((PVR_DBG_ERROR, "%08X %08X %08X %08X %08X %08X %08X %08X\n", p[i + 0], p[i + 1], p[i + 2], p[i + 3], p[i + 4], p[i + 5], p[i + 6], p[i + 7])); } } +#else +static INLINE IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) +{ + PVR_UNREFERENCED_PARAMETER(psPTInfoList); +} +#endif +#if PT_DEBUG static IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) { IMG_UINT32 *p = (IMG_UINT32*) psPTInfoList->PTPageCpuVAddr; @@ -226,18 +235,13 @@ static IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) if(psPTInfoList->ui32ValidPTECount != ui32Count) { - PVR_DPF((PVR_DBG_WARNING, "ui32ValidPTECount: %u ui32Count: %u\n", + PVR_DPF((PVR_DBG_ERROR, "ui32ValidPTECount: %u ui32Count: %u\n", psPTInfoList->ui32ValidPTECount, ui32Count)); DumpPT(psPTInfoList); BUG(); } } #else -static INLINE IMG_VOID DumpPT(MMU_PT_INFO *psPTInfoList) -{ - PVR_UNREFERENCED_PARAMETER(psPTInfoList); -} - static INLINE IMG_VOID CheckPT(MMU_PT_INFO *psPTInfoList) { PVR_UNREFERENCED_PARAMETER(psPTInfoList); @@ -2754,6 +2758,9 @@ MMU_MapPage (MMU_HEAP *pMMUHeap, ui32Index )); PVR_DPF((PVR_DBG_ERROR, "MMU_MapPage: Page table entry value: 0x%08X", uTmp)); PVR_DPF((PVR_DBG_ERROR, "MMU_MapPage: Physical page to map: 0x%08X", DevPAddr.uiAddr)); +#if PT_DUMP + DumpPT(ppsPTInfoList[0]); +#endif } #if !defined(FIX_HW_BRN_31620) PVR_ASSERT((uTmp & SGX_MMU_PTE_VALID) == 0); diff --git a/drivers/gpu/pvr/sgxerrata.h b/drivers/gpu/pvr/sgxerrata.h index 9463308..8a3632f 100644 --- a/drivers/gpu/pvr/sgxerrata.h +++ b/drivers/gpu/pvr/sgxerrata.h @@ -647,6 +647,8 @@ #else #if SGX_CORE_REV == 1014 #else + #if SGX_CORE_REV == 10141 + #else #if SGX_CORE_REV == SGX_CORE_REV_HEAD #else @@ -658,6 +660,7 @@ #endif #endif #endif + #endif #define SGX_CORE_DEFINED #endif |