<span style=" font-size:10pt;font-family:Arial">copied verbatim from P9
DD2 Nest Accelerators Workbook</span><span style=" font-size:10pt;font-family:sans-serif">Version 3.2</span><br><br><span style=" font-size:10pt;font-family:sans-serif">Table 4-36. </span><span style=" font-size:10pt;font-family:Arial"><i>CSB
Non-zero CC Reported Error Types</i></span><br><br><span style=" font-size:10pt;font-family:sans-serif">CC=5, Error Type:
Translation, </span><br><span style=" font-size:10pt;font-family:sans-serif">Comment: Unused,
defined by RFC02130 (footnote:  </span><span style=" font-size:10pt;font-family:Arial">DMA
controller uses this CC internally in translation fault handling. Do not
reuse for other purposes.</span><span style=" font-size:10pt;font-family:sans-serif">)</span><br><br><span style=" font-size:10pt;font-family:Arial">CC=240 through 251,
reserved for future firmware use, </span><br><span style=" font-size:10pt;font-family:Arial">Comment: Error codes
240 - 255 (0xF0 - 0xF0) are reserved for firmware use and are not signalled
by the hardware. </span><br><span style=" font-size:10pt;font-family:Arial">These CCs are written
in the CSB by hypervisor to alert the partition to error conditions detected
by the hypervisor. </span><br><span style=" font-size:10pt;font-family:Arial">These codes have been
used in past processors for this purpose and ought not be relocated.</span><br><br><br><br><br><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">From:
       </span><span style=" font-size:9pt;font-family:sans-serif">Haren
Myneni/Beaverton/IBM</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">To:
       </span><span style=" font-size:9pt;font-family:sans-serif">Michael
Ellerman <mpe@ellerman.id.au></span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Cc:
       </span><span style=" font-size:9pt;font-family:sans-serif">abali@us.ibm.com,
Haren Myneni <haren@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org,
"Linuxppc-dev"<linuxppc-dev-bounces+hbabu=us.ibm.com@lists.ozlabs.org>,
rzinsly@linux.ibm.com, tulioqm@br.ibm.com, Haren Myneni/Beaverton/IBM@IBMUS</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Date:
       </span><span style=" font-size:9pt;font-family:sans-serif">07/09/2020
04:01 PM</span><br><span style=" font-size:9pt;color:#5f5f5f;font-family:sans-serif">Subject:
       </span><span style=" font-size:9pt;font-family:sans-serif">Re:
