gfx: pvr: fix SGX_READ_HWPERF IOCTL according to v1.7 ABI
authorImre Deak <imre.deak@intel.com>
Fri, 27 Jan 2012 16:27:31 +0000 (18:27 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:42 +0000 (12:29 +0300)
There has been a change in the parameters for this IOCTL in v1.7 of the
driver. While the userspace library was updated accordingly we didn't do
this on the kernel side. We missed the difference since the size of the
structure wasn't checked against the user space version. The next patch
will add this check to avoid similar problems in the future.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Tested-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/pvr/include4/sgxapi_km.h
drivers/staging/mrst/pvr/services4/include/sgx_mkif_km.h
drivers/staging/mrst/pvr/services4/srvkm/devices/sgx/sgxinit.c
drivers/staging/mrst/pvr/services4/srvkm/hwdefs/sgxfeaturedefs.h

index 737e21f..150cd6d 100644 (file)
@@ -83,12 +83,13 @@ extern "C" {
 #define SGX_MAX_DST_SYNCS                              1
 #endif
 
-
 #if defined(SGX_FEATURE_EXTENDED_PERF_COUNTERS)
-#define        PVRSRV_SGX_HWPERF_NUM_COUNTERS  8
+#define PVRSRV_SGX_HWPERF_NUM_COUNTERS  8
+#define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 11
 #else
-#define        PVRSRV_SGX_HWPERF_NUM_COUNTERS  9
-#endif 
+#define PVRSRV_SGX_HWPERF_NUM_COUNTERS  9
+#define PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS 8
+#endif
 
 #define PVRSRV_SGX_HWPERF_INVALID                                      0x1
 
@@ -143,11 +144,14 @@ extern "C" {
 typedef struct _PVRSRV_SGX_HWPERF_CB_ENTRY_
 {
        IMG_UINT32      ui32FrameNo;
+       IMG_UINT32      ui32PID;
+       IMG_UINT32      ui32RTData;
        IMG_UINT32      ui32Type;
        IMG_UINT32      ui32Ordinal;
        IMG_UINT32      ui32Info;
        IMG_UINT32      ui32Clocksx16;
-       IMG_UINT32      ui32Counters[SGX_FEATURE_MP_CORE_COUNT][PVRSRV_SGX_HWPERF_NUM_COUNTERS];
+       IMG_UINT32      ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS];
+       IMG_UINT32      ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS];
 } PVRSRV_SGX_HWPERF_CB_ENTRY;
 
 
index 93578c2..8fd42e6 100644 (file)
@@ -318,12 +318,16 @@ typedef struct _PVRSRV_SGX_MISCINFO_INFO
 typedef struct _SGXMKIF_HWPERF_CB_ENTRY_
 {
        IMG_UINT32      ui32FrameNo;
+       IMG_UINT32      ui32PID;
+       IMG_UINT32      ui32RTData;
+
        IMG_UINT32      ui32Type;
        IMG_UINT32      ui32Ordinal;
        IMG_UINT32      ui32Info;
        IMG_UINT32      ui32TimeWraps;
        IMG_UINT32      ui32Time;
-       IMG_UINT32      ui32Counters[SGX_FEATURE_MP_CORE_COUNT][PVRSRV_SGX_HWPERF_NUM_COUNTERS];
+       IMG_UINT32      ui32Counters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_COUNTERS];
+       IMG_UINT32      ui32MiscCounters[SGX_FEATURE_MP_CORE_COUNT_3D][PVRSRV_SGX_HWPERF_NUM_MISC_COUNTERS];
 } SGXMKIF_HWPERF_CB_ENTRY;
 
 typedef struct _SGXMKIF_HWPERF_CB_
index 54f3fec..f797da5 100644 (file)
@@ -2751,6 +2751,9 @@ PVRSRV_ERROR SGXReadHWPerfCBKM(IMG_HANDLE                                 hDevHandle,
                SGXMKIF_HWPERF_CB_ENTRY *psMKPerfEntry = &psHWPerfCB->psHWPerfCBData[psHWPerfCB->ui32Roff];
 
                psClientHWPerfEntry[i].ui32FrameNo = psMKPerfEntry->ui32FrameNo;
+               psClientHWPerfEntry[i].ui32PID = psMKPerfEntry->ui32PID;
+               psClientHWPerfEntry[i].ui32RTData = psMKPerfEntry->ui32RTData;
+
                psClientHWPerfEntry[i].ui32Type = psMKPerfEntry->ui32Type;
                psClientHWPerfEntry[i].ui32Ordinal      = psMKPerfEntry->ui32Ordinal;
                psClientHWPerfEntry[i].ui32Info = psMKPerfEntry->ui32Info;
@@ -2761,6 +2764,11 @@ PVRSRV_ERROR SGXReadHWPerfCBKM(IMG_HANDLE                                        hDevHandle,
                                  &psMKPerfEntry->ui32Counters[0][0],
                                  sizeof(psMKPerfEntry->ui32Counters));
 
+               OSMemCopy(&psClientHWPerfEntry[i].ui32MiscCounters[0][0],
+                       &psMKPerfEntry->ui32MiscCounters[0][0],
+                       sizeof(psMKPerfEntry->ui32MiscCounters));
+
+
                psHWPerfCB->ui32Roff = (psHWPerfCB->ui32Roff + 1) & (SGXMKIF_HWPERF_CB_SIZE - 1);
        }
 
index 714bea3..8d9e504 100644 (file)
 #endif
 #else
 #define SGX_FEATURE_MP_CORE_COUNT      (1)
+#define SGX_FEATURE_MP_CORE_COUNT_3D   1
+#define SGX_FEATURE_MP_CORE_COUNT_TA   1
 #endif
 
 #if defined(SUPPORT_SGX_LOW_LATENCY_SCHEDULING) && !defined(SUPPORT_SGX_PRIORITY_SCHEDULING)