Skip to content

Commit 5a3840a

Browse files
oohalmpe
authored andcommitted
powerpc/papr_scm: Use the correct bind address
When binding an SCM volume to a physical address the hypervisor has the option to return early with a continue token with the expectation that the guest will resume the bind operation until it completes. A quirk of this interface is that the bind address will only be returned by the first bind h-call and the subsequent calls will return 0xFFFF_FFFF_FFFF_FFFF for the bind address. We currently do not save the address returned by the first h-call. As a result we will use the junk address as the base of the bound region if the hypervisor decides to split the bind across multiple h-calls. This bug was found when testing with very large SCM volumes where the bind process would take more time than they hypervisor's internal h-call time limit would allow. This patch fixes the issue by saving the bind address from the first call. Cc: stable@vger.kernel.org Fixes: b5beae5 ("powerpc/pseries: Add driver for PAPR SCM regions") Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 579b923 commit 5a3840a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/powerpc/platforms/pseries/papr_scm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
4343
{
4444
unsigned long ret[PLPAR_HCALL_BUFSIZE];
4545
uint64_t rc, token;
46+
uint64_t saved = 0;
4647

4748
/*
4849
* When the hypervisor cannot map all the requested memory in a single
@@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
5657
rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0,
5758
p->blocks, BIND_ANY_ADDR, token);
5859
token = ret[0];
60+
if (!saved)
61+
saved = ret[1];
5962
cond_resched();
6063
} while (rc == H_BUSY);
6164

@@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
6467
return -ENXIO;
6568
}
6669

67-
p->bound_addr = ret[1];
70+
p->bound_addr = saved;
6871

6972
dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res);
7073

0 commit comments

Comments
 (0)