Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6689780pxv; Thu, 29 Jul 2021 23:11:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLLdnbeJJmOeCC3Q3m/qu/EXntkASjx0EerVxeQDM0fhu1ZJRY1zAjB9BAXliO1nvHLxh0 X-Received: by 2002:a5d:878d:: with SMTP id f13mr20619ion.83.1627625500672; Thu, 29 Jul 2021 23:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627625500; cv=none; d=google.com; s=arc-20160816; b=c10l3WmYSFrS2F6q4K7FYjK5pY7ItE+WqsMkgDlHjP83XX952/8dDl7wwqE6+rAVSM 4MY85KC3HSEs5La8ql5JEP3Xq/8OYWiq4LcrtGw1AVO818INMbYKqv8kIi+FxcQFv/Y+ KollVFHLtX6LxBkOHRCdNIUmT4OCQXV+LVwdRKUZDB+v9afHmhcMAM6AgwJyd22v1ExP LGRNiXtBtvDZjFGt26JQm51clkmmjfvDYwREr7PL4cIGGEaot/XtxLBtIY8cma62m54J JyLit9GK7ZMVTVl09r/iNdKuLjztffxq9hHpR+4TjZ4kQdfSsI45telQpu0TXJjI2xMy BjRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc; bh=gk+GxgtodsJUUXTj4rWsTKN+5bmzUQ8Kpsbg62p3IOI=; b=OEsJp9NBFp1L/jBRNwq1SXUYnFu3pcN5Pw1/pJqECqtmBvRV+m+G+GzTqeYaghFtrW yL4JQUFNPXyh1ac3pbwZ1ex6WU2iKP9v+DomdbPoDk7dRYj+T4N/k9wSJ7HoDPIE+wxm LQUo7T2DfOc1tjk06J5e+9g7BOWHTszNuefC2quFAi8AALfFSkMfnx4bWwZxBVF3PfhF yEFdpauRiwAsIHmBM/hM+pymmgqX0NG10M2wIc7BofRHsgNHHa6yIgLtpBe7SIKlSwqC j5CeofGFhknLzrwXMzGbDWYlwoPaZz0pUEsyKsbUHQtDRPDfyMCGAuw9Sb2B9UdAaYeJ 68Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si754874iol.91.2021.07.29.23.11.28; Thu, 29 Jul 2021 23:11:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237268AbhG3GK1 (ORCPT + 99 others); Fri, 30 Jul 2021 02:10:27 -0400 Received: from mga12.intel.com ([192.55.52.136]:61346 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbhG3GK0 (ORCPT ); Fri, 30 Jul 2021 02:10:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="192633733" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="192633733" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2021 23:10:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="465344879" Received: from allen-box.sh.intel.com (HELO [10.239.159.118]) ([10.239.159.118]) by orsmga008.jf.intel.com with ESMTP; 29 Jul 2021 23:10:19 -0700 Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, suravee.suthikulpanit@amd.com, john.garry@huawei.com, dianders@chromium.org Subject: Re: [PATCH v2 13/24] iommu/dma: Remove redundant "!dev" checks To: Robin Murphy , joro@8bytes.org, will@kernel.org References: <200af1d10b493a90aada6466b1f1938e1b16731f.1627468309.git.robin.murphy@arm.com> From: Lu Baolu Message-ID: <32647590-5957-5a54-71ed-fa6e6f2b1a5b@linux.intel.com> Date: Fri, 30 Jul 2021 14:08:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <200af1d10b493a90aada6466b1f1938e1b16731f.1627468309.git.robin.murphy@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/28/21 11:58 PM, Robin Murphy wrote: > iommu_dma_init_domain() is now only called from iommu_setup_dma_ops(), > which has already assumed dev to be non-NULL. > > Reviewed-by: John Garry > Signed-off-by: Robin Murphy > --- > drivers/iommu/dma-iommu.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > index 10067fbc4309..e28396cea6eb 100644 > --- a/drivers/iommu/dma-iommu.c > +++ b/drivers/iommu/dma-iommu.c > @@ -363,7 +363,7 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, > > init_iova_domain(iovad, 1UL << order, base_pfn); > > - if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) && > + if (!cookie->fq_domain && !dev_is_untrusted(dev) && > domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) { > if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, > iommu_dma_entry_dtor)) > @@ -372,9 +372,6 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, > cookie->fq_domain = domain; > } > > - if (!dev) > - return 0; > - > return iova_reserve_iommu_regions(dev, domain); > } > > Reviewed-by: Lu Baolu Best regards, baolu