[Openpvrsgx-devgroup] [PATCH] Update pvrsgx 1.14.3759903 to latest kernel

Lucas Fryzek lucas.fryzek at hazeco.xyz
Fri Nov 12 13:53:39 CET 2021


Incorporate fixes from the pvrsgx 1.17.4948957 driver to the
1.14.3759903 driver to allow it to build on the latest 5.15 kernel version
---
 .../services4/srvkm/env/linux/dmabuf.c        |   3 +-
 .../eurasia_km/services4/srvkm/env/linux/mm.c |  56 +++++++++
 .../services4/srvkm/env/linux/mmap.c          |  19 ++++
 .../services4/srvkm/env/linux/module.c        |   4 +
 .../services4/srvkm/env/linux/mutils.h        |   6 +
 .../services4/srvkm/env/linux/osfunc.c        | 106 +++++++++++++-----
 .../services4/srvkm/env/linux/private_data.h  |   3 +
 .../services4/srvkm/env/linux/proc.c          |  11 ++
 .../services4/srvkm/env/linux/pvr_bridge_k.c  |   4 +
 .../services4/srvkm/env/linux/pvr_drm.h       |   3 +
 .../services4/srvkm/env/linux/pvr_uaccess.h   |   4 +-
 .../services4/system/sgx_jz4780/sysconfig.h   |   3 +
 12 files changed, 193 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/dmabuf.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/dmabuf.c
index 8e26d7c01027..14cb0e986ca6 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/dmabuf.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/dmabuf.c
@@ -48,7 +48,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <linux/err.h>
 #include <linux/dma-buf.h>
 #include <linux/scatterlist.h>
-#if defined(SUPPORT_DRI_DRM)
+#include <linux/version.h>
+#if defined(SUPPORT_DRI_DRM) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
 #include <drm/drmP.h>
 #endif
 
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mm.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mm.c
index c5a9b9b0bf63..80147aabd416 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mm.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mm.c
@@ -485,6 +485,58 @@ AllocFlagsToPGProt(pgprot_t *pPGProtFlags, IMG_UINT32 ui32AllocFlags)
     return IMG_TRUE;
 }
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
+#else
+/* provide pre-5.8 __vmalloc() with 3 parameters */
+
+#include <linux/kallsyms.h>
+
+static void *__old_vmalloc_node(unsigned long size, unsigned long align,
+			    gfp_t gfp_mask, pgprot_t prot,
+			    int node, const void *caller)
+{
+#if 0
+/* unfortunately this does no longer work
+ * because now kallsyms_lookup_name() itself is no longer
+ * exported
+ * See: https://lwn.net/Articles/813350/
+*/
+	/* look up a function that is not exported by EXPORT_SYMBOL
+	 * so that we can link a kernel module
+	 * see: https://www.programmersought.com/article/40296591069/
+	 */
+
+	typedef void *ft(unsigned long size, unsigned long align,
+			unsigned long start, unsigned long end, gfp_t gfp_mask,
+			pgprot_t prot, unsigned long vm_flags, int node,
+			const void *caller);
+
+	ft *fp = (ft *) kallsyms_lookup_name("__vmalloc_node_range");
+
+	if (!fp)
+		return NULL;
+
+	return fp(size, align, VMALLOC_START, VMALLOC_END,
+				gfp_mask, prot, 0, node, caller);
+#else
+/* this works
+ * if we add EXPORT_SYMBOL(__vmalloc_node_range);
+ * to vmalloc.c */
+
+	return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
+				    gfp_mask, prot, 0, node, caller);
+
+
+#endif
+}
+
+static void *__old_vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
+{
+	return __old_vmalloc_node(size, 1, gfp_mask, prot, NUMA_NO_NODE,
+				__builtin_return_address(0));
+}
+#endif
+
 IMG_VOID *
 _VMallocWrapper(IMG_SIZE_T uiBytes,
                 IMG_UINT32 ui32AllocFlags,
@@ -509,7 +561,11 @@ _VMallocWrapper(IMG_SIZE_T uiBytes,
 #endif
 
 	/* Allocate virtually contiguous pages */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
     pvRet = __vmalloc(uiBytes, gfp_mask, PGProtFlags);
+#else
+    pvRet = __old_vmalloc(uiBytes, gfp_mask, PGProtFlags);
+#endif
     
 #if defined(DEBUG_LINUX_MEMORY_ALLOCATIONS)
     if (pvRet)
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mmap.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mmap.c
index e7fb667ec398..5a6068e04452 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mmap.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mmap.c
@@ -66,12 +66,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <asm/current.h>
 #endif
 #if defined(SUPPORT_DRI_DRM)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
 #include <drm/drmP.h>
+#else
+#include <linux/platform_device.h>
+#endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
 #include <drm/drm_legacy.h>
 #endif
 #endif
 
+
+
 #ifdef CONFIG_ARCH_OMAP5
 #ifdef CONFIG_DSSCOMP
 #include <../drivers/staging/omapdrm/omap_dmm_tiler.h>
@@ -787,7 +793,20 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea,
 #if defined(PVR_MAKE_ALL_PFNS_SPECIAL)
 		    if (bMixedMap)
 		    {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0))
+			pfn_t pfns = { pfn };
+			vm_fault_t vmf;
+
+			vmf = vmf_insert_mixed(ps_vma, ulVMAPos, pfns);
+			if (vmf & VM_FAULT_ERROR)
+				result = vm_fault_to_errno(vmf, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0))
+			pfn_t pfns = { pfn };
+
+			result = vm_insert_mixed(ps_vma, ulVMAPos, pfns);
+#else
 			result = vm_insert_mixed(ps_vma, ulVMAPos, pfn);
