From patchwork Tue Sep 5 11:49:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13374442 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 9836BC83F33 for ; Tue, 5 Sep 2023 11:51:14 +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=Oo9F477KxGGqPOxpGLtEfGlMS268hlpJQIXhCSdn//M=; b=WyU vsNFRSg2HyMSB11VFgodUCWVcN+SwkD9JEzOJLfd7Ad970hmnK4pqthERlXq4FBopfG3RarFilxWQ pu4gW53AtlRY9tZinOVxRFy9Q+pGIMBqosleV/rCzYYE9SujcD1OA8Y1YoQDV6PPdhuAbi+VBTJIJ /qXOHoosvgj7zKNHkrLcqpn9IsQJqS7lixNztUgJ4fTtgAbNfd2oeLRAc9ApDWc0eU8lKYYT6xRyg ozOmqxEyNkH2igWZ+j0MZXaREmd9ks2x4GzhJ5x61IPWjpuw1kOG1mzf9TU79vkYlxUlEl2TdNe2O bOxhfvKyF7WfeuZOb74aWn53v5jNqaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qdUZy-005whY-1d; Tue, 05 Sep 2023 11:50:46 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qdUZv-005wgP-1J for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2023 11:50:44 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d745094c496so2017928276.1 for ; Tue, 05 Sep 2023 04:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1693914638; x=1694519438; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=SzB7/p5kiVgqDZadgU1A1MlN/VGpPTK51C1Zm9U7VD8=; b=bzuYUF77W4yjo/mnxHaet0QGZWLGsfgMFe2KAJSseSFDqq9bzFDba1PsbrP2HM0ha7 5d5KpQru9mk28u0eYD46LCZb/yq+dyL0aDWsJ9CwoW2dADxlHE3vLJ8XNgmtIP5bCSS+ G+WgYJzsrOyZHzP4ISY0BuXTxkGCAEJrxSWMA0RW06j2hAS/QkoEheMnmAYbV1dHGDYp HfJd27zgKr8yk9qLU2mX446PtcqQWzhBPtYBaUfft4CgZGJsiqQ7SpQcE6OAjXKA/z5d nxwzDA+GUQ7L8J0auMYFPiM9HsyxpKddZzM72lhHbFOqeOCcOPNC4h1Ub5H07keomh2i QHsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693914638; x=1694519438; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SzB7/p5kiVgqDZadgU1A1MlN/VGpPTK51C1Zm9U7VD8=; b=P5r4J7sQfkcgUjvMAyM6AotFBbQS2vgNKhTE+d11ZIDSRtSDFT1I7jH+lI8xqImbO8 vibj/29jC8Kms3+kGUn3QG9I5OvjL4lAF1DuiX5VT5YeZZ08iLi0yXYS/y84cLRPS2l3 GvQD+UBKu4kjkiBjdG6b25cNITD6AqgEQQgbaoJdcdIo+zNhB4fhO8fNw6XN96AzDVPU H9mDl0b0pW8fH2qzVHe5/PGLtA7gIxSDDQexTuMuLot893AokyTav5EanfX+VanFu06o Tas4Ei2NmA/vdFKbKfvFL9DUAmM69ivPD0Ka8ftFozrZRTj2V/gzYsLYsXpsicKetFBR Jbdg== X-Gm-Message-State: AOJu0Yxl1VMYwJoulw+3Wny+U06X5lPtXG0Fm3viDM9tUNUo9m3wl2uV ef+sEMH71zrBWArWw5MkHa1Urub+ds2E X-Google-Smtp-Source: AGHT+IHnCMAXRadb7D/VG+uuqzw6rDCLizjl0eoGPjlSpcOcMPhC2fjWoy8tcBS4IofcN1BaFhx2zvF7ED8E X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:c4a8:fdce:d8d3:7b02]) (user=mshavit job=sendgmr) by 2002:a25:2543:0:b0:d4d:8ade:4dfa with SMTP id l64-20020a252543000000b00d4d8ade4dfamr331712ybl.1.1693914638742; Tue, 05 Sep 2023 04:50:38 -0700 (PDT) Date: Tue, 5 Sep 2023 19:49:11 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230905115013.1572240-1-mshavit@google.com> Subject: [PATCH v1 0/3] Clean-up arm-smmu-v3-sva.c: remove arm_smmu_bond From: Michael Shavit To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, robin.murphy@arm.com, nicolinc@nvidia.com, jean-philippe@linaro.org, jgg@nvidia.com, tina.zhang@intel.com, Michael Shavit , Jason Gunthorpe , Joerg Roedel , Kevin Tian , "Kirill A. Shutemov" , Lu Baolu , Mark Brown , Tomas Krcka , Yicong Yang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230905_045043_462902_140226D3 X-CRM114-Status: GOOD ( 11.81 ) 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 small series was originally part of a larger effort to support set_dev_pasid in arm-smmu-v3.c and a related SVA refactoring. But it can also stand on its own as an initial and prepatory clean-up. The crux of this series relies on the observation that SVA won't allocate multiple SVA domains for the same device and mm pair. There's therefore no reason for the driver to try to normalize data allocated for a device/mm pair across set_dev_pasid calls. This simplification then allows set_dev_pasid to use the SVA iommu_domain to hold information instead of allocating a "bond" to represent the attachement. Note that long term, we'll likely want to represent the SVA domain using the same arm_smmu_domain struct used in arm-smmu-v3. This series serves as an interim step to make those later refactors easier to reason about. Note that arm-smmu-v3-sva performs a second level of normalization by mapping multiple bonds (now SVA domains) attached to devices with the same SMMU (if those devices have the same RID domain attached) to a single arm_smmu_mmu_notifier. This is not affected by these patches. Michael Shavit (3): iommu/arm-smmu-v3-sva: Remove unused iommu_sva handle iommu/arm-smmu-v3-sva: Remove bond refcount iommu/arm-smmu-v3-sva: Remove arm_smmu_bond .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 90 ++++++------------- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 - drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- 3 files changed, 28 insertions(+), 65 deletions(-) base-commit: 6eaae198076080886b9e7d57f4ae06fa782f90ef