km: fix use of freed gem object in UnwrapExtMemoryCallBack()
UnwrapExtMemoryCallBack() first frees the drm_gem_object via
FreeMemCallBackCommon(), and then continues using the drm_gem_object by
calling omap_gem_put_paddr(). This leads to omap_gem_put_paddr()
accessing freed memory.
Change the call order to first call omap_gem_put_paddr() and only then
call FreeMemCallBackCommon().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
UnwrapExtMemoryCallBack() first frees the drm_gem_object via
FreeMemCallBackCommon(), and then continues using the drm_gem_object by
calling omap_gem_put_paddr(). This leads to omap_gem_put_paddr()
accessing freed memory.
Change the call order to first call omap_gem_put_paddr() and only then
call FreeMemCallBackCommon().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
KM: Replace DOS-line endings with Unix ones
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
KM: Disable the Interrupt Sync Check unless SUPPORT_LISR_MISR_SYNC is defined
Reimplement the patch "KM: Disable the check of interrupt count at function SGXPrePowerState() temporarily"
per DDK 1.12. The LISR and MISR are only loosely synchronized unless
the compiler switch SUPPORT_LISR_MISR_SYNC is defined, therefore, we
need to disable the SYNC check during the power state transition.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
Reimplement the patch "KM: Disable the check of interrupt count at function SGXPrePowerState() temporarily"
per DDK 1.12. The LISR and MISR are only loosely synchronized unless
the compiler switch SUPPORT_LISR_MISR_SYNC is defined, therefore, we
need to disable the SYNC check during the power state transition.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
KM: Remove the OCP_SYSCONFIG setting
The SYSCONFIG init value 0x14 will disable the power management capability.
Use the default value 0x28 instead.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
The SYSCONFIG init value 0x14 will disable the power management capability.
Use the default value 0x28 instead.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
KM: Add SGX hardware reset assert at the function PVRSRVDriverRemove.
The SGX device should be put into reset state when the PVRSRV driver is removed.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
The SGX device should be put into reset state when the PVRSRV driver is removed.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
KM: Disable the check of interrupt count at function SGXPrePowerState() temporarily.
There seems to be 2 missing interrupts when the SGX program is terminated,
therefore this wait will fail every time.
This check is disabled temporarily until the root cause is identified. Then
this patch will be reverted.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
There seems to be 2 missing interrupts when the SGX program is terminated,
therefore this wait will fail every time.
This check is disabled temporarily until the root cause is identified. Then
this patch will be reverted.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
KM: Update the device-sgx names at omap_gpu_id_table
module.c: Update the device-sgx names per DT changes
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
module.c: Update the device-sgx names per DT changes
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
Update the compatible name for AM3/AM4 SGX
KM: Add include file "asm/outercache.h" if CONFIG_OUTER_CACHE
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: fix recursive mutex lock problem when debug
options are enabled and
km: change device binding to be compatible with
updated DT
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
options are enabled and
km: change device binding to be compatible with
updated DT
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: fix recursive mutex lock problem when debug
options are enabled
Note: some changes are mixed with other patches
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
options are enabled
Note: some changes are mixed with other patches
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: update for omapdrm plugin changes supporting single mapper
DRM driver supports only single plugin - SGX. There is no need for a mapper_id
in that case.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
DRM driver supports only single plugin - SGX. There is no need for a mapper_id
in that case.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: remove inclusion of asm/system.h
This header file has been removed in K4.1. Remove references to this header
file.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
This header file has been removed in K4.1. Remove references to this header
file.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: change drm_mmap to drm_gem_mmap
drm_mmap has been deprecated. GEM aware drivers are supposed to support
drm_gem_mmap.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
drm_mmap has been deprecated. GEM aware drivers are supposed to support
drm_gem_mmap.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: enable traces when the SGX recovers from error
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: mmap.c Add SUPPORT_DRI_DRM_EXTERNAL protection for drm_gen related code
Add SUPPORT_DRI_DRM_EXTERNAL compiler switch protection against drm_gen
related API calls at function MMapVCloseNoLock()
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
Add SUPPORT_DRI_DRM_EXTERNAL compiler switch protection against drm_gen
related API calls at function MMapVCloseNoLock()
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Enhance DDK initialization procedure to support non-OMAP5 devices.
The IMG DDK is designed to support all devices, but the DDK 1.9 was used for
OMAP5 only until now and therefore it is a little out of date for non-OMAP5 devices.
To enable support for non-OMAP5 devices, such as AM335x and AM437x, the
following changes are required:
- Introduce new compiler switch "PM_RUNTIME_SUPPORT" and "CONFIG_RESET_CONTROLLER"
- DEVNAME should be the same as DRVNAME
- Update the SGX compatible string to "ti,sgx" for non-OMAP5 devices
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
The IMG DDK is designed to support all devices, but the DDK 1.9 was used for
OMAP5 only until now and therefore it is a little out of date for non-OMAP5 devices.
To enable support for non-OMAP5 devices, such as AM335x and AM437x, the
following changes are required:
- Introduce new compiler switch "PM_RUNTIME_SUPPORT" and "CONFIG_RESET_CONTROLLER"
- DEVNAME should be the same as DRVNAME
- Update the SGX compatible string to "ti,sgx" for non-OMAP5 devices
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Add PVR trace to function PVRSRVDrmInit()
PVRSRVDRmInit() is the first PVR function to be invoked when DRM is enabled
by defining SUPPORT_DRI_DRM.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
PVRSRVDRmInit() is the first PVR function to be invoked when DRM is enabled
by defining SUPPORT_DRI_DRM.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Add more "SUPPORT_DRI_DRM_EXTERNAL" protected sections
The cuurent DDK supports only the OMAP5 devices which use external DRM driver
so that the SUPPORT_DRI_DRM_EXTERNAL is always defined. To enhnace the DDK to
support other types of devices which may not even use DRM, we need to enhance
the DDK KM to support the case where SUPPORT_DRI_DRM_EXTERNAL is not defined.
We need to add "#if defined(SUPPORT_DRI_DRM_EXTERNAL)" protection to any code
sections where omap_gen APIs or other omap_drm related structures or functionalities
are invoked.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
The cuurent DDK supports only the OMAP5 devices which use external DRM driver
so that the SUPPORT_DRI_DRM_EXTERNAL is always defined. To enhnace the DDK to
support other types of devices which may not even use DRM, we need to enhance
the DDK KM to support the case where SUPPORT_DRI_DRM_EXTERNAL is not defined.
We need to add "#if defined(SUPPORT_DRI_DRM_EXTERNAL)" protection to any code
sections where omap_gen APIs or other omap_drm related structures or functionalities
are invoked.
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Enable AM437x support
- Add am437x sysconfig.c and other device-specific header and utility files
- Add am437x Makefile
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
- Add am437x sysconfig.c and other device-specific header and utility files
- Add am437x Makefile
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Enable AM335x support
- Add am335x sysconfig.c and other device-specific header and utility files
- Add am335x Makefile
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
- Add am335x sysconfig.c and other device-specific header and utility files
- Add am335x Makefile
Signed-off-by: Eric Ruei <e-ruei1@ti.com>
km: Fix array-OOB issue in create_gem_wrapper
The number of pages allocated at NewAllocPagesLinuxMemArea
[eurasia_km/services4/srvkm/env/linux/mm.c] is stored in
psLinuxMemArea->ui32ByteSize.
However, the number of pages required is not at times the
same as calculated in BM_GetVirtualSize.
Its ok to allocate a bigger array of pages, but let's not
try to access the source array beyond the array bounds.
Signed-off-by: Subhajit Paul <a0132170@ti.com>
The number of pages allocated at NewAllocPagesLinuxMemArea
[eurasia_km/services4/srvkm/env/linux/mm.c] is stored in
psLinuxMemArea->ui32ByteSize.
However, the number of pages required is not at times the
same as calculated in BM_GetVirtualSize.
Its ok to allocate a bigger array of pages, but let's not
try to access the source array beyond the array bounds.
Signed-off-by: Subhajit Paul <a0132170@ti.com>
Truncate the SGX HW recovery traces
SGX HW recovery indicates that GPU has undergone an error in its operations and
has recovered through reset. The traces printed during HW recovery slows down
the system and is required only for in-depth debugging.
By default, disable the dumping of HW recovery traces.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
SGX HW recovery indicates that GPU has undergone an error in its operations and
has recovered through reset. The traces printed during HW recovery slows down
the system and is required only for in-depth debugging.
By default, disable the dumping of HW recovery traces.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Enable voluntary kernel preemption option in the SGX driver
SGX driver uses work queues which requires full kernel preemption. Allow SGX
driver to be built with voluntary kernel preemption.
Note that kernel scheduling with voluntary preemption is substantially
different from full kernel preemption. Selection of preemption mode must be
done by the system integrator based on the required use cases.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
SGX driver uses work queues which requires full kernel preemption. Allow SGX
driver to be built with voluntary kernel preemption.
Note that kernel scheduling with voluntary preemption is substantially
different from full kernel preemption. Selection of preemption mode must be
done by the system integrator based on the required use cases.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: fix GEM handle memory leak
When memory handles are mapped, a dummy GEM handle is created so that it can be
accepted by DRM. However, when the memory handle is unmaped, there is no
corresponding delete of the GEM handle.
Given that each GEM handle is 4K bytes, this will result in a memory leak that
will result in application crash over time. This is not catastrophic to the
system since DRM/GEM core will cleanup the GEM handles allocated as part of the
proces when it exit.
This patch addresses the GEM handle leak in SGX driver.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
When memory handles are mapped, a dummy GEM handle is created so that it can be
accepted by DRM. However, when the memory handle is unmaped, there is no
corresponding delete of the GEM handle.
Given that each GEM handle is 4K bytes, this will result in a memory leak that
will result in application crash over time. This is not catastrophic to the
system since DRM/GEM core will cleanup the GEM handles allocated as part of the
proces when it exit.
This patch addresses the GEM handle leak in SGX driver.
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
km: removed extra character from trace message
This string concatenation caused compilation errors when trace was enabled.
Change-Id: I1de6870a22fe223496483e3e8b7281cf1dbeb7a2
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
This string concatenation caused compilation errors when trace was enabled.
Change-Id: I1de6870a22fe223496483e3e8b7281cf1dbeb7a2
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
K3.14: Changed compatibility to omap4-gpu as per the new DT
Change-Id: If81be34700c99ce938eb9ad4c440b075403bfd4c
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Change-Id: If81be34700c99ce938eb9ad4c440b075403bfd4c
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Use omap_gem APIs for accessing private data
The current code accesses the private buffer from DRM object directly. Instead,
use the APIs defined in omap_gem to access the private data.
Change-Id: Ibd6c0bd9c4dfe7df4926e55ca0f28b917cbc262d
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
The current code accesses the private buffer from DRM object directly. Instead,
use the APIs defined in omap_gem to access the private data.
Change-Id: Ibd6c0bd9c4dfe7df4926e55ca0f28b917cbc262d
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
K3.14: API changes for ioremap
ioremap_cached is redefined as ioremap_cache in k3.14
Change-Id: Ie539ef5da4109e1bd2d5cc589c026d833858c849
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
ioremap_cached is redefined as ioremap_cache in k3.14
Change-Id: Ie539ef5da4109e1bd2d5cc589c026d833858c849
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Revert "Add support for a segmented register memory map for SGX"
This reverts commit 70bbb856e74feba2007ba0645ca975730afc9bd6.
Anand: K3.14 DTS file has the SGX register map defined as a single continuous
region. For K3.8/K3.12, the register map was broken down for individual
submodules of SGX
This reverts commit 70bbb856e74feba2007ba0645ca975730afc9bd6.
Anand: K3.14 DTS file has the SGX register map defined as a single continuous
region. For K3.8/K3.12, the register map was broken down for individual
submodules of SGX
K3.12 mmap support for sync data
mmap support by creating in-kernel private handles was
incorporated in a previous patch. However, handles were
created only for memory allocated inside the mmap function.
If the mmap request is made on an existing memory, create a
handle as well.
Change-Id: I3a44db65700bc0f8e08ddc438d305bf2911817fb
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
mmap support by creating in-kernel private handles was
incorporated in a previous patch. However, handles were
created only for memory allocated inside the mmap function.
If the mmap request is made on an existing memory, create a
handle as well.
Change-Id: I3a44db65700bc0f8e08ddc438d305bf2911817fb
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
K3.12 create a dummy gem handle for every gem allocation
K3.12 GEM vma features ensure that mmap on a gem is called
only if a handle is created for it. This serves the purpose
of authentication.
Since SGX creates GEM areas in KM using omap_gem_new_ext and
therefore no handles are created, mmap fails.
Lets just create a dummy handle for each gem object. Dont
bother to free it. drm_release will take care if it.
Change-Id: I2415a9a8aaf4001e558b824821a05904a2934005
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
K3.12 GEM vma features ensure that mmap on a gem is called
only if a handle is created for it. This serves the purpose
of authentication.
Since SGX creates GEM areas in KM using omap_gem_new_ext and
therefore no handles are created, mmap fails.
Lets just create a dummy handle for each gem object. Dont
bother to free it. drm_release will take care if it.
Change-Id: I2415a9a8aaf4001e558b824821a05904a2934005
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
K3.12 fix for SGX modifying return value after gem_new
SGX modifies the value of buffer size after gem is created
to align it to page size. In 3.12 kernel, if gem allocation
size and vaddr start and end do not match, a mmap cannot
be done.
So why not determine how much will be the return size and
allocate a big enough gem area. Makes both parties happy.
Change-Id: I5fb99d7a479f53048ddb77bda001bf516bec5d06
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
SGX modifies the value of buffer size after gem is created
to align it to page size. In 3.12 kernel, if gem allocation
size and vaddr start and end do not match, a mmap cannot
be done.
So why not determine how much will be the return size and
allocate a big enough gem area. Makes both parties happy.
Change-Id: I5fb99d7a479f53048ddb77bda001bf516bec5d06
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
K3.12 update DRM_IOCTLs to reflect argument size
In the 3.12 kernel, the ioctls expect the argument size
to be present in the ioctl definition.
Change-Id: I74d0d3ecb4207f17031d5bb0636513affc036803
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
In the 3.12 kernel, the ioctls expect the argument size
to be present in the ioctl definition.
Change-Id: I74d0d3ecb4207f17031d5bb0636513affc036803
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
K3.12: Disable the warning for missing prototypes
* In K3.12, missing-prototypes warning causes compilation errors for NOP cache
* operations.
* Disable this warning
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
* In K3.12, missing-prototypes warning causes compilation errors for NOP cache
* operations.
* Disable this warning
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
K3.12: Update the driver for changes in ProcFS APIs
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Changed the DT compatibility to omap5 instead of omap4
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
memory leak fix for external GEM buffers
The drm_gem_objects mmaped should be dereferenced by the
respective vm_close function.
Since the DRM GEM core is not responsible for freeing up any
memory attached to the external GEM buffers, the pages array
needs to be freed up in the PVR core, after the GEM object
has been released.
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
The drm_gem_objects mmaped should be dereferenced by the
respective vm_close function.
Since the DRM GEM core is not responsible for freeing up any
memory attached to the external GEM buffers, the pages array
needs to be freed up in the PVR core, after the GEM object
has been released.
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
DDK changes for GLSDK 6.02
* Add the paths for omapdrm header files in Kbuild
* Add support for a segmented register memory map for SGX
* Change the module from platform driver model to DT model
Signed-off by: Subhajit Paul <subhajit_paul@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
* Add the paths for omapdrm header files in Kbuild
* Add support for a segmented register memory map for SGX
* Change the module from platform driver model to DT model
Signed-off by: Subhajit Paul <subhajit_paul@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Reversing the K3.8 patch
* this commit has gone through review comments and needs to be updated
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
* this commit has gone through review comments and needs to be updated
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Updated README with build instructions and version information
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Merge branch 'master' of git.ti.com:graphics/omap5-sgx-ddk-linux
Added an eurasia_km directory to maintain the directory structure
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
porting to Linux-3.8.y
Linux upstream has stopped supporting platform data
In this case, the platform driver calls probe if a
compatible platform driver is found.
This patch modifies the driver to be based entirely
on DT.
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
Linux upstream has stopped supporting platform data
In this case, the platform driver calls probe if a
compatible platform driver is found.
This patch modifies the driver to be based entirely
on DT.
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
Installation for kernel modules
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Ensure that Linux kernel has been built with preemptible kernel
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Updated readme to reflect OMAP5 build steps
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Added a git ignore
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
DDK 1.9 kernel module
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>
Signed-off-by: Anand Balagopalakrishnan <anandb@ti.com>