Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2951550ioo; Tue, 24 May 2022 09:30:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzczj3qiENTr8o2inBDbHBgi9KwewGRSVMAM9a6pN2LlSULBb7OjieOifiNJkw2WsgEn1nQ X-Received: by 2002:a05:6402:d05:b0:425:b7ab:776e with SMTP id eb5-20020a0564020d0500b00425b7ab776emr29042305edb.142.1653409846511; Tue, 24 May 2022 09:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653409846; cv=none; d=google.com; s=arc-20160816; b=PRJ+3GzC3oN0qtj+Hk4l/PB13dn0qUAKCw7isZGIRO1p+M21uR0HD9a2GLgSebFDeB QznI/6JoFdBzZTJHnIQhILXaWav/QYz8I7D6yblOreTWLIpEzgYYJYLpAj0JKdXZ8C+o nAw540xmVFn5XIVdLQOGM3gDsnojLeEmK2/SmaTpNL5y2WtFmtAubU+GoACVIXAoZGtb llDuOr61SmtV3EfI13LHGfuL3M9EonlAEnsMiK7XEy5C4M5a9jr3JJ3858bRwxFiBvWQ ODIhVO/BPbrIGPVG22KsD6LqwbZKfvulqmUdNRWwlpa6yIUtfl/yZTd5svhtfXXhRHzV Ds5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eCjI61TxF/VhR4kH8WebLIwDAZqQH5lWWY5eksn1pk4=; b=cWtM2eO1kLUVbo5FCd95ARlYtIOkCzUlQtHr9h6+WpMZgj5qv7zlWhfrSUH9ddI6Pw HkZHZPX/vlsvrmL/31S0/cj9MFl6rSIqeh5r6l1rU7HtKpAvEql7NofGJtcOXFT4hzkv Uttf/sXR76e3DqjdkjeHEEQFBIKZd/Js0mbpAOTbU2DNSerMwyzfczTdmtjdVVM8sc5E 1nVaAurEbCqHbcSvG6zM7MrgWik3A2adCGKGrRZ6YzPgVDaaQdJ1W+Raq+Mk60GicH5e Z96/U/njcJ0mE+fnV6oxtLoiV/qb5D70OnJjyMC7Xp3MfIkP4L1n0f4fBb71GoldIMyy nieQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vv0TNhcI; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b006fe94f688d8si16031117ejc.928.2022.05.24.09.30.19; Tue, 24 May 2022 09:30:46 -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=@linaro.org header.s=google header.b=vv0TNhcI; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236328AbiEXK62 (ORCPT + 99 others); Tue, 24 May 2022 06:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233509AbiEXK60 (ORCPT ); Tue, 24 May 2022 06:58:26 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A6E68BD00 for ; Tue, 24 May 2022 03:58:26 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id o9so2681539wmd.0 for ; Tue, 24 May 2022 03:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eCjI61TxF/VhR4kH8WebLIwDAZqQH5lWWY5eksn1pk4=; b=vv0TNhcIJ4S4bv7c//57PxGJKqkVJwPgBpjuTOpLp+J5+358caS7gCJhwUY2f80H4Z Jgrh6OAVm1iAgDWdWVCBmf8NS9N7XjpDJ6LyhL3rzY3YxKDb44cHx8KemQcVBPkmexP6 9w5aUBbryD0GbFuSEpJEysh3VHFFpD4S1pKgJ4DkOaPQ5qigvL5UMaT2urRAxdsXUS5e FDpv5zmJ64vnO5oSkS9A5eO+xAvBWaSMvk5BwkPSfPrM8dzNi6LkjvMSn8+d2yjSpGlY 3XFx9G9TUqrsUeO/Fo1kcCoR108PWVQtJiYIH+d4lw3m7XUPjJxJVOl0qMIgwDtrsI/l VQ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eCjI61TxF/VhR4kH8WebLIwDAZqQH5lWWY5eksn1pk4=; b=6L9GmGZPkKww6mQDs46odWhpXcrUcKNK/++IZEQjJCBmCimFixuGQTShT1gDkhRtrM 1oW0GD/+vzT5V43JnYJcAxvTThaxDQKVxAHmmrIcdhjTSL8js17y2r/erZQAR5NnswVi UbLN5sxnbZrzkSJnGBQUMb0FHwRYx0smP7tyyxiUCiPzpObv6/py1XNW30sh9J5mYTf5 3D0dP57NkzmVw5+g25gC+7zI/Mfrta6vcCSvAZEhlPiiHdHKu6rUU7QPdq6bHPH4Qhmt hLvabGFmAb9+d7AY+lqkCZNsUh0WXCk50mFh3g+Edy6J7wNZM5SfHwEPJ2TQAWVYpQqa URTA== X-Gm-Message-State: AOAM530kCb9YH+53toOVPN0k0Ls+kvLML0M8WQN4OMKSPwH34wMFfBXP /JTNMMfPl5/NQpsHih8ggs9BIQ== X-Received: by 2002:a05:600c:29d3:b0:397:4730:ee75 with SMTP id s19-20020a05600c29d300b003974730ee75mr3185384wmd.149.1653389904595; Tue, 24 May 2022 03:58:24 -0700 (PDT) Received: from myrica (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id o16-20020adf8b90000000b0020fc3e24041sm10338214wra.106.2022.05.24.03.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 03:58:24 -0700 (PDT) Date: Tue, 24 May 2022 11:57:59 +0100 From: Jean-Philippe Brucker To: "Tian, Kevin" Cc: Lu Baolu , Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , "Raj, Ashok" , Will Deacon , Robin Murphy , Jean-Philippe Brucker , "Jiang, Dave" , Vinod Koul , Eric Auger , "Liu, Yi L" , "Pan, Jacob jun" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v7 06/10] iommu/sva: Refactoring iommu_sva_bind/unbind_device() Message-ID: References: <20220519072047.2996983-1-baolu.lu@linux.intel.com> <20220519072047.2996983-7-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Tue, May 24, 2022 at 10:22:28AM +0000, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Thursday, May 19, 2022 3:21 PM > > > > The existing iommu SVA interfaces are implemented by calling the SVA > > specific iommu ops provided by the IOMMU drivers. There's no need for > > any SVA specific ops in iommu_ops vector anymore as we can achieve > > this through the generic attach/detach_dev_pasid domain ops. > > set/block_pasid_dev, to be consistent. > > > + > > + mutex_lock(&iommu_sva_lock); > > + /* Search for an existing domain. */ > > + domain = iommu_get_domain_for_dev_pasid(dev, mm->pasid); > > + if (domain) { > > + sva_domain = to_sva_domain(domain); > > + refcount_inc(&sva_domain->bond.users); > > + goto out_success; > > + } > > + > > why would one device/pasid be bound to a mm more than once? Device drivers can call bind() multiple times for the same device and mm, for example if one process wants to open multiple accelerator queues. Thanks, Jean