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=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, 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 7AF9BC48BDF for ; Fri, 18 Jun 2021 08:52:54 +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 4827E61245 for ; Fri, 18 Jun 2021 08:52:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4827E61245 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z2aSu7Y0oYAN+ghV3gpUGs0kyivZ1HQNoHm2J9OyCs8=; b=snIfJZAU/bYZOA VcXVUbhT83h2JG5uPvZ7o8APuVIOP/TCtX8Q40MZLc7eHCX+rvTNdx0seHEcLItqC6wspG679ge9d g8tnD7f5nvmq8GYMjTi7Pxnj5hwcMzQOQd7ONBn4ZtawzGS6wb8W72hrr0cdg7lUmJwHZ7a15jbfn jIW7YybbR186ykwSKFpHkg3Hg9GqHhf/eg+Pvq2KXN7D1epIWXbwpx4HXZFFBzgc0AyPGnl1lZ61m GIucbnA0CtE//JwnhtELNQ8PByL9oC/lEIfngHsE+hyiMTLAfN31jgnVYSopTyALedhlWAOoFdhiu ujWaZ7i2qF7lYAKbQnMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luADM-00DMxw-4l; Fri, 18 Jun 2021 08:51:00 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luADA-00DMwJ-SH for linux-arm-kernel@lists.infradead.org; Fri, 18 Jun 2021 08:50:50 +0000 Received: by mail-oi1-x22e.google.com with SMTP id q10so9773851oij.5 for ; Fri, 18 Jun 2021 01:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jdFKobz0v5eVip0thXQlonp2mF35EnH4oN1hYfZc5Y8=; b=eaI1qif8hWH4BDUPA4zAfU/JyLPIPsuOqFjMGM8Bena5fakXJe42h1NsUQcLTvKdJ1 LOcf3Qw8GQpYgpe1f/t5BZwAua9NJK/G8Q5YA0x3gEUix6SK0puD0UuAtx+522RhyFpH v4eUaoWuflGssbIsWGhZ4Q0auBg7DdWZVHDrnnwfk2+9LefFaGFSuIuQ9zld9KS8IFv6 Sd0rdtaCXNVsby6BzdgBjLciQorxLwS2MxQSfyQVweBhblWYkBi4L+gKasclg9l19zHq 1GMpCGCj40H2EsIOBz8dw37C0Qe0+/jP52+2bQikzN3ft8mTNr0GKkink3eqiPd9DNE/ sy/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jdFKobz0v5eVip0thXQlonp2mF35EnH4oN1hYfZc5Y8=; b=qtxh653Yb5xZeZ7YXB+ifMIBHy6Z7B2h4NggrR1Dmh8wxjX2csN9AgblWmX3y71kjE IurCybCZNW/JLrqzt+4Y0fbLrp9Uta6sz5XB/vNm4pVSOkt5wMNIy6+R47SSHwrJVy+G 9/wmHbB+K647sbzZnJDwIM9k5gBqWgD7jSCMBpcNwmBLWvFdOEAI9tscK+5CNR9dI6xF uDN58oOVv0vS92Pqwu4drNiiE8Kh4IeOFeFscVog3uIYSnoHfRCMlKj5LcQMGbt6VtvL D5M+2MvyT0Cts+MA58r3xlb6thbmxS1AyWdrCPXGf/BYyy6rcyonTh6aHTXBMLsDqD0D AcFg== X-Gm-Message-State: AOAM531q3N9oVy2dvurIa0RpwxtwgDKtYgHlyuNy3hYb5Gza3PBhHesR Dz3kyEmL+F93F7pcrHmWLxE9itvENBjj17vhVTy46Q== X-Google-Smtp-Source: ABdhPJypyxrsFJT695FL1xens+cccnkIs+C967czc330C77nK9BPZwBZ32eYzwZk3n/kX5cAq1Thkw1gKRvl10izUa0= X-Received: by 2002:aca:de07:: with SMTP id v7mr13635036oig.8.1624006243106; Fri, 18 Jun 2021 01:50:43 -0700 (PDT) MIME-Version: 1.0 References: <20210616095200.38008-1-wangyanan55@huawei.com> <20210616095200.38008-2-wangyanan55@huawei.com> In-Reply-To: <20210616095200.38008-2-wangyanan55@huawei.com> From: Fuad Tabba Date: Fri, 18 Jun 2021 09:50:06 +0100 Message-ID: Subject: Re: [PATCH v6 1/4] KVM: arm64: Introduce cache maintenance callbacks for guest stage-2 To: Yanan Wang Cc: Marc Zyngier , Will Deacon , Quentin Perret , Alexandru Elisei , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_015048_960207_8F17A255 X-CRM114-Status: GOOD ( 25.01 ) 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, Jun 16, 2021 at 10:52 AM 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. > + * @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); > }; > Just to add to Marc's comment on naming, flush_dcache is in this case a clean and invalidate: I see that in patch 4 it eventually does a civac. So, yes, although it is a mouthful, I think it should be dcache_clean_inval and not just dcache_clean. An alternative, if it's acceptable by Marc and the others, is to name the parameters dcmo/icmo or something like that, where the nature of the maintenance operation is not necessarily tied to the name. For reference, this is the patch Marc mentioned, where we're trying to fix the naming to make it consistent with Arm terminology (Arm doesn't define what a flush is): https://lore.kernel.org/linux-arm-kernel/20210524083001.2586635-19-tabba@google.com/ Otherwise: Reviewed-by: Fuad Tabba Cheers, /fuad > /** > -- > 2.23.0 > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel