lkml.org 
[lkml]   [2023]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH v5 09/12] iommu: Make iommu_queue_iopf() more generic
From

On 9/14/2023 4:56 PM, Lu Baolu wrote:
> Make iommu_queue_iopf() more generic by making the iopf_group a minimal
> set of iopf's that an iopf handler of domain should handle and respond
> to. Add domain parameter to struct iopf_group so that the handler can
> retrieve and use it directly.
>
> Change iommu_queue_iopf() to forward groups of iopf's to the domain's
> iopf handler. This is also a necessary step to decouple the sva iopf
> handling code from this interface.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> include/linux/iommu.h | 4 ++--
> drivers/iommu/iommu-sva.h | 6 ++---
> drivers/iommu/io-pgfault.c | 49 ++++++++++++++++++++++++++++----------
> drivers/iommu/iommu-sva.c | 3 +--
> 4 files changed, 42 insertions(+), 20 deletions(-)
>
......

> @@ -112,6 +110,7 @@ int iommu_queue_iopf(struct iommu_fault *fault, struct device *dev)
> {
> int ret;
> struct iopf_group *group;
> + struct iommu_domain *domain;
> struct iopf_fault *iopf, *next;
> struct iommu_fault_param *iopf_param;
> struct dev_iommu *param = dev->iommu;
> @@ -143,6 +142,19 @@ int iommu_queue_iopf(struct iommu_fault *fault, struct device *dev)
> return 0;
> }
>
> + 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) {

Does it need to check if 'domain' is error ?  Like below:

         if (!domain || IS_ERR(domain) || !domain->iopf_handler)
Thanks,
Jingqi


\
 
 \ /
  Last update: 2023-09-21 22:48    [W:0.051 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site