<html><body><p><tt><font size="2">"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></font></tt><br><tt><font size="2">> To: Haren Myneni <haren@linux.ibm.com></font></tt><br><tt><font size="2">> Cc: tulioqm@br.ibm.com, abali@us.ibm.com, linuxppc-<br>> dev@lists.ozlabs.org, rzinsly@linux.ibm.com</font></tt><br><tt><font size="2">> Date: 07/09/2020 04:21 AM</font></tt><br><tt><font size="2">> Subject: [EXTERNAL] Re: [PATCH 1/2] powerpc/vas: Report proper error<br>> for address translation failure</font></tt><br><tt><font size="2">> Sent by: "Linuxppc-dev" <linuxppc-dev-bounces<br>> +hbabu=us.ibm.com@lists.ozlabs.org></font></tt><br><tt><font size="2">> <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?</font></tt><br><br><tt><font size="2">Yes, mentioned in</font></tt><font size="2" face="Arial-ItalicMT"> Table 4-36. CSB Non-zero CC Reported Error Types</font><tt><font size="2"> (</font></tt><tt><font size="2">P9 NX DD2 work book). Also footnote for CC=5 says </font></tt><font size="2">"</font><font size="2">DMA controller uses this CC internally in translation fault handling. Do not reuse for other purposes</font><font size="2">"</font><br><br><font size="2">I will add documentation reference for CC=250 comment. </font><br><tt><font size="2"><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.</font></tt><br><br><tt><font size="2">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. </font></tt><br><br><tt><font size="2">Table 4-36: </font></tt><br><tt><font size="2">For CC=5: says Translation</font></tt><br><tt><font size="2">CC=250: says "Address Translation Fault"</font></tt><br><br><tt><font size="2">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. </font></tt><br><br><tt><font size="2">Thanks</font></tt><br><tt><font size="2">Haren</font></tt><br><tt><font size="2"><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></font></tt><BR>
</body></html>