[EXTERNAL] Re: [PATCH 1/2] powerpc/vas: Report proper error for address
translation failure</span><br><hr noshade><br><br><br><br><tt><span style=" font-size:10pt">"Linuxppc-dev" <linuxppc-dev-bounces+hbabu=us.ibm.com@lists.ozlabs.org>
wrote on 07/09/2020 04:22:10 AM:<br><br>> From: Michael Ellerman <mpe@ellerman.id.au></span></tt><br><tt><span style=" font-size:10pt">> To: Haren Myneni <haren@linux.ibm.com></span></tt><br><tt><span style=" font-size:10pt">> Cc: tulioqm@br.ibm.com, abali@us.ibm.com,
linuxppc-<br>> dev@lists.ozlabs.org, rzinsly@linux.ibm.com</span></tt><br><tt><span style=" font-size:10pt">> Date: 07/09/2020 04:21 AM</span></tt><br><tt><span style=" font-size:10pt">> Subject: [EXTERNAL] Re: [PATCH
1/2] powerpc/vas: Report proper error<br>> for address translation failure</span></tt><br><tt><span style=" font-size:10pt">> Sent by: "Linuxppc-dev"
<linuxppc-dev-bounces<br>> +hbabu=us.ibm.com@lists.ozlabs.org></span></tt><br><tt><span style=" font-size:10pt">> <br>> Haren Myneni <haren@linux.ibm.com> writes:<br>> > DMA controller uses CC=5 internally for translation fault handling.
So<br>> > OS should be using CC=250 and should report this error to the
user space<br>> > when NX encounters address translation failure on the request
buffer.<br>> <br>> That doesn't really explain *why* the OS must use CC=250.<br>> <br>> Is it documented somewhere that 5 is for hardware use, and 250 is
for<br>> software?</span></tt><br><br><tt><span style=" font-size:10pt">Yes, mentioned in</span></tt><span style=" font-size:10pt;font-family:Arial-ItalicMT">Table 4-36. CSB Non-zero CC Reported Error Types</span><tt><span style=" font-size:10pt">(P9 NX DD2 work book). Also footnote for CC=5 says </span></tt><span style=" font-size:10pt;font-family:sans-serif">"DMA
controller uses this CC internally in translation fault handling. Do not
reuse for other purposes"</span><br><br><span style=" font-size:10pt;font-family:sans-serif">I will add documentation
reference for CC=250 comment. </span><br><tt><span style=" font-size:10pt"><br>> <br>> > This patch defines CSB_CC_ADDRESS_TRANSLATION(250) and updates<br>> > CSB.CC with this proper error code for user space.<br>> <br>> We still have:<br>> <br>> #define CSB_CC_TRANSLATION   (5)<br>> <br>> And it's very unclear where one or the other should be used.<br>> <br>> Can one or the other get a name that makes the distinction clear.</span></tt><br><br><tt><span style=" font-size:10pt">CSB_CC_TRANSLATION is added in 842
driver (nx-common-powernv.c) when NX is introduced (P7+). NX will not see
faults on kernel requests (cc=250) and even CC=5. </span></tt><br><br><tt><span style=" font-size:10pt">Table 4-36: </span></tt><br><tt><span style=" font-size:10pt">For CC=5: says Translation</span></tt><br><tt><span style=" font-size:10pt">CC=250:    says "Address
Translation Fault"</span></tt><br><br><tt><span style=" font-size:10pt">So I can say CRB_CC_ADDRESS_TRANSLATION_FAULT
or CRN_CC_TRANSLATION_FAULT. This code path (also CRBs) should be generic,
so should not use like CRB_CC_NX_FAULT. </span></tt><br><br><tt><span style=" font-size:10pt">Thanks</span></tt><br><tt><span style=" font-size:10pt">Haren</span></tt><br><tt><span style=" font-size:10pt"><br>> <br>> cheers<br>> <br>> <br>> > diff --git a/Documentation/powerpc/vas-api.rst b/Documentation/<br>> powerpc/vas-api.rst<br>> > index 1217c2f..78627cc 100644<br>> > --- a/Documentation/powerpc/vas-api.rst<br>> > +++ b/Documentation/powerpc/vas-api.rst<br>> > @@ -213,7 +213,7 @@ request buffers are not in memory. The <br>> operating system handles the fault by<br>> >  updating CSB with the following data:<br>> >  <br>> >     csb.flags = CSB_V;<br>> > -   csb.cc = CSB_CC_TRANSLATION;<br>> > +   csb.cc = CSB_CC_ADDRESS_TRANSLATION;<br>> >     csb.ce = CSB_CE_TERMINATION;<br>> >     csb.address = fault_address;<br>> >  <br>> > diff --git a/arch/powerpc/include/asm/icswx.h b/arch/powerpc/<br>> include/asm/icswx.h<br>> > index 965b1f3..b1c9a57 100644<br>> > --- a/arch/powerpc/include/asm/icswx.h<br>> > +++ b/arch/powerpc/include/asm/icswx.h<br>> > @@ -77,6 +77,8 @@ struct coprocessor_completion_block {<br>> >  #define CSB_CC_CHAIN      (37)<br>> >  #define CSB_CC_SEQUENCE      (38)<br>> >  #define CSB_CC_HW      (39)<br>> > +/* User space address traslation failure */<br>> > +#define   CSB_CC_ADDRESS_TRANSLATION   (250)<br>> >  <br>> >  #define CSB_SIZE      (0x10)<br>> >  #define CSB_ALIGN      CSB_SIZE<br>> > diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/<br>> powerpc/platforms/powernv/vas-fault.c<br>> > index 266a6ca..33e89d4 100644<br>> > --- a/arch/powerpc/platforms/powernv/vas-fault.c<br>> > +++ b/arch/powerpc/platforms/powernv/vas-fault.c<br>> > @@ -79,7 +79,7 @@ static void update_csb(struct vas_window *window,<br>> >     csb_addr = (void __user *)be64_to_cpu(crb->csb_addr);<br>> >  <br>> >     memset(&csb, 0, sizeof(csb));<br>> > -   csb.cc = CSB_CC_TRANSLATION;<br>> > +   csb.cc = CSB_CC_ADDRESS_TRANSLATION;<br>> >     csb.ce = CSB_CE_TERMINATION;<br>> >     csb.cs = 0;<br>> >     csb.count = 0;<br>> > -- <br>> > 1.8.3.1<br>> <br></span></tt><br><br><BR>