Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp912855rwr; Wed, 19 Apr 2023 15:20:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bqwHOKA3S3FFOxDwTDTAO1A+i3v9YgNqnp6agRnhAeOnFIIcu+An5C5+M1kvqV0Nvl5rjQ X-Received: by 2002:a17:902:e842:b0:1a1:cef2:acd1 with SMTP id t2-20020a170902e84200b001a1cef2acd1mr7862791plg.17.1681942817788; Wed, 19 Apr 2023 15:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681942817; cv=none; d=google.com; s=arc-20160816; b=stAGvkhXa1yTeTqzHb878Yannf/S/pjdlqoI8Xz6gfShq3Uge6z72rw0yurrOTnEoy Yc4f9JkQCTVlJ+u7CQRZltZJDRAjQLYiekW8C6Sfge+sssVSWsa/+KZE0ahcDJTXdfKb fCEMDrWR1D7RZnl0GHyLqO9qpiC206rBA4i5uK/lxIpt+8C5QDian6STGUiNVTQKQDkb ldOdGzbPX0LoADtBWt0Y2lqfBX5tVj75f5OLLSVGKAoDuIMRnBeh7EpHmYTUvzN6Q2Ur N0jVAbuwhOmCLVHep1GSr/yAh2FvFem1KTdGqxgxKxaHMqja9D08xm0TogS6mlKSGBeB 6yIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ojiAvkB2QjgGX0WuePfTk5AH+Ftof3ihRnPYCRhXfys=; b=EBhIHJBlqGAe4uuEbfyJfSVUTaAZf/pNyimz87AV0dm++9dZ+rbxRY0/ZHEbYb4tg4 OPmV3Cp5tstkbeCOpvRjIdNmNaGgeriiOpaxBoip+8A0IeOwl/6nLNs60mra7Y/VH/f9 lim67StGwUC61Wq8c6CGi5nHZjY4hYEhSOnJTwn92NOSLbfsi5SpZsP2/u0Pxb19XAmS 07A1Z2+s9431i1enHxUg48ezU+BgTTVOecp1SJNvatCnaFbqQRuR3klNVutdqmtIpSvR EEkQmcMgpqb4MMTu7PHNx9gqn3NTR0mWXglptbhPD9sCRVoLUrEZ3Lg4R9xPervJp0Xy XUwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=GI5HHNoD; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170903124e00b001a66afd1fcfsi17905422plh.651.2023.04.19.15.20.04; Wed, 19 Apr 2023 15:20:17 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=GI5HHNoD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbjDSWTQ (ORCPT + 99 others); Wed, 19 Apr 2023 18:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbjDSWSb (ORCPT ); Wed, 19 Apr 2023 18:18:31 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE5B49E7 for ; Wed, 19 Apr 2023 15:18:13 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1a66e7a52d3so4246585ad.0 for ; Wed, 19 Apr 2023 15:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681942685; x=1684534685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ojiAvkB2QjgGX0WuePfTk5AH+Ftof3ihRnPYCRhXfys=; b=GI5HHNoDfnv7Xt2dXdQVsSPXXrf8xeXQpNWlFXZorCsInUO+7v9NY0aJ61Wq3Jrs8E kGQwH76ph9khKWrUeXzvPLglMXDgMZIIY54cSF/xDKTI2B+6z40RBNIFJsJyIqLBi2Tp /4IjX7V/Nl9JV0ZKRW6w1rRtjDB7U9hS1o72B3bA9f1kQsnaasLnan0u04D8EJ66o/lT QRUjYtEUOZzmooLboK7oxd2ALtGFHtLnXQq0cGS3gCSZ9ykQyEYPx3B41T0RJmlLxBu3 0pGJgbLQ8aYagsnC8EaV+V6QeE9vVfhTJFm18qhaheSKMiu2Zw5f5PQymgLHdTXWDrLv QNiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681942685; x=1684534685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ojiAvkB2QjgGX0WuePfTk5AH+Ftof3ihRnPYCRhXfys=; b=R4UrdmVVYAoA2iRMLi0i4mDtJojoiuhjh9xkVwe0Oc2ObcdfNHZMe2LAuDdAwPwZj1 ztVIPkGRJEBZBgfhljEndcCjY+brAW7//npP5/MRuspLQQHxOLj4bOef0mP8N9GDyg3t g9omq0x36//lHJlYaBiLLnTcp+KX0gkE+Z+CpHp0H4pkUZNXNraeUZiNY+bhxWZxry35 wUq4tvcok01mS9+PxTPj/qJzNkONmqjkz/UpnDxoWTUNMgbhrHRoL2x6Lo0X5CYvSzS/ hlyDmyfpw84A7eJSplePSW6AK4mr91YoS6fKcMYUR7RI32xVX1nRv/O2a90UDDL0pbon F+Pg== X-Gm-Message-State: AAQBX9ez2sVovqNwm3LsZaOwnSpD93kccgTYFom+yu5+nxCSVG+48EJz Hytu+olkabmrJI/exJ+CxVpdi0l1rEglOJgsnbM= X-Received: by 2002:a17:903:22c1:b0:1a1:c3eb:afd with SMTP id y1-20020a17090322c100b001a1c3eb0afdmr7315223plg.65.1681942684832; Wed, 19 Apr 2023 15:18:04 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id jn11-20020a170903050b00b00196807b5189sm11619190plb.292.2023.04.19.15.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:18:04 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Andrew Morton , Anup Patel , Atish Patra , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Suzuki K Poulose , Will Deacon , Marc Zyngier , Sean Christopherson , linux-coco@lists.linux.dev, Dylan Reid , abrestic@rivosinc.com, Samuel Ortiz , Christoph Hellwig , Conor Dooley , Greg Kroah-Hartman , Guo Ren , Heiko Stuebner , Jiri Slaby , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Mayuresh Chitale , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Rajnesh Kanwal , Uladzislau Rezki Subject: [RFC 16/48] RISC-V: KVM: Skip most VCPU requests for TVMs Date: Wed, 19 Apr 2023 15:16:44 -0700 Message-Id: <20230419221716.3603068-17-atishp@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419221716.3603068-1-atishp@rivosinc.com> References: <20230419221716.3603068-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Currently, KVM manages TLB shootdown, hgatp updates and fence.i through vcpu requests. TLB shootdown for the TVMs happens in co-ordination with TSM. The fence.i & hgatp updates are directly managed by the TSM. There is no need to issue these requests directly for TVMs. Signed-off-by: Atish Patra --- arch/riscv/kvm/vcpu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index c53bf98..3b600c6 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -22,6 +22,7 @@ #include #include #include +#include const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { KVM_GENERIC_VCPU_STATS(), @@ -1078,6 +1079,15 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu) if (kvm_check_request(KVM_REQ_VCPU_RESET, vcpu)) kvm_riscv_reset_vcpu(vcpu); + if (is_cove_vcpu(vcpu)) { + /* + * KVM doesn't need to do anything special here + * as the TSM is expected track the tlb version and issue + * hfence when vcpu is scheduled again. + */ + return; + } + if (kvm_check_request(KVM_REQ_UPDATE_HGATP, vcpu)) kvm_riscv_gstage_update_hgatp(vcpu); -- 2.25.1