From patchwork Tue Jul 31 13:08:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 10550785 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 A8E5B13B8 for ; Tue, 31 Jul 2018 13:09:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F022AC9C for ; Tue, 31 Jul 2018 13:09:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 894812ACA1; Tue, 31 Jul 2018 13:09:34 +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 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 1C6FD2AC9C for ; Tue, 31 Jul 2018 13:09:34 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=F0mIqahOfXC/gbBB+PLgvglSvlPuKR6zw6NFn2IUWz8=; b=fMS rFfLsMlG0t9By+xxsY4a7AkV3cBORqu3oOsZ/VYtn2n3IFZ+hhHTP/oahSHnsrV9byxz0ugxtT/Wp W9zruH09hfv08MsZRjQfqrLA2AaVNQUyv9fRkUJU81loUaX8Ac8/gJJdcdnqoLAG2F4r6rDgGawpg xEccAkBFLVyPZnEOi2/GK3WxTrVbwbKr3gYC4orZydQe9CCPoD8qURs0du5Yn0jwCoRY0wTH20YES AK9b4VZSuqkD4iXu/FoKGGgziZXnko9SK8MlR+tF5SVN987XtItZSorazfC8LS4rvtuQvnL6Lj4vr f9Xbf93E8f6fH/VjFE39oAI+9oXH3+g==; 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 1fkUP2-0000Kl-Bk; Tue, 31 Jul 2018 13:09:28 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkUOr-0008V8-Pj for linux-arm-kernel@lists.infradead.org; Tue, 31 Jul 2018 13:09:21 +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 7894080D; Tue, 31 Jul 2018 06:09:07 -0700 (PDT) Received: from bc-d5-1-10.euhpc.arm.com. (bc-d5-1-10.euhpc.arm.com [10.6.15.98]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F2D6E3F5D0; Tue, 31 Jul 2018 06:09:05 -0700 (PDT) From: Vladimir Murzin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 0/3] Support Common Not Private translations Date: Tue, 31 Jul 2018 14:08:55 +0100 Message-Id: <1533042538-26184-1-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180731_060918_355144_64439DC8 X-CRM114-Status: GOOD ( 12.20 ) 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: julien.thierry@arm.com, marc.zyngier@arm.com, christoffer.dall@arm.com, kristina.martsenko@arm.com, james.morse@arm.com, kbuild-all@01.org, robin.murphy@arm.com MIME-Version: 1.0 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 Common Not Private (CNP) translations is a feature of ARMv8.2 extension which allows translation table entries to be shared between different PEs in the same inner shareable domain, so the hardware can use this fact to optimise the caching of such entries in the TLB. This patch set is an attempt to bring CNP support into Linux. It was tested on a v8.2 Fast Model with exploring traces and checking that TTBRx_ELy and VTTBR_EL2 have CnP bit set where appropriate. Changelog: v5 -> v6 - fix CONFIG_ARM64_PA_BITS_52 (per Catalin) - is_kdump_kernel() instead of elfcorehdr_size (per Suzuki) - rebased on 4.18-rc6 v4 -> v5 - cleanups and comment/commit improvements (per James) - VTTBR_CNP_BIT instead of a hard-coded value (per Catalin) - rebased on 4.18-rc1 v3 -> v4 - rebased on 4.17-rc4 for real v2 -> v3 - do not enable CNP if we are crush kernel (per James) - default to "no" - rebased on 4.17-rc4 v1 -> v2 - handle cpuilde case (per James) - use lm_allias with swapper_pg_dir (per James) - rule out ARM64_SW_TTBR0_PAN case (per Catalin) - s/BUG_ON/WARN_ON/ (per Catalin) - comment and commit message updates (per Catalin) - TTBR_CNP_BIT moved to asm/pgtable-hwdef.h (per Catalin) - has_useable_cnp() simplified (per Julien) RFC -> v1 - dropped RFC tag - rebased on 4.14-rc4 Thanks! Vladimir Murzin (3): arm64: mm: Support Common Not Private translations arm64: KVM: Enable Common Not Private translations arm64: Introduce command line parameter to disable CNP Documentation/admin-guide/kernel-parameters.txt | 4 +++ arch/arm/include/asm/kvm_arm.h | 1 + arch/arm/include/asm/kvm_mmu.h | 5 +++ arch/arm64/Kconfig | 13 ++++++++ arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/cpufeature.h | 6 ++++ arch/arm64/include/asm/kvm_arm.h | 1 + arch/arm64/include/asm/kvm_mmu.h | 5 +++ arch/arm64/include/asm/mmu_context.h | 17 ++++++++-- arch/arm64/include/asm/pgtable-hwdef.h | 2 ++ arch/arm64/kernel/cpufeature.c | 43 +++++++++++++++++++++++++ arch/arm64/kernel/suspend.c | 4 +++ arch/arm64/kvm/hyp-init.S | 3 ++ arch/arm64/mm/context.c | 3 ++ arch/arm64/mm/proc.S | 11 +++++-- virt/kvm/arm/arm.c | 4 +-- 16 files changed, 117 insertions(+), 8 deletions(-)