From patchwork Wed Jun 21 06:37:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shavit X-Patchwork-Id: 13286745 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 229F8EB64D8 for ; Wed, 21 Jun 2023 06:45:10 +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=IyXkaahiLig0hPbt6ZnPXRxt1H uK0LUtNxKgHIUWxU7+yBweWtWXV7nzx0Zbd1bXD4IgKw9hS6MmBN4t8DIlBz+o1vND8kjb2mMqztl cpbcnY7KrVeWMD4GBLXg3fV7+rsh980BmaMVkF7WbJCGgSgTQQN/qx+byGkkP2Rw3UhK8X9qH5n6g OYd4vmXpfxakidzJBaKPcf9Z8GdVn2++Ya5fiDiXkzYr8DmitY4EslHRZyZIUSRtpzmdV8twgpVo5 +aGbIZC5+C3j6kIEHs0D0DLkmzxQJO/FECn1/OAmQttrulT5rhn29BIwgUNeMr1YNq00i4bmUhXJ2 /BZ4QZZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBraF-00DShW-0N; Wed, 21 Jun 2023 06:44:51 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBraB-00DSeg-0C for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 06:44:48 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-56d43d49d58so77021597b3.1 for ; Tue, 20 Jun 2023 23:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687329886; x=1689921886; 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=NwyrXz6ubgbYeu5se4OnmTGRl/ECZnN/7JXUGfb3yfJHIleuEhl/vBOWZdfzMER6Gx BiPVvWA9Zp+4QaWrnn9OAzgPxD8EtCxqeits8Wu66pkUEHOGaiwDQhRW/J+yNdDMsAlF y8tREQZuazgzoLW1lJOdMAgC3jROf3yU6f6/ooGUM/ed0cdMK69TTIuHL8pi8+hdgxg4 sMmuWLwUHHqnGxYMofKOeij/4hhaVO7yrHVtyCzzPIP3fz7HtdUP47sUq7HkSrrLt0u4 AKIy0MweTpJJB47zOUsszP8BDsLy6b518MCCeqGT4lRkc+iJWu0D/oSX+S9wtNgHByFL IhfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687329886; x=1689921886; 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=lB1J8k3+rJ2Uak5hncBlOfMQ3nD8GAjPda1uWA7WXNMrne0lPdw4JD8MuNbu7hgnlW W0KTraoOwVLVl9OCCEuMHttGm7jxfDUj89o0MCuxOvyJmWdjDnIBEiLGIR4SXiBJdJ5t 8GwhKw7BVucIPRCXCpx+uespxp7FTNLbEyRgjNNT/QWEpmyXhTAPczQhA8ZDX2Hc5TiE usN/i5pFXPymIrGe1rv9NrtlyhKQNhsd+yGApVAAMNA/1VtRaG7ahByzztyYmALcgaoV AviTPcQvOK4n3A23Sne9wyFIMdyZubNZZp1TjE8x8jOxC/ExkPI3FxyGu6U81ORi4FQL f07Q== X-Gm-Message-State: AC+VfDyxU2ltZ+CdPcQu97eT/LTJHQKF5tJjLyMUISNsOHfMzXsb7kqP k8nQXjmMUhdqyxYJDLc8kebAbznb3Mdm X-Google-Smtp-Source: ACHHUZ7QGJG0D7z7/43AEtJ6RwcS6kiSb09I0mWwsorRzmgb/ZEaTmvkUNbdIb93dJYPVoc71NOppCwfYFjW X-Received: from mshavit.ntc.corp.google.com ([2401:fa00:95:20c:384f:f7da:c61d:5a3e]) (user=mshavit job=sendgmr) by 2002:a81:bc4d:0:b0:56f:2841:aa24 with SMTP id b13-20020a81bc4d000000b0056f2841aa24mr6215155ywl.10.1687329885894; Tue, 20 Jun 2023 23:44:45 -0700 (PDT) Date: Wed, 21 Jun 2023 14:37:23 +0800 In-Reply-To: <20230621063825.268890-1-mshavit@google.com> Mime-Version: 1.0 References: <20230621063825.268890-1-mshavit@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230621063825.268890-12-mshavit@google.com> Subject: [PATCH v4 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-20230620_234447_098277_5795294F X-CRM114-Status: GOOD ( 13.49 ) 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;