From mboxrd@z Thu Jan 1 00:00:00 1970 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 1DFFEC3DA4A for ; Fri, 16 Aug 2024 15:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3SWsEn4KHiP0TPzVz646a3O5/WlmjFDgz1IwFxCIA0Q=; b=WAtt8WuBwmdR4a0dj+fOmAbQ5w xbBxaLnEC8eWWGNOH/Wu/KCmQXmQ0mjsJhgG2UbPJAGYZWnry6jg5oeUur4xrawwkowjZknZNPji3 tAy2ByTRXcjAMkYTKaPI7nG+zQCjbd+9ekY6nqf02hxSU1kJrA9MV2e7ViC7eR7PvjMWpYCYKZNef iSyMJPsalV3UWX7CBk3vFAOES4CJY9AXVG8quHQ/gs4jqchrGX5tnTRLlb4dm78UolnXX/ZFSJfsB qe0Ul9OVLW9qa2Ylsee8rNjgeyWL74f5Ry5DNnBhOHmyKkts0+tF/qodktXQ7z4qldk6QI4LyeUK5 zQ8+kdFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyv6-0000000DORH-073l; Fri, 16 Aug 2024 15:31:16 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sexni-0000000DBsT-2Id9 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 14:19:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E7AB3CE1FE3; Fri, 16 Aug 2024 14:19:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A247C32782; Fri, 16 Aug 2024 14:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723817972; bh=m91wiXNoBr6hhHKIFDdh37bRQg05EDSHZsMVwPiqzCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KB0pqGezWVzR8/+nqWelgCQXCSCJfB2kp04qOp4E5wuGnke2YJJ+hpSVGpfDzp7aj Z0Ndf7jAJ8qcL+LAQrg5BtQ6XFRs1Jv9rYbrigX/28d1ekXMYA9HE8+SFqui5L8VOT MrRnBrn0gRMYrWF1PhdPBXyFrHY8o1SwocKnOjyJFO0UPUhl4pYzILkIlzMEhhj+f0 sqexNlaqem4nkOLkBZv6B8wUCys1QgQcER10PJhDupl/aOl3b6QDSkmnCavuJZVvAg TPRU176FF7Zix9eaPYWyuJvFPZwQ5WgbQ3Z09YVxXXYhALD38EFVIoo+P6wu96/7a0 JGE8z7tRYJJsA== Date: Fri, 16 Aug 2024 15:19:26 +0100 From: Will Deacon To: Nicolin Chen Cc: robin.murphy@arm.com, joro@8bytes.org, jgg@nvidia.com, thierry.reding@gmail.com, vdumpa@nvidia.com, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH v11 8/9] iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV Message-ID: <20240816141926.GA24676@willie-the-truck> References: <849c17b97ae0a38db1cee949db2488e4045666df.1722993435.git.nicolinc@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <849c17b97ae0a38db1cee949db2488e4045666df.1722993435.git.nicolinc@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_071934_960134_380FE35D X-CRM114-Status: GOOD ( 28.50 ) 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 On Tue, Aug 06, 2024 at 07:11:53PM -0700, Nicolin Chen wrote: > From: Nate Watterson > > NVIDIA's Tegra241 Soc has a CMDQ-Virtualization (CMDQV) hardware, extending > the standard ARM SMMU v3 IP to support multiple VCMDQs with virtualization > capabilities. In terms of command queue, they are very like a standard SMMU > CMDQ (or ECMDQs), but only support CS_NONE in the CS field of CMD_SYNC. > > Add a new tegra241-cmdqv driver, and insert its structure pointer into the > existing arm_smmu_device, and then add related function calls in the SMMUv3 > driver to interact with the CMDQV driver. > > In the CMDQV driver, add a minimal part for the in-kernel support: reserve > VINTF0 for in-kernel use, and assign some of the VCMDQs to the VINTF0, and > select one VCMDQ based on the current CPU ID to execute supported commands. > This multi-queue design for in-kernel use gives some limited improvements: > up to 20% reduction of invalidation time was measured by a multi-threaded > DMA unmap benchmark, compared to a single queue. > > The other part of the CMDQV driver will be user-space support that gives a > hypervisor running on the host OS to talk to the driver for virtualization > use cases, allowing VMs to use VCMDQs without trappings, i.e. no VM Exits. > This is designed based on IOMMUFD, and its RFC series is also under review. > It will provide a guest OS a bigger improvement: 70% to 90% reductions of > TLB invalidation time were measured by DMA unmap tests running in a guest, > compared to nested SMMU CMDQ (with trappings). > > As the initial version, the CMDQV driver only supports ACPI configurations. > > Signed-off-by: Nate Watterson > Reviewed-by: Jason Gunthorpe > Co-developed-by: Nicolin Chen > Signed-off-by: Nicolin Chen > --- > MAINTAINERS | 1 + > drivers/iommu/Kconfig | 11 + > drivers/iommu/arm/arm-smmu-v3/Makefile | 1 + > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 9 + > .../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 868 ++++++++++++++++++ > 5 files changed, 890 insertions(+) > create mode 100644 drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c [...] > +struct arm_smmu_device * > +tegra241_cmdqv_acpi_dsdt_probe(struct arm_smmu_device *smmu, > + struct acpi_iort_node *node) > +{ > + struct resource *res; > + int irq; > + > + /* Keep the pointer smmu intact if !res */ > + res = tegra241_cmdqv_find_acpi_resource(smmu, node, &irq); > + if (!res) > + return smmu; Given that this probing code will end up running on non-tegra hardware when CONFIG_TEGRA241_CMDQV is enabled, please can you move the common part into the main driver? Will