lkml.org 
[lkml]   [2022]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 1/1] iommu/vt-d: Fix RID2PASID setup failure
Date
> From: Baolu Lu <baolu.lu@linux.intel.com>
> Sent: Tuesday, June 21, 2022 11:39 AM
>
> On 2022/6/21 10:54, Tian, Kevin wrote:
> >> From: Lu Baolu <baolu.lu@linux.intel.com>
> >> Sent: Monday, June 20, 2022 4:17 PM
> >> @@ -2564,7 +2564,7 @@ static int domain_add_dev_info(struct
> >> dmar_domain *domain, struct device *dev)
> >> ret = intel_pasid_setup_second_level(iommu,
> >> domain,
> >> dev, PASID_RID2PASID);
> >> spin_unlock_irqrestore(&iommu->lock, flags);
> >> - if (ret) {
> >> + if (ret && ret != -EBUSY) {
> >> dev_err(dev, "Setup RID2PASID failed\n");
> >> dmar_remove_one_dev_info(dev);
> >> return ret;
> >> --
> >> 2.25.1
> >
> > It's cleaner to avoid this error at the first place, i.e. only do the
> > setup when the first device is attached to the pasid table.
>
> The logic that identifies the first device might introduce additional
> unnecessary complexity. Devices that share a pasid table are rare. I
> even prefer to give up sharing tables so that the code can be
> simpler.:-)
>

It's not that complex if you simply move device_attach_pasid_table()
out of intel_pasid_alloc_table(). Then do the setup if
list_empty(&pasid_table->dev) and then attach device to the
pasid table in domain_add_dev_info().
\
 
 \ /
  Last update: 2022-06-21 05:47    [W:0.566 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site