Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp713522imj; Wed, 13 Feb 2019 16:19:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IaFRaeIgs7txPZbbHdd4V7cUKmbbQYbGUL2LfykiEBYMvTo9HcxTC44f4DVDAhbVsT8EQY6 X-Received: by 2002:a17:902:7882:: with SMTP id q2mr976258pll.305.1550103584636; Wed, 13 Feb 2019 16:19:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103584; cv=none; d=google.com; s=arc-20160816; b=QIj5qrei5bZf/TqtVPIGg31pboqIC3BmjorS/VqCG5KIatf5Tb0RsPsQ4RuVb/5bWA 8zD3x/Vb2LU3OmV7gsfwFnuHvXKtiT+l4RsEoDdxqLSuIqMCNfZ0Ctsx2FWpTQ1YgEQc iFcJwDgfO5mPShJ0dxn8LKzzHLd4v+kOyu6dF1LhkiFlw9revYhvxAX87sqYjzcUdN2P aYZwNIm1u/n2dt9+71XZnSSQKeyKK1m3xdQW1cUBjau7sd1zUo2YwRMGlBaRu8fQf2uy c2XYXCYIEjeZJycA0fzBM3jAx2FSWLpGVVBxoR8Chgo50hDIb++sC+O/ZNQ//aCyurEs itDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i0ZdWR05SMZkoEP9hVMfG/Sr6aizJ4w0bvFNFI4bx/s=; b=aucBLyNoChebKpP3T16uX5PPC/M35INa6EGufx/YuE+immITja5jdJ6hdWcL/tpvve rustIzZi/DikFYPv2w+2CkAgkqnrCsKTS4ls27J3G9AXkvuCqpsZLE1VeuiOTksJkufE Ujjc1cPvIpvUFRlVLRupS7S77PRoal9Avl3FgquG5AeSYIlfPtfdHHgnrsmIKI0ScAEe lsAAVExuLGjf8PQ9X1UKU2ST770evNeSQDLoUCE09p9d+/2UPmAmqMmluUBemubKzczV uK9BWFB6KvHbCosvzvxQIitp43ObxKBUQSgyc15c7LoYpkHNJVuKTjBohRi+rWEc2dIe rWJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JMcO+5+G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s7si739280plq.237.2019.02.13.16.19.28; Wed, 13 Feb 2019 16:19:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JMcO+5+G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406366AbfBMSqE (ORCPT + 99 others); Wed, 13 Feb 2019 13:46:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:44650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730855AbfBMSqC (ORCPT ); Wed, 13 Feb 2019 13:46:02 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D13ED20811; Wed, 13 Feb 2019 18:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083561; bh=qMnelwY010Rk5ajCtSKpBzK8nV4ItgG4WFdaS9Txuo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMcO+5+GramXaFruw6i2B9IwD5Jk2ouJHmcm8sSn4hZuOZHnwll4lHYNaLPxtzDI3 J97mH80wUd1u8gOLHtBG2wLmvX8Ckm4hF8mwlUf90ljHZjKmelP6ZPNbO71nl7znKT i2VlIBfafiQiLbcrKlyuFQwgu14kANX5dZ8v4Pto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver OHalloran , Michael Ellerman Subject: [PATCH 4.20 33/50] powerpc/papr_scm: Use the correct bind address Date: Wed, 13 Feb 2019 19:38:38 +0100 Message-Id: <20190213183658.371944412@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oliver O'Halloran commit 5a3840a470c41ec0b85cd36ca80370330656b163 upstream. 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: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions") Signed-off-by: Oliver O'Halloran Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/papr_scm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c @@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm { unsigned long ret[PLPAR_HCALL_BUFSIZE]; uint64_t rc, token; + uint64_t saved = 0; /* * When the hypervisor cannot map all the requested memory in a single @@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, p->blocks, BIND_ANY_ADDR, token); token = ret[0]; + if (!saved) + saved = ret[1]; cond_resched(); } while (rc == H_BUSY); @@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm return -ENXIO; } - p->bound_addr = ret[1]; + p->bound_addr = saved; dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res);