From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbcEYG3V (ORCPT ); Wed, 25 May 2016 02:29:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55631 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060AbcEYG3R (ORCPT ); Wed, 25 May 2016 02:29:17 -0400 From: Baoquan He To: joro@8bytes.org Cc: iommu@lists.linux-foundation.org, vincent.wan@amd.com, xlpang@redhat.com, dyoung@redhat.com, linux-kernel@vger.kernel.org, Baoquan HE , Baoquan He Subject: [Patch v4 4/9] iommu/amd: add early_enable_iommu() helper function Date: Wed, 25 May 2016 14:28:50 +0800 Message-Id: <1464157735-8865-5-git-send-email-bhe@redhat.com> In-Reply-To: <1464157735-8865-1-git-send-email-bhe@redhat.com> References: <1464157735-8865-1-git-send-email-bhe@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 25 May 2016 06:29:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baoquan HE This can make later kdump change easier. Signed-off-by: Baoquan He --- drivers/iommu/amd_iommu_init.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 9e1dfcb..9c1aa54 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -1673,6 +1673,18 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu) iommu->stored_addr_lo | 1); } +static void early_enable_iommu(struct amd_iommu *iommu) +{ + iommu_disable(iommu); + iommu_init_flags(iommu); + iommu_set_device_table(iommu); + iommu_enable_command_buffer(iommu); + iommu_enable_event_buffer(iommu); + iommu_set_exclusion_range(iommu); + iommu_enable(iommu); + iommu_flush_all_caches(iommu); +} + /* * This function finally enables all IOMMUs found in the system after * they have been initialized @@ -1681,16 +1693,8 @@ static void early_enable_iommus(void) { struct amd_iommu *iommu; - for_each_iommu(iommu) { - iommu_disable(iommu); - iommu_init_flags(iommu); - iommu_set_device_table(iommu); - iommu_enable_command_buffer(iommu); - iommu_enable_event_buffer(iommu); - iommu_set_exclusion_range(iommu); - iommu_enable(iommu); - iommu_flush_all_caches(iommu); - } + for_each_iommu(iommu) + early_enable_iommu(iommu); } static void enable_iommus_v2(void) -- 2.5.5