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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 86531C48BE5 for ; Wed, 16 Jun 2021 13:22:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45B4B61166 for ; Wed, 16 Jun 2021 13:22:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45B4B61166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WjBfmhPrrRkzpsOqud/t3RKT03ORBnyRwQuI3xtCbrA=; b=QaDrp4n5iio0Ot zfhE3Mwgwx+LZ7+1wkMKkaQu1bK228DylKffI3FtLv61d869BjcxbQV+60ZgLXSVUh1EM1biSGK1Y WAQj/4nZ7qJCZja8qYySd5u4T9MYtE//bF86w829r94qikcouKShDpOgHSZPR5lmYRcMr6AQZXBG1 /6LIgvNlpau0MSL7/E9+tZSLxh27JfeSzobF5rzamForco7dD528Pbet3GH5nOgQmn0HRJVDhmluy Cmz5rpX+a16A8kQobiWUfbG3xF2tjcUBAMZ14co9sl0U2hMWXsHZYL3NDOnB9D9pwD4TXp6/P3FcD 79T2Sx8OEFNOk8O7xUTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltVU2-006O66-96; Wed, 16 Jun 2021 13:21:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltVTy-006O5f-Ix for linux-arm-kernel@lists.infradead.org; Wed, 16 Jun 2021 13:21:27 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D990B6102A; Wed, 16 Jun 2021 13:21:25 +0000 (UTC) Received: from [185.219.108.64] (helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ltVTv-007xFJ-Si; Wed, 16 Jun 2021 14:21:24 +0100 Date: Wed, 16 Jun 2021 14:21:23 +0100 Message-ID: <87eed2lzcc.wl-maz@kernel.org> From: Marc Zyngier To: Yanan Wang Cc: Will Deacon , "Quentin\ Perret" , Alexandru Elisei , , , , , Catalin Marinas , James Morse , Julien Thierry , "Suzuki K Poulose" , Gavin Shan , , , Subject: Re: [PATCH v6 1/4] KVM: arm64: Introduce cache maintenance callbacks for guest stage-2 In-Reply-To: <20210616095200.38008-2-wangyanan55@huawei.com> References: <20210616095200.38008-1-wangyanan55@huawei.com> <20210616095200.38008-2-wangyanan55@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: wangyanan55@huawei.com, will@kernel.org, qperret@google.com, alexandru.elisei@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, gshan@redhat.com, wanghaibin.wang@huawei.com, zhukeqian1@huawei.com, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210616_062126_693588_DDFDBE5F X-CRM114-Status: GOOD ( 24.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Yanan, On Wed, 16 Jun 2021 10:51:57 +0100, Yanan Wang wrote: > > 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. Please don't reintroduce the word 'flush'. We are really trying to move away from it as it doesn't describe what we want to do. Here this should be 'clean_invalidate_dcache' which, despite being a mouthful, describe accurately what we expect it to do. The comment is also missing the invalidate part, and we shouldn't assume that this is only used for S2 mapping. > + * @flush_icache: Invalidate instruction cache for a guest page address > + * range before creating or updating the corresponding > + * stage-2 mapping. Same thing here; this should be 'invalidate_icache', and the comment cleaned up. > */ > 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); > }; > > /** Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel