From patchwork Thu Aug 3 10:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13339651 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 58F8AC001DF for ; Thu, 3 Aug 2023 10:14:36 +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: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=2isrpl6HuFTfhH1/3eaUfCp5vZyBkTAFcasiT4ACxRo=; b=S79 rFR9DrtIxlV7Qe0ZHEGnwjP36M87mFv6EpjR8r+s7DxW4p/HBvXixX0PqS5mYmXgQPn5FCRPx5ki0 RUBlvA3JOAeekY288r/DhYBWGE+R1K41dk1cgKFawLaJQIVtMxuVLVuBAj2qlWT9xIhqjvu3Acltx M9DjQpTAgafef+ddcO5GyqwYXeldf7lm/qh5h7Iu7iNHAV8DfT1Kj8HlfdBGIqKD+BMcSBdQNAML7 ZmS4/Pfo3i9htlSWKH12x1KIPJlscswn8ZIlmW5CMN6aNqPxIMfAz2sxoDe6so1zH/WJx3TFkZwa/ sJbCZqt+K4lGzFmcVXCw61pCWK2qMcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRVLO-007Jb2-0J; Thu, 03 Aug 2023 10:14:10 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRVLK-007JYw-2U for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 10:14:08 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-583b256faf5so13559857b3.1 for ; Thu, 03 Aug 2023 03:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691057643; x=1691662443; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=fVgHMX1sr8AcQcx105vokEVgUIzKx0M+De6kyi4f2qE=; b=niZqGqYtr3p2xGfUmasZnjAPX/OeMRTw6aza5d9thhbKzKRn5xtIhhPsfN98IeD9AQ nq/pYNbt3XnGZLQGfnzlqvb/SxjxaCHe6Q93XBBw8LXkdlk14twmjVxXS/Kw90l9VWmj 2lu7pMOhy+G9hJ85UuI1rG7VSwMJoYvZneZteBMhnFpfanEtugrvn1/fKGg2bgKzSKPJ VqE34s3jgXyaBxy5t0Nr+P/tqiYGaweLEcYLOL4ntzOiCRyh8LEtLhZkKkXiWkhzPdYx TRvssOHwpMK9bdLyPX2Y0Kg1bXpeVimpwCEzgCBbGobM6a2bebWJT+H6m/oHzjl7K2LJ tquA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691057643; x=1691662443; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fVgHMX1sr8AcQcx105vokEVgUIzKx0M+De6kyi4f2qE=; b=TLMt4aGg0q4vZtvF5uLhZweE3NzPNDBTnDjUU200gpQOZm26+m29ppPBS00/jhrT0q U1g1HRHtxhlakZccGgiXEv9bmoTYkrR90E8/W/fP/UWmAV/rbwx1rNJIm1M0/Es4tUQ0 ZpibN0W+wZm+/Y4H3kzNxZXx51FF4+Og+XatK8ATMDU/o9KVvp7iqgRtLSNW/NWIUyWk wZggslcqDAAB3CtgVCtu374Rx5j8in91ThRVC7cqmhy+R3sLAFvss0wdUqzz+IJIX+9U dG/M8/dXFph6kK3jLDymiP0+Rzmp85JFEofUeK56hz1G1s++KVEe5MygndpU9bsWhN9Z WqdA== X-Gm-Message-State: ABy/qLZh+N0hzg3vRy+W0pM6hE8PQ6H5y4C5ZqGCnzYbl0M8evuZ6EUT ONukXOHoFiRddfNhQlrBsFwT69EEG2+f X-Google-Smtp-Source: APBJJlE7K1GSQsi/VVVhGXbw+cVlEoPlz/1jiaXcsCJSXM0lTDGJSv6Hq6VtqV5ijgB/OdXi4eqaBHyIpx8i X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:39d1:8774:b733:6210]) (user=mshavit job=sendgmr) by 2002:a81:788e:0:b0:57a:6019:62aa with SMTP id t136-20020a81788e000000b0057a601962aamr244992ywc.5.1691057642789; Thu, 03 Aug 2023 03:14:02 -0700 (PDT) Date: Thu, 3 Aug 2023 18:12:20 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230803101351.1561031-1-mshavit@google.com> Subject: [PATCH v5 0/6] Add PASID support to SMMUv3 unmanaged domains From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: baolu.lu@linux.intel.com, will@kernel.org, jgg@nvidia.com, jean-philippe@linaro.org, robin.murphy@arm.com, nicolinc@nvidia.com, Michael Shavit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_031406_836855_C3360B12 X-CRM114-Status: GOOD ( 13.48 ) 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 This patch series implements the set_dev_pasid operation for DMA and UNMANAGED iommu domains. The series depends on the CD table refactor patch series as a pre-requisite. This patch series is also available on gerrit with Jean's SMMU test engine patches cherry-picked along with an additional set of tests for this feature: https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/24770/6 Thanks, Michael Shavit Changes in v5: - Renamed domain_head to list for consistency with other lists - Renamed attached_domains to attached_ssids to avoid confusion. This is a list of master/ssid pairs the domain is attached to, not a list of other domains. - Fix missing error value return in set_dev_pasid - Fix issue where nr_attached_pasid_domains isn't updated when arm_smmu_write_ctx_desc fails - Fix missing free of the attached_domain node - Split off the CD table refactor to separate patch series: https://lore.kernel.org/all/20230802163328.2623773-1-mshavit@google.com/ - Link to v4: https://lore.kernel.org/all/20230621063825.268890-1-mshavit@google.com/ - New commit: Free attached pasid domains on release_device() call Changes in v4: - Fix build warning and error on patch 07. The error was introduced during a v1->v2 rebase and hidden by patch 09 which removed the offending line. - Link to v3: https://lore.kernel.org/all/20230614154304.2860121-1-mshavit@google.com/ Changes in v3: - Dropped the bulk of the SVA refactoring to re-work as a follow-up series. - Reworded cover letter to omit dropped changes. - Rebased on 6.4 tip - Link to v2: https://lore.kernel.org/all/20230606120854.4170244-1-mshavit@google.com/ Changes in v2: - Reworded cover letter and commits based on v1 feedback. - Split and reworked `iommu/arm-smmu-v3: Move cdtable to arm_smmu_master` - Added SVA clean-up and refactor. - A few other small bug fixes and cosmetics. - Link to v1: https://lore.kernel.org/all/20230510205054.2667898-1-mshavit@google.com/ Michael Shavit (6): iommu/arm-smmu-v3: Simplify arm_smmu_enable_ats iommu/arm-smmu-v3: Keep track of attached ssids iommu/arm-smmu-v3: Add helper for atc invalidation iommu/arm-smmu-v3: Implement set_dev_pasid iommu/arm-smmu-v3: Free pasid domains on iommu release iommu/arm-smmu-v3: Cleanup arm_smmu_domain_finalise .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 28 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 283 ++++++++++++++---- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 31 +- 3 files changed, 267 insertions(+), 75 deletions(-) base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4 prerequisite-patch-id: c8d21ff19c2c1dd18799a6b83f483add654d187e prerequisite-patch-id: bdeb88498393e7049fd22cfc24d2b7674e81bb85 prerequisite-patch-id: b84be729e187aa2d67a7f90ec396e2b878c76243 prerequisite-patch-id: 0ee7da8eaae46e2f8a0a791808f421025e148d79 prerequisite-patch-id: 2d80d99964059ecb31065ec4954130c817b9046c prerequisite-patch-id: 49910462ec68b834c6af18ae9c58de25982e2752 prerequisite-patch-id: 1daf192523b0b7ed24a670b47ad07366aca6d26d prerequisite-patch-id: 96101f0f4fd95cdb442cfe0881d80c3a61a93716