Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp814225rdg; Thu, 10 Aug 2023 23:50:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgyz1USS6AHnO5V0julN9wf1tM3r9Q/b55ohS/7wbTE9963B36Xpu1Q+bnAY7iYCp1pP1L X-Received: by 2002:a19:6547:0:b0:4f8:6abe:5249 with SMTP id c7-20020a196547000000b004f86abe5249mr680708lfj.3.1691736627446; Thu, 10 Aug 2023 23:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691736627; cv=none; d=google.com; s=arc-20160816; b=UoZci0obpNax4hA3aJ9wUErTHXPD9hR71h2CwcqS86dWqhpVPMz/CNOKq2BceyBDK5 NBPHNQRE+f1Z2S8V4d7potFWpD8sNQPvG91KNOvKBW5IYzBYVefvNEJSXu/cWNGetJ2Z WoZQFQ7p1xqvXbaJW7nDtY1OfR1kOzD+iHMCjLtEpHvALcdV6KjJQuSSXCFjqxJv++ys BPG4KKqW0/Qxc+TfmZ0/PlHEzndj9aVp7Q5KqfLCzKlxJpZL1SZIdVM0nTvRmuLxnweB Ilsm88zFhaiGrknJfxVZHknbX05nONiTurbZzMsj2zhp0piN7kSA+bmeb9dYXBjkGaAL E2UA== 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=ASzbcsqwIIPxgx+XyAMT2G1wf8WK9Z2hf5Cip/a2faA=; fh=IwM2bGvNcx4AOiRggi2QL247Tc8sje27XNWCS4A7kXU=; b=Mf03X2H47IKeFGV68J3jLsNL3xQyVZtB/bpeI4KH3xmdV9D1RY0QP6McaGq2kOtZ8j S+DBLSlSez+tSIksZhwO0nbq61dd2VEaMBfw5ZAW9ddPBPVuVvY+WjZsdLj4omuOHqxq f9SW9xszNOGTp/tOjz+zdZyWk0F+msHSJutkbz0UutSrbRmIKQwq+Sc94SbydvoFiSNW psJZ2sZHOf6l2tymAi91hUYOyUb3ERY7UcOYKSVU32WvaoGQQ5aOxKk/2+fd4W7XL0WN lmZ0KTjmADqD1TsgcwXGSo9qxF9wf7OVTCE6mVxHOi4Xni5WgOueCRa/nfiiAmG7JNj1 fcKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=uAabUmiZ; 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 m23-20020aa7c2d7000000b00523713420c4si2857393edp.328.2023.08.10.23.50.02; Thu, 10 Aug 2023 23:50: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=uAabUmiZ; 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 S233592AbjHKEvz (ORCPT + 99 others); Fri, 11 Aug 2023 00:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233159AbjHKEvm (ORCPT ); Fri, 11 Aug 2023 00:51:42 -0400 Received: from mail-ot1-x349.google.com (mail-ot1-x349.google.com [IPv6:2607:f8b0:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0AFD2D62 for ; Thu, 10 Aug 2023 21:51:39 -0700 (PDT) Received: by mail-ot1-x349.google.com with SMTP id 46e09a7af769-6bc59b0fff5so1708825a34.0 for ; Thu, 10 Aug 2023 21:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691729498; x=1692334298; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ASzbcsqwIIPxgx+XyAMT2G1wf8WK9Z2hf5Cip/a2faA=; b=uAabUmiZLe4MoUbS9wWG4jcqfN0u7QlPThTWrmHmQHgIqkO2BufLaqzmmlZnIyCOO+ T/L4kbkpAFt+ZBdM8kowjgzj6ukuum0CjGTGLYU3iRP5tAAb3o0Ntc7xlF3UR3cHB4tn DeUzU/obpskCQQfPFVk0wKOJHfy6VGzilCBOqGZ4AzgEZ8gbc7vfKZNsMiDf+Mnw4tyT 6nipzycm7kXiOKYibxHOYUWZ2mkVxSRxc5NUa35+yCEee1ubON6GL22QYtP7OtxRf/u6 JsUs87W8hFKFBeYOzN3POKlGxAmYSwY+LebXiY8Q3ZfGJNrmkf5yu6H0xJ2oAOGtMDcq RlQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691729498; x=1692334298; 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=ASzbcsqwIIPxgx+XyAMT2G1wf8WK9Z2hf5Cip/a2faA=; b=Y7kd53s+XF5ZgLFMbuPGpwh/A7/f7cncmswQVnt05utQ/bvAU3w1MAWYxuvzVTVM2c VvOh6SaoN0el2KyJF8qv351aHJzZ7zkEdliK3BaTr6BD4r7/x8j6bChSjRc2UFTNFKY9 I08MIvJqAyTe7ALatWu+HdWHiD4Eh3b0tqFu49D/FNxFZxyTIpzAOSKLkrmYbdjbCkW6 D01QXGwk0JygmWLy+PWssAGo45Fr9NbBNb3GDISz6eQTGMb/63YSXRqB/hyoazwnRpF2 ly1V41JJxVljxZDQu3r/OWBHeV7DIwgEXc0J1Gh43dIedouz/nKYR/JNsURwC+Gl4aE6 a/OQ== X-Gm-Message-State: AOJu0Ywq52oEcwfgwW7ypGQ6VxD430IwEMs3TA3cfpdnE7SFCGM2/s2V TLsh26yZMaTgcqF8wsfGw8LrvdtxFYXX X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a05:6870:a8a8:b0:1bf:d3b8:5cae with SMTP id eb40-20020a056870a8a800b001bfd3b85caemr12117oab.10.1691729498753; Thu, 10 Aug 2023 21:51:38 -0700 (PDT) Date: Fri, 11 Aug 2023 04:51:16 +0000 In-Reply-To: <20230811045127.3308641-1-rananta@google.com> Mime-Version: 1.0 References: <20230811045127.3308641-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog Message-ID: <20230811045127.3308641-4-rananta@google.com> Subject: [PATCH v9 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 , Gavin Shan 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_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 Reviewed-by: Gavin Shan --- 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