[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cbbe1175-40f3-805e-02c2-f887b3289f04@linux.intel.com>
Date: Wed, 12 Jul 2023 10:32:13 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Jason Gunthorpe <jgg@...pe.ca>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Nicolin Chen <nicolinc@...dia.com>
Cc: baolu.lu@...ux.intel.com, "Liu, Yi L" <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/9] iommu: Add common code to handle IO page faults
On 2023/7/11 14:12, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@...ux.intel.com>
>> Sent: Tuesday, July 11, 2023 9:07 AM
>>
>> +static int iommu_handle_io_pgfault(struct device *dev,
>> + struct iommu_fault *fault)
>> +{
>> + struct iommu_domain *domain;
>> +
>> + if (fault->type != IOMMU_FAULT_PAGE_REQ)
>> + return -EINVAL;
>> +
>> + if (fault->prm.flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID)
>> + domain = iommu_get_domain_for_dev_pasid(dev, fault-
>>> prm.pasid, 0);
>> + else
>> + domain = iommu_get_domain_for_dev(dev);
>> +
>> + if (!domain || !domain->iopf_handler)
>> + return -ENODEV;
>> +
>> + if (domain->iopf_handler == iommu_sva_handle_iopf)
>> + return iommu_queue_iopf(fault, dev);
>
> You can avoid the special check by directly making iommu_queue_iopf
> as the iopf_handler for sva domain.
Yeah, good catch!
>
>> +
>> + return domain->iopf_handler(fault, dev, domain->fault_data);
>> +}
>
> btw is there value of moving the group handling logic from
> iommu_queue_iopf() to this common function?
>
> I wonder whether there is any correctness issue if not forwarding
> partial request to iommufd. If not this can also help reduce
> notifications to the user until the group is ready.
I don't think there's any correctness issue. But it should be better if
we can inject the page faults to vm guests as soon as possible. There's
no requirement to put page requests to vIOMMU's hardware page request
queue at the granularity of a fault group. Thoughts?
Best regards,
baolu
Powered by blists - more mailing lists