summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorGuanghui Feng <guanghuifeng@linux.alibaba.com>2026-09-28 11:27:22 +0800
committerJoerg Roedel <joerg.roedel@amd.com>2026-09-28 10:17:43 +0200
commit754d07b940c4ce025fab022b548fb5c3d11bf766 (patch)
tree37afe78b0487b4a4e0a5551a40a2b21306281c80 /rust/kernel/alloc/allocator
parent5fbb0fa7327667ade8fa61921425bd4f8803e272 (diff)
downloadlwn-754d07b940c4ce025fab022b548fb5c3d11bf766.tar.gz
lwn-754d07b940c4ce025fab022b548fb5c3d11bf766.zip
iommu/vt-d: Fix IQE handling to cover all descriptors in submission range
When an Invalidation Queue Error (IQE) occurs, hardware halts fetching and IQH points at the faulting descriptor. The previous code only checked whether IQH matched the first descriptor index of the current submission, missing faults on any other descriptor within the batch. Expand the check to cover the entire submission range [index, wait_index], accounting for circular wrap-around. Furthermore, after detecting IQE, the old recovery only replaced the single faulting slot with a copy of the wait descriptor and immediately returned -EINVAL. This left two problems: a) Hardware resumed fetching and could hit another invalid descriptor in the same abandoned batch, raising a second IQE that no submitter would claim — permanently deadlocking the queue. b) The caller reclaimed all batch slots (QI_FREE) while hardware might still be asynchronously processing descriptors from that batch, allowing concurrent overwrite and descriptor corruption. Fix both by introducing qi_drain_remaining_descs(): upon IQE detection, overwrite the stranded slots in [IQH, wait_index) with fenced no-op wait descriptors, resubmit the wait descriptor at wait_index, clear IQE, and spin until hardware signals QI_DONE (with DMAR_OPERATION_TIMEOUT). This guarantees hardware has fully drained the batch before the caller reclaims slots. Fixes: 8a1d82462540 ("iommu/vt-d: Multiple descriptors per qi_submit_sync()") Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions