Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp307147pxj; Wed, 16 Jun 2021 02:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy47SVzahkzY4JuCc7FD+YnfVFSzc6aotJJ7u1iReJSHXXspXEhixKFbuTgJfQ+HRSCnrrn X-Received: by 2002:a05:6e02:511:: with SMTP id d17mr3012114ils.229.1623837321105; Wed, 16 Jun 2021 02:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623837321; cv=none; d=google.com; s=arc-20160816; b=McweSfVmWfl59isp29QtdlV3ErYEPE3AauCeriFiDkzwue2KKOA9z1StTs7tavufRc h/WhV3kfciAu/PO4AqVvgVYGoFf0uzSuVhYfBRJlp1fvw51Tk+MXRuWOAsc9hcCdZ6JU 9//3Kga8xv24RghflegA4MQcDBYIvvHXEXzVndcS8MNgdjhdBT97zJJ2YBJMTprQNcmP pyA1QseDQdkxkzAYyhJFYb/eYNav5gWXbqMcDjBQmBOuDZ61JG7RXDse4HdiMs8cQWfo 1TthbRAvOF9BbGoFBYOl03+GjdBe7tRSUH24akKTGdeS6WaPyq6tcOSigvwMGXbEqpJ0 7X+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=nHq4lKxXmaGpn+fPS/T3NTwSN8ctGl2vfUfkmiU96Ls=; b=EEmfDihhq6r2SDG4gOwsDAsCSmIYacLgyOhvo6bSFnPPfRbnlPF6Q5mc90tigayNP9 g0ndaz2BIfAhFTF2z9+JHbwrjqXrYSGSiEBTlOUlhsgJH/eMerb15z7UusnaV7XujSPi UV0Mj8cWubueZV6akjl/xInGsTfjK1DwRPoDAy/JbAbC8xfd8L4S2qOK2zOeQWujXlX9 h0SWLpyaXVHEtiQT57hbxL0o1/9SudqRvI6k6VxVZCO7WSiG3OcibwtPNNTvpAqc282x 4TQh75s3a5/ChR0AaSpKQhZqvURvtD3PX/DYynOlLItp0hd4wkmM9vcc7HB3FYlvOIUP YPBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si2011334jap.60.2021.06.16.02.55.09; Wed, 16 Jun 2021 02:55:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbhFPJy7 (ORCPT + 99 others); Wed, 16 Jun 2021 05:54:59 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:4948 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232328AbhFPJyy (ORCPT ); Wed, 16 Jun 2021 05:54:54 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G4gQ91274z70PJ; Wed, 16 Jun 2021 17:49:37 +0800 (CST) Received: from dggpemm500023.china.huawei.com (7.185.36.83) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 16 Jun 2021 17:52:46 +0800 Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 16 Jun 2021 17:52:45 +0800 From: Yanan Wang To: Marc Zyngier , Will Deacon , "Quentin Perret" , Alexandru Elisei , , , , CC: Catalin Marinas , James Morse , Julien Thierry , "Suzuki K Poulose" , Gavin Shan , , , , Yanan Wang Subject: [PATCH v6 1/4] KVM: arm64: Introduce cache maintenance callbacks for guest stage-2 Date: Wed, 16 Jun 2021 17:51:57 +0800 Message-ID: <20210616095200.38008-2-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210616095200.38008-1-wangyanan55@huawei.com> References: <20210616095200.38008-1-wangyanan55@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To prepare for performing guest CMOs in the fault handlers in pgtable.c, introduce two cache maintenance callbacks in struct kvm_pgtable_mm_ops. The new callbacks are specific for guest stage-2, so they will only be initialized in 'struct kvm_pgtable_mm_ops kvm_s2_mm_ops'. Signed-off-by: Yanan Wang --- arch/arm64/include/asm/kvm_pgtable.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h index c3674c47d48c..302eca32e0af 100644 --- a/arch/arm64/include/asm/kvm_pgtable.h +++ b/arch/arm64/include/asm/kvm_pgtable.h @@ -44,6 +44,11 @@ typedef u64 kvm_pte_t; * in the current context. * @virt_to_phys: Convert a virtual address mapped in the current context * into a physical address. + * @flush_dcache: Clean data cache for a guest page address range before + * creating the corresponding stage-2 mapping. + * @flush_icache: Invalidate instruction cache for a guest page address + * range before creating or updating the corresponding + * stage-2 mapping. */ struct kvm_pgtable_mm_ops { void* (*zalloc_page)(void *arg); @@ -54,6 +59,8 @@ struct kvm_pgtable_mm_ops { int (*page_count)(void *addr); void* (*phys_to_virt)(phys_addr_t phys); phys_addr_t (*virt_to_phys)(void *addr); + void (*flush_dcache)(void *addr, size_t size); + void (*flush_icache)(void *addr, size_t size); }; /** -- 2.23.0