Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1616949rwd; Thu, 1 Jun 2023 19:32:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4s/desQa+3uZsWFGhKgAWmemZlOAqG+Rg55F6gBaH1RYVOvh2obO8Ut6c7QwKxQVvm0+LX X-Received: by 2002:a17:90b:4d81:b0:256:cda5:c02a with SMTP id oj1-20020a17090b4d8100b00256cda5c02amr587115pjb.49.1685673168695; Thu, 01 Jun 2023 19:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685673168; cv=none; d=google.com; s=arc-20160816; b=O9O1yw9e1NWlF7Rc+o0pIGucn57ABzwVX0B/FdD+Sa/vjxjq0ibriiUZmDj0itmjWV EKeTL9pTTBZBBmR9wPabpB5CU+DSSPm13e5JZaAHHbOKWjc/DSEliOBQ9K9hqD1GIZcb Z785oGxMdcdvKKFup9q+VsOHPVJi4Rbd9Vsk5yg2L2QJS/7wP0nqdHP2iqrdDtdT/+kL bXtLcA+lkxpJd3e9erI6fb6v56AthwDAimvPJhh4VojhnTWMiByw7vXdPLqzoim1upq0 vL0u4EXWecA+OXul+YocBYzYPBe1KH3n36ywBOvxV30sLrj8yDlNdZpCtxipqSU8d9xY NCFQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a638648000000b0054033bf35ebsi170802pgd.771.2023.06.01.19.32.35; Thu, 01 Jun 2023 19:32:48 -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 S232160AbjFBCIf (ORCPT + 99 others); Thu, 1 Jun 2023 22:08:35 -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 ); 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 ; 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 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: X-Mailing-List: linux-kernel@vger.kernel.org dmar_reenable_qi() may not succeed. Check and return when it fails. Signed-off-by: Yanfei Xu --- 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) + return ret; + } for_each_iommu(iommu, drhd) { if (drhd->ignored) { -- 2.34.1