add check node for slt[1/3]
authorJiyu Yang <Jiyu.Yang@amlogic.com>
Mon, 23 Apr 2018 12:28:47 +0000 (20:28 +0800)
committerJiyu Yang <jiyu.yang@amlogic.com>
Fri, 27 Apr 2018 11:54:04 +0000 (04:54 -0700)
PD#NONE
Change-Id: Iabe5491ca2f6be5130566bda703dc16920acce13

bifrost/r9p0/kernel/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_jm_hw.c
bifrost/r9p0/kernel/drivers/gpu/arm/midgard/mali_kbase.h
bifrost/r9p0/kernel/drivers/gpu/arm/midgard/mali_kbase_jd.c
bifrost/r9p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.h
bifrost/r9p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/mpgpu.c
dvalin/kernel/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_jm_hw.c
dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase.h
dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_jd.c
dvalin/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.h
dvalin/kernel/drivers/gpu/arm/midgard/platform/devicetree/mpgpu.c

index 0a2a0b7b9965dd35609ecf11433b4f6e03545052..622b220f7a597d3ce17cc9843e795c17a0702436 100644 (file)
@@ -300,6 +300,7 @@ void kbase_job_done(struct kbase_device *kbdev, u32 done)
                                                BASE_JD_EVENT_TERMINATED;
                                        /* fall through */
                                default:
+                                       meson_gpu_data_invalid_count ++;
                                        dev_warn(kbdev->dev, "error detected from slot %d, job status 0x%08x (%s)",
                                                        i, completion_code,
                                                        kbase_exception_name
index 11113a943a14ab7bbfde255231d061abf47aa54c..92bf1ac1b74c27c51fcbbc0db0ca002cfe2c2905 100644 (file)
@@ -607,5 +607,5 @@ int kbase_io_history_resize(struct kbase_io_history *h, u16 new_size);
 
 #endif
 
-
-
+extern int meson_gpu_data_invalid_count;
+extern int meson_gpu_fault;
index aa545fd7ff7146a6e524487a8a24e3c8434db35a..721949edf5bec34e8f3ef4685c581a65753b5099 100644 (file)
@@ -1254,11 +1254,13 @@ void kbase_jd_done_worker(struct work_struct *data)
                return;
        }
 
-       if (katom->event_code != BASE_JD_EVENT_DONE)
+       if (katom->event_code != BASE_JD_EVENT_DONE) {
+               meson_gpu_fault ++;
                dev_err(kbdev->dev,
                        "t6xx: GPU fault 0x%02lx from job slot %d\n",
-                                       (unsigned long)katom->event_code,
-                                                               katom->slot_nr);
+                            (unsigned long)katom->event_code,
+                            katom->slot_nr);
+       }
 
        if (kbase_hw_has_issue(kbdev, BASE_HW_ISSUE_8316))
                kbase_as_poking_timer_release_atom(kbdev, kctx, katom);
index ca797524a2d0227fc3b8921744ee7b4d919037d5..dbce893d8c537f03453537a4f96b1a7f841d3aec 100644 (file)
@@ -29,5 +29,6 @@ int mali_meson_uninit(struct platform_device* ptr_plt_dev);
 int mpgpu_class_init(void);
 void mpgpu_class_exit(void);
 void mali_gpu_utilization_callback(int utilization_pp);
+u32 mpgpu_get_gpu_err_count(void);
 
 #endif /* MESON_MAIN_H_ */
index 0cc5035ab766df0dedc2882de10d867890db63f9..d0a4c60b30872a4b203e1857a9421cc570c278d7 100644 (file)
 #include <asm/io.h>
 #endif
 
+//#include <mali_kbase.h>
 #include "meson_main2.h"
 
