From patchwork Tue Apr 11 06:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 81770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2373459vqo; Mon, 10 Apr 2023 23:55:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9oofW9MQg39Um2u4yGuynGFU/NvAq2T9eaqVF3R7LFUYSeBfX4mXaRi+aqiWiptDxoGw2 X-Received: by 2002:a05:6402:1908:b0:504:77ed:5a33 with SMTP id e8-20020a056402190800b0050477ed5a33mr12967161edz.8.1681196148618; Mon, 10 Apr 2023 23:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681196148; cv=none; d=google.com; s=arc-20160816; b=dE4Oxoj+Epb7VQLhdYpZWoWV1KwFQNc/J+F2xOl3C0QVfNO5Aoi+ECDEgDVg8MCzsj wMbosaCPWTfiFDN4KFSF1LiSRfb7O4H6UMPs0YBhBjKmiLxxN9DS6ju8P+htzpuYtz6N IDJlE3HZmYJ7Qse3m2mobV9lGU9/aSiAQDJlor99nu08y1wbpuZkwy0JV4ZU7UqwR1cm B4FgR4KkA+T1tVSokhRuYuFGCTO7+6N8tmbexFNdQucoKOaQVmcPhuUR3jRUh/T5beLj Hboi6SatB8Oeujq0n6sQmcO/hF0LNxuZfeJz7eX3RoOpnVTcwasw2D4LbFFEjr6Iu0yH XQjw== 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=da+sWeatrPMJqe/nMXibACnGC0HtDx0V9Zj/9Kbs5Q4=; b=xVF/cOBghAfW1zJ3E3vizIE5e10jvi5PBLKtImzkLmhBwxzf4AbFwtKT2y3yrv9Ids YiuMPHFKfPo3+pTW1V2CYmHAtRU7lGsq0EPV8HCjYTToEFybkyzyr2B4Ds35rpJG91uB w9/Eph+IVhzhskkkT3Xyul8/gd29s1dagcmkD8xNAW5J802ahJwBTm30o124TgYQlK9x lo3V/C8U1hOGWGV+7RcgKK+w2i8uDckVL55XhhrJf19j3FZYAjkUoH8/pmgK8Dstc+jF vnVUvflU6Vos7Q1ykvkNb2RgwbzNVZKiZl6+rkuNbMO15dGmtQY1kxdrJen4sySCui0R 9dsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CoH5ldwt; 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 be15-20020a0564021a2f00b005048bdaa403si6543668edb.655.2023.04.10.23.55.24; Mon, 10 Apr 2023 23:55: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=CoH5ldwt; 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 S230456AbjDKGu7 (ORCPT + 99 others); Tue, 11 Apr 2023 02:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbjDKGuf (ORCPT ); Tue, 11 Apr 2023 02:50:35 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51A1C40C6 for ; Mon, 10 Apr 2023 23:50:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681195803; x=1712731803; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KoxeI8nGmhipdmhbf/hPatJykHf7P/Wr8q6XOawTXGM=; b=CoH5ldwtPZlPsq7JtPndgdle83aQ/P1RObsbKMqcXrS4Yd5YdT8nZ816 5o3YebNu/7KbDLlNydz3TFtGlRK3cEo+5ffopPBx9gjOfVfdWYJRXe0QA 0OY3+5qotXpZgvPUNC7Bis2oeiVnGRUnlX4A0ERriBknminZQeGaSBG6o TFfA2+4Ij4sCjrNoUSznP6Fmr2jr9n+6LLnSrrb1SVM5yJMTFK7srP2T6 7cFL+5MiqVZ1Srq5G2WEiNzZ+SPUQ8GUg3pp8FXyMQ4tg7dx7kYjLKR2h qWjkFS8v01V5IwYToQlAQDUlY6WI28t9RxAMJ3npaL8+G1m+B1pGP7pNX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="341028616" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="341028616" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2023 23:48:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="1018256633" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="1018256633" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 10 Apr 2023 23:48:37 -0700 From: Lu Baolu To: Joerg Roedel Cc: Vinod Koul , Tina Zhang , Jacob Pan , Christophe JAILLET , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 13/17] iommu/vt-d: Remove BUG_ON in handling iotlb cache invalidation Date: Tue, 11 Apr 2023 14:48:11 +0800 Message-Id: <20230411064815.31456-14-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411064815.31456-1-baolu.lu@linux.intel.com> References: <20230411064815.31456-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1762861932552479593?= X-GMAIL-MSGID: =?utf-8?q?1762861932552479593?= From: Tina Zhang VT-d iotlb cache invalidation request with unexpected type is considered as a bug to developers, which can be fixed. So, when such kind of issue comes out, it needs to be reported through the kernel log, instead of halting the system. Replacing BUG_ON with warning reporting. Signed-off-by: Tina Zhang Link: https://lore.kernel.org/r/20230406065944.2773296-4-tina.zhang@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 c4847a5aaf52..dd61bb554aa7 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -1272,7 +1272,9 @@ static void __iommu_flush_context(struct intel_iommu *iommu, | DMA_CCMD_SID(source_id) | DMA_CCMD_FM(function_mask); break; default: - BUG(); + pr_warn("%s: Unexpected context-cache invalidation type 0x%llx\n", + iommu->name, type); + return; } val |= DMA_CCMD_ICC; @@ -1308,7 +1310,9 @@ static void __iommu_flush_iotlb(struct intel_iommu *iommu, u16 did, val_iva = size_order | addr; break; default: - BUG(); + pr_warn("%s: Unexpected iotlb invalidation type 0x%llx\n", + iommu->name, type); + return; } /* Note: set drain read/write */ #if 0 @@ -1483,7 +1487,8 @@ static void iommu_flush_iotlb_psi(struct intel_iommu *iommu, uint64_t addr = (uint64_t)pfn << VTD_PAGE_SHIFT; u16 did = domain_id_iommu(domain, iommu); - BUG_ON(pages == 0); + if (WARN_ON(!pages)) + return; if (ih) ih = 1 << 6;