diff options
author | Hemant Hariyani <hemanthariyani@ti.com> | 2014-12-01 10:31:50 -0600 |
---|---|---|
committer | Hemant Hariyani <hemanthariyani@ti.com> | 2014-12-01 10:59:08 -0600 |
commit | 7ba6322476fe758da39a711c4918516694da23af (patch) | |
tree | bff4b1dd1bea0a68111d792d32245c4451867837 | |
parent | 61b0359352629226e33d2ab8ce1dc0e47508b344 (diff) | |
download | proprietary-open-jacinto-7ba6322476fe758da39a711c4918516694da23af.tar.gz |
sgx_src: Update sgx_src with missing files and platform rev
This files were missing from the previous commit. Also, set
default platform version to 5.0 to allow building KM
without Android enviornment.
Change-Id: I768a1824846ac07574ca3b78769dd4bf56628c80
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
-rw-r--r-- | jacinto6/README.SGX | 12 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/common/android/platform_version.mk | 2 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.c | 283 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.h | 58 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/srvkm/include/external_sync.h (renamed from jacinto6/sgx_src/eurasia_km/services4/srvkm/include/ion_sync.h) | 24 |
5 files changed, 361 insertions, 18 deletions
diff --git a/jacinto6/README.SGX b/jacinto6/README.SGX index 1479e47..c1fde6c 100644 --- a/jacinto6/README.SGX +++ b/jacinto6/README.SGX @@ -16,11 +16,13 @@ sgx.tgz a set of binaries built for SGX544. [DDK Version] 1.12/2917986 [DDK commit ID] - 0c60181 android: update hal_public.h for TI formats + c76a085 build-km: Set 5.0 as default version [Branch] android/1.12/2917986_k3.14_L_gem [Kernel modules built against] Kernel Version: 3.14.y with CONFIG_MODVERSIONS=y +[Build type] + debug (export BUILD=debug) #=========================================================================== # Building SGX Kernel Modules @@ -31,17 +33,17 @@ Make sure kernel is built before building modules # cd ANDROID_ROOT/device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/omap_android/ # export KERNELDIR=path_to_kernel +# export PATH=<path to kernel toolchain>:$PATH To build for OMAP5 (SGX 544 multi core): -# make ARCH=arm KERNEL_CROSS_COMPILE=arm-eabi- CROSS_COMPILE=arm-eabi- TARGET_PRODUCT="jacinto6evm" PLATFORM_VERSION=5.0 BUILD=debug +# make ARCH=arm KERNEL_CROSS_COMPILE=arm-eabi- CROSS_COMPILE=arm-eabi- TARGET_PRODUCT="jacinto6evm" BUILD=debug Once the .ko is built, install it onto device (/system/lib/modules) -# cd ANDROID_ROOT/device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/binary2_omap_android_release/target/ +# cd ANDROID_ROOT/device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/binary2_omap_android_debug/target/ # adb push pvrsrvkm.ko /system/lib/modules/ -# adb push omaplfb.ko /system/lib/modules/ If you build the kernel module, it is highly advisable to replace the binaries -in your device with the ones located in sgx.tgz to avoid incompatibility. +in your device with the ones in sgx.tgz to avoid incompatibility. Reboot device. diff --git a/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/common/android/platform_version.mk b/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/common/android/platform_version.mk index 482fd19..bf43dda 100644 --- a/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/common/android/platform_version.mk +++ b/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/common/android/platform_version.mk @@ -45,7 +45,7 @@ PLATFORM_VERSION := $(shell \ cat $(TARGET_ROOT)/product/$(TARGET_DEVICE)/system/build.prop | \ grep ^ro.build.version.release | cut -f2 -d'=' | cut -f1 -d'-'; \ else \ - echo 1.6; \ + echo 5.0; \ fi) define version-starts-with diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.c b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.c new file mode 100644 index 0000000..29c7d5d --- /dev/null +++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.c @@ -0,0 +1,283 @@ +/*************************************************************************/ /*! +@Title Ion driver inter-operability code. +@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved +@License Dual MIT/GPLv2 + +The contents of this file are subject to the MIT license as set out below. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Alternatively, the contents of this file may be used under the terms of +the GNU General Public License Version 2 ("GPL") in which case the provisions +of GPL are applicable instead of those above. + +If you wish to allow use of your version of this file only under the terms of +GPL, and not to allow others to use your version of this file under the terms +of the MIT license, indicate your decision by deleting the provisions above +and replace them with the notice and other provisions required by GPL as set +out in the file called "GPL-COPYING" included in this distribution. If you do +not delete the provisions above, a recipient may use your version of this file +under the terms of either the MIT license or GPL. + +This License is also included in this distribution in the file called +"MIT-COPYING". + +EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS +PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /**************************************************************************/ + +#include "dmabuf.h" +#include <linux/platform_device.h> +#include <linux/dma-buf.h> +#include <linux/dma-direction.h> +#include <linux/scatterlist.h> +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/err.h> + +extern struct platform_device *gpsPVRLDMDev; + +#define MAX_IMPORT_DMABUF_FDS 3 + +typedef struct _DMABUF_IMPORT_DATA_ +{ + /* Number of dma_buf handles represented by this import */ + IMG_UINT32 ui32NumHandles; + + /* Array of dma_buf handles in use by services */ + struct dma_buf *apsDmaBuf[MAX_IMPORT_DMABUF_FDS]; + + /* Array of dma_buf attachments */ + struct dma_buf_attachment *apsDmaBufAttachment[MAX_IMPORT_DMABUF_FDS]; + + /* Array of sg_tables */ + struct sg_table *apsSgTable[MAX_IMPORT_DMABUF_FDS]; + + /* Array of physical addresses represented by these buffers */ + IMG_SYS_PHYADDR *psSysPhysAddr; + +#if defined(PDUMP) + /* FIXME: Not sure if this is needed here */ + IMG_PVOID pvKernAddr0; +#endif /* defined(PDUMP) */ +} +DMABUF_IMPORT_DATA; + +PVRSRV_ERROR DmabufImportBufferAndAcquirePhysAddr(IMG_UINT32 ui32NumFDs, + IMG_INT32 *pai32BufferFDs, + IMG_UINT32 *pui32PageCount, + IMG_SYS_PHYADDR **ppsSysPhysAddr, + IMG_PVOID *ppvKernAddr0, + IMG_HANDLE *phPriv, + IMG_HANDLE *phUnique) +{ + struct scatterlist *psTemp, *psScatterList[MAX_IMPORT_DMABUF_FDS] = {}; + PVRSRV_ERROR eError = PVRSRV_ERROR_OUT_OF_MEMORY; + IMG_UINT32 i, k, ui32PageCount = 0; + DMABUF_IMPORT_DATA *psImportData; + + if(ui32NumFDs > MAX_IMPORT_DMABUF_FDS) + { + printk(KERN_ERR "%s: More passed in than supported " + "(%d provided, %d max)", __func__, ui32NumFDs, + MAX_IMPORT_DMABUF_FDS); + return PVRSRV_ERROR_INVALID_PARAMS; + } + + psImportData = kzalloc(sizeof(DMABUF_IMPORT_DATA), GFP_KERNEL); + if (psImportData == NULL) + { + goto exitFailKMallocImportData; + } + + /* Set up import data for free call */ + psImportData->ui32NumHandles = ui32NumFDs; + + for(i = 0; i < ui32NumFDs; i++) + { + int fd = (int)pai32BufferFDs[i]; + + psImportData->apsDmaBuf[i] = dma_buf_get(fd); + if (psImportData->apsDmaBuf[i] == IMG_NULL) + { + eError = PVRSRV_ERROR_BAD_MAPPING; + goto exitFailImport; + } + + psImportData->apsDmaBufAttachment[i] = dma_buf_attach(psImportData->apsDmaBuf[i], + &gpsPVRLDMDev->dev); + + psImportData->apsSgTable[i] = dma_buf_map_attachment(psImportData->apsDmaBufAttachment[i], + DMA_BIDIRECTIONAL); + + psScatterList[i] = psImportData->apsSgTable[i]->sgl; + if (psScatterList[i] == NULL) + { + eError = PVRSRV_ERROR_INVALID_PARAMS; + goto exitFailImport; + } + + /* Although all heaps will provide an sg_table, the tables cannot + * always be trusted because sg_lists are just pointers to "struct + * page" values, and some memory e.g. carveout may not have valid + * "struct page" values. In particular, on ARM, carveout is + * generally reserved with memblock_remove(), which leaves the + * "struct page" entries uninitialized when SPARSEMEM is enabled. + * The effect of this is that page_to_pfn(pfn_to_page(pfn)) != pfn. + * + * There's more discussion on this mailing list thread: + * http://lists.linaro.org/pipermail/linaro-mm-sig/2012-August/002440.html + * + * probably a contiguous allocator. If the phys() function is + * implemented, we'll use it to check sg_table->sgl[0]. If we find + * they don't agree, we'll assume phys() is more reliable and use + * that. + * + * Some heaps out there will implement phys() even though they are + * not for physically contiguous allocations (so the sg_table must + * be used). Therefore use the sg_table if the phys() and first + * sg_table entry match. This should be reliable because for most + * contiguous allocators, the sg_table should be a single span + * from 'start' to 'start+size'. + * + * Also, ion prints out an error message if the heap doesn't implement + * ->phys(), which we want to avoid, so only use ->phys() if the + * sg_table contains a single span and therefore could plausibly + * be a contiguous allocator. + */ + #if 0 + if(!sg_next(psScatterList[i])) + { + ion_phys_addr_t sPhyAddr; + size_t sLength; + + if(!ion_phys(psIonClient, psImportData->apsIonHandle[i], + &sPhyAddr, &sLength)) + { + BUG_ON(sLength & ~PAGE_MASK); + + if(sg_phys(psScatterList[i]) != sPhyAddr) + { + psScatterList[i] = IMG_NULL; + ui32PageCount += sLength / PAGE_SIZE; + } + } + } + #endif + for(psTemp = psScatterList[i]; psTemp; psTemp = sg_next(psTemp)) + { + IMG_UINT32 j; + for (j = 0; j < psTemp->length; j += PAGE_SIZE) + { + ui32PageCount++; + } + } + } + + BUG_ON(ui32PageCount == 0); + + psImportData->psSysPhysAddr = kmalloc(sizeof(IMG_SYS_PHYADDR) * ui32PageCount, GFP_KERNEL); + if (psImportData->psSysPhysAddr == NULL) + { + goto exitFailImport; + } + + for(i = 0, k = 0; i < ui32NumFDs; i++) + { + if(psScatterList[i]) + { + for(psTemp = psScatterList[i]; psTemp; psTemp = sg_next(psTemp)) + { + IMG_UINT32 j; + for (j = 0; j < psTemp->length; j += PAGE_SIZE) + { + psImportData->psSysPhysAddr[k].uiAddr = sg_phys(psTemp) + j; + k++; + } + } + } +#if 0 + else + { + ion_phys_addr_t sPhyAddr; + size_t sLength, j; + + ion_phys(psIonClient, psImportData->apsIonHandle[i], + &sPhyAddr, &sLength); + + for(j = 0; j < sLength; j += PAGE_SIZE) + { + psImportData->psSysPhysAddr[k].uiAddr = sPhyAddr + j; + k++; + } + } +#endif + } + + *pui32PageCount = ui32PageCount; + *ppsSysPhysAddr = psImportData->psSysPhysAddr; + +#if defined(PDUMP) + if(ui32NumFDs == 1) + { + /*FIXME */ + /* Need to handle kernel mapping */ + } + else +#endif /* defined(PDUMP) */ + { + *ppvKernAddr0 = NULL; + } + + *phPriv = psImportData; + *phUnique = (IMG_HANDLE)psImportData->psSysPhysAddr[0].uiAddr; + + return PVRSRV_OK; + +exitFailImport: + for(i = 0; psImportData->apsDmaBuf[i] != NULL; i++) + { + dma_buf_put(psImportData->apsDmaBuf[i]); + } + kfree(psImportData); +exitFailKMallocImportData: + return eError; +} + +IMG_VOID DmabufUnimportBufferAndReleasePhysAddr(IMG_HANDLE hPriv) +{ + DMABUF_IMPORT_DATA *psImportData = hPriv; + IMG_UINT32 i; + +#if defined(PDUMP) + if (psImportData->pvKernAddr0) + { + //FIXME + } +#endif /* defined(PDUMP) */ + for(i = 0; i < psImportData->ui32NumHandles; i++) + { + dma_buf_unmap_attachment(psImportData->apsDmaBufAttachment[i], + psImportData->apsSgTable[i], + DMA_BIDIRECTIONAL); + dma_buf_detach(psImportData->apsDmaBuf[i], + psImportData->apsDmaBufAttachment[i]); + dma_buf_put(psImportData->apsDmaBuf[i]); + } + + kfree(psImportData->psSysPhysAddr); + kfree(psImportData); +} diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.h b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.h new file mode 100644 index 0000000..4ea3ff1 --- /dev/null +++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/env/linux/dmabuf.h @@ -0,0 +1,58 @@ +/*************************************************************************/ /*! +@Title Ion driver inter-operability code. +@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved +@License Dual MIT/GPLv2 + +The contents of this file are subject to the MIT license as set out below. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Alternatively, the contents of this file may be used under the terms of +the GNU General Public License Version 2 ("GPL") in which case the provisions +of GPL are applicable instead of those above. + +If you wish to allow use of your version of this file only under the terms of +GPL, and not to allow others to use your version of this file under the terms +of the MIT license, indicate your decision by deleting the provisions above +and replace them with the notice and other provisions required by GPL as set +out in the file called "GPL-COPYING" included in this distribution. If you do +not delete the provisions above, a recipient may use your version of this file +under the terms of either the MIT license or GPL. + +This License is also included in this distribution in the file called +"MIT-COPYING". + +EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS +PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /**************************************************************************/ + +#ifndef __IMG_LINUX_DMABUF_H__ +#define __IMG_LINUX_DMABUF_H__ + +#include "img_types.h" +#include "servicesext.h" + +PVRSRV_ERROR DmabufImportBufferAndAcquirePhysAddr(IMG_UINT32 ui32NumFDs, + IMG_INT32 *pi32BufferFDs, + IMG_UINT32 *pui32PageCount, + IMG_SYS_PHYADDR **ppsSysPhysAddr, + IMG_PVOID *ppvKernAddr0, + IMG_HANDLE *phPriv, + IMG_HANDLE *phUnique); + +IMG_VOID DmabufUnimportBufferAndReleasePhysAddr(IMG_HANDLE hPriv); + +#endif /* __IMG_LINUX_DMABUF_H__ */ diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/include/ion_sync.h b/jacinto6/sgx_src/eurasia_km/services4/srvkm/include/external_sync.h index 8600a19..9b64d1e 100644 --- a/jacinto6/sgx_src/eurasia_km/services4/srvkm/include/ion_sync.h +++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/include/external_sync.h @@ -43,31 +43,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "img_types.h" #include "servicesint.h" -#ifndef __ION_SYNC_H__ -#define __ION_SYNC_H__ +#ifndef __EXTERNAL_SYNC_H__ +#define __EXTERNAL_SYNC_H__ -typedef struct _PVRSRV_ION_SYNC_INFO_ { +typedef struct _PVRSRV_EXTERNAL_SYNC_INFO_ { PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; IMG_HANDLE hUnique; IMG_UINT32 ui32RefCount; IMG_UINT64 ui64Stamp; -} PVRSRV_ION_SYNC_INFO; +} PVRSRV_EXTERNAL_SYNC_INFO; -PVRSRV_ERROR PVRSRVIonBufferSyncAcquire(IMG_HANDLE hUnique, +PVRSRV_ERROR PVRSRVExternalBufferSyncAcquire(IMG_HANDLE hUnique, IMG_HANDLE hDevCookie, IMG_HANDLE hDevMemContext, - PVRSRV_ION_SYNC_INFO **ppsIonSyncInfo); + PVRSRV_EXTERNAL_SYNC_INFO **ppsExternalSyncInfo); -IMG_VOID PVRSRVIonBufferSyncRelease(PVRSRV_ION_SYNC_INFO *psIonSyncInfo); +IMG_VOID PVRSRVExternalBufferSyncRelease(PVRSRV_EXTERNAL_SYNC_INFO *psExternalSyncInfo); -static INLINE PVRSRV_KERNEL_SYNC_INFO *IonBufferSyncGetKernelSyncInfo(PVRSRV_ION_SYNC_INFO *psIonSyncInfo) +static INLINE PVRSRV_KERNEL_SYNC_INFO *ExternalBufferSyncGetKernelSyncInfo(PVRSRV_EXTERNAL_SYNC_INFO *psExternalSyncInfo) { - return psIonSyncInfo->psSyncInfo; + return psExternalSyncInfo->psSyncInfo; } -static INLINE IMG_UINT64 IonBufferSyncGetStamp(PVRSRV_ION_SYNC_INFO *psIonSyncInfo) +static INLINE IMG_UINT64 ExternalBufferSyncGetStamp(PVRSRV_EXTERNAL_SYNC_INFO *psExternalSyncInfo) { - return psIonSyncInfo->ui64Stamp; + return psExternalSyncInfo->ui64Stamp; } -#endif /* __ION_SYNC_H__ */ +#endif /* __EXTERNAL_SYNC_H__ */ |