+#endif
 	                if(result != 0)
 	                {
 	                    PVR_DPF((PVR_DBG_ERROR,"%s: Error - vm_insert_mixed failed (%d)", __FUNCTION__, result));
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/module.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/module.c
index 59e101149de6..c31f9ca8e719 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/module.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/module.c
@@ -87,7 +87,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <linux/fs.h>
 
 #if defined(SUPPORT_DRI_DRM)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
 #include <drm/drmP.h>
+#else
+#include <drm/drm_file.h>
+#endif
 #if defined(PVR_SECURE_DRM_AUTH_EXPORT)
 #include "env_perproc.h"
 #endif
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mutils.h b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mutils.h
index 61edf9523555..9d3ff0f2c575 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mutils.h
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/mutils.h
@@ -57,6 +57,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 #endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
+#define ioremap_nocache ioremap
+// #define ioremap_cache(physaddr, size) memremap((physaddr), (size), MEMREMAP_WB)
+// #define ioremap_wt(physaddr, size) memremap((physaddr), (size), MEMREMAP_WT)
+#endif
+
 #if defined(SUPPORT_LINUX_X86_PAT)
 	pgprot_t pvr_pgprot_writecombine(pgprot_t prot);
 	#define	PGPROT_WC(pv)	pvr_pgprot_writecombine(pv)
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/osfunc.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/osfunc.c
index c56ff2537f4b..7925a7103d31 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/osfunc.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/osfunc.c
@@ -52,14 +52,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
 #include <asm/system.h>
 #endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0))
 #include <asm/cacheflush.h>
+#endif
 #include <linux/mm.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
+#else
+#define mmap_sem mmap_lock	// has been renamed by v5.8-rc1
+#endif
+
 #include <linux/pagemap.h>
 #include <linux/hugetlb.h> 
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
+#include <linux/platform_device.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0))
+#else
+#include <linux/dma-map-ops.h>
+#endif
 
 #include <linux/string.h>
 #include <linux/sched.h>
@@ -2793,15 +2805,27 @@ static void OSTimerCallbackBody(TIMER_CALLBACK_DATA *psTimerCBData)
     mod_timer(&psTimerCBData->sTimer, psTimerCBData->ui32Delay + jiffies);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+ /*!
+ ******************************************************************************
+
+ @Function      OSTimerCallbackWrapper
+
+ @Description   OS specific timer callback wrapper function
 
+ @Input         psTimer    Timer list structure
+
+*/ /**************************************************************************/
+static void OSTimerCallbackWrapper(struct timer_list *psTimer)
+{
+	TIMER_CALLBACK_DATA *psTimerCBData = from_timer(psTimerCBData, psTimer, sTimer);
+#else
 /*!
 ******************************************************************************
 
  @Function	OSTimerCallbackWrapper
  
- @Description 
- 
- OS specific timer callback wrapper function
+ @Description 	OS specific timer callback wrapper function
  
  @Input    ui32Data : timer callback data
 
@@ -2811,7 +2835,9 @@ static void OSTimerCallbackBody(TIMER_CALLBACK_DATA *psTimerCBData)
 static IMG_VOID OSTimerCallbackWrapper(IMG_UINTPTR_T uiData)
 {
     TIMER_CALLBACK_DATA	*psTimerCBData = (TIMER_CALLBACK_DATA*)uiData;
-    
+
+#endif
+
 #if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) || defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE)
     int res;
 
@@ -2910,6 +2936,9 @@ IMG_HANDLE OSAddTimer(PFN_TIMER_FUNC pfnTimerFunc, IMG_VOID *pvData, IMG_UINT32
     psTimerCBData->ui32Delay = ((HZ * ui32MsTimeout) < 1000)
                                 ?	1
                                 :	((HZ * ui32MsTimeout) / 1000);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+    timer_setup(&psTimerCBData->sTimer, OSTimerCallbackWrapper, 0);
+#else
     /* initialise object */
     init_timer(&psTimerCBData->sTimer);
     
@@ -2917,7 +2946,7 @@ IMG_HANDLE OSAddTimer(PFN_TIMER_FUNC pfnTimerFunc, IMG_VOID *pvData, IMG_UINT32
     /* PRQA S 0307,0563 1 */ /* ignore warning about inconpartible ptr casting */
     psTimerCBData->sTimer.function = (IMG_VOID *)OSTimerCallbackWrapper;
     psTimerCBData->sTimer.data = (IMG_UINTPTR_T)psTimerCBData;
-    
+#endif
     return (IMG_HANDLE)(ui + 1);
 }
 
@@ -3378,19 +3407,8 @@ PVRSRV_ERROR OSCopyFromUser( IMG_PVOID pvProcess,
 ******************************************************************************/
 IMG_BOOL OSAccessOK(IMG_VERIFY_TEST eVerification, IMG_VOID *pvUserPtr, IMG_SIZE_T uiBytes)
 {
-    IMG_INT linuxType;
-
-    if (eVerification == PVR_VERIFY_READ)
-    {
-        linuxType = VERIFY_READ;
-    }
-    else
-    {
-        PVR_ASSERT(eVerification == PVR_VERIFY_WRITE);
-        linuxType = VERIFY_WRITE;
-    }
-
-    return access_ok(linuxType, pvUserPtr, uiBytes);
+    (void)eVerification; /* unused */
+    return access_ok(pvUserPtr, uiBytes);
 }
 
 typedef enum _eWrapMemType_
@@ -3445,6 +3463,9 @@ static IMG_BOOL CPUVAddrToPFN(struct vm_area_struct *psVMArea, IMG_UINTPTR_T uCP
     pud_t *psPUD;
     pmd_t *psPMD;
     pte_t *psPTE;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(4,12,0))
+    p4d_t *psP4D;
+#endif
     struct mm_struct *psMM = psVMArea->vm_mm;
     spinlock_t *psPTLock;
     IMG_BOOL bRet = IMG_FALSE;
@@ -3456,7 +3477,15 @@ static IMG_BOOL CPUVAddrToPFN(struct vm_area_struct *psVMArea, IMG_UINTPTR_T uCP
     if (pgd_none(*psPGD) || pgd_bad(*psPGD))
         return bRet;
 
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(4,12,0))
+    psP4D = p4d_offset(psPGD, uCPUVAddr);
+    if (p4d_none(*psP4D) || unlikely(p4d_bad(*psP4D)))
+        return bRet;
+
+    psPUD = pud_offset(psP4D, uCPUVAddr);
+#else
     psPUD = pud_offset(psPGD, uCPUVAddr);
+#endif
     if (pud_none(*psPUD) || pud_bad(*psPUD))
         return bRet;
 
@@ -3542,7 +3571,11 @@ PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem)
                         SetPageDirty(psPage);
                     }
 	        }
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
                 page_cache_release(psPage);
