From patchwork Fri Oct 19 12:58:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 10649527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75CCF14E2 for ; Fri, 19 Oct 2018 13:44:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 653F328BC1 for ; Fri, 19 Oct 2018 13:44:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5999F28B9D; Fri, 19 Oct 2018 13:44:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC81428BDE for ; Fri, 19 Oct 2018 13:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qWMN+60Wz5TLfmCFRr6f1xczRytFBQSCHWdwS5EjzFU=; b=rFe0/hangb3q8n 3/wnAx1aFxKjSnxrqo/qAQZHf12S2aYKTohPf59f9l/+SPycHxBqrmQYag8KZylqwAG5mX28gxsCE bXxly1fD+jfPUPW1cv3g6PePjXJXVe/+WDfi3qCrnHIcE2JU/qMn0MgLCDzH2eFb1f0caAz+mAMnV +5irTvD/Dy4tRtKmrP9u3jLj6G9NS6cpF+msrBjgtL0uCa0eT7TpTRhhZrRSFBe1C4jio/JIgJMG7 9F68rZrRXE2tOmHoLuXtnOz+W13akvNFw6JfxtedUwnQl8JIxv0FFcPYWIOYQIeMjTDSojUpIt5Rb 6nRYLTISC7FNlwnc+wRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDV4n-0003G7-Gi; Fri, 19 Oct 2018 13:44:29 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDUc6-0000Hs-2s for linux-arm-kernel@bombadil.infradead.org; Fri, 19 Oct 2018 13:14:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nI9XbeAge7R/qTNam5DOwJObYaBYDkeSYHYM0U0ryMQ=; b=uwPVjzFdDKLZZD3qME71OKFgkz j1HVrx3W6dnxHWLdR7YLNfBSy9vIkcYAjFfl1kopjExjaYf45ji/6LHsbAn6+wr/lbkIY+OePmzFB tOXG15tRdWUq1r12E7PzBY4PiDkjC1O94PJMEbNni1BDTNcIPXbpqKRvOS9eeJMroRRADQxDsMVGG C+lwwlW9xHzuF+MvZKCO0Lggdl/3IiwM6Y5JkiYX9rNQwtG1RPNF5H+RKkOvXp7/lxJmJyWDxt9Xq LwJaNhGm7+JWA6uKPWobRcbP0HP5/qr48G/zng6W+wO74tdWhKe5CoV4znBpHnGNkDYDm2195QS+k bIz/2+HQ==; Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDUNJ-0000Gp-Ep for linux-arm-kernel@lists.infradead.org; Fri, 19 Oct 2018 12:59:36 +0000 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 6EA7EEBD; Fri, 19 Oct 2018 05:59:21 -0700 (PDT) Received: from filthy-habits.cambridge.arm.com (filthy-habits.cambridge.arm.com [10.1.196.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C4BD93F71D; Fri, 19 Oct 2018 05:59:18 -0700 (PDT) From: Marc Zyngier To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Subject: [PATCH 01/26] kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table Date: Fri, 19 Oct 2018 13:58:36 +0100 Message-Id: <20181019125901.185478-2-marc.zyngier@arm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181019125901.185478-1-marc.zyngier@arm.com> References: <20181019125901.185478-1-marc.zyngier@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181019_135933_713091_B693B994 X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , zhong jiang , kvm@vger.kernel.org, Suzuki K Poulose , Catalin Marinas , Punit Agrawal , Christoffer Dall , Kristina Martsenko , Dongjiu Geng , Eric Auger , James Morse , Robin Murphy , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose 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 --- 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); }