From patchwork Fri Nov 22 10:26:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180006 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp40764ilf; Fri, 22 Nov 2019 02:57:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwhj3LEt1m+JKnn6rtbGBZ8dfIZktykUFKDqoa84zW7Hf3qMdU4uPf4tNi6D2ZjouRa14GD X-Received: by 2002:aa7:cf8b:: with SMTP id z11mr277405edx.294.1574420234988; Fri, 22 Nov 2019 02:57:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420234; cv=none; d=google.com; s=arc-20160816; b=ZYa7zADXJg5pYpt65wnx/DiMKX7+2k2yq1nLmsOSYzq6mn1976z+bAQdjjn/2pPEkj R4DtvYDrbRd3MOjfyyJam6pce1y2YbWEV1ORquPvIwWbx+xV8yqXx+7GLMmHagqLoLue Iwb3JaXN7U26REUmNqqxTQHfK2sJMVWhcSNskauScTlVeJ1kf6gXf9T79pbRZww1k7P/ w+JSuLU8MPEqVSoh3gqOGVafHscVQQLudHOoALd5d8DAVBJlav3tcGuBCt2SGHOnpzld qVVgP7V7QTWpU7yF5Z69+yBg/4qIdeTkbDaikCskm1pHfvEA6vyKsi2ptepNXv18xAJ9 s0Lg== 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=nJgYtyClJ9TWtYdN/zSRsEKpFauF9tYonnjISmxwz5o=; b=GC+koEG1MM3ZTqYNF7ybYmBVKoEwhzDnhplTPJG360OBAAKf9wXwsSL2rj22QBsa0I q1PLsW9QKmL7NrhLhqJs/ETlCxv7IlxC1FiH9d+V5BFFuzWf0KfHDzXyHV0ZcSDAsHLo /8zGp6k1P8jiWuCc3/bO36CG4KVb+lZrVeZSS2XyGUlkYIJy+SnVDBDnZd8SKM/q7+Fv iW11XWub27D3NaInZQXzQ4vYpPjPGZs1RMXcz0LvFySBXQPEO/9dYuyDPYJsmsOb2KZu 8i/vc9xp58kwYd9sIQEGN/6CRRxYb9S/Zs/+YN2UyQTQ33RmVd6Dfp4FltA1hyp1OLAJ W3uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qvnTW3rV; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 v9si4799408edf.36.2019.11.22.02.57.14; Fri, 22 Nov 2019 02:57:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=qvnTW3rV; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729982AbfKVK5N (ORCPT + 15 others); Fri, 22 Nov 2019 05:57:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:45774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730405AbfKVK5I (ORCPT ); Fri, 22 Nov 2019 05:57:08 -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 7E0BB2072E; Fri, 22 Nov 2019 10:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420228; bh=5MH6Ax/vtJQFiVkOpwSaJoxC1Gi53ZAWxPTk71j1TkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvnTW3rVsN8K3gTCFIV4Ou7Vfpdb0/aeE/5HYqfyuIN359esmjaTYm6FoDyduMQWv XLrESa3F4NYHQRmYlyWBubUtvGKjcSsDDPMn1nltOOUra2KiQsoTtK4auqoJK/Hk3u 4FwYdEpbTmeRNVMyhYj8UL8MsLIDP4HIYhoWoRVQ= 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.19 036/220] kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table Date: Fri, 22 Nov 2019 11:26:41 +0100 Message-Id: <20191122100914.936074739@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 --- virt/kvm/arm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 1344557a70852..bf330b493c1e7 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -412,7 +412,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); }