<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">
      <pre>On 8/24/21 12:09 PM, Michael Ellerman wrote:</pre>
    </div>
    <blockquote type="cite" cite="mid:87eeajcpmq.fsf@mpe.ellerman.id.au">
      <pre class="moz-quote-pre" wrap="">Hi Ganesh,

Some comments below ...

Ganesh Goudar <a class="moz-txt-link-rfc2396E" href="mailto:ganeshgr@linux.ibm.com"><ganeshgr@linux.ibm.com></a> writes:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Add support to parse and log control memory access
error for pseries.

Signed-off-by: Ganesh Goudar <a class="moz-txt-link-rfc2396E" href="mailto:ganeshgr@linux.ibm.com"><ganeshgr@linux.ibm.com></a>
---
v2: No changes in this patch.
---
 arch/powerpc/platforms/pseries/ras.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 167f2e1b8d39..608c35cad0c3 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -80,6 +80,7 @@ struct pseries_mc_errorlog {
 #define MC_ERROR_TYPE_TLB              0x04
 #define MC_ERROR_TYPE_D_CACHE          0x05
 #define MC_ERROR_TYPE_I_CACHE          0x07
+#define MC_ERROR_TYPE_CTRL_MEM_ACCESS  0x08
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">...
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""> 
+#define MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK   0
+#define MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS     1
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">

Where do the above values come from?</pre>
    </blockquote>
    <pre class="moz-quote-pre" wrap="">It is from latest PAPR that added support for control memory error.
</pre>
    <blockquote type="cite" cite="mid:87eeajcpmq.fsf@mpe.ellerman.id.au">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+
 static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
 {
        switch (mlog->error_type) {
@@ -112,6 +116,8 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog)
        case    MC_ERROR_TYPE_ERAT:
        case    MC_ERROR_TYPE_TLB:
                return (mlog->sub_err_type & 0x03);
+       case    MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+               return (mlog->sub_err_type & 0x70) >> 4;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Can you add to the comment above sub_err_type explaining what these bits are.</pre>
    </blockquote>
    <pre class="moz-quote-pre" wrap="">Sure, for other errors it is explained in pseries_mc_errorlog definition, ill add it there. 
</pre>
    <blockquote type="cite" cite="mid:87eeajcpmq.fsf@mpe.ellerman.id.au">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">   default:
                return 0;
        }
@@ -699,6 +705,21 @@ static int mce_handle_err_virtmode(struct pt_regs *regs,
        case MC_ERROR_TYPE_I_CACHE:
                mce_err.error_type = MCE_ERROR_TYPE_ICACHE;
                break;
+       case MC_ERROR_TYPE_CTRL_MEM_ACCESS:
+               mce_err.error_type = MCE_ERROR_TYPE_RA;
+               if (mce_log->sub_err_type & 0x80)
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
This appears many times in the file.

Can we add eg. MC_EFFECTIVE_ADDR_PROVIDED?</pre>
    </blockquote>
    <pre>ok, thanks.
</pre>
    <blockquote type="cite" cite="mid:87eeajcpmq.fsf@mpe.ellerman.id.au">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+                  eaddr = be64_to_cpu(mce_log->effective_address);
+               switch (err_sub_type) {
+               case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
+                       mce_err.u.ra_error_type =
+                               MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
That name is ridiculously long, but I guess that's not your fault :)
We can fix it up in a later patch.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+                  break;
+               case MC_ERROR_CTRL_MEM_ACCESS_OP_ACCESS:
+                       mce_err.u.ra_error_type =
+                               MCE_RA_ERROR_LOAD_STORE_FOREIGN;
+                       break;
+               }
+               break;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
cheers
</pre>
    </blockquote>
  </body>
</html>