From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 253F4C43219 for ; Wed, 1 May 2019 09:48:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA22B217D4 for ; Wed, 1 May 2019 09:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726445AbfEAJsr (ORCPT ); Wed, 1 May 2019 05:48:47 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55026 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726224AbfEAJsR (ORCPT ); Wed, 1 May 2019 05:48:17 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C4F005DC777B751C2BF8; Wed, 1 May 2019 17:48:14 +0800 (CST) Received: from HGHY2Y004646261.china.huawei.com (10.184.12.158) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Wed, 1 May 2019 17:48:07 +0800 From: Zenghui Yu To: , , , CC: , , , , , , , , , , Zenghui Yu Subject: [PATCH 1/5] KVM: arm/arm64: Introduce helpers for page table enties with contiguous bit Date: Wed, 1 May 2019 09:44:23 +0000 Message-ID: <1556703867-22396-2-git-send-email-yuzenghui@huawei.com> X-Mailer: git-send-email 2.6.4.windows.1 In-Reply-To: <1556703867-22396-1-git-send-email-yuzenghui@huawei.com> References: <1556703867-22396-1-git-send-email-yuzenghui@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.184.12.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce helpers to manipulate stage2 page table entries - set contiguous bit in the entry and say whether this entry points to a contiguous block. The helpers are introduced in preparation for supporting contiguous hugepages at stage2. Signed-off-by: Zenghui Yu --- arch/arm/include/asm/kvm_mmu.h | 22 ++++++++++++++++++++++ arch/arm64/include/asm/kvm_mmu.h | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index 31de4ab..80d73ae 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h @@ -143,6 +143,28 @@ static inline bool kvm_s2pud_young(pud_t pud) return false; } +static inline pte_t kvm_s2pte_mkcont(pte_t pte) +{ + BUG(); + return pte; +} + +static inline bool kvm_s2pte_cont(pte_t pte) +{ + return false; +} + +static inline pmd_t kvm_s2pmd_mkcont(pmd_t pmd) +{ + BUG(); + return pmd; +} + +static inline bool kvm_s2pmd_cont(pmd_t pmd) +{ + return false; +} + static inline pte_t kvm_s2pte_mkwrite(pte_t pte) { pte_val(pte) |= L_PTE_S2_RDWR; diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index ebeefcf..4afdad9 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -295,6 +295,26 @@ static inline bool kvm_s2pud_young(pud_t pud) return pud_young(pud); } +static inline pte_t kvm_s2pte_mkcont(pte_t pte) +{ + return pte_mkcont(pte); +} + +static inline bool kvm_s2pte_cont(pte_t pte) +{ + return pte_cont(pte); +} + +static inline pmd_t kvm_s2pmd_mkcont(pmd_t pmd) +{ + return pmd_mkcont(pmd); +} + +static inline bool kvm_s2pmd_cont(pmd_t pmd) +{ + return !!(pmd_val(pmd) & PMD_SECT_CONT); +} + #define hyp_pte_table_empty(ptep) kvm_page_empty(ptep) #ifdef __PAGETABLE_PMD_FOLDED -- 1.8.3.1