Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3813739imm; Mon, 17 Sep 2018 03:45:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYr0FHg9TAbZ8dKgjaaaq4BYuaHZ59IxWERD9A8fKeYiNR3k66P+DoCmqH5YmtAfNE9mBaw X-Received: by 2002:a17:902:708a:: with SMTP id z10-v6mr24556332plk.229.1537181144747; Mon, 17 Sep 2018 03:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537181144; cv=none; d=google.com; s=arc-20160816; b=ag5EJ4Lw+pssFtUDPpWUivnl++oCFQoVt3FdXJICLgiSbqO43CUas6/CoQ3pkx7npU tG2Eavt8w7PXL2YI5gepYxJ8zIWy8SGe8/BBcyzLeQ4TFm5F3T5ZTF2ZofcW0GtAUF+o JSeK/BCZU553EirbzefKxVHhsmm9qnLI6cPGBxyibgQSLgGw6GYWqVPvDD94fCWY4irQ vqg+mEsR13L46IRTa3oMNfs51NvzrlmOv9VR8jo97eInFDKo8nqQpNCbxDGl1Lk/H5EN fB0nWwYoYqzI33K8MVqDBiVr0c2KNehMx0qfpbo4W7BlVneWHuo78/xVbSc/rlo3IyiI 5Ngw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ChgmaEsdjSWoAO7Q+f7PSNo0XQlvlBsT5Ond4Kxk0yg=; b=0JMtFOh2/0oYsA9vmwPXMsmqm2E8lZhBBnzpKCLuwtSKBxtRWkS+5XhTdaGRtKMSh9 WZOSa5Ijy9EX4ZVjVhd80vXtvto3vc0crbFJbtSQP5Iust4vGsf3P9D6gxl6F5iWCqhT deO5wT+iCB8Y9flxcNrQy/zUvcMnYdvsnxhLN7JJdrL9U2RgIwdSn81zFSsQOiKv4MdK P6UhMY9itIvtacwkg4kJqNjS2af/yQ99YVLoNzgcHD/9RQEZzu8uGWbYadkQ/CTae0DY 3KuirjtU/GAdAmFliPvaU98zL8IVv4YbFJpa4f+rH5K0duQ0ujKcOg2GKVADCJnuWdTf EJLg== ARC-Authentication-Results: i=1; mx.google.com; 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 g20-v6si14914222pgb.239.2018.09.17.03.45.29; Mon, 17 Sep 2018 03:45:44 -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; 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 S1727806AbeIQQJN (ORCPT + 99 others); Mon, 17 Sep 2018 12:09:13 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56422 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726824AbeIQQJN (ORCPT ); Mon, 17 Sep 2018 12:09:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E9AD80D; Mon, 17 Sep 2018 03:42:25 -0700 (PDT) Received: from en101.Emea.Arm.com (en101.emea.arm.com [10.4.13.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EDA603F5BD; Mon, 17 Sep 2018 03:42:22 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, marc.zyngier@arm.com, cdall@kernel.org, eric.auger@redhat.com, pbonzini@redhat.com, rkrcmar@redhat.com, will.deacon@arm.com, catalin.marinas@arm.com, james.morse@arm.com, dave.martin@arm.com, julien.grall@arm.com, linux-kernel@vger.kernel.org, suzuki.poulose@arm.com Subject: [PATCH v5 01/18] kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table Date: Mon, 17 Sep 2018 11:41:23 +0100 Message-Id: <20180917104144.19188-2-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917104144.19188-1-suzuki.poulose@arm.com> References: <20180917104144.19188-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- virt/kvm/arm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index ed162a6c57c5..ee7ce8fa4a12 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); } -- 2.19.0