[PATCH v5 04/18] iommu: Convert gdev->blocked from bool to enum gdev_blocked
Baolu Lu
baolu.lu at linux.intel.com
Mon Jul 13 04:33:51 PDT 2026
On 7/3/2026 12:06 PM, Nicolin Chen wrote:
> The gdev->blocked flag tracks whether a device is individually being held
> in the group->blocking_domain while group->domain is retained. Up to now,
> a PCI reset in flight is the only producer, so a bool suffices.
>
> Subsequent changes will add more reasons to keep a device blocked, e.g. a
> failed-reset case that must not auto-unblock, or a driver-side quarantine
> for a hardware fault. These reasons are cleared by different events, which
> a single bool cannot encode.
>
> Convert "bool blocked" into "enum gdev_blocked blocked", provisioned with
> two initial values: BLOCKED_NO and BLOCKED_RESETTING, for the existing use
> cases. All readers keep the "if (gdev->blocked)" form, as BLOCKED_NO == 0.
>
> This is a pure type change with no behavior change. Follow-on changes will
> add new enum values along with their producers.
>
> Assisted-by: Claude:claude-opus-4-7
> Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
> ---
> drivers/iommu/iommu.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index e8f13dcebbde5..342e8a5ad628c 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -73,16 +73,20 @@ struct iommu_group {
> void *owner;
> };
>
> +enum gdev_blocked {
> + BLOCKED_NO = 0, /* Not blocked */
> + BLOCKED_RESETTING, /* PCI reset in flight */
> +};
Nit: Would it be more readable if we rename this to 'enum
blocked_reason'? Something like:
enum blocked_reason {
BLOCKED_NONE = 0,
BLOCKED_RESETTING,
};
[...snip...]
Anyway, this looks good to me.
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
More information about the linux-arm-kernel
mailing list