From patchwork Wed Jun 14 02:47:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 107678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp964035vqr; Tue, 13 Jun 2023 20:02:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HdZstaB0AXU3mlxHmi7ya7zF+Ki388R4doBMkGZN8GUgdffvJuj2jwaHddr2HUYuaqSkM X-Received: by 2002:a17:906:ee86:b0:978:9223:6630 with SMTP id wt6-20020a170906ee8600b0097892236630mr13634098ejb.37.1686711749982; Tue, 13 Jun 2023 20:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686711749; cv=none; d=google.com; s=arc-20160816; b=GfR9GorOI8LvGaX1pCQkgUCBwZNGDUGEYKx3gxfnBF8SId+zk18gPbmgP/GMjnQI35 cTm4aG2OIeh0uPLQhrXrXTjHkTlMacj18n6inXS0ersv9CCqEF/q53Ebl1MTExfwmKa/ YCgTddcShks68wAhKRGypzgph8jaeaRj/5GtGOiaSaeuAVHgvsWaIyBgCaroWRKZCgK1 hpiHLrKpMgHB2++yGAKbJnE/S5CmupFv5K5clZLkdjvfqkua0SMY58F2N8+f9b2D4gUx HqBgs/VdCFnV9vEdbEb+ki1OKdtxweWqTeQ5sIfgkATGqI+1Aj2xPDtqzKQA/clRgbjb Fi5A== 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=R9h0at6WksPwSquZi2y6l+2TO+C4ZJ0Rt4Yuidyg8ac=; b=KtBXUkF7foqVocYuDDMdlupS0K00VDr9B8NLSGkXk2ClN5KgCVV1+63UXnxrcdlw01 Qqb2YiFRUx/3wnBT4JIwNSsC69Hr/jRTQSWPGz5/rWCSiaSeiM484luTUzwZUiybMSH+ IEk9e1IQ+YmfYAfyH2KEC/m23k724o8aJYrtdyX7029p/QDZJ9tvm56+U8S7prZ3joD/ 65tjwxx1vuH1O8EwuZKT5F+PNSdWIzjy9EMOFTcFFFsExAHe/4NfJnKjnMjIRuA5/SjW nteAUBDod33ipG+4OdVgwpqhTMs9VYNV9TzYNpfa3/0iixebQ6KvIqMkn18d7aEjshla 0rcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gGdyfAl9; 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 g15-20020a17090613cf00b00977cccbbaaesi7503311ejc.966.2023.06.13.20.02.04; Tue, 13 Jun 2023 20:02:29 -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=gGdyfAl9; 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 S241706AbjFNCtH (ORCPT + 99 others); Tue, 13 Jun 2023 22:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242329AbjFNCsp (ORCPT ); Tue, 13 Jun 2023 22:48:45 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7D01FFB for ; Tue, 13 Jun 2023 19:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686710899; x=1718246899; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1Kwv1UQHKRHrV8kbWrew4OGtdP1EEr6az2+Laq0Cs7w=; b=gGdyfAl9EuQOf2ibGWoHN2TA8KPQH1DBeu5qIRxTjFy5jxayKerF90qU 7c11gD3BoMx+5koNzfVLqBnWv37eeFoIge4rhjNOqAOM8QqGL4KuuxQLf rjpGmBvweF2faVr9WMMCfLRLL65ouna/S50+88kUrNnTFCGxQJkMVR9hg Di5QXpdfpQOh5G63GHy48R0otLtZMnaIzUt09yZ4FB0KrCi5F9V5Oap8j zPvzN51XGkMrqtrZDfIzh0rToKOZ3wK6xkZ8dgXoEuuylB6M0lOWSCGgr BEyIoiFrFqfEGWcAb6jMR6E5I0zVFmDsP0MntIQvOkB2tu1OVhVYbjJKi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="348164455" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="348164455" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 19:48:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="711884198" X-IronPort-AV: E=Sophos;i="6.00,241,1681196400"; d="scan'208";a="711884198" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orsmga002.jf.intel.com with ESMTP; 13 Jun 2023 19:48:16 -0700 From: Lu Baolu To: Joerg Roedel Cc: Yanfei Xu , Suhui , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Date: Wed, 14 Jun 2023 10:47:03 +0800 Message-Id: <20230614024705.88878-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614024705.88878-1-baolu.lu@linux.intel.com> References: <20230614024705.88878-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768645459925893957?= X-GMAIL-MSGID: =?utf-8?q?1768645459925893957?= From: Yanfei Xu dmar_reenable_qi() may not succeed. Check and return when it fails. Signed-off-by: Yanfei Xu Link: https://lore.kernel.org/r/20230605112659.308981-2-yanfei.xu@intel.com Signed-off-by: Lu Baolu --- 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 323fa1a93765..e83fe243680b 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) {