From patchwork Wed Jun 14 15:42:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13280163 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 60C87EB64D9 for ; Wed, 14 Jun 2023 15:45:17 +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=Wp1cI66UKYVPWSunLOP/qahTo4eKMI5Xwo57UeR3b2k=; b=UdAvjerS55pWdf6azvD2go0OiQ HbzEOH0f2jZSdBXtfmsSRRd97vILyq1JR8b0pmk3fdXcMW/TqnaSFQCdYP48a8+am6mMnQJIZ7pU1 a29lUyd7VdhhJT/JH10bWJcbo+gcOMQLBYIIfdseR5MbPFUc1OQddRR59G+C+6UCmkQRf47oH8uTe 04zRpHoHxVScFqYXpox2UzPjg1SPUu6ewoJDTTxKriavq38EzHAj1SmUFrHU1Anp894nM6Xp+6p0D oJOu8Chu5SK2S1k3R0BwKoeyjRUWx06wldC2l/LUOimkEYKDwSnvArwDmbRK+KusNn1ifrEZaLyva IIybCNmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9Sg6-00C6l1-39; Wed, 14 Jun 2023 15:44:58 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9Sg3-00C6iC-2d for linux-arm-kernel@lists.infradead.org; Wed, 14 Jun 2023 15:44:57 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-bc8ea14f4eeso1003449276.0 for ; Wed, 14 Jun 2023 08:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686757494; x=1689349494; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=1HNFofEgftQ/0viD8hP2C9StxNG8tEEj8VIgof4alao=; b=miKKuVOqy3O5VFZtsBJw0DWAr4nJ6ea8nlIylue8vHaIsdYyKs5VFM0KTJacu51Qzm +DH3Zl9jsvtSJPHee4tayDVENGPTKWf9gWXrcL4hC1Sc2GgiVQBtqQ7FnZG8+YwqkBPh yA8Et/DjbQCMxnJvenLQiNf7A7GFBipkyxcRcbX25mPlSQAORH+f6lepCF7STCNnbSjz QEVoAOVVQy/KvCuZreeHmBUtlj6a0/QT8lJ7Ls6W5a6m4+Xc6bUdeRYUvj91Jh2RQGIL 1UcOZtIRMZQKKjjJou6pQavpNlTolKJ9ovsaIENZITg6nYLeQ/1+rErxMkqfwI2pqIqu 2vrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686757494; x=1689349494; 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=1HNFofEgftQ/0viD8hP2C9StxNG8tEEj8VIgof4alao=; b=EglSCBsK9Wv21RGsOW6v5cc6WpsEHUBAY5RY+Nq9CGLgh2VepxVDgbZseSRJRAAisM qn2NCzRLHQocPnxs7jiUUXvJXl+G9rVaa7zv4dALubb0FqAi5Eyz9IY8tm+cJM5uvyGe ZTYAjw9+bsFSE4R3MYf39kzx/Z1XUmWdl7vYvWhwMenC6U57HhLzLRgC88+CO2dxajDj LMNTiB6SE2P9hA2GlGuqJWwwZaumoKf6IdMnAGVJS6mncAH+6/br3ZuU9P+ghDzEBweK WsBne8d+CNz3oZs/UoS29z9L68puvUyOxXYCf9YJOSjX/dFgA6GrIJLFFEL/WyJVMk1+ 63yQ== X-Gm-Message-State: AC+VfDyQBzUKJns4k/IIzJfsYCGAMSC8ebTQgoI9KiGQv1cB4lPo4mpo RnAO4lKDFvuE2JwZEgLzZ372OiBcvIpu X-Google-Smtp-Source: ACHHUZ78kKfpFZreseZ4ojfWuvi9sDnPV/0PlekSvb+T1K6vSEDreVSyrSqoVe2hWBnfSGsU5TgB/jwAdAGz X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:c6e6:49bf:5c44:5965]) (user=mshavit job=sendgmr) by 2002:a25:7356:0:b0:bc7:f6af:8cff with SMTP id o83-20020a257356000000b00bc7f6af8cffmr1176382ybc.2.1686757494488; Wed, 14 Jun 2023 08:44:54 -0700 (PDT) Date: Wed, 14 Jun 2023 23:42:03 +0800 In-Reply-To: <20230614154304.2860121-1-mshavit@google.com> Mime-Version: 1.0 References: <20230614154304.2860121-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230614154304.2860121-12-mshavit@google.com> Subject: [PATCH v3 11/13] iommu/arm-smmu-v3-sva: Clean unused iommu_sva From: Michael Shavit To: Will Deacon , Robin Murphy , Joerg Roedel Cc: Michael Shavit , jean-philippe@linaro.org, nicolinc@nvidia.com, jgg@nvidia.com, baolu.lu@linux.intel.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230614_084455_860505_0094754F X-CRM114-Status: GOOD ( 13.60 ) 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 __arm_smmu_sva_bind function returned an unused iommu_sva handle that can be removed. Signed-off-by: Michael Shavit --- .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c index 20301d0a2c0b0..650c9c9ad52f1 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c @@ -25,7 +25,6 @@ struct arm_smmu_mmu_notifier { #define mn_to_smmu(mn) container_of(mn, struct arm_smmu_mmu_notifier, mn) struct arm_smmu_bond { - struct iommu_sva sva; struct mm_struct *mm; struct arm_smmu_mmu_notifier *smmu_mn; struct list_head list; @@ -364,8 +363,7 @@ static void arm_smmu_mmu_notifier_put(struct arm_smmu_mmu_notifier *smmu_mn) arm_smmu_free_shared_cd(cd); } -static struct iommu_sva * -__arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm) +static int __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm) { int ret; struct arm_smmu_bond *bond; @@ -374,14 +372,13 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm) struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); if (!master || !master->sva_enabled) - return ERR_PTR(-ENODEV); + return -ENODEV; bond = kzalloc(sizeof(*bond), GFP_KERNEL); if (!bond) - return ERR_PTR(-ENOMEM); + return -ENOMEM; bond->mm = mm; - bond->sva.dev = dev; bond->smmu_mn = arm_smmu_mmu_notifier_get(smmu_domain, mm); if (IS_ERR(bond->smmu_mn)) { @@ -390,11 +387,11 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm) } list_add(&bond->list, &master->bonds); - return &bond->sva; + return 0; err_free_bond: kfree(bond); - return ERR_PTR(ret); + return ret; } bool arm_smmu_sva_supported(struct arm_smmu_device *smmu) @@ -572,13 +569,10 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain, struct device *dev, ioasid_t id) { int ret = 0; - struct iommu_sva *handle; struct mm_struct *mm = domain->mm; mutex_lock(&sva_lock); - handle = __arm_smmu_sva_bind(dev, mm); - if (IS_ERR(handle)) - ret = PTR_ERR(handle); + ret = __arm_smmu_sva_bind(dev, mm); mutex_unlock(&sva_lock); return ret;