Message ID | 20230530092503.152926-2-yanfei.xu@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2053071vqr; Tue, 30 May 2023 02:39:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WaN1baZCDgzVYlOefZVi1sdf/0VAu4h3NIZlclfBBG3IiZPMJLTvlQQGAanoYfSXGCL1j X-Received: by 2002:a17:902:724c:b0:1a5:150f:8558 with SMTP id c12-20020a170902724c00b001a5150f8558mr1561920pll.17.1685439595047; Tue, 30 May 2023 02:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685439595; cv=none; d=google.com; s=arc-20160816; b=c29aQIustWKIgBQV6m5P5MsucgNgXJUwj3kch8P2r9PuYEms15zwDjfX4mUqBFxA8b vlDSE+JBNUJDesvFioh3Pah+fRM9p6sdzP1ZIAok7PQg0WL8oGuso+IjNCTsD2zuMYkl hrEFaCT7X5nh7JFi+yqoPvrBMUoZL+es72KVc0GEU7kc+iCY25tGxHY8q7ZbAgSJoBe8 OGa0Sj3cAePpFDWgxEyQAExmCV/ycxi+STnjzYgdVIet3rmTXr2RKP19oAzN4DLv2HSJ OGdf6sXCeQv4mJoIY5Godjfzj7dcdBIOSxUR7XlCjyHGhPMsKa+1XpQR+kf8J7VU+12D sn9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tcvNz8xK9WvUKZ24DYxNfoAXw/+CoS550f21MyOdqdk=; b=fzjjVKRyOQBhnfblSDsrUIA8Ky2AlyaU95ngi+8tgBZy5VA72AhSNGLRu9R4l+4p9l vI45kBSMDfGHWj0WJ6bmnc7hYftWEMUZpzS0YWV4/uPS/PlYE98+JWLu0GoJhJMNEbbM UdiPSyZE/87bgXcOPInOwwM9yfdvnDgYCNRfibGXfdwXMWwSDgGBhd6yQpUm3zKtFWmj 0sb2f/j0tYP5JypiYQZuNc6eEh4KOVou7v5etB1x+dYDxb4KTGqJor8M3oWbNapGGZkZ zhkijz/OwA1rJD/22B4OleCGU981wRTLlQGGi+rhOdpydom9xpdEJh2COzRVV+jooesS Ta/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mCk0zoPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170902704600b001ac8daed841si1405350plt.646.2023.05.30.02.39.43; Tue, 30 May 2023 02:39:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mCk0zoPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjE3J2z (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Tue, 30 May 2023 05:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjE3J2W (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 30 May 2023 05:28:22 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E9FE4E for <linux-kernel@vger.kernel.org>; Tue, 30 May 2023 02:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685438867; x=1716974867; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fwx6XkwajTMSuzKO6uWLg7Ou7DkXom2s4s3Qa8sVvZ4=; b=mCk0zoPAfXEfuYY2lbxyF8C11muBH69vVv3bnw9d83YkEbd+whM2NB4L CE8gZuF+bl2J5ehu41vo8shVUdbuJLfuTL0/FsKQ2LOvOOTi4atiD97MH bIOFxX6CVZ9mT3oTTGBMnxsZdY1Xpi8jKTckzCIR45HufuajN4O1befdD 9EHskiTgYBrV5YowHzyhPkfhzv2TJ12fPwB/IXQJxpIW4o1Ay0jst5wwZ WxQbR3Qll2bFiHpehsaBOYzsigIdS+re23SF0KGSvsjsf0fxkv8Zk229K AX6znjsJ+yvK4pyG1iyky3ymo4MDd2IEVjyjG1Cem6DzLW1uI9FrBP+dI A==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="344365164" X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="344365164" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 02:27:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="818720160" X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="818720160" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 02:27:44 -0700 From: Yanfei Xu <yanfei.xu@intel.com> To: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, yanfei.xu@intel.com Subject: [PATCH 1/2] iommu/vt-d: Remove the dead code in init_iommu_hw() Date: Tue, 30 May 2023 17:25:02 +0800 Message-Id: <20230530092503.152926-2-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530092503.152926-1-yanfei.xu@intel.com> References: <20230530092503.152926-1-yanfei.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767311509213406040?= X-GMAIL-MSGID: =?utf-8?q?1767311509213406040?= |
Series |
Misc cleanup for iommu/vt-d
|
|
Commit Message
Yanfei Xu
May 30, 2023, 9:25 a.m. UTC
After 'commit 2a41ccee2fdc ("iommu/vt-d: Change
iommu_enable/disable_translation to return void")', init_iommu_hw() only
returns 0. If statement for return value of this function is meaningless.
Hence change init_iommu_hw() to return viod and remove the dead code of
if statement in init_iommu_hw()
Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
---
drivers/iommu/intel/iommu.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
Comments
On 5/30/23 5:25 PM, Yanfei Xu wrote: > After 'commit 2a41ccee2fdc ("iommu/vt-d: Change > iommu_enable/disable_translation to return void")', init_iommu_hw() only > returns 0. If statement for return value of this function is meaningless. > Hence change init_iommu_hw() to return viod and remove the dead code of > if statement in init_iommu_hw() > > Signed-off-by: Yanfei Xu<yanfei.xu@intel.com> > --- > drivers/iommu/intel/iommu.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index 8096273b034c..e98f1b122b49 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -2963,7 +2963,7 @@ static void __init init_no_remapping_devices(void) > } > > #ifdef CONFIG_SUSPEND > -static int init_iommu_hw(void) > +static void init_iommu_hw(void) > { > struct dmar_drhd_unit *drhd; > struct intel_iommu *iommu = NULL; > @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) > iommu_enable_translation(iommu); > iommu_disable_protect_mem_regions(iommu); > } > - > - return 0; 2966 static int init_iommu_hw(void) 2967 { 2968 struct dmar_drhd_unit *drhd; 2969 struct intel_iommu *iommu = NULL; 2970 2971 for_each_active_iommu(iommu, drhd) 2972 if (iommu->qi) 2973 dmar_reenable_qi(iommu); dmar_reenable_qi() still possibly returns an error number. It's better to pass this error number to the caller of init_iommu_hw()? 2974 2975 for_each_iommu(iommu, drhd) { 2976 if (drhd->ignored) { Best regards, baolu
Hi Baolu, On 5/31/2023 11:24 AM, Baolu Lu wrote: > On 5/30/23 5:25 PM, Yanfei Xu wrote: >> After 'commit 2a41ccee2fdc ("iommu/vt-d: Change >> iommu_enable/disable_translation to return void")', init_iommu_hw() only >> returns 0. If statement for return value of this function is >> meaningless. >> Hence change init_iommu_hw() to return viod and remove the dead code of >> if statement in init_iommu_hw() >> >> Signed-off-by: Yanfei Xu<yanfei.xu@intel.com> >> --- >> drivers/iommu/intel/iommu.c | 12 ++---------- >> 1 file changed, 2 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c >> index 8096273b034c..e98f1b122b49 100644 >> --- a/drivers/iommu/intel/iommu.c >> +++ b/drivers/iommu/intel/iommu.c >> @@ -2963,7 +2963,7 @@ static void __init init_no_remapping_devices(void) >> } >> #ifdef CONFIG_SUSPEND >> -static int init_iommu_hw(void) >> +static void init_iommu_hw(void) >> { >> struct dmar_drhd_unit *drhd; >> struct intel_iommu *iommu = NULL; >> @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) >> iommu_enable_translation(iommu); >> iommu_disable_protect_mem_regions(iommu); >> } >> - >> - return 0; > > 2966 static int init_iommu_hw(void) > 2967 { > 2968 struct dmar_drhd_unit *drhd; > 2969 struct intel_iommu *iommu = NULL; > 2970 > 2971 for_each_active_iommu(iommu, drhd) > 2972 if (iommu->qi) > 2973 dmar_reenable_qi(iommu); > > dmar_reenable_qi() still possibly returns an error number. It's better > to pass this error number to the caller of init_iommu_hw()? > Event dmar_reenable_qi can return error number, but there is no caller check it. As below, only these two places invoke it: 1. init_iommu_hw->dmar_reenable_qi 2. reenable_irq_remapping->dmar_reenable_qi I think we can also convert dmar_reenable_qi() to return void: diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index a3414afe11b0..1432483c79e8 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -2112,13 +2112,10 @@ int __init enable_drhd_fault_handling(void) /* * Re-enable Queued Invalidation interface. */ -int dmar_reenable_qi(struct intel_iommu *iommu) +void dmar_reenable_qi(struct intel_iommu *iommu) { - if (!ecap_qis(iommu->ecap)) - return -ENOENT; - - if (!iommu->qi) - return -ENOENT; + WARN_ON(!iommu->qi || !ecap_qis(iommu->ecap)) + return; /* * First disable queued invalidation. @@ -2130,8 +2127,6 @@ int dmar_reenable_qi(struct intel_iommu *iommu) * invalidation. */ __dmar_enable_qi(iommu); - - return 0; } From my understanding, dmar_reenable_qi() is used in suspend/resume case, so the extended cap of an existing IOMMU hardware is unlikely changed. As for the check of iommu->qi, if dmar_reenable_qi() can be invoked all is depended on the no-NULL of iommu->qi at first. How about using WARN_ON for both of them to simply this function. Thanks, Yanfei > 2974 > 2975 for_each_iommu(iommu, drhd) { > 2976 if (drhd->ignored) { > > Best regards, > baolu
On 5/31/23 2:55 PM, Yanfei Xu wrote: > > On 5/31/2023 11:24 AM, Baolu Lu wrote: >> On 5/30/23 5:25 PM, Yanfei Xu wrote: >>> After 'commit 2a41ccee2fdc ("iommu/vt-d: Change >>> iommu_enable/disable_translation to return void")', init_iommu_hw() only >>> returns 0. If statement for return value of this function is >>> meaningless. >>> Hence change init_iommu_hw() to return viod and remove the dead code of >>> if statement in init_iommu_hw() >>> >>> Signed-off-by: Yanfei Xu<yanfei.xu@intel.com> >>> --- >>> drivers/iommu/intel/iommu.c | 12 ++---------- >>> 1 file changed, 2 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c >>> index 8096273b034c..e98f1b122b49 100644 >>> --- a/drivers/iommu/intel/iommu.c >>> +++ b/drivers/iommu/intel/iommu.c >>> @@ -2963,7 +2963,7 @@ static void __init init_no_remapping_devices(void) >>> } >>> #ifdef CONFIG_SUSPEND >>> -static int init_iommu_hw(void) >>> +static void init_iommu_hw(void) >>> { >>> struct dmar_drhd_unit *drhd; >>> struct intel_iommu *iommu = NULL; >>> @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) >>> iommu_enable_translation(iommu); >>> iommu_disable_protect_mem_regions(iommu); >>> } >>> - >>> - return 0; >> >> 2966 static int init_iommu_hw(void) >> 2967 { >> 2968 struct dmar_drhd_unit *drhd; >> 2969 struct intel_iommu *iommu = NULL; >> 2970 >> 2971 for_each_active_iommu(iommu, drhd) >> 2972 if (iommu->qi) >> 2973 dmar_reenable_qi(iommu); >> >> dmar_reenable_qi() still possibly returns an error number. It's better >> to pass this error number to the caller of init_iommu_hw()? >> > Event dmar_reenable_qi can return error number, but there is no caller > check it. As below, only these two places invoke it: > 1. init_iommu_hw->dmar_reenable_qi > 2. reenable_irq_remapping->dmar_reenable_qi > > I think we can also convert dmar_reenable_qi() to return void: > diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c > index a3414afe11b0..1432483c79e8 100644 > --- a/drivers/iommu/intel/dmar.c > +++ b/drivers/iommu/intel/dmar.c > @@ -2112,13 +2112,10 @@ int __init enable_drhd_fault_handling(void) > /* > * Re-enable Queued Invalidation interface. > */ > -int dmar_reenable_qi(struct intel_iommu *iommu) > +void dmar_reenable_qi(struct intel_iommu *iommu) > { > - if (!ecap_qis(iommu->ecap)) > - return -ENOENT; > - > - if (!iommu->qi) > - return -ENOENT; > + WARN_ON(!iommu->qi || !ecap_qis(iommu->ecap)) > + return; > > /* > * First disable queued invalidation. > @@ -2130,8 +2127,6 @@ int dmar_reenable_qi(struct intel_iommu *iommu) > * invalidation. > */ > __dmar_enable_qi(iommu); > - > - return 0; > } > > From my understanding, dmar_reenable_qi() is used in suspend/resume case, > so the extended cap of an existing IOMMU hardware is unlikely changed. As > for the check of iommu->qi, if dmar_reenable_qi() can be invoked all is > depended on the no-NULL of iommu->qi at first. How about using WARN_ON for > both of them to simply this function. This seems to be heading in the opposite direction. Actually any operation may succeed or fail. diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index b871a6afd803..ecc2007a96f9 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2967,10 +2967,13 @@ static int init_iommu_hw(void) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu = NULL; + int ret; - for_each_active_iommu(iommu, drhd) - if (iommu->qi) - dmar_reenable_qi(iommu); + for_each_active_iommu(iommu, drhd) { + ret = dmar_reenable_qi(iommu); + if (ret) + return ret; + } for_each_iommu(iommu, drhd) { if (drhd->ignored) { Best regards, baolu
On 6/1/2023 9:15 AM, Baolu Lu wrote: > On 5/31/23 2:55 PM, Yanfei Xu wrote: >> >> On 5/31/2023 11:24 AM, Baolu Lu wrote: >>> On 5/30/23 5:25 PM, Yanfei Xu wrote: >>>> After 'commit 2a41ccee2fdc ("iommu/vt-d: Change >>>> iommu_enable/disable_translation to return void")', init_iommu_hw() >>>> only >>>> returns 0. If statement for return value of this function is >>>> meaningless. >>>> Hence change init_iommu_hw() to return viod and remove the dead >>>> code of >>>> if statement in init_iommu_hw() >>>> >>>> Signed-off-by: Yanfei Xu<yanfei.xu@intel.com> >>>> --- >>>> drivers/iommu/intel/iommu.c | 12 ++---------- >>>> 1 file changed, 2 insertions(+), 10 deletions(-) >>>> >>>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c >>>> index 8096273b034c..e98f1b122b49 100644 >>>> --- a/drivers/iommu/intel/iommu.c >>>> +++ b/drivers/iommu/intel/iommu.c >>>> @@ -2963,7 +2963,7 @@ static void __init >>>> init_no_remapping_devices(void) >>>> } >>>> #ifdef CONFIG_SUSPEND >>>> -static int init_iommu_hw(void) >>>> +static void init_iommu_hw(void) >>>> { >>>> struct dmar_drhd_unit *drhd; >>>> struct intel_iommu *iommu = NULL; >>>> @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) >>>> iommu_enable_translation(iommu); >>>> iommu_disable_protect_mem_regions(iommu); >>>> } >>>> - >>>> - return 0; >>> >>> 2966 static int init_iommu_hw(void) >>> 2967 { >>> 2968 struct dmar_drhd_unit *drhd; >>> 2969 struct intel_iommu *iommu = NULL; >>> 2970 >>> 2971 for_each_active_iommu(iommu, drhd) >>> 2972 if (iommu->qi) >>> 2973 dmar_reenable_qi(iommu); >>> >>> dmar_reenable_qi() still possibly returns an error number. It's better >>> to pass this error number to the caller of init_iommu_hw()? >>> >> Event dmar_reenable_qi can return error number, but there is no caller >> check it. As below, only these two places invoke it: >> 1. init_iommu_hw->dmar_reenable_qi >> 2. reenable_irq_remapping->dmar_reenable_qi >> >> I think we can also convert dmar_reenable_qi() to return void: >> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c >> index a3414afe11b0..1432483c79e8 100644 >> --- a/drivers/iommu/intel/dmar.c >> +++ b/drivers/iommu/intel/dmar.c >> @@ -2112,13 +2112,10 @@ int __init enable_drhd_fault_handling(void) >> /* >> * Re-enable Queued Invalidation interface. >> */ >> -int dmar_reenable_qi(struct intel_iommu *iommu) >> +void dmar_reenable_qi(struct intel_iommu *iommu) >> { >> - if (!ecap_qis(iommu->ecap)) >> - return -ENOENT; >> - >> - if (!iommu->qi) >> - return -ENOENT; >> + WARN_ON(!iommu->qi || !ecap_qis(iommu->ecap)) >> + return; >> >> /* >> * First disable queued invalidation. >> @@ -2130,8 +2127,6 @@ int dmar_reenable_qi(struct intel_iommu *iommu) >> * invalidation. >> */ >> __dmar_enable_qi(iommu); >> - >> - return 0; >> } >> >> From my understanding, dmar_reenable_qi() is used in suspend/resume >> case, >> so the extended cap of an existing IOMMU hardware is unlikely >> changed. As >> for the check of iommu->qi, if dmar_reenable_qi() can be invoked all is >> depended on the no-NULL of iommu->qi at first. How about using >> WARN_ON for >> both of them to simply this function. > > This seems to be heading in the opposite direction. Actually any > operation may succeed or fail. > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index b871a6afd803..ecc2007a96f9 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -2967,10 +2967,13 @@ static int init_iommu_hw(void) > { > struct dmar_drhd_unit *drhd; > struct intel_iommu *iommu = NULL; > + int ret; > > - for_each_active_iommu(iommu, drhd) > - if (iommu->qi) > - dmar_reenable_qi(iommu); > + for_each_active_iommu(iommu, drhd) { > + ret = dmar_reenable_qi(iommu); > + if (ret) > + return ret; For confirm, you mean this? @@ -2967,10 +2970,14 @@ static int init_iommu_hw(void) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu = NULL; + int ret; - for_each_active_iommu(iommu, drhd) + for_each_active_iommu(iommu, drhd) { if (iommu->qi) - dmar_reenable_qi(iommu); + ret = dmar_reenable_qi(iommu); + if (ret) + return ret; + } If drop NULL value check of iommu->qi, dmar_reenable_qi() may return minus value to break the loop of dmar_reenable_qi as one of iommus doesn't set up iommu->qi. Thanks, Yanfei > + } > > for_each_iommu(iommu, drhd) { > if (drhd->ignored) { > > Best regards, > baolu
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 8096273b034c..e98f1b122b49 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2963,7 +2963,7 @@ static void __init init_no_remapping_devices(void) } #ifdef CONFIG_SUSPEND -static int init_iommu_hw(void) +static void init_iommu_hw(void) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu = NULL; @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) iommu_enable_translation(iommu); iommu_disable_protect_mem_regions(iommu); } - - return 0; } static void iommu_flush_all(void) @@ -3051,13 +3049,7 @@ static void iommu_resume(void) struct intel_iommu *iommu = NULL; unsigned long flag; - if (init_iommu_hw()) { - if (force_on) - panic("tboot: IOMMU setup failed, DMAR can not resume!\n"); - else - WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); - return; - } + init_iommu_hw(); for_each_active_iommu(iommu, drhd) {