Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2462646imm; Mon, 28 May 2018 08:31:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJE/WN51DzG+i3tlvMavOmft3Gx0ONXJetF+KgTVczrpCrTsBXYTdHDK7Xc6M7nSoxuYfBj X-Received: by 2002:a62:49d4:: with SMTP id r81-v6mr8709546pfi.146.1527521507383; Mon, 28 May 2018 08:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527521507; cv=none; d=google.com; s=arc-20160816; b=TWoBSeC9OmZvM3u8BnacEKvLd6xSB79NCBUMw59BSHK6lpzPayJTFeBxJVd+fLcN+C E3JNHyhjvnpD2FEXCScirHbh2P7ZCxSu4ZdrhRSolx8jvPCvFoX343gfUW/2X9j38qVC VcJc0/nT8qjQifKVK6a630+8f/ANvywKNXb1TwZvq6oylUHVItK1in3a3X8HI3iuRAF9 6g1VPbY3LStCw6mX+xgbATZHulmsUcNe/GONnCnfGjmZslmWfBSLjs6GHIaq4k205S+R 1xznBCeKc1Bqt6pF5prC2QiMRW7IUmY2Jzad0I0pEe0OSUgC8vApQkE2SUvYxPaab8od Y8eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Vvg92o+Pz1V7uQUsAErOQ3fWxiTITAoPF+BA4xR+KXo=; b=LjoHbXYsp78NGA8JRIrF2aZgVSRDxsma9u2luvffkgPdaJbLSr4nkw82oOLFJ3bpZm 3jkjwUNrd+/4yHO42zIUvZHJmpq7vPm+EACDHgyVKFhj9dt1Ly9qHGUVyOT8L6uLWDls OK+FGm1vVkzEbP5sir5ezwdrX0wsqp9HIBXgDdF0zoHa11X2JYAZlhJQQWm7ggk2Ph85 mcDWcFrpsLWantVn3nBbVCvw4TwNsqCNM6J2qOBkTvsNiUcd3upeEIbZ4HX0qhMlCCv3 iwzknddzd/niQBl5IaQuNLzjk4XWvIWFHGDL6BQxMvGgOuhvAzF/X20N7Q/3jSpRyTcV K/AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wUzgWnTa; 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 p11-v6si30464609pfj.294.2018.05.28.08.31.32; Mon, 28 May 2018 08:31:47 -0700 (PDT) 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=wUzgWnTa; 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 S1034305AbeE1Paq (ORCPT + 99 others); Mon, 28 May 2018 11:30:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:39380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968545AbeE1KT2 (ORCPT ); Mon, 28 May 2018 06:19:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 C22D9206B7; Mon, 28 May 2018 10:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502768; bh=YjgCh9d3hr8v/6DLG4ROXmjjHwfwOl3p3cAfwnJUJB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wUzgWnTam7KCcjSAyKf/2x2Ao9l3PQZ2CPrus1gVnnnh9nI+AJGBgsCAMZ9HIZei+ g2QzqZHmABCAjZyStDgg21xkHPrI+1Ame2YtAcILDLPStoVBauCBSGU3lH907dXG7o DsWn1r+H1Kg4abppafURJ7TJR3pm5f6cYeBPWKvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Mackerras , Sasha Levin Subject: [PATCH 4.4 122/268] KVM: PPC: Book3S HV: Fix VRMA initialization with 2MB or 1GB memory backing Date: Mon, 28 May 2018 12:01:36 +0200 Message-Id: <20180528100215.927437114@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100202.045206534@linuxfoundation.org> References: <20180528100202.045206534@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Mackerras [ Upstream commit debd574f4195e205ba505b25e19b2b797f4bcd94 ] The current code for initializing the VRMA (virtual real memory area) for HPT guests requires the page size of the backing memory to be one of 4kB, 64kB or 16MB. With a radix host we have the possibility that the backing memory page size can be 2MB or 1GB. In these cases, if the guest switches to HPT mode, KVM will not initialize the VRMA and the guest will fail to run. In fact it is not necessary that the VRMA page size is the same as the backing memory page size; any VRMA page size less than or equal to the backing memory page size is acceptable. Therefore we now choose the largest page size out of the set {4k, 64k, 16M} which is not larger than the backing memory page size. Signed-off-by: Paul Mackerras Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_hv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -3002,15 +3002,17 @@ static int kvmppc_hv_setup_htab_rma(stru goto up_out; psize = vma_kernel_pagesize(vma); - porder = __ilog2(psize); up_read(¤t->mm->mmap_sem); /* We can handle 4k, 64k or 16M pages in the VRMA */ - err = -EINVAL; - if (!(psize == 0x1000 || psize == 0x10000 || - psize == 0x1000000)) - goto out_srcu; + if (psize >= 0x1000000) + psize = 0x1000000; + else if (psize >= 0x10000) + psize = 0x10000; + else + psize = 0x1000; + porder = __ilog2(psize); /* Update VRMASD field in the LPCR */ senc = slb_pgsize_encoding(psize);