+#else
+                put_page(psPage);
+#endif
 	    }
             break;
         }
@@ -3724,8 +3757,17 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr,
     bMMapSemHeld = IMG_TRUE;
 
     /* Get page list */
-    psInfo->iNumPagesMapped = get_user_pages(current, current->mm, uStartAddr, psInfo->iNumPages, 1, 0, psInfo->ppsPages, NULL);
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
+    psInfo->iNumPagesMapped = get_user_pages(
+		current, current->mm,
+		uStartAddr, psInfo->iNumPages, 1, 0, psInfo->ppsPages, NULL);
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0))
+    psInfo->iNumPagesMapped = get_user_pages(
+		uStartAddr, psInfo->iNumPages, 1, 0, psInfo->ppsPages, NULL);
+#else
+    psInfo->iNumPagesMapped = get_user_pages(
+		uStartAddr, psInfo->iNumPages, 1, psInfo->ppsPages, NULL);
+#endif
     if (psInfo->iNumPagesMapped >= 0)
     {
         /* See if we got all the pages we wanted */
@@ -4540,8 +4582,12 @@ static inline size_t pvr_dma_range_len(const void *pvStart, const void *pvEnd)
 static void pvr_dma_cache_wback_inv(const void *pvStart, const void *pvEnd)
 {
 	size_t uLength = pvr_dma_range_len(pvStart, pvEnd);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
-	dma_cache_sync(NULL, (void *)pvStart, uLength, DMA_BIDIRECTIONAL);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
+	struct device *dev = PVRLDMGetDevice();
+	dma_sync_single_for_device(dev, (dma_addr_t)pvStart, uLength, DMA_BIDIRECTIONAL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
+	struct device *dev = PVRLDMGetDevice();
+	dma_cache_sync(dev, (void *)pvStart, uLength, DMA_BIDIRECTIONAL);
 #else
 	dma_cache_wback_inv((unsigned long)pvStart, uLength);
 #endif
@@ -4550,8 +4596,12 @@ static void pvr_dma_cache_wback_inv(const void *pvStart, const void *pvEnd)
 static void pvr_dma_cache_wback(const void *pvStart, const void *pvEnd)
 {
 	size_t uLength = pvr_dma_range_len(pvStart, pvEnd);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
-	dma_cache_sync(NULL, (void *)pvStart, uLength, DMA_TO_DEVICE);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
+	struct device *dev = PVRLDMGetDevice();
+	dma_sync_single_for_device(dev, (dma_addr_t)pvStart, uLength, DMA_TO_DEVICE);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
+	struct device *dev = PVRLDMGetDevice();
+	dma_cache_sync(dev, (void *)pvStart, uLength, DMA_TO_DEVICE);
 #else
 	dma_cache_wback((unsigned long)pvStart, uLength);
 #endif
@@ -4560,8 +4610,12 @@ static void pvr_dma_cache_wback(const void *pvStart, const void *pvEnd)
 static void pvr_dma_cache_inv(const void *pvStart, const void *pvEnd)
 {
 	size_t uLength = pvr_dma_range_len(pvStart, pvEnd);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
-	dma_cache_sync(NULL, (void *)pvStart, uLength, DMA_FROM_DEVICE);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
+	struct device *dev = PVRLDMGetDevice();
+	dma_sync_single_for_device(dev, (dma_addr_t)pvStart, uLength, DMA_FROM_DEVICE);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
+	struct device *dev = PVRLDMGetDevice();
+	dma_cache_sync(dev, (void *)pvStart, uLength, DMA_FROM_DEVICE);
 #else
 	dma_cache_inv((unsigned long)pvStart, uLength);
 #endif
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/private_data.h b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/private_data.h
index e2a6c74d35d4..3e75b7e6da14 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/private_data.h
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/private_data.h
@@ -42,10 +42,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef __INCLUDED_PRIVATE_DATA_H_
 #define __INCLUDED_PRIVATE_DATA_H_
 
+#include <linux/version.h>
 #if defined(SUPPORT_DRI_DRM) && defined(PVR_SECURE_DRM_AUTH_EXPORT)
 #include <linux/list.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
 #include <drm/drmP.h>
 #endif
+#endif
 
 /* This structure is required in the rare case that a process creates
  * a connection to services, but before closing the file descriptor,
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/proc.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/proc.c
index 788757ba2a48..9f8e293686b7 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/proc.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/proc.c
@@ -91,6 +91,7 @@ static const IMG_CHAR PVRProcDirRoot[] = "pvr";
 static IMG_INT pvr_proc_open(struct inode *inode,struct file *file);
 static ssize_t pvr_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0))
 static struct file_operations pvr_proc_operations =
 {
 	.open		= pvr_proc_open,
@@ -99,6 +100,16 @@ static struct file_operations pvr_proc_operations =
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
+#else
+static struct proc_ops pvr_proc_operations =
+{
+	.proc_open	= pvr_proc_open,
+	.proc_read	= seq_read,
+	.proc_write	= pvr_proc_write,
+	.proc_lseek	= seq_lseek,
+	.proc_release	= seq_release,
+};
+#endif
 
 static void *pvr_proc_seq_start (struct seq_file *m, loff_t *pos);
 static void *pvr_proc_seq_next (struct seq_file *m, void *v, loff_t *pos);
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.c b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.c
index 2a61e545015f..8840ba49f1fa 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.c
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.c
@@ -59,7 +59,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "buffer_manager.h"
 
 #if defined(SUPPORT_DRI_DRM)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0))
 #include <drm/drmP.h>
+#else
+#include <drm/drm_file.h>
+#endif
 #include "pvr_drm.h"
 #if defined(PVR_SECURE_DRM_AUTH_EXPORT)
 #include "env_perproc.h"
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_drm.h b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_drm.h
index 1c537559e3b1..409a6490918d 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_drm.h
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_drm.h
@@ -42,6 +42,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #if !defined(__PVR_DRM_H__)
 #define __PVR_DRM_H__
 
+#include <drm/drm_device.h>
+#include <linux/platform_device.h>
+
 #if defined (PDUMP)
 #include "linuxsrv.h"
 #endif
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_uaccess.h b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_uaccess.h
index 7583d7eb25bc..736eab953aba 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_uaccess.h
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/srvkm/env/linux/pvr_uaccess.h
@@ -54,7 +54,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 static inline unsigned long pvr_copy_to_user(void __user *pvTo, const void *pvFrom, unsigned long ulBytes)
 {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
-    if (access_ok(VERIFY_WRITE, pvTo, ulBytes))
+    if (access_ok(pvTo, ulBytes))
     {
 	return __copy_to_user(pvTo, pvFrom, ulBytes);
     }
@@ -71,7 +71,7 @@ static inline unsigned long pvr_copy_from_user(void *pvTo, const void __user *pv
      * The compile time correctness checking introduced for copy_from_user in
      * Linux 2.6.33 isn't fully comaptible with our usage of the function.
      */
-    if (access_ok(VERIFY_READ, pvFrom, ulBytes))
+    if (access_ok(pvFrom, ulBytes))
     {
 	return __copy_from_user(pvTo, pvFrom, ulBytes);
     }
diff --git a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/system/sgx_jz4780/sysconfig.h b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/system/sgx_jz4780/sysconfig.h
index 4bbcb75e874e..77607a04c8b7 100644
--- a/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/system/sgx_jz4780/sysconfig.h
+++ b/drivers/gpu/drm/pvrsgx/1.14.3759903/eurasia_km/services4/system/sgx_jz4780/sysconfig.h
@@ -49,6 +49,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define VS_PRODUCT_NAME	"JZ4780 SGX"
 
+#define SYS_SGX_HWRECOVERY_TIMEOUT_FREQ		(100)	// 10ms (100hz)
+#define SYS_SGX_PDS_TIMER_FREQ				(1000)	// 1ms (1000hz)
+
 #define SYS_SGX_USSE_COUNT					(1)
 
 #if defined(NO_HARDWARE)
-- 
2.33.1



More information about the openpvrsgx-devgroup mailing list