Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1189432ybm; Sat, 30 May 2020 01:15:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQpnP130AfMAlhIAxdR+r+nU0uCjIcd+SYoeSzXSZMUWzz+yxw6xYNyjAbycDC4evzzGms X-Received: by 2002:a17:906:938a:: with SMTP id l10mr10836179ejx.186.1590826530062; Sat, 30 May 2020 01:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590826530; cv=none; d=google.com; s=arc-20160816; b=SolIkJ1x7B2v6VuSvbXquw5tQlxEPS+gBXAGM1Bd+7/rsIIXI4cS3tayBjKcK9mWns effGh+E8rJRXRXF/XMGgZsbBIIuTgZAYfGM6bbOwDt1pjuTqSRAMXWnrdFwoPXkG8/pe NTgh0Wo9TEhDaq0hU7WZ6dD89JjZRq9YNfFu32OnMg+aK4LkotZrB5qj4C7PRa6KfHxd ZNZ4Cak3/ZoMPXRjDcSbPe/ZpmvsgtCN40DiTU36Y/NwnxBoh0Dte48w7u2tsSUcpHb5 f+axBY2uFsNfC7HN1KY7BngISHFgrRKcEeQFe2k310Vq9vDo9qhchZC9Db7pyAosn+mI GVGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xCqWi5z6+Xboewg72YASIv16teQ3+/TFq1FrFtej2K8=; b=auBKejpbfwb54ic6JlhPlLBMaHPAC9m4sw/fCMPwb02KfUj4csWNwI4KVdnIbbtOoD eqIgDjudTiWmQpFgqDpd8TZzFvd0CxiFHPTc1f10XK7m9elbApijCHvk5F1N6bSvgIH9 72Qu0JNJ01CGK3JY9dyWkkQgrdmsktzxT8Vt1tya7uJY508rxS+SZzyUR16kks2sW0ab Z139JFKxcThZyrmW51O5ew7JXBYgVutblPrPOO+OSyh5coGUvzalE9Qb6V/rTCGHgepj i4dDgPvAAvq7ozpbnCbfffuHU/8X6iLfJPgwr6IsDX1Or5N8ZK7+d9ORGZXK0Rncyv36 ulYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=RfOQHU1f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si6748156edo.83.2020.05.30.01.15.07; Sat, 30 May 2020 01:15:30 -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; dkim=pass header.i=@mediatek.com header.s=dk header.b=RfOQHU1f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728883AbgE3INB (ORCPT + 99 others); Sat, 30 May 2020 04:13:01 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:26156 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725813AbgE3INA (ORCPT ); Sat, 30 May 2020 04:13:00 -0400 X-UUID: b63df20561ea4050b73b0b2952e3ce3b-20200530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=xCqWi5z6+Xboewg72YASIv16teQ3+/TFq1FrFtej2K8=; b=RfOQHU1fv5UUkq8SuaR6jDUbZzp2s6doDwQ9yrLWgq/y8HyuW6XdQbNXJzGotupRADLgyiYiBmGzC7bS7o6uYOfMPBQX5ASohmVqjh7fmcVmwh/H5QnQoMly+07zk4LY+nJGoYkSZbTG6LF18Gm8FZ/no4y3MzXSByKZ5fQCiDc=; X-UUID: b63df20561ea4050b73b0b2952e3ce3b-20200530 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1261379275; Sat, 30 May 2020 16:12:57 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 30 May 2020 16:12:54 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 30 May 2020 16:12:54 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , , Subject: [PATCH v4 04/17] iommu/mediatek: Add device_link between the consumer and the larb devices Date: Sat, 30 May 2020 16:10:05 +0800 Message-ID: <1590826218-23653-5-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> References: <1590826218-23653-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TWVkaWFUZWsgSU9NTVUgZG9uJ3QgaGF2ZSBpdHMgcG93ZXItZG9tYWluLiBhbGwgdGhlIGNvbnN1 bWVyIGNvbm5lY3QNCndpdGggc21pLWxhcmIsIHRoZW4gY29ubmVjdCB3aXRoIHNtaS1jb21tb24u DQoNCiAgICAgIC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