From patchwork Thu Jan 31 09:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10790265 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 624E6746 for ; Thu, 31 Jan 2019 09:53:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 616662FE14 for ; Thu, 31 Jan 2019 09:53:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 559392FE29; Thu, 31 Jan 2019 09:53:04 +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,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3599A2FE14 for ; Thu, 31 Jan 2019 09:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfAaJwt (ORCPT ); Thu, 31 Jan 2019 04:52:49 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40644 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbfAaJwt (ORCPT ); Thu, 31 Jan 2019 04:52:49 -0500 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 5FBB2A78; Thu, 31 Jan 2019 01:52:49 -0800 (PST) Received: from localhost (e113682-lin.copenhagen.arm.com [10.32.144.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C3E143F71E; Thu, 31 Jan 2019 01:52:48 -0800 (PST) From: Christoffer Dall To: kvm@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall , James Hogan , Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , Joerg Roedel , Marc Zyngier , Paul Mackerras , Christian Borntraeger , Anshuman Khandual , Suzuki K Poulose , Sean Christopherson Subject: [PATCH v2 0/3] KVM: Unify mmu_memory_cache functionality across architectures Date: Thu, 31 Jan 2019 10:52:40 +0100 Message-Id: <20190131095244.7480-1-christoffer.dall@arm.com> X-Mailer: git-send-email 2.18.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We currently have duplicated functionality for the mmu_memory_cache used to pre-allocate memory for the page table manipulation code which cannot allocate memory while holding spinlocks. This functionality is duplicated across x86, arm/arm64, and mips. There were recently a debate of modifying the arm code to be more in line with the x86 code and some discussions around changing the page flags used for allocation. This series should make it easier to take a uniform approach across architectures. While there's not a huge amount of code sharing, we come out with a net gain. Only tested on arm/arm64, and only compile-tested on x86 and mips. Changes since v1: - Split out rename from initial x86 patch to have separate patches to move the logic to common code and to rename. - Introduce KVM_ARCH_WANT_MMU_MEMCACHE to avoid compile breakage on architectures that don't use this functionality. - Rename KVM_NR_MEM_OBJS to KVM_MMU_NR_MEMCACHE_OBJS --- Christoffer Dall (4): KVM: x86: Move mmu_memory_cache functions to common code KVM: x86: Rename mmu_memory_cache to kvm_mmu_memcache KVM: arm/arm64: Move to common kvm_mmu_memcache infrastructure KVM: mips: Move to common kvm_mmu_memcache infrastructure arch/arm/include/asm/kvm_host.h | 13 +--- arch/arm/include/asm/kvm_mmu.h | 2 +- arch/arm/include/asm/kvm_types.h | 12 ++++ arch/arm64/include/asm/kvm_host.h | 13 +--- arch/arm64/include/asm/kvm_mmu.h | 2 +- arch/arm64/include/asm/kvm_types.h | 13 ++++ arch/mips/include/asm/kvm_host.h | 15 +---- arch/mips/include/asm/kvm_types.h | 12 ++++ arch/mips/kvm/mips.c | 2 +- arch/mips/kvm/mmu.c | 54 +++------------- arch/powerpc/include/asm/kvm_types.h | 5 ++ arch/s390/include/asm/kvm_types.h | 5 ++ arch/x86/include/asm/kvm_host.h | 17 +---- arch/x86/include/asm/kvm_types.h | 12 ++++ arch/x86/kvm/mmu.c | 97 ++++++---------------------- arch/x86/kvm/paging_tmpl.h | 4 +- include/linux/kvm_host.h | 11 ++++ include/linux/kvm_types.h | 13 ++++ virt/kvm/arm/arm.c | 2 +- virt/kvm/arm/mmu.c | 68 +++++-------------- virt/kvm/kvm_main.c | 60 +++++++++++++++++ 21 files changed, 202 insertions(+), 230 deletions(-) create mode 100644 arch/arm/include/asm/kvm_types.h create mode 100644 arch/arm64/include/asm/kvm_types.h create mode 100644 arch/mips/include/asm/kvm_types.h create mode 100644 arch/powerpc/include/asm/kvm_types.h create mode 100644 arch/s390/include/asm/kvm_types.h create mode 100644 arch/x86/include/asm/kvm_types.h