mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails
[ Upstream commit 3a855b7ac7 ]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2d99de9420
commit
8a6709ad4c
@@ -42,8 +42,9 @@ struct papr_scm_priv {
|
|||||||
static int drc_pmem_bind(struct papr_scm_priv *p)
|
static int drc_pmem_bind(struct papr_scm_priv *p)
|
||||||
{
|
{
|
||||||
unsigned long ret[PLPAR_HCALL_BUFSIZE];
|
unsigned long ret[PLPAR_HCALL_BUFSIZE];
|
||||||
uint64_t rc, token;
|
|
||||||
uint64_t saved = 0;
|
uint64_t saved = 0;
|
||||||
|
uint64_t token;
|
||||||
|
int64_t rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the hypervisor cannot map all the requested memory in a single
|
* When the hypervisor cannot map all the requested memory in a single
|
||||||
@@ -63,6 +64,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
|
|||||||
} while (rc == H_BUSY);
|
} while (rc == H_BUSY);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
/* H_OVERLAP needs a separate error path */
|
||||||
|
if (rc == H_OVERLAP)
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
|
dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
@@ -316,6 +321,14 @@ static int papr_scm_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* request the hypervisor to bind this region to somewhere in memory */
|
/* request the hypervisor to bind this region to somewhere in memory */
|
||||||
rc = drc_pmem_bind(p);
|
rc = drc_pmem_bind(p);
|
||||||
|
|
||||||
|
/* If phyp says drc memory still bound then force unbound and retry */
|
||||||
|
if (rc == -EBUSY) {
|
||||||
|
dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
|
||||||
|
drc_pmem_unbind(p);
|
||||||
|
rc = drc_pmem_bind(p);
|
||||||
|
}
|
||||||
|
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user