[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRTHWhXDrM/sh6LN@Asurada-Nvidia>
Date: Wed, 12 Nov 2025 09:43:54 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
CC: <joro@...tes.org>, <afael@...nel.org>, <bhelgaas@...gle.com>,
<alex@...zbot.org>, <jgg@...dia.com>, <kevin.tian@...el.com>,
<will@...nel.org>, <robin.murphy@....com>, <lenb@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>, <iommu@...ts.linux.dev>,
<linux-kernel@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
<linux-pci@...r.kernel.org>, <kvm@...r.kernel.org>,
<patches@...ts.linux.dev>, <pjaroszynski@...dia.com>, <vsethi@...dia.com>,
<helgaas@...nel.org>, <etzhao1900@...il.com>
Subject: Re: [PATCH v5 4/5] iommu: Introduce iommu_dev_reset_prepare() and
iommu_dev_reset_done()
On Wed, Nov 12, 2025 at 02:18:09PM +0800, Baolu Lu wrote:
> On 11/11/25 13:12, Nicolin Chen wrote:
> > +int iommu_dev_reset_prepare(struct device *dev)
> > +{
> > + struct iommu_group *group = dev->iommu_group;
> > + unsigned long pasid;
> > + void *entry;
> > + int ret = 0;
> > +
> > + if (!dev_has_iommu(dev))
> > + return 0;
>
> Nit: This interface is only for PCI layer, so why not just
>
> if (WARN_ON(!dev_is_pci(dev)))
> return -EINVAL;
> ?
The function naming was a bit generic, but we do have a specific
use case here. So, yea, let's add one.
> > +
> > + guard(mutex)(&group->mutex);
> > +
> > + /*
> > + * Once the resetting_domain is set, any concurrent attachment to this
> > + * iommu_group will be rejected, which would break the attach routines
> > + * of the sibling devices in the same iommu_group. So, skip this case.
> > + */
> > + if (dev_is_pci(dev)) {
> > + struct group_device *gdev;
> > +
> > + for_each_group_device(group, gdev) {
> > + if (gdev->dev != dev)
> > + return 0;
> > + }
> > + }
>
> With above dev_is_pci() check, here it can simply be,
>
> if (list_count_nodes(&group->devices) != 1)
> return 0;
Will replace that.
Thanks!
Nicolin
Powered by blists - more mailing lists