Message ID | 20221128064648.1934720-11-baolu.lu@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5475329wrr; Sun, 27 Nov 2022 22:57:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ubr3YumCsuovHASY4a4KtDxofLs/pR3kMx9S+pey51I6xz6TDa+WsTruhi/ww66BPYaus X-Received: by 2002:a05:6402:4c2:b0:461:3ae6:8bf2 with SMTP id n2-20020a05640204c200b004613ae68bf2mr30027475edw.396.1669618666699; Sun, 27 Nov 2022 22:57:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669618666; cv=none; d=google.com; s=arc-20160816; b=tqYPal5k98YnoDasopVAcXAWd4WieR2mhyesnzUapl+rGmlotM6deBEdKNZPRy5QHq wHQ9c9yNlPjC6wplft8qoy95NGbZFUkfmLiGz9no8jz1E/Llo+FuXCE9jqZuaZS/5qGU Cus0CoqI5yAJ3D5DwH3I4ygV5vrk8XVWO6OK/dZJDa2qKxIU1PSzdeUksmREOMEqv/ui ssrt3+6+vWIBoXnQtyn7endH46/jPp3ayBFDOCbu1ojQY9qzWSAPGSRDlQRDfk35Do62 KdpAG9yKRo1CBLIlFlyHE7wiQmrGwbAGfkn+PpntwUKGsw0tozSHZMNf+m4YLgdyvHig yUSg== 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=WnL9ypTZL6P60VJ45M82kVDBIe6WslMmSb2j27US2Kw=; b=pAOJMyb/evC3n5yXbgZgTi/xp2mL1Fnqbic7JiEC5sVznvzXfD/ANnD1ZxvVsUkPXR 3sCQXl23yai8PKa+vrSP9bvvvyVLZ8uU7GHdUfRXA8o8xgXod03fGbIT8bnVN7XdOeaL oiAE7GEFkxCFgsiUVYKcd3XnJdkT8QXJY05UIvXkDCxfOKtUZKSj1DpSBUOULnTZGcNk HKCZLUV7Do3iNpswm2cFh0MbvJtSiblzv4uJg7Ry9UCDdX3zH0pK59gmPgPD0oX7P6hv J4zVjzk0+A08XMHaoWyue5IL5QDoKeREOJ/VCSIXVbXLdqnwM8vJnuwlYzSUN4p4G7o1 BdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eacNunm3; 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 y13-20020a50e60d000000b0045b265a1712si8235248edm.595.2022.11.27.22.57.23; Sun, 27 Nov 2022 22:57:46 -0800 (PST) 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=eacNunm3; 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 S229662AbiK1G4H (ORCPT <rfc822;gah0developer@gmail.com> + 99 others); Mon, 28 Nov 2022 01:56:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbiK1Gzo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 28 Nov 2022 01:55:44 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8471572B for <linux-kernel@vger.kernel.org>; Sun, 27 Nov 2022 22:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618525; x=1701154525; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PhxHKh8gGEUFxS7QMyT5AZD9ZvqhOGgKls6j0D/stek=; b=eacNunm3Z60WklM5QOyJxZMrGGv24pVRHC9hKgRCR7xWp0Q5M/Xv8oXK 4mI7bpuZm5n0UYd9GbT9Adl2r5XLOA17g2fSc4GMzstx+tAleElhcwEVQ 5bngJM5ueh5AEREQf1yBxlCUfT4fzk7QpYqeS+yezbIU0tUWVXdv1LXjW EcTy+K1pWMnhagekeQpkf0FTNJXsgbrQrhpm5CbKy1SDwvXvS3Bz17Mu6 TGknE/HQdq4HhrVLpMJXaTHE2MswZ67euljt4MzwhgGM5i6JbqOW0UyON XrjuGy2ZgdhuE+SjBAwsAT4cWK7KmjBmKLfCuwbswUmZKKpZR/RcH5Atv g==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395062" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395062" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120967" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120967" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:08 -0800 From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>, Christoph Hellwig <hch@infradead.org>, Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Jean-Philippe Brucker <jean-philippe@linaro.org> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>, Rob Clark <robdclark@gmail.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Yong Wu <yong.wu@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, Heiko Stuebner <heiko@sntech.de>, Matthew Rosato <mjrosato@linux.ibm.com>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com>, Chen-Yu Tsai <wens@csie.org>, Thierry Reding <thierry.reding@gmail.com>, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> Subject: [PATCH v3 10/20] iommu: Add set_platform_dma iommu ops Date: Mon, 28 Nov 2022 14:46:38 +0800 Message-Id: <20221128064648.1934720-11-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750722063250699983?= X-GMAIL-MSGID: =?utf-8?q?1750722063250699983?= |
Series |
iommu: Retire detach_dev callback
|
|
Commit Message
Baolu Lu
Nov. 28, 2022, 6:46 a.m. UTC
When VFIO finishes assigning a device to user space and calls
iommu_group_release_dma_owner() to return the device to kernel, the IOMMU
core will attach the default domain to the device. Unfortunately, some
IOMMU drivers don't support default domain, hence in the end, the core
calls .detach_dev instead.
This adds set_platform_dma iommu ops to make it clear that what it does
is returning control back to the platform DMA ops.
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
include/linux/iommu.h | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Mon, Nov 28, 2022 at 02:46:38PM +0800, Lu Baolu wrote: > When VFIO finishes assigning a device to user space and calls > iommu_group_release_dma_owner() to return the device to kernel, the IOMMU > core will attach the default domain to the device. Unfortunately, some > IOMMU drivers don't support default domain, hence in the end, the core > calls .detach_dev instead. > > This adds set_platform_dma iommu ops to make it clear that what it does > is returning control back to the platform DMA ops. > > Suggested-by: Jason Gunthorpe <jgg@nvidia.com> > Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> > --- > include/linux/iommu.h | 4 ++++ > 1 file changed, 4 insertions(+) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> > + * @set_platform_dma: Returning control back to the platform DMA ops. Only > + * valid for IOMMU drivers which don't support default > + * domain. I would add: This op is to support old IOMMU drivers, new drivers should use default domains, and the common IOMMU DMA ops. Jason
On 11/28/22 10:11 PM, Jason Gunthorpe wrote: > On Mon, Nov 28, 2022 at 02:46:38PM +0800, Lu Baolu wrote: >> When VFIO finishes assigning a device to user space and calls >> iommu_group_release_dma_owner() to return the device to kernel, the IOMMU >> core will attach the default domain to the device. Unfortunately, some >> IOMMU drivers don't support default domain, hence in the end, the core >> calls .detach_dev instead. >> >> This adds set_platform_dma iommu ops to make it clear that what it does >> is returning control back to the platform DMA ops. >> >> Suggested-by: Jason Gunthorpe<jgg@nvidia.com> >> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com> >> --- >> include/linux/iommu.h | 4 ++++ >> 1 file changed, 4 insertions(+) > Reviewed-by: Jason Gunthorpe<jgg@nvidia.com> > >> + * @set_platform_dma: Returning control back to the platform DMA ops. Only >> + * valid for IOMMU drivers which don't support default >> + * domain. > I would add: > > This op is to support old IOMMU drivers, new drivers should use > default domains, and the common IOMMU DMA ops. Done. Thank you! Best regards, baolu
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 68d7d304cdb7..3542461558fa 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -223,6 +223,9 @@ struct iommu_iotlb_gather { * @release_device: Remove device from iommu driver handling * @probe_finalize: Do final setup work after the device is added to an IOMMU * group and attached to the groups domain + * @set_platform_dma: Returning control back to the platform DMA ops. Only + * valid for IOMMU drivers which don't support default + * domain. * @device_group: find iommu group for a particular device * @get_resv_regions: Request list of reserved regions for a device * @of_xlate: add OF master IDs to iommu grouping @@ -251,6 +254,7 @@ struct iommu_ops { struct iommu_device *(*probe_device)(struct device *dev); void (*release_device)(struct device *dev); void (*probe_finalize)(struct device *dev); + void (*set_platform_dma)(struct device *dev); struct iommu_group *(*device_group)(struct device *dev); /* Request/Free a list of reserved regions for a device */