Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5487186rwd; Mon, 5 Jun 2023 04:33:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52gsTp+H5knQ8sXj/t5VDqSC9HuExLx5CYufmRHND5B61gq8Q3vAj6yFcBPEgqMA7qC2lj X-Received: by 2002:a05:6a00:84e:b0:658:7f40:652 with SMTP id q14-20020a056a00084e00b006587f400652mr2422838pfk.20.1685964838344; Mon, 05 Jun 2023 04:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685964838; cv=none; d=google.com; s=arc-20160816; b=LbDCnhi6usk0yyoQD8f8A41W+pqcRXwBZcM7R0pXGtVM992Li5YrgfMlyff8aXKYtd NCkYuiqVAg9rrTCoGB8nhQVLa1Nhq/0zrbMVDRmkZrf4p3+oLKJdN+h03tCIpSl/KUoB 1kgJJfcaENjlPv/eyeOCAcCo4pIpClij6ldWTauCl15p8LnnOOtFY9ov1GFS+8L53Rqm aSv+taVm/H0yariQdSmkCOZkYg/2RvpvOi9+Z6EkdL99G82Ez7jOp+WVDTbjUdzKw3/s a6Ixwo+B9lLVdJ+p2q7aasiCtMvH0h0k+o9OizDmTtH3PPFnjCMZxro+zvRUKZPReZdZ xzbw== 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=c/9F+2IyhRU5KITHrvOLFwcmIfkutFv5VVsVTelJeAo=; b=YxHyqmd3PeR9s3vdsUqk2D7UGSV5KZ1NO8iP0SEKMcQFBeHuorWS3NlJtplBoDVQ1r YWZYDD/kzNgMq7wI/Wavd6uAeA975FmROMeG+gYHwrAEUrzJsYQWqo63MJRFbTEMxtZ6 CfaXRCEiz5T/hqOS/02oXfUgNgcRwv2HkiVxwKY+j/NK/viifygqJ5QC/zvdaVJSgnYi NYcQsow5yxUN/wqDs1Ja+liebWQc3J/Q7YsIjC5U9Xj0ziMvhcQ5zrqJOOEmL5lzaClc ioJiedMoT42vGoG2w4tfq61wDVt7Yk93XXHUrNy3WBPlg5GPxBh5CfcBxhB0YJRTfmCd Go0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F4qmDLin; 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 v191-20020a6389c8000000b0053ef14a4fe8si5302616pgd.446.2023.06.05.04.33.46; Mon, 05 Jun 2023 04:33:58 -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=F4qmDLin; 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 S232149AbjFEL3y (ORCPT + 99 others); Mon, 5 Jun 2023 07:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbjFEL3r (ORCPT ); Mon, 5 Jun 2023 07:29:47 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18376DF for ; Mon, 5 Jun 2023 04:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685964586; x=1717500586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xTKbEBDDCXHkiOwFc8keR7O1v8qG4g2CVMGkrh5HwGY=; b=F4qmDLinHiPUi1r4HMGClI4bzPYB+Idiyoie6zQ+StyadjzFnt507zoT ByhdC/xvn6WnMPXEmBr5FHaZFR94BRmzrXd6aE2LVzSqKoxB753EQ6JFJ J3araf93lCAoe39ah6s+y5QjRNp+JjvSCzgptwyUdCPfUeIKZFUR6LmwH rLONSxUgBH5uF3NrCKRjdRK2H8j9WiAItQDaiMfEcK67HzsAILVu3iev0 YUd+BoADalqgZ6xEeWI4jk3SoavhfzWK5IF/aY4KkW/twlQhO1CxCYCHo oyLu9UHYNZbN1yg8QbyPwzZaWkgVpXks/TgEb56PO5M+Fxi3b/slq7jFI g==; X-IronPort-AV: E=McAfee;i="6600,9927,10731"; a="336699349" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="336699349" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 04:29:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10731"; a="708626664" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="708626664" Received: from tower.bj.intel.com ([10.238.157.62]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 04:29:43 -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 v3 1/2] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Date: Mon, 5 Jun 2023 19:26:58 +0800 Message-Id: <20230605112659.308981-2-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605112659.308981-1-yanfei.xu@intel.com> References: <20230605112659.308981-1-yanfei.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 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 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 8096273b034c..c13c6475b626 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2967,10 +2967,15 @@ 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) { + if (iommu->qi) { + ret = dmar_reenable_qi(iommu); + if (ret) + return ret; + } + } for_each_iommu(iommu, drhd) { if (drhd->ignored) { -- 2.34.1