Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp792252rdg; Thu, 10 Aug 2023 22:40:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1JI0SR7+jO0DKKne2UWCh5HBYlH5LzkqJhHdFxv5AeiiFtP5yEDSHxUL8r4JfmoRKGmv8 X-Received: by 2002:a17:902:a407:b0:1bd:ae7f:3671 with SMTP id p7-20020a170902a40700b001bdae7f3671mr704670plq.63.1691732422113; Thu, 10 Aug 2023 22:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691732422; cv=none; d=google.com; s=arc-20160816; b=pv0kiCNa3AhHeTI3b119tt1OK43pQkn7vnt+dWFQ++My2v/76tEbHrcUlh+4gBSkW+ tGwK0S7mHQPmR4HA3Yid9jZzRm+ao6PZ2wKUlJkTHfuonl1NLVt2MHMjqrCNc9lDcUMw 4jiTTapKQJGklyD6SVn0gpbZ9Hy5UQHvuzv/KL/H2qjwQSLpeGgLUZq9inmC9yfRFqwx +1apCWQQKNmrGXargwxsydC9oVIKYZPFFc8kVTOeJu6EJWqrGHRljLH+d3ppYsRSkQIo xCe7ZE9qG8f/lxlJI7+CRvff4/wJd2sjTyYDCoM3NTzyPzwTSND6rvsYmwEEQtH82sTK J/Ug== 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=oLpltBl1pXuOSkpdQMGZFCQJKBJp7Al35vzbWbo573Q=; fh=yw5tXiXa6fgZNcqMuRzw9eeT6vziy3WnhZBwRz1vFio=; b=JLls+e2Mkv2DqUHhi8TpS0HYdnYi0fpsrC9jw7ERVBjfE3Ne6pyUmT3X96brvhHZ7Z PsloYKV6u6qNZLph2577bskc1DvqdmJeOZJLWWlaITwCVlPsvJ29eqB92d8YXPSOZlCc bzpiC2slFYZRSJlpPCDzOKp5rB2nIBOsGT0Kcen7ftNffsR65/oOZJqgfVVHeBEafHpW tc7XYdb78ZFrBcuEfN65fuMkA9jmy4pkKTHyQ4D6GefgKUVKLtgYvODDgy8XbE4RittB PsttwWj+urZprJajHYBRfzfb+GLrC8NncQa+ABYGUsIHymN+K97i3aijEOQJxnodxW82 GN7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=ABgFIwVo; 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 n4-20020a170902d2c400b001b8ae9058d3si2869570plc.516.2023.08.10.22.40.10; Thu, 10 Aug 2023 22:40:22 -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=ABgFIwVo; 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 S231233AbjHKEwf (ORCPT + 99 others); Fri, 11 Aug 2023 00:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233662AbjHKEwF (ORCPT ); Fri, 11 Aug 2023 00:52:05 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E979830C8 for ; Thu, 10 Aug 2023 21:51:47 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-58667d06607so19956497b3.1 for ; Thu, 10 Aug 2023 21:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691729507; x=1692334307; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oLpltBl1pXuOSkpdQMGZFCQJKBJp7Al35vzbWbo573Q=; b=ABgFIwVolq/6ag26A1K+kK7FXdPo3peqsgbFXc8qiwvbhPI3bZRUdLezxZ8tQik92l T+iaoKDZaDOv6IfoUeiWPTwxhMI85ie6LyPMFxNj8XDmursgFf3en60dEzF4dqf3h+RK WWx7VeXuvcWe37vd84r2WsEbYnf4b0bMiMo48syBpgvZj3Mksg0RwjMn5w1l5qhHm9a0 rzrR9Pv0NaqoQijOdbcWJVVU6XHeWI2Lcm9tCQY3XKwKjOaLQmbXEehuzJJrIwVg3DQc UD1yUHkb20HLZXzkBKX91nLMJ4OeAFKhFEZgnnRUJwp6sPgDeXUVCPtkFFCTN0I7E6Kc DCjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691729507; x=1692334307; 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=oLpltBl1pXuOSkpdQMGZFCQJKBJp7Al35vzbWbo573Q=; b=d9amCJXGSuyVRHY1FYeq6H2u1vkbiHV0e1AAQUop5sS0LpBzX/I3ADcQ5IewzuTHyX YbraoCoIe3zRFatJwYmnX4FNp7N6uA0jcVd0Xuvr+EnpU4TJVYS57NQ9E4JHlrJAmneS Whc2K+XLka6V+7pKPdDIa4ghKqWIZXvzQkgwxcVVDcWq9LDmZNfOQV4OZu86ovxU8f/y oGUEk6v9jU9XgUcLYrT24qSCOK49o81ULmuhC9MH7NvBs0Vm0k0rYFPCkivgIPak9uB/ mVzSY2Xxxhx6U5LSdTMcDO8x/UrBfOr9vTM2jJ7ZQXQn1Hd3rWfB/N0/Oaxs9dtqr9ZO nzzw== X-Gm-Message-State: AOJu0YyMNM75BEcL2on9Erb0pWvurLdOmvY5E0UXZ/YLpzzcXWCyg1U2 eg5v/0OxlHIPF00wWqqHXiWtWUyICAN2 X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a81:ad51:0:b0:583:a8dc:1165 with SMTP id l17-20020a81ad51000000b00583a8dc1165mr13228ywk.10.1691729507118; Thu, 10 Aug 2023 21:51:47 -0700 (PDT) Date: Fri, 11 Aug 2023 04:51:24 +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-12-rananta@google.com> Subject: [PATCH v9 11/14] 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 , 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, Gavin Shan , 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=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 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 Reviewed-by: Shaoqin Huang --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/mmu.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 20f2ba149c70c..8f2d99eaab036 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1113,6 +1113,8 @@ struct kvm *kvm_arch_alloc_vm(void); #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE + 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 0ac721fa27f18..702f8715f9fe7 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -172,6 +172,14 @@ int kvm_arch_flush_remote_tlbs(struct kvm *kvm) return 0; } +int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm, + gfn_t gfn, u64 nr_pages) +{ + kvm_tlb_flush_vmid_range(&kvm->arch.mmu, + gfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); + return 0; +} + static bool kvm_is_device_pfn(unsigned long pfn) { return !pfn_is_map_memory(pfn); -- 2.41.0.640.ga95def55d0-goog