[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52761F71BA509501C1766E9A8C31A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 11 Jul 2023 06:12:05 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.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: "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
> 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.
> +
> + 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.
Powered by blists - more mailing lists