Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5947352pxb; Mon, 14 Feb 2022 11:24:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpcoL1aYaBSWI18CjqhFyQTU/bJuWZaTMilMODuxYfkJ0XhsatJ9GnBcHI8bCmsqh+q4P3 X-Received: by 2002:a17:902:7ec8:: with SMTP id p8mr224511plb.165.1644866643427; Mon, 14 Feb 2022 11:24:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644866643; cv=none; d=google.com; s=arc-20160816; b=xUOicPz1VuPpRbMbS7G+Er0DPpCowuj0j8X/nn4dT1YiYNfHRvaFSGAV6JDzSS7md2 AJj/w0XDeVUAfFuXu6kmw6+sIQyaRFBBIyGHgaqho30YWtTslYJoKJg1Vy789VKBamwm JmItSpemhSlv7SrSbphsqdy9ay4fvsGI8hD1Lg8JTVkqvijIWpDIO4y6gxawDovLhVoT tEA3zxg/PyR1/D1WVShywR4/fLjkW34ZX/H29BKR0WFO2n5BjSY1of/Y0J3a33mqXrGv HnNiM6XdIh/SNLUuzyXnf4oTjPqyI54eADzI+Zk/YZtO6wiyzJlw52V7rq4p2fSEy6fN 0qTw== 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; bh=vP1O5ZY0Onh1BpimaTvvYNfZo71qLJyy4Al89vjeKvk=; b=ohWrugco9HoA6LKV0ZB9paQWAnqbShKPKJZcjxadohsOTR35APC0wqY9o3QeZxUQiX DNQl8i+xshvrG5P2fz3R7VZY9PrFeuesi41ywx/e1sF2gVqOtrNnngpabkwokKAjxMxp qX6FfN49B1Xu74NPWSDsOpjc+l9Pz7xmpEwGmN4uVmUMA2PNRs3uYc6THuyCnUMW70ug ThCgfDxP3LkXlHEjUHRwofQvw+tRBZESAzPuYzsSI0u+eE3fBUjzlmUWkaM/8e2nzyw/ CniT1MDQdfzKn+HqgWoqPXgkhuCroKTHShX9jk5HYuBs6gJuokO+wtph1FIRiMD2h9F5 IOtw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n9si14080211plg.23.2022.02.14.11.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:24:03 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F21489E578; Mon, 14 Feb 2022 11:14:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355091AbiBNOXU (ORCPT + 99 others); Mon, 14 Feb 2022 09:23:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242631AbiBNOXS (ORCPT ); Mon, 14 Feb 2022 09:23:18 -0500 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0502A49FB8; Mon, 14 Feb 2022 06:23:10 -0800 (PST) Received: by theia.8bytes.org (Postfix, from userid 1000) id 1C490374; Mon, 14 Feb 2022 15:23:09 +0100 (CET) Date: Mon, 14 Feb 2022 15:23:07 +0100 From: Joerg Roedel To: Jason Gunthorpe Cc: Lu Baolu , Alex Williamson , Robin Murphy , Christoph Hellwig , Kevin Tian , Ashok Raj , Greg Kroah-Hartman , Bjorn Helgaas , Will Deacon , Dan Williams , rafael@kernel.org, Diana Craciun , Cornelia Huck , Eric Auger , Liu Yi L , Jacob jun Pan , Chaitanya Kulkarni , Stuart Yoder , Laurentiu Tudor , Thierry Reding , David Airlie , Daniel Vetter , Jonathan Hunter , Li Yang , Dmitry Osipenko , iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 5/8] iommu/amd: Use iommu_attach/detach_device() Message-ID: References: <20220106022053.2406748-1-baolu.lu@linux.intel.com> <20220106022053.2406748-6-baolu.lu@linux.intel.com> <20220106143345.GC2328285@nvidia.com> <20220214131544.GX4160@nvidia.com> <20220214140236.GC929467@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220214140236.GC929467@nvidia.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Feb 14, 2022 at 10:02:36AM -0400, Jason Gunthorpe wrote: > That works for VFIO, but it doesn't work for other in-kernel > drivers.. Is there something ensuring the group is only the GPU and > sound device? Is the GPU never an addin card? GPUs supporting this functionality are always iGPUs, AFAIK. > I'd say the right way to code this after Lu's series to have both the > GPU and sound driver call iommu_attach_device() during their probe()'s > and specify the identity domain as the attaching domain. > > That would be quite similar to how the Tegra drivers got arranged. > > And then maybe someone could better guess what the "sound driver" is > since it would be marked with an iommu_attach_device() call. Device drivers calling into iommu_attach_device() is seldom a good idea. In this case the sound device has some generic hardware interface so that an existing sound driver can be re-used. Making this driver call iommu-specific functions for some devices is something hard to justify. With sub-groups on the other hand it would be a no-brainer, because the sound device would be in a separate sub-group. Basically any device in the same group as the GPU would be in a separate sub-group. Regards, Joerg