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=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 4F353C433E7 for ; Thu, 3 Sep 2020 04:15:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 181F22080C for ; Thu, 3 Sep 2020 04:15:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cgahcRt/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cabzlV4s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 181F22080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QBhc9VDCF/akGKXZeOiwUpS5tgQjCfcwvwDFaDleobo=; b=cgahcRt/LH2OBO z6f7gSwrwvaI6j05fKtBKh+KldtC72iP0hJB4Yzh2f6kzPAxqr744pKygSwQ+5wnEewwxxxSOI8te YpC7df9Ol3mysiawzHVNqHf+9ZzvavcEQI6kL7SFoory8GdotqBzysBFHBZOAttwJzOea1yB2nC6m 12Qs2yIw9cui+CDE8YHRlL4J3r4go2HF6sd05WB/x4oJjAnXYp9SwG9LQCSlwBHAGR0ssXbioQ0ke DzNT2aYeAuC+7bcP+1LcVGa/S3RkAOaJNPaBieoF1kSmtEQD0W53ukexGyt26U/OLkJhyVvjRdHP2 5hpJtI4xN8WpI6iPeI1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDgd3-0002Iw-Ux; Thu, 03 Sep 2020 04:13:42 +0000 Received: from us-smtp-1.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDgd1-0002IU-Gz for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 04:13:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599106416; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rq+RcL/kflZe/rFvjt0kr+ANZbQ/zGvh9W2eFhHJr7Y=; b=cabzlV4sFl/uZrPDlhCYeYtwJbTzFVwxVQmUhT8jKDhJwjRsLV+AgAQa01y/7rhMFoMwxf rFkaKsbegofr1nReaLCZyTgbMGHfRdYAB+d9v2SqseOs+pOkIrNCn4BDAjHT3Ptqjxljxx dy5KF4ozQjJHb7NieWPV700DLwglWUM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-TZCb7spnM5a_QkW7fp29ag-1; Thu, 03 Sep 2020 00:13:34 -0400 X-MC-Unique: TZCb7spnM5a_QkW7fp29ag-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D5F61DE00; Thu, 3 Sep 2020 04:13:32 +0000 (UTC) Received: from [10.64.54.159] (vpn2-54-159.bne.redhat.com [10.64.54.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D69691002D5A; Thu, 3 Sep 2020 04:13:29 +0000 (UTC) Subject: Re: [PATCH v3 08/21] KVM: arm64: Convert kvm_set_spte_hva() to generic page-table API To: Will Deacon , kvmarm@lists.cs.columbia.edu References: <20200825093953.26493-1-will@kernel.org> <20200825093953.26493-9-will@kernel.org> From: Gavin Shan Message-ID: <98ceab8b-d612-2111-121f-2a43febab7ea@redhat.com> Date: Thu, 3 Sep 2020 14:13:28 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200825093953.26493-9-will@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_001339_674465_3169A7E9 X-CRM114-Status: GOOD ( 20.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan Cc: Suzuki Poulose , Marc Zyngier , Quentin Perret , James Morse , Catalin Marinas , kernel-team@android.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will, On 8/25/20 7:39 PM, Will Deacon wrote: > Convert kvm_set_spte_hva() to use kvm_pgtable_stage2_map() instead > of stage2_set_pte(). > > Cc: Marc Zyngier > Cc: Quentin Perret > Signed-off-by: Will Deacon > --- > arch/arm64/kvm/mmu.c | 23 ++++++++++------------- > 1 file changed, 10 insertions(+), 13 deletions(-) > Reviewed-by: Gavin Shan > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 33146d3dc93a..704b471a48ce 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -1911,28 +1911,27 @@ int kvm_unmap_hva_range(struct kvm *kvm, > > static int kvm_set_spte_handler(struct kvm *kvm, gpa_t gpa, u64 size, void *data) > { > - pte_t *pte = (pte_t *)data; > + kvm_pfn_t *pfn = (kvm_pfn_t *)data; > > WARN_ON(size != PAGE_SIZE); > + > /* > - * We can always call stage2_set_pte with KVM_S2PTE_FLAG_LOGGING_ACTIVE > - * flag clear because MMU notifiers will have unmapped a huge PMD before > - * calling ->change_pte() (which in turn calls kvm_set_spte_hva()) and > - * therefore stage2_set_pte() never needs to clear out a huge PMD > - * through this calling path. > + * The MMU notifiers will have unmapped a huge PMD before calling > + * ->change_pte() (which in turn calls kvm_set_spte_hva()) and > + * therefore we never need to clear out a huge PMD through this > + * calling path and a memcache is not required. > */ > - stage2_set_pte(&kvm->arch.mmu, NULL, gpa, pte, 0); > + kvm_pgtable_stage2_map(kvm->arch.mmu.pgt, gpa, PAGE_SIZE, > + __pfn_to_phys(*pfn), KVM_PGTABLE_PROT_R, NULL); > return 0; > } > > - > int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) > { > unsigned long end = hva + PAGE_SIZE; > kvm_pfn_t pfn = pte_pfn(pte); > - pte_t stage2_pte; > > - if (!kvm->arch.mmu.pgd) > + if (!kvm->arch.mmu.pgt) > return 0; > > trace_kvm_set_spte_hva(hva); > @@ -1942,9 +1941,7 @@ int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) > * just like a translation fault and clean the cache to the PoC. > */ > clean_dcache_guest_page(pfn, PAGE_SIZE); > - stage2_pte = kvm_pfn_pte(pfn, PAGE_S2); > - handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &stage2_pte); > - > + handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &pfn); > return 0; > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel