From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757776AbcC2RmA (ORCPT ); Tue, 29 Mar 2016 13:42:00 -0400 Received: from mail.kernel.org ([198.145.29.136]:46200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752711AbcC2Rl7 (ORCPT ); Tue, 29 Mar 2016 13:41:59 -0400 From: "Luis R. Rodriguez" To: joro@8bytes.org, oded.gabbay@amd.com, christian.koenig@amd.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [RFT v2] iommu/amd: use subsys_initcall() on amdv2 iommu Date: Tue, 29 Mar 2016 10:41:53 -0700 Message-Id: <1459273313-5139-1-git-send-email-mcgrof@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <20160316171719.GE2195@8bytes.org> References: <20160316171719.GE2195@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to ensure amd iommu v2 initializes before driver uses such as drivers/gpu/drm/amd/amdkfd/kfd_module.c, to do this make its init routine a subsys_initcall() which ensures its load init is called first than modules when built-in. This reverts the old work around implemented through commit 1bacc894c227fad8a7 ("drivers: Move iommu/ before gpu/ in Makefile"), instead of making the dependency implicit by linker order this makes the ordering requirement explicit through proper kernel APIs. Cc: Oded Gabbay Cc: Christian König Signed-off-by: Luis R. Rodriguez --- This goes along with the revert included. Can someone please test? drivers/Makefile | 6 ++---- drivers/iommu/amd_iommu_v2.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/Makefile b/drivers/Makefile index 8f5d076baeb0..cc3cfbddc376 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -50,10 +50,7 @@ obj-$(CONFIG_RESET_CONTROLLER) += reset/ obj-y += tty/ obj-y += char/ -# iommu/ comes before gpu as gpu are using iommu controllers -obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ - -# gpu/ comes after char for AGP vs DRM startup and after iommu +# gpu/ comes after char for AGP vs DRM startup obj-y += gpu/ obj-$(CONFIG_CONNECTOR) += connector/ @@ -146,6 +143,7 @@ obj-y += clk/ obj-$(CONFIG_MAILBOX) += mailbox/ obj-$(CONFIG_HWSPINLOCK) += hwspinlock/ +obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ obj-$(CONFIG_REMOTEPROC) += remoteproc/ obj-$(CONFIG_RPMSG) += rpmsg/ diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index 56999d2fac07..60df645b9927 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c @@ -1004,5 +1004,5 @@ static void __exit amd_iommu_v2_exit(void) destroy_workqueue(iommu_wq); } -module_init(amd_iommu_v2_init); +subsys_initcall(amd_iommu_v2_init); module_exit(amd_iommu_v2_exit); -- 2.7.2