On Sat, Sep 25, 2021 at 05:18:02PM +0300, Lennert Buytenhek wrote:
> +#define IS_IOMMU_MEM_TRANSACTION(flags)              \
> +     (((flags) & EVENT_FLAG_I) == 0)
> +
> +#define IS_WRITE_REQUEST(flags)                      \
> +     ((flags) & EVENT_FLAG_RW)
> +
>  static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
>                                       u64 address, int flags)
>  {
> @@ -484,6 +490,18 @@ static void amd_iommu_report_page_fault(u16 devid, u16 
> domain_id,
>       if (pdev)
>               dev_data = dev_iommu_priv_get(&pdev->dev);
>  
> +     /*
> +      * If this is a DMA fault (for which the I(nterrupt) bit will
> +      * be unset), allow report_iommu_fault() to prevent logging it.
> +      */
> +     if (dev_data && IS_IOMMU_MEM_TRANSACTION(flags)) {
> +             if (!report_iommu_fault(&dev_data->domain->domain,
> +                                     &pdev->dev, address,
> +                                     IS_WRITE_REQUEST(flags) ?
> +                                     IOMMU_FAULT_WRITE : IOMMU_FAULT_READ))
> +                     goto out;

This is better placed inside the 'if (dev_data)' statement below.

Otherwise it looks good to me.


Regards,

        Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to