Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp586604ybz; Wed, 15 Apr 2020 14:35:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLruG7dpvGo3Xq2HQVuuAG6r6ymkJNFzQO4FwGbHNEvVAjPQlHTmRZo4qI4opiFbYvORw6A X-Received: by 2002:a17:906:374b:: with SMTP id e11mr7256349ejc.283.1586986554441; Wed, 15 Apr 2020 14:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986554; cv=none; d=google.com; s=arc-20160816; b=anQTG0tkYhpMZIV3yXMTw7QIwwPsAB4VeRtNreyfx3Royg5YNwYKI36uNCzB5kZHm1 jdxQNv97soEd7iAjSDHFWt0QppDhEaGbqZLfm5g2ApRF2Wh7HFkK8kA+ioTi0jW8Dslg /YcTIY/h5Imio3jSiJlFV0yWi9c08osochfYd7Ppnq7CcKXGipztjqH0kdHx7O+UVTxY jioaW1lrcuKKW+u+gXZcZw8nmEe+lOISBMbtixU2AQirn4GcR47e863Y+1ZaRGwQLK9P ovvCVXG9uVrsaPkjzGGYYyBnxrxZqwEOm7aJnqONghAzixlcJctsd2BbfGQXWtbBxcmQ pMFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=/bddT2VFZSW1gKSGo3MuWCsEOjPPpI0c/+yJmrS1poU=; b=Js6CTry5ifXG01dX7tmBw7UxSM1PdrnERqmhk4WTmUHt+uGSfzjSu0MrAYMiNqGSGg xQ0dYm024sIVZ1s21zwVCDbitcQe2eyt02ACcWLticrbsiv9L934wIruZxuDOSE3Nx5g wMCBRkDkrKUl6APKrYGd8DZOXT6pX3lBcn5muG5DGKoIq4V2vsRxb8oU16cqh+0ffGm5 senbJS5eUQVBBg/E81SbftOkAMj3Tyq0ZeLOo3dCMpatnrjMfDVfa0lEwQkC5SIZ1Gtw lFXLD5QJT3bX+1vEhNv5hpLXVQrxOm+SpoQ0HF+kbuMZLJTGYizRGkAP26Qqq7aY5hod tD3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si9247273edn.181.2020.04.15.14.35.31; Wed, 15 Apr 2020 14:35:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731354AbgDNNWC (ORCPT + 99 others); Tue, 14 Apr 2020 09:22:02 -0400 Received: from 8bytes.org ([81.169.241.247]:35236 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502906AbgDNNQH (ORCPT ); Tue, 14 Apr 2020 09:16:07 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 470097E3; Tue, 14 Apr 2020 15:15:57 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v2 30/33] iommu/exynos: Use first SYSMMU in controllers list for IOMMU core Date: Tue, 14 Apr 2020 15:15:39 +0200 Message-Id: <20200414131542.25608-31-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414131542.25608-1-joro@8bytes.org> References: <20200414131542.25608-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel On Exynos platforms there can be more than one SYSMMU (IOMMU) for one DMA master device. Since the IOMMU core code expects only one hardware IOMMU, use the first SYSMMU in the list. Signed-off-by: Joerg Roedel --- drivers/iommu/exynos-iommu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 186ff5cc975c..09cdd163560a 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1261,6 +1261,11 @@ static int exynos_iommu_add_device(struct device *dev) } iommu_group_put(group); + /* There is always at least one entry, see exynos_iommu_of_xlate() */ + data = list_first_entry(&owner->controllers, + struct sysmmu_drvdata, owner_node); + iommu_device_link(&data->iommu, dev); + return 0; } @@ -1286,6 +1291,11 @@ static void exynos_iommu_remove_device(struct device *dev) list_for_each_entry(data, &owner->controllers, owner_node) device_link_del(data->link); + + /* There is always at least one entry, see exynos_iommu_of_xlate() */ + data = list_first_entry(&owner->controllers, + struct sysmmu_drvdata, owner_node); + iommu_device_unlink(&data->iommu, dev); } static int exynos_iommu_of_xlate(struct device *dev, -- 2.17.1