From patchwork Thu Oct 6 11:12:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 13000162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF7A3C433F5 for ; Thu, 6 Oct 2022 11:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231472AbiJFLLy (ORCPT ); Thu, 6 Oct 2022 07:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbiJFLLw (ORCPT ); Thu, 6 Oct 2022 07:11:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4FDC7F020 for ; Thu, 6 Oct 2022 04:11:51 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA75E1BF7; Thu, 6 Oct 2022 04:11:56 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 740023F73B; Thu, 6 Oct 2022 04:11:49 -0700 (PDT) From: Alexandru Elisei To: pbonzini@redhat.com, thuth@redhat.com, andrew.jones@linux.dev, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: [kvm-unit-tests PATCH 0/3] arm/arm64: mmu cleanups and fixes Date: Thu, 6 Oct 2022 12:12:38 +0100 Message-Id: <20221006111241.15083-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org I was writing a quick test when I noticed that arm's implementation of __virt_to_phys(), which ends up calling virt_to_pte_phys(), doesn't handle block mappings and returns a bogus value. When fixing that, I realized that lib/vmalloc confuses the return value for virt_to_pte_phys(), which is harmless, but still wrong. I also got confused about mmu_get_pte() and get_pte(), so I (hopefully) improved that by renaming mmu_get_pte() to follow_pte(). Tested on rockpro64: arm64, 4k and 64k pages, with qemu and kvmtool; arm, with qemu and kvmtool. And on an odroid-c4: arm64, 4k, 16k and 64k pages with qemu and kvmtool; arm, with qemu and kvmtool. Alexandru Elisei (3): lib/vmalloc: Treat virt_to_pte_phys() as returning a physical address arm/arm64: mmu: Teach virt_to_pte_phys() about block descriptors arm/arm64: mmu: Rename mmu_get_pte() -> follow_pte() lib/arm/asm/mmu-api.h | 2 +- lib/arm/mmu.c | 88 +++++++++++++++++++++++++------------------ lib/vmalloc.c | 4 +- 3 files changed, 55 insertions(+), 39 deletions(-)