]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/mips/mm/c-octeon.c
MIPS/EDAC: Improve OCTEON EDAC support.
[mirror_ubuntu-bionic-kernel.git] / arch / mips / mm / c-octeon.c
index 9f67553762d5e606bb8aeced4766598d4f86d455..6ec04daf423112903669ea98eb7e2b41dfd931c0 100644 (file)
@@ -286,10 +286,9 @@ void __cpuinit octeon_cache_init(void)
        board_cache_error_setup = octeon_cache_error_setup;
 }
 
-/**
+/*
  * Handle a cache error exception
  */
-
 static RAW_NOTIFIER_HEAD(co_cache_error_chain);
 
 int register_co_cache_error_notifier(struct notifier_block *nb)
@@ -304,14 +303,39 @@ int unregister_co_cache_error_notifier(struct notifier_block *nb)
 }
 EXPORT_SYMBOL_GPL(unregister_co_cache_error_notifier);
 
-static inline int co_cache_error_call_notifiers(unsigned long val)
+static void co_cache_error_call_notifiers(unsigned long val)
 {
-       return raw_notifier_call_chain(&co_cache_error_chain, val, NULL);
+       int rv = raw_notifier_call_chain(&co_cache_error_chain, val, NULL);
+       if ((rv & ~NOTIFY_STOP_MASK) != NOTIFY_OK) {
+               u64 dcache_err;
+               unsigned long coreid = cvmx_get_core_num();
+               u64 icache_err = read_octeon_c0_icacheerr();
+
+               if (val) {
+                       dcache_err = cache_err_dcache[coreid];
+                       cache_err_dcache[coreid] = 0;
+               } else {
+                       dcache_err = read_octeon_c0_dcacheerr();
+               }
+
+               pr_err("Core%lu: Cache error exception:\n", coreid);
+               pr_err("cp0_errorepc == %lx\n", read_c0_errorepc());
+               if (icache_err & 1) {
+                       pr_err("CacheErr (Icache) == %llx\n",
+                              (unsigned long long)icache_err);
+                       write_octeon_c0_icacheerr(0);
+               }
+               if (dcache_err & 1) {
+                       pr_err("CacheErr (Dcache) == %llx\n",
+                              (unsigned long long)dcache_err);
+               }
+       }
 }
 
-/**
+/*
  * Called when the the exception is recoverable
  */
+
 asmlinkage void cache_parity_error_octeon_recoverable(void)
 {
        co_cache_error_call_notifiers(0);
@@ -319,11 +343,8 @@ asmlinkage void cache_parity_error_octeon_recoverable(void)
 
 /**
  * Called when the the exception is not recoverable
- *
- * The issue not that the cache error exception itself was non-recoverable
- * but that due to nesting of exception may have lost some state so can't
- * continue.
  */
+
 asmlinkage void cache_parity_error_octeon_non_recoverable(void)
 {
        co_cache_error_call_notifiers(1);