From patchwork Tue Jun 2 07:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1302181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bkdx6dgnz9sT6; Tue, 2 Jun 2020 17:47:17 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jg1dh-0004Dk-9t; Tue, 02 Jun 2020 07:47:13 +0000 Received: from mail-pj1-f66.google.com ([209.85.216.66]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jg1d2-0003Wa-4U for kernel-team@lists.ubuntu.com; Tue, 02 Jun 2020 07:46:32 +0000 Received: by mail-pj1-f66.google.com with SMTP id nm22so980767pjb.4 for ; Tue, 02 Jun 2020 00:46:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cf3HGZQ588M+bhzv/Xq8neEezkAxMqWcswrn1g3FnBQ=; b=oM+lo7+rgYzBhTx3K6t8jhaWyxe2AGBYM7E2XPAn5SNVvP1j+jh1QfzoTbAchvCj3q nMS0IcBfZvYhqvQYbsJ0xIsaONtBIVpksd2hob60HQwv8GS07v25cK8ivAr4hWQ8n57v WolEPzR7af0f64RR3MEr6ZUX5nAlaz0GiCqO0TDa9NlpL/RKFhZTGP4vYhGVGckfu7M+ 1cIaUHf5aWHCbN75UHc0/VMAzyOWI4BxByuA6VYXf4AdEaeNJQAYMbtKWNpAV4Q8LVTy dv5nRpsjcvE/GQyf60EPizxqQEXJDEyvRLDQNkBq7s5tSWVskUJ+ap4zKGheoUkuuTHy 5PoA== X-Gm-Message-State: AOAM5318MCfMNeZdDEPtO1GfJ96CxCn+ntcj5hKzbgWFwS/NuVnaLWc5 UXSNAGqBsnY1AKQEbx+hEVGvCtAjIVI= X-Google-Smtp-Source: ABdhPJzXXAs2e+1Y2C+YtAT9sq2b9hc6crWYiC9koWHD4T2xcN1qakWxh6fvVKT4uOAS4K5zFhDXzg== X-Received: by 2002:a17:90a:336c:: with SMTP id m99mr3827711pjb.168.1591083989308; Tue, 02 Jun 2020 00:46:29 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id m18sm1556043pfo.173.2020.06.02.00.46.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 00:46:28 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 48/60][SRU][OEM-5.6] iommu/exynos: Use first SYSMMU in controllers list for IOMMU core Date: Tue, 2 Jun 2020 15:44:09 +0800 Message-Id: <20200602074421.1742802-49-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200602074421.1742802-1-vicamo.yang@canonical.com> References: <20200602074421.1742802-1-vicamo.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Joerg Roedel BugLink: https://bugs.launchpad.net/bugs/1876707 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 Tested-by: Marek Szyprowski Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20200429133712.31431-31-joro@8bytes.org Signed-off-by: Joerg Roedel (cherry picked from commit 66ae88e71ecb93bafaacaeef233971eacd10e749 linux-next) Signed-off-by: You-Sheng Yang --- 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,