1
linux/drivers/iommu/arm/arm-smmu-v3
Pranjal Shrivastava b58b133e68 iommu: Handle iommu faults for a bad iopf setup
The iommu_report_device_fault function was updated to return void while
assuming that drivers only need to call iommu_report_device_fault() for
reporting an iopf. This implementation causes following problems:

1. The drivers rely on the core code to call it's page_reponse,
   however, when a fault is received and no fault capable domain is
   attached / iopf_param is NULL, the ops->page_response is NOT called
   causing the device to stall in case the fault type was PAGE_REQ.

2. The arm_smmu_v3 driver relies on the returned value to log errors
   returning void from iommu_report_device_fault causes these events to
   be missed while logging.

Modify the iommu_report_device_fault function to return -EINVAL for
cases where no fault capable domain is attached or iopf_param was NULL
and calls back to the driver (ops->page_response) in case the fault type
was IOMMU_FAULT_PAGE_REQ. The returned value can be used by the drivers
to log the fault/event as needed.

Reported-by: Kunkun Jiang <jiangkunkun@huawei.com>
Closes: https://lore.kernel.org/all/6147caf0-b9a0-30ca-795e-a1aa502a5c51@huawei.com/
Fixes: 3dfa64aecb ("iommu: Make iommu_report_device_fault() return void")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20240816104906.1010626-1-praan@google.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-08-23 11:16:39 +02:00
..
arm-smmu-v3-sva.c iommu/arm-smmu-v3: Put the SVA mmu notifier in the smmu_domain 2024-07-02 15:39:48 +01:00
arm-smmu-v3-test.c iommu/arm-smmu-v3: add missing MODULE_DESCRIPTION() macro 2024-07-02 17:13:54 +01:00
arm-smmu-v3.c iommu: Handle iommu faults for a bad iopf setup 2024-08-23 11:16:39 +02:00
arm-smmu-v3.h iommu/arm-smmu-v3: Enable HTTU for stage1 with io-pgtable mapping 2024-07-03 15:45:47 +01:00
Makefile iommu/arm-smmu-v3: Use *-y instead of *-objs in Makefile 2024-06-05 13:59:38 +01:00