From mboxrd@z Thu Jan 1 00:00:00 1970 From: "joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org" Subject: Re: [RFC PATCH 11/34] iommu: Split off default domain allocation from group assignment Date: Tue, 14 Apr 2020 17:27:52 +0200 Message-ID: <20200414152752.GC14731@8bytes.org> References: <20200407183742.4344-1-joro@8bytes.org> <20200407183742.4344-12-joro@8bytes.org> <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <6a801ff9e6471bda7c6f510dfa2ba7e7c35cb559.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Sender: "iommu" To: "Derrick, Jonathan" Cc: "heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org" , "virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jean-philippe-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org" , "linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org" , "linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org" , "jroedel-l3A5Bk7waGM@public.gmane.org" , "linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: virtualization@lists.linuxfoundation.org Hi Jonathan, On Mon, Apr 13, 2020 at 10:10:50PM +0000, Derrick, Jonathan wrote: > I had to add the following for initial VMD support. The new PCIe domain > added on VMD endpoint probe didn't have the dev_iommu member set on the > VMD subdevices, which I'm guessing is due to probe_iommu_group already > having been run on the VMD endpoint's group prior to those subdevices > being added. > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 8a5e1ac328dd..ac1e4fb9bf48 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1577,6 +1577,9 @@ static int iommu_bus_notifier(struct notifier_block *nb, > if (action == BUS_NOTIFY_ADD_DEVICE) { > int ret; > > + if (!dev_iommu_get(dev)) > + return -ENOMEM; > + > ret = iommu_probe_device(dev); > return (ret) ? NOTIFY_DONE : NOTIFY_OK; > } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { Right, thanks for catching this. The hotplug path does not allocate the dev->iommu structure yet. I'll have to figure out if the above patch adds it at the right place, but I'll fix it in the next version. Thanks again, Joerg