Re: [PATCH v5 05/18] iommu: Pass in reset result to pci_dev_reset_iommu_done()
From: Baolu Lu
Date: Tue Jul 14 2026 - 01:39:32 EST
On 7/14/26 02:32, Nicolin Chen wrote:
On Mon, Jul 13, 2026 at 07:48:53PM +0800, Baolu Lu wrote:
On 7/3/2026 12:06 PM, Nicolin Chen wrote:
@@ -762,6 +763,9 @@ static void __iommu_group_remove_device(struct device *dev)
if (device->dev != dev)
continue;
+ /* Must drop the recovery_cnt when removing a blocked device */
+ if (device->blocked && !WARN_ON(group->recovery_cnt == 0))
+ group->recovery_cnt--;
I feel that the change above is unrelated to the purpose of this patch.
It looks like an independent fix that belongs to a separate patch.
It's actually related; I had this in the commit message:
"
This introduces a new situation where a blocked device is being unplugged.
Decrement the group->recovery_cnt accordingly.
"
Okay, I see your point now. Previously, reset_prepare and reset_done
were always paired regardless of whether the reset succeeded or failed.
This patch changes that model. The DMA blocking state of a device will
not be released after a failed reset. Thus, it is now possible for a
device to be released by the IOMMU subsystem while its DMA remains
blocked waiting for a successful recovery reset.
So, it was not needed prior to this patch: it wouldn't fix anything
if applied before, and it would be a bit odd to apply/fix after.
It's a small three-line change, so I think folding it in is okay?
That makes sense then.
Thanks,
baolu