From patchwork Tue Apr 11 06:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 81783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2381338vqo; Tue, 11 Apr 2023 00:13:30 -0700 (PDT) X-Google-Smtp-Source: AKy350ZyoRCNFBjeoiaDPrxNoV1myMeyDPwpLLt+bxiEbQOY5gMx97MkyvqBm2wXCrhiUl/qZAbv X-Received: by 2002:a17:906:6447:b0:930:f953:9608 with SMTP id l7-20020a170906644700b00930f9539608mr11594748ejn.0.1681197210427; Tue, 11 Apr 2023 00:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681197210; cv=none; d=google.com; s=arc-20160816; b=IMC6DZMfXOHGxxsVQY53RMs0IATFUOWSdmEm2lyf4IH718i0Xkn6xT+Ay50sRN+eQC vKRm4NdYfnWkf4HtGeZCexMuEl7uyN46hlSC6emliI8/qYi2tGVfhdrLwQQCMQolPU6E EfoabvDJJhdN1AT6n/3mjrmYR3pv505dkR+FHNJkeDYyfOBNYcP7cTelSqru1UstvUmf wiLNI7oyZm+EpWNQuKK0wAerlckxs8jwegQvR2ugAFHNI5F8aD8rhUjwBJpTqKwXD9gO /hucHaWoIH718c5Atu6k/Xiw04iz30wgdSLFw3wBBivVANfKAFo2akYMX4Dk8kNTP8D+ Wf2Q== 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=mzPtakEcRhO3QOefmfwyhDEB1APQPoGBeKnI1gQUcvo=; b=I3+2chigXbYjCwtvbuW/QeAsBFgFDyD7uZahUk88dMoJTiQZ5heTF1iuKQdEkycC6h o+59B5g35pLxaX8XrcTIMBP5oo0iRdd4X0ytJtGYPQ+x5u6JQQYoN3TrcOsBpSRQdihb jPzOHlT/B+VK8fQ/h7u7VNjl52ip3yZ/UKUuep99+4siDS7F79h2cBaAr/7h7yFKqB2e 0chqNRRaswEExfX0rEQp4trZgt+RMcxZc7XNzxbqIHoLroRx/KXgcLwKMHj/FntfwW/p f1VWK//YSiEpdy9yDHaR6Hdso0L9jdXvVhoG8m8CPsvWHjqSU5fQB21lh200ouvlIPUN FBKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="NJ7+aF/K"; 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 j18-20020aa7c0d2000000b005002e947c3fsi8078120edp.119.2023.04.11.00.13.05; Tue, 11 Apr 2023 00:13:30 -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="NJ7+aF/K"; 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 S230469AbjDKGvC (ORCPT + 99 others); Tue, 11 Apr 2023 02:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbjDKGuj (ORCPT ); Tue, 11 Apr 2023 02:50:39 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A0340FB for ; Mon, 10 Apr 2023 23:50:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681195806; x=1712731806; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n8EBKPy48sTV6ZkkN0Av9i1KZOvW3Gj5TdFWIOX431s=; b=NJ7+aF/Ko46KeXHGCNniHLhGa0y4cNbYp3EM0cM60iB9owfAecD65g1h c++gpGjNZjN//F222LPSwh/p5WqEyNK/AXyrJ6UMq1SWDEM+y0WyrXz2H awRmcav2I0cFu/GVSIk5/w8YsAekenKruCJigr5BQjS9dCAlvkF0bi4Cc XAXeLMmTSzlF7tyMs74HzV/JtEPFQzUxnkYC06D8Da/105hc3fzKVAWWC 5ygkjal+j08JysmoLo4nPpbIwajuLjZm7orDm8mciEDg3Ck0Q3w3aSCce mPK0GmjYoOtj23aFp+FaDy3PRIDQuLdF9LzrWxGwk5XGCv0iZRP1bgwg3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="341028622" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="341028622" 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:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="1018256637" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="1018256637" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 10 Apr 2023 23:48:40 -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 14/17] iommu/vt-d: Remove BUG_ON when domain->pgd is NULL Date: Tue, 11 Apr 2023 14:48:12 +0800 Message-Id: <20230411064815.31456-15-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?1762863045800374493?= X-GMAIL-MSGID: =?utf-8?q?1762863045800374493?= From: Tina Zhang When performing domain_context_mapping or getting dma_pte of a pfn, the availability of the domain page table directory is ensured. Therefore, the domain->pgd checkings are unnecessary. Signed-off-by: Tina Zhang Link: https://lore.kernel.org/r/20230406065944.2773296-5-tina.zhang@intel.com Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index dd61bb554aa7..f11347a590d7 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -915,8 +915,6 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, int level = agaw_to_level(domain->agaw); int offset; - BUG_ON(!domain->pgd); - if (!domain_pfn_supported(domain, pfn)) /* Address beyond IOMMU's addressing capabilities. */ return NULL; @@ -1910,8 +1908,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain, pr_debug("Set context mapping for %02x:%02x.%d\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - BUG_ON(!domain->pgd); - spin_lock(&iommu->lock); ret = -ENOMEM; context = iommu_context_addr(iommu, bus, devfn, 1);