From patchwork Mon Jun 5 11:26:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yanfei Xu X-Patchwork-Id: 103213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2615112vqr; Mon, 5 Jun 2023 04:34:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VMMlGhGMUE7gjy1Tqj4miaQVzK8m8mi5FkmD+93szyFj9564z77V/MDxg38W0MXPoI3J1 X-Received: by 2002:a92:de0e:0:b0:335:6e5d:afb4 with SMTP id x14-20020a92de0e000000b003356e5dafb4mr16737403ilm.24.1685964878315; Mon, 05 Jun 2023 04:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685964878; cv=none; d=google.com; s=arc-20160816; b=kFSEQZzySfungekEVbWw4rFhg9fW3mFOkTzJ4FGr8odldRsw5lc235+cULzVEDCHl3 QjAaLt6RKiE3KRWOCotRw5Zj6kRi2gdxwKqNuTXEl4NQtI26ObDGlm2XzNBmOFm/P+q4 VXArZ2eJIayhZ2KNHyzwyZVwGYj1+FIXqMqhUu1Ska1Zt018u8kSsl4WimBgJX6JfNNS kO9V2/7GT4ud0h07ApH+BSwW44C02yrZE+KrjryVXGvFue/lV+dW2yP7lqSH2L/joW0I VLK7DCue7ItlVtFLynbhUlgtVOjGq3D5zKoorcQqVXA9ICd8lEWmZUo1BlhM4/6jDic6 sIHg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d190-20020a6336c7000000b00543c6a8c7c8si527565pga.583.2023.06.05.04.34.25; Mon, 05 Jun 2023 04:34:38 -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 S229570AbjFEL3z (ORCPT + 99 others); Mon, 5 Jun 2023 07:29:55 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767862308133686518?= X-GMAIL-MSGID: =?utf-8?q?1767862308133686518?= 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) {