From patchwork Fri Apr 15 21:58:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12815446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91E41C433F5 for ; Fri, 15 Apr 2022 22:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9OqTIowHW1OTnuKQQfDu3dhCzfA+AyAxYpRGqdMW6U4=; b=vbZKz2k04RLsVj9Y2g02AdRe45 THYt4UYC/1Qg+QIvQAbLHVKcQgwvpELmrhHk2rr4KWfflEGlbqsXx8wMwzmAaZzB4aO19p0id3guY 2mgb5GoVoRz2nSnplbJaLpt4FC9elqe9cVtr8ImT51UH4PHqKuevNG7a5Fe8SnCt03mdFtiTOYxUK Im020fsyzmFvOYA3VBpU4YGcypG5tIUOGN+nXu3/pt8fL0EzHioliEg0cxpy5dCEVwGUZ8IQz0vOG P3yLAPPE2yz66P7kzGm72y55nMNwoAnxDDpgbzMfqCWKKvX/vjC6xyQbwJFBy0CFN7tFTEVEh/9JW VBTZyKtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfTyn-00BSLS-BN; Fri, 15 Apr 2022 21:59:49 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfTyE-00BS04-0r for linux-arm-kernel@lists.infradead.org; Fri, 15 Apr 2022 21:59:15 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-2ebebe9f982so74996837b3.17 for ; Fri, 15 Apr 2022 14:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=rJSIRdYzlgGDLU7B2Sk5nACgnVsuidWq4rds0LFJzOM=; b=SkrQ1f8DZ8O/NnR7vbyJvJQIHE/etfmq3uFO690m3CAYnbo6y2Ixqb7gAvpAOTVELL 6wOSAg7n/y+F6WeMp05hmHl1fcyiWC8VoNMxEO4OeOYzRlFDvzzQ7jFGCTtm845QHSoG LccB7cLdd71eA0BI0Ru81TgjWmc8dS30Ot2pDg0Hy1uI1b5zb05v+/GrUfnWCauhOnPJ NySizl2te/E7Y0lMCQzjXVzUzPthbWsjhBBncJtixhl5pRXhKQ3taAldhzHbsTSuXMOE rm5tR4TfdW/tfw/Uf8GxBSY3l4Dd0OpWCNbMfnbvgCpEtN0cME8Q2ExGtfE12VB6U/GX +VFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=rJSIRdYzlgGDLU7B2Sk5nACgnVsuidWq4rds0LFJzOM=; b=Yf7TbSNRLwh8e/lJa0DqoHeL8k1Z/jSB6Dm4ASK41Fsl2EKy3WBc3q1m4jhR2H3jNH cagYjiQ54ikYqLQrWeOzb1g43iV+a8lmDsPleFSUm59JJ9gJJBH/paV6Kosenwfd9HP6 UQSaNnREWTgcbRZupqbzBk/htiT1napjK4QbBDuwfqPg5o6+wsSEnnvjHh9lOqN9gOIa SHbznaIHJ2Suqd1yvj3CLq7657+QCO2q7YPkxPtfZhBvmuIj+AqXM9SOD0I724fm16LA ssSkYl0+w76uZ3EwGBHbc+M6E/oFGpj0VEEiXj59SWzSvCN0b6ztr9qAktVMRub6WjtN jU7A== X-Gm-Message-State: AOAM530iTnLkR7tafTmhtJsh3RGnja+RgoL7RJ/6O7Z2Jro01bQr8mOu 2/f4q/4CwFGCTiX/nTuMXoottk+l3Hc= X-Google-Smtp-Source: ABdhPJwz4sx5L43ob0Z3jNzyJVyA2Jzsl+sCY5ofO1Xxk9cu0zlH1igqV35RpwEAUlFfB8+y4wm6MGToMi4= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a25:6f55:0:b0:63e:7447:7c19 with SMTP id k82-20020a256f55000000b0063e74477c19mr1036666ybc.551.1650059951469; Fri, 15 Apr 2022 14:59:11 -0700 (PDT) Date: Fri, 15 Apr 2022 21:58:47 +0000 In-Reply-To: <20220415215901.1737897-1-oupton@google.com> Message-Id: <20220415215901.1737897-4-oupton@google.com> Mime-Version: 1.0 References: <20220415215901.1737897-1-oupton@google.com> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [RFC PATCH 03/17] KVM: arm64: Return the next table from map callbacks From: Oliver Upton To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Reiji Watanabe , Paolo Bonzini , Sean Christopherson , Ben Gardon , David Matlack , Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220415_145914_127740_2FBBFC5C X-CRM114-Status: GOOD ( 11.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The stage-2 and hyp stage-1 map walkers install new page tables during their traversal. In order to support parallel table walks, make callers return the next table to traverse. Signed-off-by: Oliver Upton --- arch/arm64/kvm/hyp/pgtable.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index ad911cd44425..5b64fbca8a93 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -205,13 +205,12 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data, if (!table && (flags & KVM_PGTABLE_WALK_LEAF)) { ret = kvm_pgtable_visitor_cb(data, addr, level, ptep, &pte, KVM_PGTABLE_WALK_LEAF); - pte = *ptep; - table = kvm_pte_table(pte, level); } if (ret) goto out; + table = kvm_pte_table(pte, level); if (!table) { data->addr = ALIGN_DOWN(data->addr, kvm_granule_size(level)); data->addr += kvm_granule_size(level); @@ -429,6 +428,7 @@ static int hyp_map_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, kvm_pte kvm_set_table_pte(ptep, childp, mm_ops); mm_ops->get_page(ptep); + *old = *ptep; return 0; } @@ -828,7 +828,7 @@ static int stage2_map_walk_leaf(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, kvm_set_table_pte(ptep, childp, mm_ops); mm_ops->get_page(ptep); - + *old = *ptep; return 0; }