Message ID | 20230602020520.224465-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 k13csp757981vqr; Thu, 1 Jun 2023 19:59:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ElFSQJfz/2KBmbWwNcOotmpCr3R28+v9eVtoAbz8OyldGVxL4Ob5l9yQWOsORVz4Xmo9b X-Received: by 2002:a92:cc01:0:b0:33a:5ec7:e07f with SMTP id s1-20020a92cc01000000b0033a5ec7e07fmr7218078ilp.5.1685674747061; Thu, 01 Jun 2023 19:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685674747; cv=none; d=google.com; s=arc-20160816; b=U6Ay3yUSsx0CqbRe6CfI/HktEgb2f95RScMqAc/kT5F+nwCgXziLweFsk5GR1JCGYw bw6jwfo860KPEazmAh8bnKtCDzFf4M3IKe5OXau5JB34v1h6rs7a3en5l3vKyPT34Udp sjJHJScHcTGAsbH4BUsdZlxtMG0DF9Q2vjwIYsIOngYx7r0SyQq7Uw4WIr5c5vF3AXs+ AmBd26FIRWGo19xWzSp+rQTRhwafM5KVTKlt5JZllxYgE/SXt/iY2dAHFk47PB2HNHsk ksGvYMV1GYTkgX21f/NQYEs9MLpNk19ZLqpIDpmA351QqkmuNNwXcYOPtanhAeiIvciF +PAg== 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=nMSpTpmLir6NsrasYp0i4tQrFAZY+I9Vu9ZHUn/U3F4=; b=vHPPHkSr9xzKAj+xoXUUMFZKm/NTdoAlAn59fPldTXwPx2cuAGMe0d/jtOm0xAOPM7 v7jf41i6omI4OFPnLcJED7pjClnF06H1yumSrcMkzLmB36RaQY2G3FCR+k6XoocFF6v7 7dvfitxyR+LqCtex55N2Z+3BOBhbi24OR2odSQsOQf+gc22ZSs5BC0rFRWq5u+VLiUPy DEG0cnLldizIVX2KWjV6tJfevapD1pd2i8iypb8smc3soa84BWQLJRw5dqF1Oq17SnVy aUeD8hwR1ms/V3WNZDMFLmLxX7TraU0a5c+ENlNJlEB6es3/tSjbpKRKQ8bzupBQIhnA CmnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JvCysEE6; 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 g4-20020a625204000000b0063a6dbeaa56si20782pfb.60.2023.06.01.19.58.54; Thu, 01 Jun 2023 19:59:07 -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=JvCysEE6; 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 S233452AbjFBCIg (ORCPT <rfc822;limurcpp@gmail.com> + 99 others); Thu, 1 Jun 2023 22:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233340AbjFBCId (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 1 Jun 2023 22:08:33 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585D4180 for <linux-kernel@vger.kernel.org>; Thu, 1 Jun 2023 19:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685671712; x=1717207712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JEJ1L3fbLIKfs8vDviE5ZoWgHo3ib3dTNshAkV9bzsg=; b=JvCysEE68GeseskCo0qc0y6LVQfrBG47NEVEfOICGRbJ4J6W3tFkWlBV OwcQm5IMz3OL3r/W/PNjd23NS7CIB9txgunRoZ7cYQTy/JCdDh0t4WOEY QLDCGTqmx92d7AqrjMpmdtIZgZQ5bhYvF2a/9/I5XArUwEsp3QLAAf87B t8DQfQwLOGYMHV3DItwctG1zkzz5I2q5t6ZKDb0bxnCYlcgKdXDFXfR1L D1LykknocDXoMyrESt/SINIpiaqIBX5aZ+blksslvcBBXZ24Pwktfc9FC 3Gxy4qlbLq935IRZQiEwiXpUSTbcntM824etgBnsZCzwskVSroy3e57b5 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="359039378" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="359039378" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:08:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="777457812" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="777457812" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 19:08:22 -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 v2 1/2] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Date: Fri, 2 Jun 2023 10:05:19 +0800 Message-Id: <20230602020520.224465-2-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602020520.224465-1-yanfei.xu@intel.com> References: <20230602020520.224465-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, 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?1767558083677010060?= X-GMAIL-MSGID: =?utf-8?q?1767558083677010060?= |
Series |
Misc cleanup for iommu/vt-d
|
|
Commit Message
Yanfei Xu
June 2, 2023, 2:05 a.m. UTC
dmar_reenable_qi() may not succeed. Check and return when it fails.
Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
---
drivers/iommu/intel/iommu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
On 2023-06-02 03:05, Yanfei Xu wrote: > dmar_reenable_qi() may not succeed. Check and return when it fails. > > Signed-off-by: Yanfei Xu <yanfei.xu@intel.com> > --- > drivers/iommu/intel/iommu.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index 8096273b034c..e9188d045609 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -2967,10 +2967,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) Nit: either this should be inside the previous condition, or you need to initialise ret to 0. Thanks, Robin. > + return ret; > + } > > for_each_iommu(iommu, drhd) { > if (drhd->ignored) {
On 6/2/2023 5:27 PM, Robin Murphy wrote: > On 2023-06-02 03:05, Yanfei Xu wrote: >> dmar_reenable_qi() may not succeed. Check and return when it fails. >> >> Signed-off-by: Yanfei Xu <yanfei.xu@intel.com> >> --- >> drivers/iommu/intel/iommu.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c >> index 8096273b034c..e9188d045609 100644 >> --- a/drivers/iommu/intel/iommu.c >> +++ b/drivers/iommu/intel/iommu.c >> @@ -2967,10 +2967,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) > > Nit: either this should be inside the previous condition, or you need > to initialise ret to 0. > Oh, you are right. Will correct it. Thanks, Yanfei > Thanks, > Robin. > >> + return ret; >> + } >> for_each_iommu(iommu, drhd) { >> if (drhd->ignored) {
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 8096273b034c..e9188d045609 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2967,10 +2967,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; + } for_each_iommu(iommu, drhd) { if (drhd->ignored) {