powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
authorVaibhav Jain <vaibhav@linux.ibm.com>
Sat, 29 Jun 2019 16:06:10 +0000 (21:36 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 22 Jul 2019 13:31:00 +0000 (23:31 +1000)
commit3a855b7ac7d5021674aa3e1cc9d3bfd6b604e9c0
treeae04913f24c6fcae47a3a1b7eca58bd94b067406
parent0d7fc080ba139a2a639d3732616403ccddfa2d36
powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails

In some cases initial bind of scm memory for an lpar can fail if
previously it wasn't released using a scm-unbind hcall. This situation
can arise due to panic of the previous kernel or forced lpar
fadump. In such cases the H_SCM_BIND_MEM return a H_OVERLAP error.

To mitigate such cases the patch updates papr_scm_probe() to force a
call to drc_pmem_unbind() in case the initial bind of scm memory fails
with EBUSY error. In case scm-bind operation again fails after the
forced scm-unbind then we follow the existing error path. We also
update drc_pmem_bind() to handle the H_OVERLAP error returned by phyp
and indicate it as a EBUSY error back to the caller.

Suggested-by: "Oliver O'Halloran" <oohall@gmail.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190629160610.23402-4-vaibhav@linux.ibm.com
arch/powerpc/platforms/pseries/papr_scm.c