From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com ([134.134.136.31]:20146 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731298AbgDOGKV (ORCPT ); Wed, 15 Apr 2020 02:10:21 -0400 Subject: Re: [PATCH v2 13/33] iommu: Export bus_iommu_probe() and make is safe for re-probing References: <20200414131542.25608-1-joro@8bytes.org> <20200414131542.25608-14-joro@8bytes.org> From: Lu Baolu Message-ID: <1853992c-47a6-3724-812c-a52558c13732@linux.intel.com> Date: Wed, 15 Apr 2020 14:10:03 +0800 MIME-Version: 1.0 In-Reply-To: <20200414131542.25608-14-joro@8bytes.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel On 2020/4/14 21:15, Joerg Roedel wrote: > From: Joerg Roedel > > Add a check to the bus_iommu_probe() call-path to make sure it ignores > devices which have already been successfully probed. Then export the > bus_iommu_probe() function so it can be used by IOMMU drivers. > > Signed-off-by: Joerg Roedel > --- > drivers/iommu/iommu.c | 6 +++++- > include/linux/iommu.h | 1 + > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 834a45da0ed0..a2ff95424044 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1615,6 +1615,10 @@ static int probe_iommu_group(struct device *dev, void *data) > if (!dev_iommu_get(dev)) > return -ENOMEM; > > + /* Device is probed already if in a group */ > + if (iommu_group_get(dev) != NULL) Same as if (iommu_group_get(dev)) ? By the way, do we need to put the group if device has already been probed? Best regards, baolu