+int meson_gpu_data_invalid_count = 0;
+int meson_gpu_fault = 0;
+
 static ssize_t domain_stat_read(struct class *class,
                struct class_attribute *attr, char *buf)
 {
@@ -312,6 +316,32 @@ static ssize_t current_pp_write(struct class *class,
 }
 #endif
 
+u32 mpgpu_get_gpu_err_count(void)
+{
+    return (meson_gpu_fault + meson_gpu_data_invalid_count);
+}
+
+static ssize_t meson_gpu_get_err_count(struct class *class,
+               struct class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", mpgpu_get_gpu_err_count());
+}
+
+static ssize_t mpgpu_set_err_count(struct class *class,
+               struct class_attribute *attr, const char *buf, size_t count)
+{
+       int ret;
+       unsigned int val;
+
+       ret = kstrtouint(buf, 10, &val);
+       if (0 != ret)
+               return -EINVAL;
+
+       meson_gpu_fault = val;
+
+       return count;
+}
+
 static struct class_attribute mali_class_attrs[] = {
        __ATTR(domain_stat,     0644, domain_stat_read, NULL),
        __ATTR(mpgpucmd,        0644, NULL,             mpgpu_write),
@@ -326,6 +356,7 @@ static struct class_attribute mali_class_attrs[] = {
 #if 0
        __ATTR(cur_pp,          0644, current_pp_read,  current_pp_write),
 #endif
+       __ATTR(gpu_err,     0644, meson_gpu_get_err_count, mpgpu_set_err_count),
 };
 
 static struct class mpgpu_class = {
index 331f6ee3ad3a4dc48f717c755aedecbbf4b8336b..05cf99a757a513a93ea7963ddf56d027d0c40c9b 100644 (file)
@@ -305,6 +305,7 @@ void kbase_job_done(struct kbase_device *kbdev, u32 done)
                                                BASE_JD_EVENT_TERMINATED;
                                        /* fall through */
                                default:
+                                       meson_gpu_data_invalid_count ++;
                                        dev_warn(kbdev->dev, "error detected from slot %d, job status 0x%08x (%s)",
                                                        i, completion_code,
                                                        kbase_exception_name
index 7174ef2ba3d2ee109a4c09a72918382c96f3dd0f..1b431d39f70c5a9592bce8de3649da70d586a762 100644 (file)
@@ -639,5 +639,5 @@ int kbase_io_history_resize(struct kbase_io_history *h, u16 new_size);
 
 #endif
 
-
-
+extern int meson_gpu_data_invalid_count;
+extern int meson_gpu_fault;
index 91cfee7a6110c861e4c4252c8230f5c1e5b7e353..71450d5ff998ee809cb9fd0d8e5510521e1d244f 100644 (file)
@@ -1270,11 +1270,13 @@ void kbase_jd_done_worker(struct work_struct *data)
                return;
        }
 
-       if (katom->event_code != BASE_JD_EVENT_DONE)
+       if (katom->event_code != BASE_JD_EVENT_DONE) {
+               meson_gpu_fault ++;
                dev_err(kbdev->dev,
                        "t6xx: GPU fault 0x%02lx from job slot %d\n",
-                                       (unsigned long)katom->event_code,
-                                                               katom->slot_nr);
+                            (unsigned long)katom->event_code,
+                            katom->slot_nr);
+       }
 
        if (kbase_hw_has_issue(kbdev, BASE_HW_ISSUE_8316))
                kbase_as_poking_timer_release_atom(kbdev, kctx, katom);
index 018787cb0d0743277cdcf4800154d2c1e2625dc1..65f8e147995dce10cc66fd7dadb80cf6e03a70a1 100644 (file)
@@ -33,5 +33,6 @@ void mali_gpu_utilization_callback(int utilization_pp);
 u32 mpgpu_get_utilization(void);
 u32 mpgpu_get_util_gl_share(void);
 u32 mpgpu_get_util_cl_share(u32 *util);
+u32 mpgpu_get_gpu_err_count(void);
 
 #endif /* MESON_MAIN_H_ */
index 4e294d9509fffc166a2130ec1e18595c7ed49a6d..831ae72e0d8abffd48aafd92d7f820f5a831c3c9 100644 (file)
 #include <asm/io.h>
 #endif
 
+//#include <mali_kbase.h>
 #include "meson_main2.h"
 
+int meson_gpu_data_invalid_count = 0;
+int meson_gpu_fault = 0;
+
 static ssize_t domain_stat_read(struct class *class,
                struct class_attribute *attr, char *buf)
 {
@@ -239,6 +243,32 @@ static ssize_t util_cl_share_read(struct class *class,
        return sprintf(buf, "%d  %d\n", val[0], val[1]);
 }
 
+u32 mpgpu_get_gpu_err_count(void)
+{
+    return (meson_gpu_fault + meson_gpu_data_invalid_count);
+}
+
+static ssize_t meson_gpu_get_err_count(struct class *class,
+               struct class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", mpgpu_get_gpu_err_count());
+}
+
+static ssize_t mpgpu_set_err_count(struct class *class,
+               struct class_attribute *attr, const char *buf, size_t count)
+{
+       int ret;
+       unsigned int val;
+
+       ret = kstrtouint(buf, 10, &val);
+       if (0 != ret)
+               return -EINVAL;
+
+       meson_gpu_fault = val;
+
+       return count;
+}
+
 static struct class_attribute mali_class_attrs[] = {
        __ATTR(domain_stat,     0644, domain_stat_read, NULL),
        __ATTR(mpgpucmd,        0644, NULL,             mpgpu_write),
@@ -249,6 +279,7 @@ static struct class_attribute mali_class_attrs[] = {
        __ATTR(utilization,     0644, utilization_read, NULL),
        __ATTR(util_gl,     0644, util_gl_share_read, NULL),
        __ATTR(util_cl,     0644, util_cl_share_read, NULL),
+       __ATTR(gpu_err,     0644, meson_gpu_get_err_count, mpgpu_set_err_count),
 };
 
 static struct class mpgpu_class = {