From patchwork Tue May 26 13:01:52 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: 1298062 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 49WZ2Z56z7z9sTP; Tue, 26 May 2020 23:05:42 +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 1jdZGy-0007gA-6g; Tue, 26 May 2020 13:05:36 +0000 Received: from mail-pf1-f196.google.com ([209.85.210.196]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jdZFe-0006Xn-EZ for kernel-team@lists.ubuntu.com; Tue, 26 May 2020 13:04:14 +0000 Received: by mail-pf1-f196.google.com with SMTP id v2so5077368pfv.7 for ; Tue, 26 May 2020 06:04:14 -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=XA2sMF5l4oyOcT2uYO2gnIroCwIFCh9ifqaVx202bw0=; b=ZgJ9gDby0ZcEBcQtfe54xa8kKFMCxGdgJ5aU4CrR4mRtOl1u0Z/UDVv3Kp8ZyMv1aJ tjoGNfl3SJJtI5i75YbJsJjCsTAWr3m861XcaM3xnz6++eNYtBuIcdDE+YH8DEjqdUar tf8KEsws+tgZ+l7Hvt4RTv70x9L698yiVk4zS8YhK0HoonxvO43ZKuHEFHgrmFv1hzeV jYVPOELmOM1qV4Btgc2MzsIGZfwWoE7zBKRsxV9wjO1ggP+DbXBcKNkNtdFvtwDO/goO mC6ID0Nvph9hRsAgpAAadQIuC3hIhZ3y3O+m8JSUxHPVLo2vx5oTHwZ3v4huLI+4jUk3 +MoQ== X-Gm-Message-State: AOAM531uh6dhEH2qrAS/X4QbQ6Pnz1l9BqgY0FLn6TKFXxyU58NQJgt4 UFmZMca1xxaPvPu0O5TlKQ/tg3YTk0w= X-Google-Smtp-Source: ABdhPJzFUoWhbASWG7qDM4+1z60AH+LcWIrxpPnFxSNOyp5rr+7fa2EON5VqKpHPxB7vELbZq6g5yA== X-Received: by 2002:a63:1d4a:: with SMTP id d10mr1020234pgm.188.1590498250215; Tue, 26 May 2020 06:04:10 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id j26sm15185604pfr.215.2020.05.26.06.04.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 06:04:09 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 48/60][SRU][OEM-5.6] UBUNTU: SAUCE: iommu/exynos: Use first SYSMMU in controllers list for IOMMU core Date: Tue, 26 May 2020 21:01:52 +0800 Message-Id: <20200526130204.238445-49-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526130204.238445-1-vicamo.yang@canonical.com> References: <20200526130204.238445-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 iommu/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,