Re: [PATCH v8 07/10] iommu/vt-d: Allow qi_submit_sync() to return the QI faults

From: Baolu Lu
Date: Sun Dec 31 2023 - 22:40:10 EST


On 12/28/23 2:17 PM, Tian, Kevin wrote:
raw_spin_lock_irqsave(&qi->q_lock, flags);
/*
@@ -1430,7 +1439,7 @@ int qi_submit_sync(struct intel_iommu *iommu,
struct qi_desc *desc,
* a deadlock where the interrupt context can wait
indefinitely
* for free slots in the queue.
*/
- rc = qi_check_fault(iommu, index, wait_index);
+ rc = qi_check_fault(iommu, index, wait_index, fault);
if (rc)
break;
and as replied in another thread let's change qi_check_fault to return
-ETIMEDOUT to break the restart loop when fault pointer is valid.

It's fine to break the retry loop when fault happens and the fault
pointer is valid. Please don't forget to add an explanation comment
around the code. Something like:

/*
* The caller is able to handle the fault by itself. The IOMMU driver
* should not attempt to retry this request.
*/

Best regards,
baolu