Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp612301ybz; Wed, 15 Apr 2020 15:08:18 -0700 (PDT) X-Google-Smtp-Source: APiQypJ237cQSBVguDgI0DO0mkYoC/qenSeIvywK64UBMcvw0sCeEs72Yu3yz3c4jG+Of3fwR0RQ X-Received: by 2002:a17:906:164f:: with SMTP id n15mr6699213ejd.322.1586988497648; Wed, 15 Apr 2020 15:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586988497; cv=none; d=google.com; s=arc-20160816; b=qdpsv+IaOnduv8ZvIgDZ3qOlOMQIfnXNAMpzNPB3DK9ooRevJwlfYhjC7i1FneUr7p I750DqsoTf2OP7meJykUNo8Zr/EBLzvC65lsd9944N+XeAIV/DUZLRof0ia6+xEbXlv9 fe6vMKN6eto0dfkQjBYlx+rAhikAsCeDsd2hPb5JNqpyv88O3um5KgX3cFQ4gqYJ2ksW fvSrzKBILoyEEsgDk0dSRXRSXnXWCQpJmsaC2LTqeKreYH86o8eSJx6MF1layz5nj27I 7+vvZTjEIuLejwMiYRA9aUA9YtPFCoHltixfaBOY9J7Bk4SMP2ZUkaghN0a+me22XjZG 8YBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc:ironport-sdr:ironport-sdr; bh=oiVe5KX51LVEvN6B93VVuI4dNdHT2T3qyg24HcVU4CU=; b=MUI7yagwf6pPeQO4sNZU6BE0OgsYY4twkUdNQGGQfxlyaaAfTjaBjPOzEY0oDaoTl0 G4jl4ifgA2B63N5k3JNVm8cI1P0FfVI9YXzIC1ZjBdAQjm5QZB7MvB0pHHCZkpDLrKL7 SvasDymGFeVBQ+pAwSoJOn7nUe18vMwP46BM5zKP2t8ovjeyNiQPJsfGEfl+gleKmY2H gNBSroAJ5zlMjJ/rY3mCJ00YeMBRgMPgEAh+earG65UhwiHgIUCLh8sUtqWz0eqpDGDG ibkUBTKpkvqBMLhgZe5HSh/mgpQPCcw1pOHx++CSEWU6K89GXsvK/9MScpi44fQ8gTDY eprA== 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 m6si10741307eje.289.2020.04.15.15.07.54; Wed, 15 Apr 2020 15:08:17 -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 S2393483AbgDOGKX (ORCPT + 99 others); Wed, 15 Apr 2020 02:10:23 -0400 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 IronPort-SDR: dSuo3T3idle2qp5g+E3kGD33taojMR5EGDQKBaIbqVU7adnzVZJrO+9LVCrq+NBX8DHqhmJUnm iP7yDhogvvhQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 23:10:10 -0700 IronPort-SDR: Xrzeker15iDL0GxYgNylnyNCcgOHg/5LrDmSleRIXI69KwIrj67IOyQN42jm1/hyg4yAT+vZ4w my6GtVMJbzjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,385,1580803200"; d="scan'208";a="363586963" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.210.208]) ([10.254.210.208]) by fmsmga001.fm.intel.com with ESMTP; 14 Apr 2020 23:10:04 -0700 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 Subject: Re: [PATCH v2 13/33] iommu: Export bus_iommu_probe() and make is safe for re-probing 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 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 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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