From patchwork Fri Jun 2 16:09:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Sharma X-Patchwork-Id: 13265690 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 B7B76C7EE29 for ; Fri, 2 Jun 2023 16:41:44 +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:Message-ID: References:Mime-Version: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=l7IwDpH8nEqHIF2f/BTSxiZf3Pf5svoRO/5CKC/Cl00=; b=RyObwJ0pRayVnMwbgX5XG6+wOz rCj9Vp14rGElAQ0gnW9B9xiwKyxCYH8Ra2pKNAanB63jUC8QDIA7Rj1brgeN2Ho1HbMcw3RkV7QvF pWvtmfro/8dpxv+kUgaixnSjlFU3maNlu6xUtTouHV+YSPXXrSVEqaFVc4mSyE2bNZPEeUUrjoJN9 YBzcWU0PgQJCSKdDNSh0aKcjZEUpnbheNsLVN1V6NX5SGboq3ICMw+w9KJk2pjzTUBqmtKRZ4MS/9 QfSNW3Cf3dOW9CA9UK5svgRY6/mUoUgPhIzGEbvqitdP5DZjdInPCsK5J4vdPuIgg+YrHpBg/bXBQ il01s7Ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q57q4-007R4z-2n; Fri, 02 Jun 2023 16:41:20 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q57q4-007R4M-0q for linux-arm-kernel@bombadil.infradead.org; Fri, 02 Jun 2023 16:41:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Cc:To:From:Subject: Message-ID:References:Mime-Version:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NyrihgmYesBmBKLp4ITVdJ3LGNh6LVDPlJHbJ3BWmKo=; b=VwXFF2oBvMh1txyZtgY8+XKuxA W717UCwypD+YexGfNk6wvYuZS8QHj25WIFYcmo7GqVMIaTvigqxLWCIUJJog02JGbseMst0BAmQem Y2Zn5PInhYfEl12gxPZlw9gIhj2wTrvXxVkyugb/1/EbGiAmadt8VMiTpU/ovzGbyIDNvLIyXRXW2 ncQNmuF07S1jEEQpjoNhtqKC1EDPQjLdx6qv6GPpheS1WF1Y2BWxd+x4AmmAQftQVDK1kFC1oiv9v awCNaGHYGi2qNqAKJpzEFLHheeLNd25knK8i1uY0AS3n+rzopmn5vjVsP98CuMFjllyyzMk9P4z9B wNQiqoOw==; Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q57LP-001N9V-2K for linux-arm-kernel@lists.infradead.org; Fri, 02 Jun 2023 16:09:43 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-565a1788f3fso33704157b3.0 for ; Fri, 02 Jun 2023 09:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685722178; x=1688314178; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NyrihgmYesBmBKLp4ITVdJ3LGNh6LVDPlJHbJ3BWmKo=; b=6JvB68luEiFeoyKEfjP/g+vMwC/sRddTQaYllS5g+5bpQDmhXIgwwZiHHiYhNY6/hh +N3LQSiNtnyna/XZaiM18ivCXXQ4yuX/15A1AGZwy0Qa/f1hIAf3oKXB2h5AuHkYQgCs xj8Y82H0f8TZvkTqQ0Hx5MWBndbNiI7NCzZ3czEuYGWHs7LAUCirzskxbkVOl+noMZFx tm27fSCTKAwfbeEstcfEbI/nW6D9qAihf0lb2MdszgnmyhfNayDhGNG1boLJ+W+UNY9A PKxN0bCcFoMuNsJAFUnK+mzP9snrdOrZPjuzoVjhjXEuIkdNPWm6zU7rdhcbdNuxMxHK DaOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685722178; x=1688314178; 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=NyrihgmYesBmBKLp4ITVdJ3LGNh6LVDPlJHbJ3BWmKo=; b=Nwu+yAnvoe6v/F+rh0JbQW/cRVKZgXTCAmf7kq2L765ONT6f/9zOzdzsOo1ob9OXWc cDmhANsAv0q4wGAb+MufCO8mPExt3uJogoDdh+P2t8eu6+byj0N5TbUeDlmXXbpmMRR7 oOHMzzedfx6YsAyhla93ZteATyq/WF7Wb5QuY5z32GdRHSxFd+Mt7KDQq4JCljx3myk5 KGNzRHngnEyvC2OXQGBwMXhcPszIDsF7zlOybHObD2QlaIFwR/ZLzI0wNYZN7RV2qvx1 o7JyD178gJVZvsWDbrGRFwKEKFDes9WON2cFDNA3dVC4eAVhmqQOVvbusehqjozezfgQ 32/Q== X-Gm-Message-State: AC+VfDwZAFyKU6BAdXHr75lOYnXO470eIfat5sqAcVKFkVqASxpKy30R OHgLA6Prv56dbtAieaDLGo3JhHSzGX9A X-Google-Smtp-Source: ACHHUZ7z74Jy0Y96qFW+7u40ZiTgX4ucCC/5bWAvnbf5ZGF1cU7Xjv0z02cQ2QpbWgJAAII5qTnOdyVeR9zk X-Received: from vipin.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:479f]) (user=vipinsh job=sendgmr) by 2002:a81:b620:0:b0:561:b8d1:743b with SMTP id u32-20020a81b620000000b00561b8d1743bmr170869ywh.10.1685722178126; Fri, 02 Jun 2023 09:09:38 -0700 (PDT) Date: Fri, 2 Jun 2023 09:09:07 -0700 In-Reply-To: <20230602160914.4011728-1-vipinsh@google.com> Mime-Version: 1.0 References: <20230602160914.4011728-1-vipinsh@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230602160914.4011728-10-vipinsh@google.com> Subject: [PATCH v2 09/16] KVM: arm64: Document the page table walker actions based on the callback's return value From: Vipin Sharma To: maz@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, chenhuacai@kernel.org, aleksandar.qemu.devel@gmail.com, tsbogend@alpha.franken.de, anup@brainfault.org, atishp@atishpatra.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, seanjc@google.com, pbonzini@redhat.com, dmatlack@google.com, ricarkol@google.com Cc: 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-kselftest@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vipin Sharma X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230602_170940_083379_7933F890 X-CRM114-Status: GOOD ( 15.19 ) 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 Document what the page table walker do when walker callback function returns a value. Current documentation is not correct as negative error of -EAGAIN on a non-shared page table walker doesn't terminate the walker and continues to the next step. There might be a better place to keep this information, for now this documentation will work as a reference guide until a better way is found. Signed-off-by: Vipin Sharma --- arch/arm64/include/asm/kvm_pgtable.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h index 8ef7e8f3f054..957bc20dab00 100644 --- a/arch/arm64/include/asm/kvm_pgtable.h +++ b/arch/arm64/include/asm/kvm_pgtable.h @@ -711,8 +711,19 @@ int kvm_pgtable_stage2_split(struct kvm_pgtable *pgt, u64 addr, u64 size, * after invoking the walker callback, allowing the walker to descend into * a newly installed table. * - * Returning a negative error code from the walker callback function will - * terminate the walk immediately with the same error code. + * Depending on the return value from the walker callback function, the page + * table walk will continue or exit the walk. This is also dependent on the + * type of the walker, i.e. shared walker (vCPU fault handlers) or non-shared + * walker. + * + * Walker Type | Callback | Walker action + * -------------|------------------|-------------- + * Non-Shared | 0 | Continue + * Non-Shared | -EAGAIN | Continue + * Non-Shared | Any other | Exit + * -------------|------------------|-------------- + * Shared | 0 | Continue + * Shared | Any other | Exit * * Return: 0 on success, negative error code on failure. */