From patchwork Fri Nov 22 10:28:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179982 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp29104ilf; Fri, 22 Nov 2019 02:46:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxOTMJSE3UGEX4xK9Qq8Z1nwaJvr1dOxfqwiWxJLu7IizcT+LRuT485vahfu7aTPOz5+frg X-Received: by 2002:a17:906:344c:: with SMTP id d12mr20577265ejb.227.1574419589975; Fri, 22 Nov 2019 02:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419589; cv=none; d=google.com; s=arc-20160816; b=kIt2iCh60OWxq/RGP3wQgWwmlCoNRIno7vKpNl8Ov8NX6kPoxg+2hssjn8bzPxGm7z UxPtXaz+xmBp09kSIqJoe1UTv9IVcbdMYXc+iXCpNhdIVjBAbow3t6f1SAoptGJ+0ZyG 7FxKSt2Z1KnP26ZmXb4PDcDjROL81rvQPZNbdtwz4Pcp+t+NcyUqVU6XbN65iAA3CXy3 Tbxsm+YOWnHssX1iWjSaFiCC4OOQCxxGqe+vlmsi5RH2EwNTMMwSOCoS7A6ExGZy59/t e2TtD4op1+U9g69YlmmTSI9aVJV5uf/pQCbXtcoVzmTrEnYJXzougecyeNIiR58v+8ds ZkEQ== 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=fxz39uD+Lz0MpMkk953nNcg4wAA3YmkL9a9ZbFltQmM=; b=ONXPSDf00TlEMZksfIfusA6EdcAkXe9tkPl5r5BLX80sJ+R/xPWYpOKnG8nfx2H5iO mX9d7BXGW9yJsoSMvl7MwJ4wOdIMET8QQfJA1JvxVkyGk3jBZktWBtjr0uS05Tq5pvx3 oNLzH1RgWWKSdzZJg2zG/gF3n55qzy9B2s79PmQGxd/TYMrXJ+TzabnhrzHl0KRM7MT+ bocmfFhDWXNK15S2XRu1b00eSsX5iBawWBvnFTo8yYVCcnks8u2rvrKbVfjv90J+uw8O 8rBCN5nYzxT5j9NxLQCOJeyS29sF95BR6Rz/SPwSMmOqujaB7X6/l3hSmJPFQVB4Jz3k VkFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t1608geW; 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 n6si4015052ejk.160.2019.11.22.02.46.29; Fri, 22 Nov 2019 02:46:29 -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=t1608geW; 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 S1729653AbfKVKq1 (ORCPT + 26 others); Fri, 22 Nov 2019 05:46:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbfKVKqY (ORCPT ); Fri, 22 Nov 2019 05:46:24 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 0596320637; Fri, 22 Nov 2019 10:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419583; bh=Yxln0144vos7Du5zQnUGkOlxhmdUTQgrIMTzV0Joh3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1608geWJGNVMZa3gbYSlcH6eonxDtiBRZGqvTo+HcnPwwCDdpItrbf0eQuntnEdP 3IWqz57cPzgxXsqf/ObPqsOKqoo89CzupK8Qqb98+jPV+/danRSqJtoOMbC/meE7Iw EDlXkwsRJ+TX2w4TnR99VWFZ6RDksBkwKdBRDIjY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoffer Dall , Marc Zyngier , Eric Auger , Suzuki K Poulose , Sasha Levin Subject: [PATCH 4.9 160/222] kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table Date: Fri, 22 Nov 2019 11:28:20 +0100 Message-Id: <20191122100914.210051442@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose [ Upstream commit d2db7773ba864df6b4e19643dfc54838550d8049 ] So far we have only supported 3 level page table with fixed IPA of 40bits, where PUD is folded. With 4 level page tables, we need to check if the PUD entry is valid or not. Fix stage2_flush_memslot() to do this check, before walking down the table. Acked-by: Christoffer Dall Acked-by: Marc Zyngier Reviewed-by: Eric Auger Signed-off-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- arch/arm/kvm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index b3d268a79f057..bb0d5e21d60bd 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -366,7 +366,8 @@ static void stage2_flush_memslot(struct kvm *kvm, pgd = kvm->arch.pgd + stage2_pgd_index(addr); do { next = stage2_pgd_addr_end(addr, end); - stage2_flush_puds(kvm, pgd, addr, next); + if (!stage2_pgd_none(*pgd)) + stage2_flush_puds(kvm, pgd, addr, next); } while (pgd++, addr = next, addr != end); }