Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5002697rwb; Tue, 8 Aug 2023 18:34:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7FGte69Fwtv1jbl73Hmj4Ogtrcr8bfPsu00wCqmJBmUHjVQIrHXXzTP5rz4gVRUkxfCSg X-Received: by 2002:a17:907:75e3:b0:99b:ef8a:d64a with SMTP id jz3-20020a17090775e300b0099bef8ad64amr986401ejc.0.1691544867484; Tue, 08 Aug 2023 18:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691544867; cv=none; d=google.com; s=arc-20160816; b=xyvBJofkr0KeUG8bY/RGfg6fjiXGX8wqeQV8CP7Sxj/N5j+/bkm7vFP5An7/ccc3zn OEuVK+1bXjMoO2x0MNUTZsdtDXACZUiI1wJazbDnyfDb2di/F4JMEIz3LVzmL2JZxkIo p3NS4VwvswIUpQndCqv6hSTN4sEKI9YJ2y/Jw05IjhsK5I9Jw/+SWdvlfU7LVIHcOQSk OozI8dTR8zAccmrDl844pyl0huCeIBLTOwczGLVbdniqvakw+P5ra3UXYo/e/Qu/x0bc g86bs9LEj8atW1ZOkiTknaUdv1mwYCLYQX4oy+usmz2ro0znYyznl5ZOypMHIKcmEi5A H7dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=yofTwj8ZWcGjgw9v2JlEZNUSzmrec+LwekHHUJcpAoM=; fh=gCmhkkXOGzgKShDZ1VA8I9oX8b+8AoHFoFVURxVyzH4=; b=J1wZT47wH8Ox0x5KG071sF+We7WoE8SbxdXy7MsROId+q7F86e9WVGsn1vUPzzz0oK rr2KmdfI01RTVq1Xt5ICjOTa35kvGMv01VIy0HFfY1QKW1877RtZ2XAdZwETv9dRJkHJ mHihMZU272NZlXOrNd3n75V95e72Ad07uwgfd2yyagxhKe9b/D2xG+gTMz7KCs5oI63x sbkosNJlbe0ZFVH9xEBKhS1/jftJf+A+fKNpgvLxstgy3wrhWP1CAYCrAsiBB13HFi8p U9H4Prk0nM72mSbKVSqRlizPCDwXwMmCbywK0OsxXVGRZ30e/ICQqXAY5rXNSpL+QhHA uT7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=dpvxAljl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gf23-20020a170906e21700b0099bcc37923esi1321087ejb.690.2023.08.08.18.34.03; Tue, 08 Aug 2023 18:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=dpvxAljl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231841AbjHHXNo (ORCPT + 99 others); Tue, 8 Aug 2023 19:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbjHHXNj (ORCPT ); Tue, 8 Aug 2023 19:13:39 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B11BE1995 for ; Tue, 8 Aug 2023 16:13:38 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d60d944f40bso173599276.3 for ; Tue, 08 Aug 2023 16:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691536418; x=1692141218; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=yofTwj8ZWcGjgw9v2JlEZNUSzmrec+LwekHHUJcpAoM=; b=dpvxAljlEqRicljPQxNOJb+MByUQynWkaoJYtNkwzaTYBVofoDLxhXQ4NUQQ/PzLSf NAtCKDbb8oJ0I+3uBtvhYWPM5zzVcZGZW3pDxQOMxKp+lvQ7BjdFrNc/q/apmXEYUx/b QhVGqmoFiocVQByOfmb4QZxlbWrg6Ieus4zhxHuCqIJKlof4GWqyS/gC4YZttzjEIT/h Whg24RDAmIE9PEXxBdCoM/i4l/H27VeCyO3o8GhqYAZYL0To+EyyDC+2J360ckq2AoBz pk0d/gNWDg05ec8YE3MwSGw7fdP5YwY4vaL8VuAGMAaNIrbzBVJmLTs6Pw2oc6uWyPcm NgSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691536418; x=1692141218; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yofTwj8ZWcGjgw9v2JlEZNUSzmrec+LwekHHUJcpAoM=; b=d9uJ2LxteBTR332AMt+tN85uuZAbbtzY7dS1h16HS0V5+d2Wp10jZg3kUE45zjrXxm gN4wzpiHAx3LXKyQ+XALGtJ4dTYH/3KxhfAvmr/ULthCO6a0CBwEWlo2VirNFzW+lq3a zXRzc45wMUC89Lj+8Ky7H10C4RpRd0QL5kDRZ4HUDE4L3clqA3WQR6zV+ufO3B5x/JHo 5T5ak70bmy95p4CbA2euqnbPRdd+b5UsPVmdTM76EDuvHOc9+dQtz6b1k/M3eJYzdacW inKEHb6A1RAvCIxO3uBgq350/crWOx3/GCjmmZB7Ks9KGqIZt/QFD/XpfhAxJfb4DK81 EFvw== X-Gm-Message-State: AOJu0YwZiaSND7fZO/ERSxLRD6K/s0PkaKEuHedOH506KMT1w2UXTORz qypYyc3e5rSVRdtTXH4Pul6cXVDfUU+0 X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a25:e90b:0:b0:d35:bf85:5aa0 with SMTP id n11-20020a25e90b000000b00d35bf855aa0mr23366ybd.4.1691536418029; Tue, 08 Aug 2023 16:13:38 -0700 (PDT) Date: Tue, 8 Aug 2023 23:13:19 +0000 In-Reply-To: <20230808231330.3855936-1-rananta@google.com> Mime-Version: 1.0 References: <20230808231330.3855936-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog Message-ID: <20230808231330.3855936-4-rananta@google.com> Subject: [PATCH v8 03/14] KVM: arm64: Use kvm_arch_flush_remote_tlbs() From: Raghavendra Rao Ananta To: Oliver Upton , Marc Zyngier , James Morse , Suzuki K Poulose Cc: Paolo Bonzini , Sean Christopherson , Huacai Chen , Zenghui Yu , Anup Patel , Atish Patra , Jing Zhang , Reiji Watanabe , Colton Lewis , Raghavendra Rao Anata , David Matlack , Fuad Tabba , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Shaoqin Huang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stop depending on CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL and opt to standardize on kvm_arch_flush_remote_tlbs() since it avoids duplicating the generic TLB stats across architectures that implement their own remote TLB flush. This adds an extra function call to the ARM64 kvm_flush_remote_tlbs() path, but that is a small cost in comparison to flushing remote TLBs. In addition, instead of just incrementing remote_tlb_flush_requests stat, the generic interface would also increment the remote_tlb_flush stat. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Shaoqin Huang --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/Kconfig | 1 - arch/arm64/kvm/mmu.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 8b6096753740c..20f2ba149c70c 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1111,6 +1111,8 @@ int __init kvm_set_ipa_limit(void); #define __KVM_HAVE_ARCH_VM_ALLOC struct kvm *kvm_arch_alloc_vm(void); +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS + static inline bool kvm_vm_is_protected(struct kvm *kvm) { return false; diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index f531da6b362e9..6b730fcfee379 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -25,7 +25,6 @@ menuconfig KVM select MMU_NOTIFIER select PREEMPT_NOTIFIERS select HAVE_KVM_CPU_RELAX_INTERCEPT - select HAVE_KVM_ARCH_TLB_FLUSH_ALL select KVM_MMIO select KVM_GENERIC_DIRTYLOG_READ_PROTECT select KVM_XFER_TO_GUEST_WORK diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 6db9ef288ec38..0ac721fa27f18 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -161,15 +161,15 @@ static bool memslot_is_logging(struct kvm_memory_slot *memslot) } /** - * kvm_flush_remote_tlbs() - flush all VM TLB entries for v7/8 + * kvm_arch_flush_remote_tlbs() - flush all VM TLB entries for v7/8 * @kvm: pointer to kvm structure. * * Interface to HYP function to flush all VM TLB entries */ -void kvm_flush_remote_tlbs(struct kvm *kvm) +int kvm_arch_flush_remote_tlbs(struct kvm *kvm) { - ++kvm->stat.generic.remote_tlb_flush_requests; kvm_call_hyp(__kvm_tlb_flush_vmid, &kvm->arch.mmu); + return 0; } static bool kvm_is_device_pfn(unsigned long pfn) -- 2.41.0.640.ga95def55d0-goog