Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3110092rwp; Fri, 14 Jul 2023 17:58:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHsNkFEHnPM028uIrTjjFFaKaC/JnsCDA6jD7C5NshuqP2bKAATOnMl0MHtUPgWLyVa3shN X-Received: by 2002:a17:906:7a4c:b0:993:d90e:3102 with SMTP id i12-20020a1709067a4c00b00993d90e3102mr604786ejo.6.1689382703093; Fri, 14 Jul 2023 17:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689382703; cv=none; d=google.com; s=arc-20160816; b=kTzp23nbK9mzW62xkejNkfrTZnCosTtIk+hqk++evwkrk2fBZsb+77ZltKtyiyFWin mVf/su+TTZJRvKEkN4oSbLNH/G/rTXr8pr1BJ5N0sOQgsIeXTv/kw0tmzkSgOI+yoOPF Up6jXiOznICehdasiNNyjOfm7AN3T05jHr2HyvdBoNt2aejYd6wZQvHP2RAoUW5Y4iM0 kxaR9kdbvO2Au4+nPzgPbm5aaByChbmxXhmgpt3d6jwZX0N6Heg1niBZ8NrySfmDzjqT vySquT4+KXfthAUrSSSoioMP8smgexPhV1xfx4Fdwwlvxpy/GT2Sg1HzmzTByBY8uNBV J90w== 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=E8/SKuTbF1S2hgzgftCz+xbv+GwRa24E0ShAGUklW+4=; fh=0mgYt7awHARBqooV7+boW/ys14vuECt03vTY4pGVtiM=; b=S8S0SuFDmnpgOLtavSrW6w9UCcx3II0qctUVIpGt34jSy0A6sSbGNt7Ed7w3QI2dMb UEv4BX6yOalD64ZOJ9lvrcMcpUtwIpmbKzDPS34QHM79DEGFztG0sVCCCAIzBTI/5F4e q9j9B7cbLHyYRrwc7GqTj7MMYWic6cShxA3MSgGzLx993JqmHT7Sv8/1D0y2C8Xvdo4R kRM7xh9n338+fAu1dMOJWRguR0EPVT2/wdcIqHenNAiz2iVB9W6eKvUJqPxldR4jXC2V oxG+zmkXeWdrnMmgfv1wH87ssHUtvo0fvAghJPw8uRYoGgIu7xf0owuC0IRZL3oxwfIg rIdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="hrja88/7"; 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 a23-20020a17090640d700b00988e89079fesi9381890ejk.167.2023.07.14.17.57.59; Fri, 14 Jul 2023 17:58:23 -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="hrja88/7"; 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 S230443AbjGOAyj (ORCPT + 99 others); Fri, 14 Jul 2023 20:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbjGOAyV (ORCPT ); Fri, 14 Jul 2023 20:54:21 -0400 Received: from mail-oo1-xc49.google.com (mail-oo1-xc49.google.com [IPv6:2607:f8b0:4864:20::c49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C493AA8 for ; Fri, 14 Jul 2023 17:54:19 -0700 (PDT) Received: by mail-oo1-xc49.google.com with SMTP id 006d021491bc7-565b98a478dso3345583eaf.0 for ; Fri, 14 Jul 2023 17:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689382459; x=1689987259; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=E8/SKuTbF1S2hgzgftCz+xbv+GwRa24E0ShAGUklW+4=; b=hrja88/7wxXiKsBqU4+BG+pM3MGM1S9DOyuubBS6zRCvIJ5eqNbAcqAnTdgYLBUU+G Xw+Q5KoogRXe6+j6MLR2KwqS39EPOItOND2hac4t/iid35aWJyaibOjPEAQmdMwYmjfh VzbdHI6TI0GOlWQpr7ND4xoMQoOV3vp6+LinZ0mxaFOfj8s73O11srFhZJK0pIAlsFoL P4nRJGXix8N2JZo0MJURuNa3SeLrZLgRbyyEKe5e1sT6jjEyyH20skLSiG1kT2BH+lWW M2jwktjB/uvksSymt5eF0yyQ/JrIKi5z5nYd8WpKGE+ItYKnNyJygjYrNRNPHTh4T2bz A4rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689382459; x=1689987259; 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=E8/SKuTbF1S2hgzgftCz+xbv+GwRa24E0ShAGUklW+4=; b=WoZITNj+8oAFM3q99rr7KjleKVQRc+S60SY7RgXbbJg4FzOTfFZ5iaOi4AdWrlhzNF GKcQa1IlDdPu7j/09I3Bs7OyOiE+jbpUNfPiPEbKeIL92gfbjgJfJTJjQMxAnQZJtNwq gTR1gwE3uSaehhJnKHfDtO2Rm4WbHtDvPxmBjHKfI2VGLX/JDw5tmk+QpKyJaA+kskC3 hBUdCpSONoe8FvsDq3oMlx0Dw0VAUscVlWOxuzOyyxerlnY9WcMo4I/aJ1UyshUKAv7E Mrc6zgTHKTAHBYURoa5XpqzipJaY8SRl7/8t7+12kSYFIvNKVekHvQ1WEzU845S8k7l5 dVjw== X-Gm-Message-State: ABy/qLYtLT+RyBBuKnGOt1iLLlQP6RYaq86K6vuiAFv9p6a0tE40MHNM pgrPdY7/YZk2KQfh0guhSqT1suqKWs/S X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a4a:5213:0:b0:55e:38ef:109b with SMTP id d19-20020a4a5213000000b0055e38ef109bmr445620oob.1.1689382459192; Fri, 14 Jul 2023 17:54:19 -0700 (PDT) Date: Sat, 15 Jul 2023 00:54:02 +0000 In-Reply-To: <20230715005405.3689586-1-rananta@google.com> Mime-Version: 1.0 References: <20230715005405.3689586-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog Message-ID: <20230715005405.3689586-9-rananta@google.com> Subject: [PATCH v6 08/11] KVM: arm64: Implement kvm_arch_flush_remote_tlbs_range() 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 , Colton Lewis , Raghavendra Rao Anata , David Matlack , 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, 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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 Implement kvm_arch_flush_remote_tlbs_range() for arm64 to invalidate the given range in the TLB. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Gavin Shan --- arch/arm64/include/asm/kvm_host.h | 3 +++ arch/arm64/kvm/mmu.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 7281222f24ef..52d3ed918893 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1114,6 +1114,9 @@ struct kvm *kvm_arch_alloc_vm(void); #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS int kvm_arch_flush_remote_tlbs(struct kvm *kvm); +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages); + static inline bool kvm_vm_is_protected(struct kvm *kvm) { return false; diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 0ac721fa27f1..387f2215fde7 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -172,6 +172,13 @@ int kvm_arch_flush_remote_tlbs(struct kvm *kvm) return 0; } +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, gfn_t start_gfn, u64 pages) +{ + kvm_tlb_flush_vmid_range(&kvm->arch.mmu, + start_gfn << PAGE_SHIFT, pages << PAGE_SHIFT); + return 0; +} + static bool kvm_is_device_pfn(unsigned long pfn) { return !pfn_is_map_memory(pfn); -- 2.41.0.455.g037347b96a-goog